Skip to content

editorGlobalsPlate2DHelpers

Class: Plate2DHelpers

Hierarchy

  • Plate2DHelpers

Index

Methods

Methods

Static _areNeighborsConvex

_areNeighborsConvex(prevNeighbor: any, nextNeighbor: any, staticPoints: any): boolean

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:949

Parameters:

Name Type
prevNeighbor any
nextNeighbor any
staticPoints any

Returns: boolean


Static _arePointsCollinear

_arePointsCollinear(prev: any, main: any, next: any): boolean

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:964

Parameters:

Name Type
prev any
main any
next any

Returns: boolean


Static Private _checkIfSectionCrossesPlate

_checkIfSectionCrossesPlate(candidateSection: OutlineSection, plate: Plate, allowSectionTouchingOutline: boolean, touchingTolerance: number): boolean

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:1407

returns whether a section pierces through a plate.

Parameters:

Name Type Default Description
candidateSection OutlineSection - the section in question
plate Plate - the plate to be tested
allowSectionTouchingOutline boolean - - if true, the case that the candidateSection lies on the other plate's outline without crossing it is considered as "crossing", if false, this case is ignored
touchingTolerance number 0.1 -

Returns: boolean

Crossing or not


Static Private _directionBetweenPoints

_directionBetweenPoints(pointA: OutlinePoint, pointB: OutlinePoint): Vector3‹›

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:1386

Parameters:

Name Type
pointA OutlinePoint
pointB OutlinePoint

Returns: Vector3‹›


Static Private _directionBetweenVectors

_directionBetweenVectors(vecA: Vector3, vecB: Vector3): Vector3‹›

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:1392

Parameters:

Name Type
vecA Vector3
vecB Vector3

Returns: Vector3‹›


Static Private _extractOutlineSubRange

_extractOutlineSubRange(outline: Outline, startPoint: OutlinePoint, endPoint: OutlinePoint): object

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:1271

Extracts a sub-range from an Outline and connects the outline points with an OutlineLine.

Parameters:

Name Type Description
outline Outline to extract sub-range from
startPoint OutlinePoint start of the sub-range (inclusive)
endPoint OutlinePoint end of the sub-range (inclusive)

Returns: object

sections and points extracted, array of finger joints that are obsolete and need to be removed


Static Private _getNextOfObject

_getNextOfObject(object: any, array: any): any

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:1382

Parameters:

Name Type
object any
array any

Returns: any


Static Private _getPrevOfObject

_getPrevOfObject(object: any, array: any): any

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:1378

Parameters:

Name Type
object any
array any

Returns: any


Static _getStartPoint

_getStartPoint(movedPoint: any, neighbors: any, staticPoints: any, staticPlane: any): any

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:973

Parameters:

Name Type
movedPoint any
neighbors any
staticPoints any
staticPlane any

Returns: any


Static Private _insertOutlinePoints

