editor › Globals › UnfoldingGroupLayouter
Class: UnfoldingGroupLayouter
Hierarchy
- UnfoldingGroupLayouter
Index
Constructors
Properties
- allPlateGroups
- baseUnfolding
- interUnfoldingConnections
- jointToConnectedUnfoldings
- parent
- plateGroupFacade
Methods
- _addChildUnfoldings
- _connectChildToJointOfParent
- _findChildUnfoldingPosition
- _getJointPositionInUnfolding
- _moveFurtherOutUntilItFits
- _noOverlapWithOutlines
- _trySlidingPlacement
- generateUnfoldingGroup
- _buildJointToConnectedUnfolding
- _getOtherElement
Constructors
constructor
+ new UnfoldingGroupLayouter(allPlateGroups: PlateGroup[], interUnfoldingConnections: Map‹Unfolding, FingerJoint[]›, baseUnfolding: Unfolding, parent?: Unfolding): UnfoldingGroupLayouter
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:53
Parameters:
| Name | Type |
|---|---|
allPlateGroups |
PlateGroup[] |
interUnfoldingConnections |
Map‹Unfolding, FingerJoint[]› |
baseUnfolding |
Unfolding |
parent? |
Unfolding |
Returns: UnfoldingGroupLayouter
Properties
Private Readonly allPlateGroups
• allPlateGroups: PlateGroup[]
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:49
Private Readonly baseUnfolding
• baseUnfolding: Unfolding
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:53
Private Readonly interUnfoldingConnections
• interUnfoldingConnections: Map‹Unfolding, FingerJoint[]›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:51
Private Readonly jointToConnectedUnfoldings
• jointToConnectedUnfoldings: Map‹FingerJoint, [Unfolding, Unfolding]›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:52
Private Optional parent
• parent? : Unfolding
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:59
Private Readonly plateGroupFacade
• plateGroupFacade: PlateGroupGraphFacade
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:50
Methods
Private _addChildUnfoldings
▸ _addChildUnfoldings(parent: Unfolding, resultUnfoldingGroup: UnfoldingGroup, hierachy: NestingHierarchy‹Unfolding›): Promise‹any[][]›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:106
Builds a mapping from EdgeJoint to the two Unfoldings which this EdgeJoints connects
Parameters:
| Name | Type |
|---|---|
parent |
Unfolding |
resultUnfoldingGroup |
UnfoldingGroup |
hierachy |
NestingHierarchy‹Unfolding› |
Returns: Promise‹any[][]›
a mapping from EdgeJoint to the two Unfoldings which this EdgeJoints connects
Private _connectChildToJointOfParent
▸ _connectChildToJointOfParent(child: Unfolding, joint: FingerJoint, resultUnfoldingGroup: UnfoldingGroup, mirror: any): Promise‹boolean›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:186
Tries to connect the hierarchical child (and recursively its sub-children) of an Unfolding to the corresponding EdgeJoint using an arrow. If not possible, creates a new UnfoldingGroup with the child separate from the original UnfoldingGroup and continues recursively from there.
Parameters:
| Name | Type | Description |
|---|---|---|
child |
Unfolding | the child to lay out |
joint |
FingerJoint | the FingerJoint connecting the child to the parent Unfolding |
resultUnfoldingGroup |
UnfoldingGroup | the base UnfoldingGroup containing the parent Unfolding |
mirror |
any | whether the child is mirrored |
Returns: Promise‹boolean›
true if the child has been laid out successfully
Private _findChildUnfoldingPosition
▸ _findChildUnfoldingPosition(normalParent: Vector3, childOutline: Polygon, straightMatrix: Matrix4, leftMatrix: Matrix4, rightMatrix: Matrix4, arrowPolygon: Polygon, blockedSpace: Polygon[]): Matrix4
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:287
If possible, finds a position for a child to lay it out next to the parent Unfolding without causing overlaps and keeping enough space for the arrow connection.
Parameters:
| Name | Type | Description |
|---|---|---|
normalParent |
Vector3 | the normal of the parent's joint connecting to the child |
childOutline |
Polygon | the polygon reflecting the shape of the child |
straightMatrix |
Matrix4 | a matrix which lays child next to the parent's joint without rotation |
leftMatrix |
Matrix4 | a matrix which lays child to the parent's joint rotated to the left relative to the parent |
rightMatrix |
Matrix4 | a matrix which lays child to the parent's joint rotated to the right relative to the parent |
arrowPolygon |
Polygon | the space one arrow connetion segment occupies, will be slided along the connecting path |
blockedSpace |
Polygon[] | the space occupied by the parent and other elements, i.e. with which the arrow and child should not overlap |
Returns: Matrix4
a transformation matrix or undefined if no position could be found
Private _getJointPositionInUnfolding
▸ _getJointPositionInUnfolding(joint: FingerJoint, unfolding: Unfolding | UnfoldingGroup): [Vector3, Vector3]
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:429
Parameters:
| Name | Type |
|---|---|
joint |
FingerJoint |
unfolding |
Unfolding | UnfoldingGroup |
Returns: [Vector3, Vector3]
section center and normal in unfolding coordinates
Private _moveFurtherOutUntilItFits
▸ _moveFurtherOutUntilItFits(existingOutlines: Polygon[], newOutline: Polygon, stepVector: Vector3, baseMatrix: Matrix4, arrowPolygon: Polygon): [number, Matrix4]
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:407
Finds a non-overlapping position for the given child polygon and arrow polygon (after applying the transformation) by sliding it step-by-step in the given direction until it fits.
Parameters:
| Name | Type | Description |
|---|---|---|
existingOutlines |
Polygon[] | the space occupied by the parent and other elements, i.e. with which the arrow and child should not overlap |
newOutline |
Polygon | the outline which should be placed |
stepVector |
Vector3 | the direction in which the child and arrow should be slid |
baseMatrix |
Matrix4 | transformation matrix which serves as the base of the transformation |
arrowPolygon |
Polygon | the shape of the arrow for which space will be reserved during sliding |
Returns: [number, Matrix4]
the number of steps and the placement if successful otherwise undefined
Private _noOverlapWithOutlines
▸ _noOverlapWithOutlines(polygon: Polygon, outlines: Polygon[]): boolean
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:361
Checks if the given polygon overlaps with any of the other provided (outline-) polygons.
Parameters:
| Name | Type |
|---|---|
polygon |
Polygon |
outlines |
Polygon[] |
Returns: boolean
whether an overlap exists
Private _trySlidingPlacement
▸ _trySlidingPlacement(existingOutlines: Polygon[], childOutline: Polygon, directionMatrix: Matrix4, arrowPolygon: Polygon, stepDirection: Vector3): [number, Matrix4]
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:377
Finds a non-overlapping position for the given child polygon and arrow polygon (after applying the transformation) by sliding it step-by-step in the given direction until it fits.
Parameters:
| Name | Type | Description |
|---|---|---|
existingOutlines |
Polygon[] | the space occupied by the parent and other elements, i.e. with which the arrow and child should not overlap |
childOutline |
Polygon | the polygon reflecting the shape of the child |
directionMatrix |
Matrix4 | a matrix that should be applied on the child polygon and arrow polygon |
arrowPolygon |
Polygon | the space one arrow connetion segment occupies, will be slided along the connecting path |
stepDirection |
Vector3 | the direction in which the child and arrow should be slid |
Returns: [number, Matrix4]
the number of steps and the placement if successful otherwise undefined
generateUnfoldingGroup
▸ generateUnfoldingGroup(hierarchy: NestingHierarchy‹Unfolding›): Promise‹[UnfoldingGroup[], EdgeJoint[]]›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:76
Lays out the given NestingHierarchy as UnfoldingGroups by keeping shared joint edges in close proximity, if possible.
Parameters:
| Name | Type | Description |
|---|---|---|
hierarchy |
NestingHierarchy‹Unfolding› | the hierarchy of unfoldings |
Returns: Promise‹[UnfoldingGroup[], EdgeJoint[]]›
the laid out unfoldings as UnfoldingGroups and the edge joints which could not be laid out
Static Private _buildJointToConnectedUnfolding
▸ _buildJointToConnectedUnfolding(interUnfoldingConnections: Map‹Unfolding, FingerJoint[]›): Map‹FingerJoint, [Unfolding, Unfolding]›
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:23
Builds a mapping from EdgeJoint to the two unfoldings which this edge joint connects
Parameters:
| Name | Type | Description |
|---|---|---|
interUnfoldingConnections |
Map‹Unfolding, FingerJoint[]› | mapping from an Unfolding to all its EdgeJoints connecting to other Unfoldings |
Returns: Map‹FingerJoint, [Unfolding, Unfolding]›
a mapping from EdgeJoint to the two unfoldings which this edge joint connects
Static Private _getOtherElement
▸ _getOtherElement‹T›(element: T, elementPair: [T, T]): T
Defined in src/modules/kyub.core.svgObjExporter/src/export/Nestings/UnfoldingGroupLayouter.ts:40
Type parameters:
▪ T
Parameters:
| Name | Type |
|---|---|
element |
T |
elementPair |
[T, T] |
Returns: T