editor › Globals › PlateGraph
Class: PlateGraph
a simple representation of plates and their joints, used to determine their assembly order
see AssemblyInstructionHints._getPlateIds
Hierarchy
- PlateGraph
Index
Properties
- cachedPlateScores
- joints
- orderedSections
- originalJoints
- plateGroupMap
- plates
- PlateScoreConnectedJointCount
- PlateScoreConnectedJointLength
- PlateScoreFinishPlateGroup
- PlateScoreHeight
- PlateScoreImpossible
- PlateScoreRemovedJointCount
- PlateScoreTilt
- PlateScoreTiltJointLength
- PlateScoreWobblyAdjust
Methods
- _canBeRemoved
- _canBeTilted
- _canPlatesBeRemoved
- _canPlatesBeTilted
- _cornerNeighborsOf
- _getCornersOfPlate
- _removePlate
- _scorePlate
- _scorePlateAssemblability
- _scorePlateRemoval
- _wobblyAdjust
- extractBestRemovablePlate
- findSubassemblies
- getGroupJoints
- getGroupRemovability
- getJoints
- getPlateRemovability
- getPlates
- isConnected
- isEmpty
- isGroupOutside
- loadPlatesAndGroups
- removeSubassembly
- splitToSubAssemblies
Properties
Private Readonly cachedPlateScores
• cachedPlateScores: Map‹Plate‹›, number› = new Map
Defined in src/util/PlateGraph.ts:64
Private Readonly joints
• joints: Map‹Plate‹›, Map‹Plate‹›, IDirectionSpace›› = new Map
Defined in src/util/PlateGraph.ts:58
Private Readonly orderedSections
• orderedSections: Map‹Plate‹›, [Plate‹›, OutlineSection‹›][]› = new Map<Plate, Array<[Plate, OutlineSection]>>()
Defined in src/util/PlateGraph.ts:60
Private Readonly originalJoints
• originalJoints: Map‹Plate‹›, Map‹Plate‹›, IDirectionSpace›› = new Map
Defined in src/util/PlateGraph.ts:59
Private plateGroupMap
• plateGroupMap: Map‹Plate, PlateGroup›
Defined in src/util/PlateGraph.ts:65
Private Readonly plates
• plates: Plate[] = []
Defined in src/util/PlateGraph.ts:62
Static Private PlateScoreConnectedJointCount
▪ PlateScoreConnectedJointCount: number = 10
Defined in src/util/PlateGraph.ts:42
Static Private PlateScoreConnectedJointLength
▪ PlateScoreConnectedJointLength: number = 0.7
Defined in src/util/PlateGraph.ts:44
Static Private PlateScoreFinishPlateGroup
▪ PlateScoreFinishPlateGroup: number = -700
Defined in src/util/PlateGraph.ts:51
Static Private PlateScoreHeight
▪ PlateScoreHeight: number = 0.3
Defined in src/util/PlateGraph.ts:36
Static Private PlateScoreImpossible
▪ PlateScoreImpossible: number = 1000000
Defined in src/util/PlateGraph.ts:54
Static Private PlateScoreRemovedJointCount
▪ PlateScoreRemovedJointCount: number = 10
Defined in src/util/PlateGraph.ts:40
Static Private PlateScoreTilt
▪ PlateScoreTilt: number = 250
Defined in src/util/PlateGraph.ts:46
Static Private PlateScoreTiltJointLength
▪ PlateScoreTiltJointLength: number = 0.5
Defined in src/util/PlateGraph.ts:49
Static Private PlateScoreWobblyAdjust
▪ PlateScoreWobblyAdjust: number = 30
Defined in src/util/PlateGraph.ts:38
Methods
Private _canBeRemoved
▸ _canBeRemoved(plate: Plate): boolean
Defined in src/util/PlateGraph.ts:586
Parameters:
| Name | Type |
|---|---|
plate |
Plate |
Returns: boolean
Private _canBeTilted
▸ _canBeTilted(plate: Plate): Promise‹boolean›
Defined in src/util/PlateGraph.ts:598
Parameters:
| Name | Type |
|---|---|
plate |
Plate |
Returns: Promise‹boolean›
Private _canPlatesBeRemoved
▸ _canPlatesBeRemoved(joints: Iterable‹IDirectionSpace› | ArrayLike‹IDirectionSpace›): boolean
Defined in src/util/PlateGraph.ts:590
Parameters:
| Name | Type |
|---|---|
joints |
Iterable‹IDirectionSpace› | ArrayLike‹IDirectionSpace› |
Returns: boolean
Private _canPlatesBeTilted
▸ _canPlatesBeTilted(neighborSides: Map‹Plate, IDirectionSpace›, jointTuples: Array‹[Plate, OutlineSection]›): Promise‹boolean›
Defined in src/util/PlateGraph.ts:607
Parameters:
| Name | Type |
|---|---|
neighborSides |
Map‹Plate, IDirectionSpace› |
jointTuples |
Array‹[Plate, OutlineSection]› |
Returns: Promise‹boolean›
Private _cornerNeighborsOf
▸ _cornerNeighborsOf(p: Plate): Set‹Plate›
Defined in src/util/PlateGraph.ts:574
Parameters:
| Name | Type |
|---|---|
p |
Plate |
Private _getCornersOfPlate
▸ _getCornersOfPlate(p: Plate): Plate[][]
Defined in src/util/PlateGraph.ts:554
Parameters:
| Name | Type |
|---|---|
p |
Plate |
Returns: Plate[][]
Private _removePlate
▸ _removePlate(plate: Plate): void
Defined in src/util/PlateGraph.ts:628
Parameters:
| Name | Type |
|---|---|
plate |
Plate |
Returns: void
Private _scorePlate
▸ _scorePlate(p: Plate, heightFactor: number): Promise‹number›
Defined in src/util/PlateGraph.ts:497
Parameters:
| Name | Type | Default |
|---|---|---|
p |
Plate | - |
heightFactor |
number | 1 |
Returns: Promise‹number›
Private _scorePlateAssemblability
▸ _scorePlateAssemblability(p: Plate): Promise‹number›
Defined in src/util/PlateGraph.ts:488
given a plate, how does it affect the whole assembly order score to remove it now used to compare assembly orders against each other
Parameters:
| Name | Type |
|---|---|
p |
Plate |
Returns: Promise‹number›
Private _scorePlateRemoval
▸ _scorePlateRemoval(p: Plate, weights?: Map‹Plate, number›): Promise‹number›
Defined in src/util/PlateGraph.ts:470
given a plate, how bad would it be to remove it now used to compare them against each other
Parameters:
| Name | Type |
|---|---|
p |
Plate |
weights? |
Map‹Plate, number› |
Returns: Promise‹number›
Private _wobblyAdjust
▸ _wobblyAdjust(p: Plate): number
Defined in src/util/PlateGraph.ts:536
how much would removing this plate now adjust the "wobbliness" of the partially-assembled object? wobbliness is defined by the corners of the object: completely empty or filled corners are stable, while partially filled corners (e.g. only half the plates are there) are wobbly.
Parameters:
| Name | Type |
|---|---|
p |
Plate |
Returns: number
extractBestRemovablePlate
▸ extractBestRemovablePlate(selection: Plate[], weights?: Map‹Plate, number›): Promise‹PlateInstruction›
Defined in src/util/PlateGraph.ts:208
Retrieves and removes a removable plate from this graph. Only call this if isEmpty returns false
Parameters:
| Name | Type | Default |
|---|---|---|
selection |
Plate[] | this.plates |
weights? |
Map‹Plate, number› | - |
Returns: Promise‹PlateInstruction›
findSubassemblies
▸ findSubassemblies(): Plate[][]
Defined in src/util/PlateGraph.ts:333
Returns: Plate[][]
getGroupJoints
▸ getGroupJoints(plates: Plate[], ignoreJoints: Map‹Plate, Set‹Plate››): Map‹Plate, IDirectionSpace›
Defined in src/util/PlateGraph.ts:158
Parameters:
| Name | Type | Default |
|---|---|---|
plates |
Plate[] | - |
ignoreJoints |
Map‹Plate, Set‹Plate›› | new Map() |
Returns: Map‹Plate, IDirectionSpace›
getGroupRemovability
▸ getGroupRemovability(plates: Plate[], ignoreJoints: Map‹Plate, Set‹Plate››): Promise‹RemovalStatus›
Defined in src/util/PlateGraph.ts:130
Parameters:
| Name | Type | Default |
|---|---|---|
plates |
Plate[] | - |
ignoreJoints |
Map‹Plate, Set‹Plate›› | new Map() |
Returns: Promise‹RemovalStatus›
getJoints
▸ getJoints(): Map‹Plate, Map‹Plate, IDirectionSpace››
Defined in src/util/PlateGraph.ts:67
Returns: Map‹Plate, Map‹Plate, IDirectionSpace››
getPlateRemovability
▸ getPlateRemovability(plate: Plate): Promise‹RemovalStatus›
Defined in src/util/PlateGraph.ts:125
Parameters:
| Name | Type |
|---|---|
plate |
Plate |
Returns: Promise‹RemovalStatus›
getPlates
▸ getPlates(): Plate[]
Defined in src/util/PlateGraph.ts:121
Returns: Plate[]
isConnected
▸ isConnected(): boolean
Defined in src/util/PlateGraph.ts:237
Returns: boolean
isEmpty
▸ isEmpty(): boolean
Defined in src/util/PlateGraph.ts:117
Returns: boolean
isGroupOutside
▸ isGroupOutside(plates: Plate[]): boolean
Defined in src/util/PlateGraph.ts:189
Parameters:
| Name | Type |
|---|---|
plates |
Plate[] |
Returns: boolean
Whether a group of plates is only connected to the outside of other plates
loadPlatesAndGroups
▸ loadPlatesAndGroups(plates: Plate[], plateGroupMap: Map‹Plate, PlateGroup›): void
Defined in src/util/PlateGraph.ts:71
Parameters:
| Name | Type |
|---|---|
plates |
Plate[] |
plateGroupMap |
Map‹Plate, PlateGroup› |
Returns: void
removeSubassembly
▸ removeSubassembly(subassemblyPlates: Plate[]): Plate[]
Defined in src/util/PlateGraph.ts:447
Removes a subassembly from the graph and returns the plates that this subassembly attaches to
Parameters:
| Name | Type | Description |
|---|---|---|
subassemblyPlates |
Plate[] | - |
Returns: Plate[]
splitToSubAssemblies
▸ splitToSubAssemblies(): object
Defined in src/util/PlateGraph.ts:264
When the graph is currently not connected, this method splits the graph into the connected subgraphs. These subgraphs represent parts that fall apart when the object gets disassembled and are thus subassemblies that are represented by a SubassemblyInstruction. The method then performs a post-processing step in which all previous plates test to which subgraphs they are connected. If they are only connected to one subgraph, they are part of its subassembly. The method returns the different subgraphs and the number of subgraphs found.
Returns: object
-
numSubassemblies: number
-
plateIDs: Map‹Plate, number›