_insertOutlinePoints(splitResults: any): OutlinePoint[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:1205

Parameters:

Name Type
splitResults any

Returns: OutlinePoint[]


Static _isPlateConvex

_isPlateConvex(prev: any, main: any, next: any): boolean

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:969

Parameters:

Name Type
prev any
main any
next any

Returns: boolean


Static Private _isPointCollinear

_isPointCollinear(outlinePoint: any): boolean

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:1451

Parameters:

Name Type
outlinePoint any

Returns: boolean


Static Private _offsetVectorArray

_offsetVectorArray(points: Vector3[], offset: number): Vector3[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:1191

Offsets a given array of Vectors that represent a polygon

Parameters:

Name Type Description
points Vector3[] the polygon
offset number number to be used as offset delta. Negative numbers shrink the polygon, positive numbers inflate the polygon

Returns: Vector3[]


Static Private _performValidSplit

_performValidSplit(plate: Plate, cutStart: OutlinePoint, cutEnd: OutlinePoint, staticPlane: Plane): object

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:1330

This function will check if the splitting is valid and if not, it will change the points and then execute the split.

Parameters:

Name Type
plate Plate
cutStart OutlinePoint
cutEnd OutlinePoint
staticPlane Plane

Returns: object

  • newStartPoint: OutlinePoint‹› = cutStart

  • plate: Plate‹› = this.splitPlateByOutlinePoints(plate, cutStart, cutEnd)


Static Private _removePlateByOutline

_removePlateByOutline(outline: any): any

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:1443

Parameters:

Name Type
outline any

Returns: any


Static Private _splitPlateAtCutLines

_splitPlateAtCutLines(plate: Plate, cutLines: Array‹object›, edgeJointClass?: Constructor‹EdgeJoint›): Plate‹›[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:1229

Parameters:

Name Type
plate Plate
cutLines Array‹object›
edgeJointClass? Constructor‹EdgeJoint

Returns: Plate‹›[]


Static Private _splitPlateByOutlinePointAndHoleOutlinePoint

_splitPlateByOutlinePointAndHoleOutlinePoint(plate: Plate, splitStart: OutlinePoint, splitEnd: OutlinePoint, edgeJointClass?: Constructor‹EdgeJoint›): void

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:1105

Splits a plate between a point on the outline and a point on a hole of the plate

Parameters:

Name Type Description
plate Plate -
splitStart OutlinePoint OutlinePoint on the Outline of the plate
splitEnd OutlinePoint OutlinePoint on one Hole of the plate
edgeJointClass? Constructor‹EdgeJoint -

Returns: void


Static Private _splitPlateByOutlinePointAndOutlinePoint

_splitPlateByOutlinePointAndOutlinePoint(plate: Plate, splitStart: OutlinePoint, splitEnd: OutlinePoint, edgeJointClass?: Constructor‹EdgeJoint›): Plate‹›

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:1020

Splits a plate between two points on the outline of the plate. This only does two simple new sections, it won't check for things like holes.

Parameters:

Name Type Description
plate Plate -
splitStart OutlinePoint OutlinePoint on the outline of the plate
splitEnd OutlinePoint OutlinePoint on the outline of the plate
edgeJointClass? Constructor‹EdgeJoint -

Returns: Plate‹›


Static addOutlinePointToOutlineSection

addOutlinePointToOutlineSection(outlineSection: OutlineSection, position2D: Vector3): OutlinePoint

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:747

Adds a new outline point to the specified section. This section will be replaced by two new OutlineLines. If this section is joined with another section, that will also be replaced by two new OutlineLines. These new OutlineSections will be joined with FingerJoints.

Parameters:

Name Type Description
outlineSection OutlineSection the section where the new outline point should be added.
position2D Vector3 the position in plate-local coordinates where the new outline point should be

Returns: OutlinePoint

the new outline point


Static adjacentPlatesFromOutlineSection

adjacentPlatesFromOutlineSection(section: OutlineSection): Plate[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:505

Returns the plates that are adjacent to this OutlineSection. The result always contains the section's Plate and sometimes also the Plate connected to this section via finger joints.

Parameters:

Name Type Description
section OutlineSection The section

Returns: Plate[]

plates connected to the point


Static adjacentSections

adjacentSections(section: OutlineSection): OutlineSection[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:881

Parameters:

Name Type Description
section OutlineSection An outline section

Returns: OutlineSection[]

array of (up to) two sections. The next and the previous section in the outline.


Static allOutlinePointsOnPlate

allOutlinePointsOnPlate(outlinePoint: OutlinePoint, plate: Plate, mergedPoints: ReadonlyArray‹OutlinePoint‹››): readonly OutlinePoint[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:863

Parameters:

Name Type Default
outlinePoint OutlinePoint -
plate Plate -
mergedPoints ReadonlyArray‹OutlinePoint‹›› outlinePoint.getMergedVertices()

Returns: readonly OutlinePoint[]


Static arePlatesIntersecting

arePlatesIntersecting(outlineA: Outline, outlineB: Outline, allowSectionTouchingOutline: boolean): boolean

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:292

Checks if one plate goes through the other plate by mutually checking if the outline sections pierce through the other plate's outline.

Parameters:

Name Type Default Description
outlineA Outline - -
outlineB Outline - -
allowSectionTouchingOutline boolean false - if true, the case that a section lies on the other plate's outline without crossing it is considered as "connected", if false, this case is ignored

Returns: boolean

Connected or not


Static averagePlateThicknessAtOutlinePoint

averagePlateThicknessAtOutlinePoint(outlinePoint: any, platesToIgnore: Plate[]): number

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:482

Parameters:

Name Type Default
outlinePoint any -
platesToIgnore Plate[] []

Returns: number


Static closestAdjacentPlate

closestAdjacentPlate(point3D: Vector3, plate: Plate): Plate‹›

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:45

Returns the plate that is directly connected to the supplied plate and is closest to the supplied point. Returns null if no such plate was found.

Parameters:

Name Type
point3D Vector3
plate Plate

Returns: Plate‹›


Static connectedButNotAdjacentPlatesFromOutlineSection

connectedButNotAdjacentPlatesFromOutlineSection(section: any): Plate‹›[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:77

Parameters:

Name Type
section any

Returns: Plate‹›[]


Static connectedOutlineSectionsFromOutlinePoint

connectedOutlineSectionsFromOutlinePoint(point: OutlinePoint, combineJointSections: boolean): OutlineSection[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:127

Returns all outline sections connected to some OutlinePoint.

Parameters:

Name Type Default Description
point OutlinePoint - the OutlinePoint
combineJointSections boolean true if true, for each pair of joint sections only one section is returned

Returns: OutlineSection[]

outline sections connected to the OutlinePoint


Static connectedOutlineSectionsFromOutlineSectionAndOutlinePoint

connectedOutlineSectionsFromOutlineSectionAndOutlinePoint(section: OutlineSection, point: OutlinePoint, combineJointSections: boolean): OutlineSection‹›[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:568

Parameters:

Name Type Default
section OutlineSection -
point OutlinePoint -
combineJointSections boolean true

Returns: OutlineSection‹›[]


Static connectedOutlineSectionsFromVertexPosition

connectedOutlineSectionsFromVertexPosition(vertexPosition: VertexPosition): OutlineSection‹›[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:115

Returns all outline sections connected to the OutlinePoints at a VertexPosition.

Parameters:

Name Type Description
vertexPosition VertexPosition the VertexPosition

Returns: OutlineSection‹›[]


Static connectedPlatesFromOutlineElement

connectedPlatesFromOutlineElement(element: any): Plate[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:86

Returns all plates connected to some outline element (OutlinePoint, OutlineSection or Outline).

Parameters:

Name Type Description
element any [OutlinePoint

Returns: Plate[]

plates connected to the outline element


Static connectedPlatesFromOutlinePoint

connectedPlatesFromOutlinePoint(point: OutlinePoint): Plate[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:528

Returns all plates connected to some OutlinePoint in the same merge-group as point.

Parameters:

Name Type Description
point OutlinePoint The point

Returns: Plate[]

connected to the point


Static connectedPlatesFromOutlineSection

connectedPlatesFromOutlineSection(section: OutlineSection): Plate[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:70

Returns all plates connected to some OutlineSection.

Parameters:

Name Type
section OutlineSection

Returns: Plate[]

plates connected to the section


Static deduplicateSections

deduplicateSections(sectionsArray: OutlineSection[], combineJointSections: boolean): OutlineSection[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:891

This method takes an array of sections and returns a deduplicated copy. No section will appear twice in that array. If combineJointSections is set to true, each pair of joint sections will only appear once.

Parameters:

Name Type Default Description
sectionsArray OutlineSection[] - the sections to deduplicate
combineJointSections boolean true If set to true, each pair of joint sections will only appear once.

Returns: OutlineSection[]


Static duplicateOrnamentsToPlate

duplicateOrnamentsToPlate(oldPlate: Plate, newPlate: Plate, side: PlateSides): Promise‹void›

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:997

Parameters:

Name Type Default
oldPlate Plate -
newPlate Plate -
side PlateSides PlateSides.BOTH

Returns: Promise‹void›


Static findOutlineSectionsWhichConnectPlates

findOutlineSectionsWhichConnectPlates(plate1: Plate, plate2: Plate): OutlineSection[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:516

Returns an array of outline sections, which connect two plates.

Parameters:

Name Type Description
plate1 Plate The first plate
plate2 Plate The second plate

Returns: OutlineSection[]

outline sections which connect the plates


Static getCornerAngle

getCornerAngle(outlinePoint: any, useTangents: boolean): number

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:933

Parameters:

Name Type Default
outlinePoint any -
useTangents boolean false

Returns: number

angle of the corner of the two sections starting/ending in this outline point, in radians. It will never exceed 180° (= flat sections). Values are positive for convex ("left turn on outline") and negative for concave ("right turn on outline") corners. A value of 0° would mean an insanely acute corner. E.g. a square will only have +90° angles, whereas a concave 90° corner will be returned as -90°


Static getInPlateDirections

getInPlateDirections(plate: Plate, mergingTolerance: number): Vector3[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:686

Based on the direction of the plate's outline sections, determines directions that lie in the plate that could be used e.g. for aligning other objects. Similar directions or directions facing opposite to another will be merged. Example: For a square, two directions will be returned, as it would make sense to align another object to either left+right or top+bottom direction

Parameters:

Name Type Default Description
plate Plate - the plate to be analyzed
mergingTolerance number 2 the angle tolerance that is used to deduplicate directions, in degrees

Returns: Vector3[]

array of direction vectors, in assembly space


Static getPlateWithOffsetOutlines

getPlateWithOffsetOutlines(plate: Plate, offset: number): Vector3‹›[][]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:471

Offsets the outlines of a plate. Shrinking increases the size of holes, inflating decreases their size.

Parameters:

Name Type Description
plate Plate the plate that will be offset.
offset number number to be used as offset delta. Negative numbers shrink the polygon, positive numbers inflate the polygon

Returns: Vector3‹›[][]


Static isConcaveCorner

isConcaveCorner(outlinePoint: OutlinePoint, tolerance: number): boolean

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:913

Parameters:

Name Type Default
outlinePoint OutlinePoint -
tolerance number 0.001

Returns: boolean

whether the corner at outlinePoint is concave (true) or convex (false)


Static mergedOutlinePointBelongingToPlate

mergedOutlinePointBelongingToPlate(point: any, plate: any): any

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:537

Parameters:

Name Type
point any
plate any

Returns: any


Static outlinePointOnPlate

outlinePointOnPlate(point: any, plate: any, mergedPoints?: any): OutlinePoint‹›

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:820

Parameters:

Name Type
point any
plate any
mergedPoints? any

Returns: OutlinePoint‹›


Static outlinePointOnSection

outlinePointOnSection(point: OutlinePoint, section: OutlineSection, mergedPoints?: OutlinePoint[]): OutlinePoint

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:841

Searches for outline points merged with point that are a part of the given section

Parameters:

Name Type Description
point OutlinePoint this point's merged vertices will be searched
section OutlineSection resulting point needs to be either start or end of this section
mergedPoints? OutlinePoint[] merged vertices of point (useful if they're currently unmerged)

Returns: OutlinePoint

resulting point or null if none was found


Static outlineSectionsLeavingOutlineAtOutlinePoint

outlineSectionsLeavingOutlineAtOutlinePoint(outline: Outline, point: OutlinePoint, combineJointSections: boolean): OutlineSection[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:553

Gets all outline sections connected to this points, removes the ones that are part of the point's outline or directly joined.

Parameters:

Name Type Default
outline Outline -
point OutlinePoint -
combineJointSections boolean true

Returns: OutlineSection[]

array of outline sections that are leaving the plate at this point, but aren't joined (== normally, orthogonal sections)


Static outlineSubRangeIsPlanar

outlineSubRangeIsPlanar(outline: Outline, startPoint: OutlinePoint, endPoint: OutlinePoint, tolerance: number): boolean

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:589

Determines whether sub-range of outline points is sufficiently planar by fitting a plane through the points and thresholding the squared siatances.

Parameters:

Name Type Default Description
outline Outline - the outline
startPoint OutlinePoint - start of the sub-range (inclusive)
endPoint OutlinePoint - end of the sub-range (inclusive)
tolerance number 0.2 maximal allowed squared distances

Returns: boolean

whether the sub-range is planar


Static removeCollinearOutlinePoints

removeCollinearOutlinePoints(outline: Outline): boolean

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:353

Parameters:

Name Type
outline Outline

Returns: boolean


Static removeZeroLengthSections

removeZeroLengthSections(outline: Outline): boolean

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:435

Parameters:

Name Type
outline Outline

Returns: boolean

whether the outline is still valid or not


Static sectionsFromVertexPositions

sectionsFromVertexPositions(positionA: VertexPosition, positionB: VertexPosition): OutlineSection[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:458

Parameters:

Name Type
positionA VertexPosition
positionB VertexPosition

Returns: OutlineSection[]

sections that are shared by the two VertexPositions. The length of the returned array may be between 0 and 2.


Static splitNonPlanarPlate

splitNonPlanarPlate(plate: Plate, movedPoints: OutlinePoint[], tolerance: number): Plate[]

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:175

This function will split the plate in multiple different plates dependent on the movedPoints. Following technique will be used: 1. If the neighbors from the movedPoint are not collinear and the plate is convex at this position, we perform a a split with the two neighbors and are already done. 2. If the neighbor cut could not executed, we start with normal splitting. 3. If the neighbors of the movedPoint are collinear we try to find the opposite point of this movedPoint and set this as our new startPoint. If there is no opposite point, we set the movedPoint as our start point. 4. Now we add as many points as possible to the new plate, until we get a point which wouldn't be planar with the new plate. 5. We cut the new plate from the original one and go back to 4. 6. If we would cut collinear points we shift the cut.

Characteristic cases: • : static OutlinePoint x : moved OutlinePoint

Neighbor split: Example 2: Example 3: Example 4: •------x •----x---• •------x--• •----x----x |\ | | / \ | |\ / /| | / | | \ | | / \ | | \ / / | | / | | \ | | / | | \// | | / | | \ | •--------• •--•------• •---------• | \ | | | •------•

More visual examples: gitlab.dev.kyub.io/laser-project/general-issues/uploads/98149eea47559e5bcfad205c64adca69/IMG_20170908_102059.jpg

Parameters:

Name Type Default Description
plate Plate - to be split
movedPoints OutlinePoint[] - the points that have been moved (not more than two, since that is the maximum number of points any tool can move at a time)
tolerance number Config.get("plates.nonPlanarityTolerance") the amount of non-planarity tolerated before the plate is split

Returns: Plate[]

array of plates that have been the original plate before splitting. If splitting doesn't work, it contains only the original plate.


Static splitPlate

splitPlate(plate: Plate, plane: Plane, edgeJointClass: Constructor‹EdgeJoint›): object

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:615

Splits a plate along a plane

Parameters:

Name Type Default Description
plate Plate - Plate to be split
plane Plane - Plane in assembly space
edgeJointClass Constructor‹EdgeJoint FingerJoint -

Returns: object


Static splitPlateByOutlinePoints

splitPlateByOutlinePoints(plate: Plate, splitStart: OutlinePoint, splitEnd: OutlinePoint, edgeJointClass: Constructor‹EdgeJoint›): Plate | undefined

Defined in src/model/data/PhysicalObject/Plate2DHelpers.ts:334

Splits the plate by two outline points. If splitEnd is in the outline, the new plate with the outline [splitStart..splitEnd] is added to the assembly and returned, the existing plate is changed to have only the outline [splitEnd..splitStart] If splitEnd is on a hole, it will return undefined, and create a plate that touches itself in the two sections on the cutline. These will be connected by a Joint that has the same plate as both physicalObjects. We also expect the line between splitStart and splitEnd not to contain any holes. Cuts through holes have to happen explicitly with the splitEnd in the hole.

Parameters:

Name Type Default Description
plate Plate - -
splitStart OutlinePoint - OutlinePoint laying in the outline of the plate
splitEnd OutlinePoint - OutlinePoint laying either in the outline, or in one hole
edgeJointClass Constructor‹EdgeJoint FingerJoint -

Returns: Plate | undefined

new plate, or undefined if there is no new plate