@itwin/core-geometry 3.4.0-dev.48 → 3.4.0-dev.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/lib/cjs/geometry3d/PolygonOps.d.ts +3 -3
  2. package/lib/cjs/geometry3d/PolygonOps.js +3 -3
  3. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  4. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +1 -1
  5. package/lib/cjs/polyface/PolyfaceBuilder.js +1 -1
  6. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  7. package/lib/cjs/polyface/PolyfaceQuery.d.ts +1 -1
  8. package/lib/cjs/polyface/PolyfaceQuery.js +1 -1
  9. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  10. package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
  11. package/lib/cjs/serialization/BGFBWriter.js +1 -0
  12. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  13. package/lib/cjs/serialization/IModelJsonSchema.d.ts +23 -15
  14. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  15. package/lib/cjs/serialization/IModelJsonSchema.js +17 -8
  16. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  17. package/lib/cjs/solid/Box.d.ts +4 -4
  18. package/lib/cjs/solid/Box.d.ts.map +1 -1
  19. package/lib/cjs/solid/Box.js +7 -7
  20. package/lib/cjs/solid/Box.js.map +1 -1
  21. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +2 -2
  22. package/lib/cjs/topology/HalfEdgeGraphSearch.js +2 -2
  23. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  24. package/lib/esm/geometry3d/PolygonOps.d.ts +3 -3
  25. package/lib/esm/geometry3d/PolygonOps.js +3 -3
  26. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  27. package/lib/esm/polyface/PolyfaceBuilder.d.ts +1 -1
  28. package/lib/esm/polyface/PolyfaceBuilder.js +1 -1
  29. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  30. package/lib/esm/polyface/PolyfaceQuery.d.ts +1 -1
  31. package/lib/esm/polyface/PolyfaceQuery.js +1 -1
  32. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  33. package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
  34. package/lib/esm/serialization/BGFBWriter.js +1 -0
  35. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  36. package/lib/esm/serialization/IModelJsonSchema.d.ts +23 -15
  37. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  38. package/lib/esm/serialization/IModelJsonSchema.js +17 -8
  39. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  40. package/lib/esm/solid/Box.d.ts +4 -4
  41. package/lib/esm/solid/Box.d.ts.map +1 -1
  42. package/lib/esm/solid/Box.js +7 -7
  43. package/lib/esm/solid/Box.js.map +1 -1
  44. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +2 -2
  45. package/lib/esm/topology/HalfEdgeGraphSearch.js +2 -2
  46. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  47. package/package.json +7 -5
@@ -46,7 +46,7 @@ export declare class Box extends SolidPrimitive {
46
46
  cloneTransformed(transform: Transform): Box | undefined;
47
47
  /**
48
48
  * Create a new box from vector and size daa.
49
- * @param baseOrigin Origin of base rectangle
49
+ * @param origin Origin of base rectangle
50
50
  * @param vectorX Direction for base rectangle
51
51
  * @param vectorY Direction for base rectangle
52
52
  * @param topOrigin origin of top rectangle
@@ -56,10 +56,10 @@ export declare class Box extends SolidPrimitive {
56
56
  * @param topY size factor for top rectangle (multiplies vectorY)
57
57
  * @param capped true to define top and bottom closure caps
58
58
  */
59
- static createDgnBox(baseOrigin: Point3d, vectorX: Vector3d, vectorY: Vector3d, topOrigin: Point3d, baseX: number, baseY: number, topX: number, topY: number, capped: boolean): Box | undefined;
59
+ static createDgnBox(origin: Point3d, vectorX: Vector3d, vectorY: Vector3d, topOrigin: Point3d, baseX: number, baseY: number, topX: number, topY: number, capped: boolean): Box | undefined;
60
60
  /**
61
61
  * Create a new box with xy directions taken from columns of the `axes` matrix.
62
- * @param baseOrigin Origin of base rectangle
62
+ * @param origin Origin of base rectangle
63
63
  * @param axes Direction for base rectangle
64
64
  * @param topOrigin origin of top rectangle
65
65
  * @param baseX size factor for base rectangle (multiplies vectorX)
@@ -68,7 +68,7 @@ export declare class Box extends SolidPrimitive {
68
68
  * @param topY size factor for top rectangle (multiplies vectorY)
69
69
  * @param capped true to define top and bottom closure caps
70
70
  */
71
- static createDgnBoxWithAxes(baseOrigin: Point3d, axes: Matrix3d, topOrigin: Point3d, baseX: number, baseY: number, topX: number, topY: number, capped: boolean): Box | undefined;
71
+ static createDgnBoxWithAxes(origin: Point3d, axes: Matrix3d, topOrigin: Point3d, baseX: number, baseY: number, topX: number, topY: number, capped: boolean): Box | undefined;
72
72
  /**
73
73
  * Create an axis-aligned `Box` primitive for a range.
74
74
  * @param range range corners Origin of base rectangle
@@ -1 +1 @@
1
- {"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../src/solid/Box.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAA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ends SolidPrimitive_1.SolidPrimitive {
62
62
  }
63
63
  /**
64
64
  * Create a new box from vector and size daa.
65
- * @param baseOrigin Origin of base rectangle
65
+ * @param origin Origin of base rectangle
66
66
  * @param vectorX Direction for base rectangle
67
67
  * @param vectorY Direction for base rectangle
68
68
  * @param topOrigin origin of top rectangle
@@ -72,14 +72,14 @@ class Box extends SolidPrimitive_1.SolidPrimitive {
72
72
  * @param topY size factor for top rectangle (multiplies vectorY)
73
73
  * @param capped true to define top and bottom closure caps
74
74
  */
75
- static createDgnBox(baseOrigin, vectorX, vectorY, topOrigin, baseX, baseY, topX, topY, capped) {
76
- const vectorZ = baseOrigin.vectorTo(topOrigin);
77
- const localToWorld = Transform_1.Transform.createOriginAndMatrixColumns(baseOrigin, vectorX, vectorY, vectorZ);
75
+ static createDgnBox(origin, vectorX, vectorY, topOrigin, baseX, baseY, topX, topY, capped) {
76
+ const vectorZ = origin.vectorTo(topOrigin);
77
+ const localToWorld = Transform_1.Transform.createOriginAndMatrixColumns(origin, vectorX, vectorY, vectorZ);
78
78
  return new Box(localToWorld, baseX, baseY, topX, topY, capped);
79
79
  }
80
80
  /**
81
81
  * Create a new box with xy directions taken from columns of the `axes` matrix.
82
- * @param baseOrigin Origin of base rectangle
82
+ * @param origin Origin of base rectangle
83
83
  * @param axes Direction for base rectangle
84
84
  * @param topOrigin origin of top rectangle
85
85
  * @param baseX size factor for base rectangle (multiplies vectorX)
@@ -88,8 +88,8 @@ class Box extends SolidPrimitive_1.SolidPrimitive {
88
88
  * @param topY size factor for top rectangle (multiplies vectorY)
89
89
  * @param capped true to define top and bottom closure caps
90
90
  */
91
- static createDgnBoxWithAxes(baseOrigin, axes, topOrigin, baseX, baseY, topX, topY, capped) {
92
- return Box.createDgnBox(baseOrigin, axes.columnX(), axes.columnY(), topOrigin, baseX, baseY, topX, topY, capped);
91
+ static createDgnBoxWithAxes(origin, axes, topOrigin, baseX, baseY, topX, topY, capped) {
92
+ return Box.createDgnBox(origin, axes.columnX(), axes.columnY(), topOrigin, baseX, baseY, topX, topY, capped);
93
93
  }
94
94
  /**
95
95
  * Create an axis-aligned `Box` primitive for a range.
@@ -1 +1 @@
1
- {"version":3,"file":"Box.js","sourceRoot":"","sources":["../../../src/solid/Box.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,wDAAqD;AACrD,wCAAqC;AACrC,0CAAuC;AAGvC,mEAAkE;AAElE,uDAAoD;AACpD,qDAAkD;AAElD;;;;;;;;;GASG;AACH,MAAa,GAAI,SAAQ,+BAAc;IAUrC,YAAsB,GAAc,EAClC,KAAa,EAAE,KAAa,EAAE,IAAY,EAAE,IAAY,EAAE,MAAe;QACzE,KAAK,CAAC,MAAM,CAAC,CAAC;QAXhB,wCAAwC;QACxB,uBAAkB,GAAG,KAAK,CAAC;QAWzC,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IACD,qBAAqB;IACd,KAAK;QACV,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5G,CAAC;IAED;;;;;OAKG;IACI,oBAAoB;QACzB,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;IACzC,CAAC;IACD;;OAEG;IACI,mBAAmB,CAAC,SAAoB;QAC7C,IAAI,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE;YAC/B,OAAO,KAAK,CAAC;QACf,SAAS,CAAC,0BAA0B,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,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AAE,EAAE,CAAC,CAAC,CAAC;SAC7D;IACH,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AApOD,kBAoOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { Geometry } from \"../Geometry\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\n\n/**\n * A box-like solid defined by\n * * A local coordinate frame\n * * (0,0,0) is left lower rear corner of box (considering \"left\" to reference x, \"lower\" to reference y, \"rear and front\" to reference z=0 and z=1)\n * * (0,0,1) is left lower front corner.\n * * (baseX,baseY,z) is right upper corner at z\n * * note that the frame x and y columns are usually unit vectors in local space, but z is full rear to front vector\n * * The separate values for base and top x and y allow the box to be a \"view frustum\" with parallel back and front planes but independent x and y bellows effects.\n * @public\n */\nexport class Box extends SolidPrimitive {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"box\";\n\n private _localToWorld: Transform;\n private _baseX: number;\n private _baseY: number;\n private _topX: number;\n private _topY: number;\n\n protected constructor(map: Transform,\n baseX: number, baseY: number, topX: number, topY: number, capped: boolean) {\n super(capped);\n this._localToWorld = map;\n this._baseX = baseX;\n this._baseY = baseY;\n this._topX = topX;\n this._topY = topY;\n }\n /** Return a clone */\n public clone(): Box {\n return new Box(this._localToWorld.clone(), this._baseX, this._baseY, this._topX, this._topY, this.capped);\n }\n\n /** Return a coordinate frame (right handed unit vectors)\n * * origin lower left of box\n * * x direction on base rectangle x edge\n * * y direction in base rectangle\n * * z direction perpendicular\n */\n public getConstructiveFrame(): Transform | undefined {\n return this._localToWorld.cloneRigid();\n }\n /** Apply the transform to the box's `localToWorld` frame.\n * * Note that this may make the frame nonrigid.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n transform.multiplyTransformTransform(this._localToWorld, this._localToWorld);\n return true;\n }\n /** Clone the box and immediately apply `transform` to the local frame of the clone. */\n public cloneTransformed(transform: Transform): Box | undefined {\n const result = this.clone();\n transform.multiplyTransformTransform(result._localToWorld, result._localToWorld);\n return result;\n }\n\n /**\n * Create a new box from vector and size daa.\n * @param baseOrigin Origin of base rectangle\n * @param vectorX Direction for base rectangle\n * @param vectorY Direction for base rectangle\n * @param topOrigin origin of top rectangle\n * @param baseX size factor for base rectangle (multiplies vectorX)\n * @param baseY size factor for base rectangle (multiplies vectorY)\n * @param topX size factor for top rectangle (multiplies vectorX)\n * @param topY size factor for top rectangle (multiplies vectorY)\n * @param capped true to define top and bottom closure caps\n */\n public static createDgnBox(baseOrigin: Point3d, vectorX: Vector3d, vectorY: Vector3d,\n topOrigin: Point3d,\n baseX: number, baseY: number, topX: number, topY: number,\n capped: boolean): Box | undefined {\n const vectorZ = baseOrigin.vectorTo(topOrigin);\n const localToWorld = Transform.createOriginAndMatrixColumns(baseOrigin, vectorX, vectorY, vectorZ);\n return new Box(localToWorld, baseX, baseY, topX, topY, capped);\n }\n\n /**\n * Create a new box with xy directions taken from columns of the `axes` matrix.\n * @param baseOrigin Origin of base rectangle\n * @param axes Direction for base rectangle\n * @param topOrigin origin of top rectangle\n * @param baseX size factor for base rectangle (multiplies vectorX)\n * @param baseY size factor for base rectangle (multiplies vectorY)\n * @param topX size factor for top rectangle (multiplies vectorX)\n * @param topY size factor for top rectangle (multiplies vectorY)\n * @param capped true to define top and bottom closure caps\n */\n public static createDgnBoxWithAxes(baseOrigin: Point3d, axes: Matrix3d,\n topOrigin: Point3d,\n baseX: number, baseY: number, topX: number, topY: number,\n capped: boolean): Box | undefined {\n return Box.createDgnBox(baseOrigin, axes.columnX(), axes.columnY(), topOrigin,\n baseX, baseY, topX, topY, capped);\n }\n\n /**\n * Create an axis-aligned `Box` primitive for a range.\n * @param range range corners Origin of base rectangle\n * @param capped true to define top and bottom closure caps\n */\n public static createRange(range: Range3d, capped: boolean): Box | undefined {\n if (!range.isNull) {\n const lowPoint = range.low;\n const xSize = range.xLength();\n const ySize = range.yLength();\n const zPoint = range.low.clone();\n zPoint.z = zPoint.z + range.zLength();\n return Box.createDgnBox(\n lowPoint,\n Vector3d.unitX(), Vector3d.unitY(),\n zPoint,\n xSize, ySize, xSize, ySize, capped);\n }\n return undefined;\n }\n /** (property accessor) return the x length at z = 0 */\n public getBaseX(): number { return this._baseX; }\n /** (property accessor) return the y length at z = 0 */\n public getBaseY(): number { return this._baseY; }\n /** (property accessor) return the x length at z = 1 */\n public getTopX(): number { return this._topX; }\n /** (property accessor) return the x length at z = 1 */\n public getTopY(): number { return this._topY; }\n /** (property accessor) return the local coordinates point (0,0,0) to world */\n public getBaseOrigin(): Point3d { return this._localToWorld.multiplyXYZ(0, 0, 0); }\n /** (property accessor) return the local coordinates point (0,0,1) to world */\n public getTopOrigin(): Point3d { return this._localToWorld.multiplyXYZ(0, 0, 1); }\n /** (property accessor) return the local coordinate frame x vector */\n public getVectorX(): Vector3d { return this._localToWorld.matrix.columnX(); }\n /** (property accessor) return the local coordinate frame y vector */\n public getVectorY(): Vector3d { return this._localToWorld.matrix.columnY(); }\n /** (property accessor) return the local coordinate frame z vector */\n public getVectorZ(): Vector3d { return this._localToWorld.matrix.columnZ(); }\n /** Test of `other` is also of class `Box` */\n public isSameGeometryClass(other: any): boolean { return other instanceof Box; }\n /** test for near equality */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof Box) {\n if (this.capped !== other.capped) return false;\n if (!this._localToWorld.isAlmostEqual(other._localToWorld)) return false;\n return Geometry.isSameCoordinate(this._baseX, other._baseX)\n && Geometry.isSameCoordinate(this._baseY, other._baseY)\n && Geometry.isSameCoordinate(this._topX, other._topX)\n && Geometry.isSameCoordinate(this._topY, other._topY);\n }\n return false;\n }\n /** Second step of double dispatch: call `handler.handleBox(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleBox(this);\n }\n /** Return strokes of the cross-section rectangle at local z coordinate */\n public strokeConstantVSection(zFraction: number): LineString3d {\n const ax = Geometry.interpolate(this._baseX, zFraction, this._topX);\n const ay = Geometry.interpolate(this._baseY, zFraction, this._topY);\n const result = LineString3d.create();\n const transform = this._localToWorld;\n const workPoint = Point3d.create();\n transform.multiplyXYZ(0, 0, zFraction, workPoint);\n result.addPoint(workPoint);\n transform.multiplyXYZ(ax, 0, zFraction, workPoint);\n result.addPoint(workPoint);\n transform.multiplyXYZ(ax, ay, zFraction, workPoint);\n result.addPoint(workPoint);\n transform.multiplyXYZ(0, ay, zFraction, workPoint);\n result.addPoint(workPoint);\n transform.multiplyXYZ(0, 0, zFraction, workPoint);\n result.addPoint(workPoint);\n return result;\n }\n /**\n * Returns the 8 corners in x fastest, then y, finally z lexical order.\n */\n public getCorners(): Point3d[] {\n const transform = this._localToWorld;\n const ax = this._baseX;\n const ay = this._baseY;\n const bx = this._topX;\n const by = this._topY;\n return [\n transform.multiplyXYZ(0, 0, 0),\n transform.multiplyXYZ(ax, 0, 0),\n transform.multiplyXYZ(0, ay, 0),\n transform.multiplyXYZ(ax, ay, 0),\n transform.multiplyXYZ(0, 0, 1),\n transform.multiplyXYZ(bx, 0, 1),\n transform.multiplyXYZ(0, by, 1),\n transform.multiplyXYZ(bx, by, 1),\n ];\n }\n\n /**\n * Consider the box sides (not top and bottom) as a (u,v) surface with\n * * v = 0 as the z=0 local plane\n * * v = 1 as the z=1 local plane\n * Return the (rectangular) section at fractional v\n */\n public constantVSection(zFraction: number): CurveCollection {\n const ls = this.strokeConstantVSection(zFraction);\n return Loop.create(ls);\n }\n /** Extend `rangeToExtend` by each of the 8 corners */\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\n const boxTransform = this._localToWorld;\n const ax = this._baseX;\n const ay = this._baseY;\n const bx = this._topX;\n const by = this._topY;\n if (transform) {\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, 0, 0, 0);\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, ax, 0, 0);\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, 0, ay, 0);\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, ax, ay, 0);\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, 0, 0, 1);\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, bx, 0, 1);\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, 0, by, 1);\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, bx, by, 1);\n } else {\n rangeToExtend.extendTransformedXYZ(boxTransform, 0, 0, 0);\n rangeToExtend.extendTransformedXYZ(boxTransform, ax, 0, 0);\n rangeToExtend.extendTransformedXYZ(boxTransform, 0, ay, 0);\n rangeToExtend.extendTransformedXYZ(boxTransform, ax, ay, 0);\n rangeToExtend.extendTransformedXYZ(boxTransform, 0, 0, 1);\n rangeToExtend.extendTransformedXYZ(boxTransform, bx, 0, 1);\n rangeToExtend.extendTransformedXYZ(boxTransform, 0, by, 1);\n rangeToExtend.extendTransformedXYZ(boxTransform, bx, by, 1);\n }\n }\n /**\n * @return true if this is a closed volume.\n */\n public get isClosedVolume(): boolean {\n return this.capped;\n }\n}\n"]}
1
+ {"version":3,"file":"Box.js","sourceRoot":"","sources":["../../../src/solid/Box.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,wDAAqD;AACrD,wCAAqC;AACrC,0CAAuC;AAGvC,mEAAkE;AAElE,uDAAo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C,6BAA6B,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/E,aAAa,CAAC,6BAA6B,CAAC,SAAS,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YAC/E,aAAa,CAAC,6BAA6B,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;SACjF;aAAM;YACL,aAAa,CAAC,oBAAoB,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAC1D,aAAa,CAAC,oBAAoB,CAAC,YAAY,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3D,aAAa,CAAC,oBAAoB,CAAC,YAAY,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YAC3D,aAAa,CAAC,oBAAoB,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YAC5D,aAAa,CAAC,oBAAoB,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAC1D,aAAa,CAAC,oBAAoB,CAAC,YAAY,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3D,aAAa,CAAC,oBAAoB,CAAC,YAAY,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YAC3D,aAAa,CAAC,oBAAoB,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;SAC7D;IACH,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AApOD,kBAoOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { Geometry } from \"../Geometry\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\n\n/**\n * A box-like solid defined by\n * * A local coordinate frame\n * * (0,0,0) is left lower rear corner of box (considering \"left\" to reference x, \"lower\" to reference y, \"rear and front\" to reference z=0 and z=1)\n * * (0,0,1) is left lower front corner.\n * * (baseX,baseY,z) is right upper corner at z\n * * note that the frame x and y columns are usually unit vectors in local space, but z is full rear to front vector\n * * The separate values for base and top x and y allow the box to be a \"view frustum\" with parallel back and front planes but independent x and y bellows effects.\n * @public\n */\nexport class Box extends SolidPrimitive {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"box\";\n\n private _localToWorld: Transform;\n private _baseX: number;\n private _baseY: number;\n private _topX: number;\n private _topY: number;\n\n protected constructor(map: Transform,\n baseX: number, baseY: number, topX: number, topY: number, capped: boolean) {\n super(capped);\n this._localToWorld = map;\n this._baseX = baseX;\n this._baseY = baseY;\n this._topX = topX;\n this._topY = topY;\n }\n /** Return a clone */\n public clone(): Box {\n return new Box(this._localToWorld.clone(), this._baseX, this._baseY, this._topX, this._topY, this.capped);\n }\n\n /** Return a coordinate frame (right handed unit vectors)\n * * origin lower left of box\n * * x direction on base rectangle x edge\n * * y direction in base rectangle\n * * z direction perpendicular\n */\n public getConstructiveFrame(): Transform | undefined {\n return this._localToWorld.cloneRigid();\n }\n /** Apply the transform to the box's `localToWorld` frame.\n * * Note that this may make the frame nonrigid.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n transform.multiplyTransformTransform(this._localToWorld, this._localToWorld);\n return true;\n }\n /** Clone the box and immediately apply `transform` to the local frame of the clone. */\n public cloneTransformed(transform: Transform): Box | undefined {\n const result = this.clone();\n transform.multiplyTransformTransform(result._localToWorld, result._localToWorld);\n return result;\n }\n\n /**\n * Create a new box from vector and size daa.\n * @param origin Origin of base rectangle\n * @param vectorX Direction for base rectangle\n * @param vectorY Direction for base rectangle\n * @param topOrigin origin of top rectangle\n * @param baseX size factor for base rectangle (multiplies vectorX)\n * @param baseY size factor for base rectangle (multiplies vectorY)\n * @param topX size factor for top rectangle (multiplies vectorX)\n * @param topY size factor for top rectangle (multiplies vectorY)\n * @param capped true to define top and bottom closure caps\n */\n public static createDgnBox(origin: Point3d, vectorX: Vector3d, vectorY: Vector3d,\n topOrigin: Point3d,\n baseX: number, baseY: number, topX: number, topY: number,\n capped: boolean): Box | undefined {\n const vectorZ = origin.vectorTo(topOrigin);\n const localToWorld = Transform.createOriginAndMatrixColumns(origin, vectorX, vectorY, vectorZ);\n return new Box(localToWorld, baseX, baseY, topX, topY, capped);\n }\n\n /**\n * Create a new box with xy directions taken from columns of the `axes` matrix.\n * @param origin Origin of base rectangle\n * @param axes Direction for base rectangle\n * @param topOrigin origin of top rectangle\n * @param baseX size factor for base rectangle (multiplies vectorX)\n * @param baseY size factor for base rectangle (multiplies vectorY)\n * @param topX size factor for top rectangle (multiplies vectorX)\n * @param topY size factor for top rectangle (multiplies vectorY)\n * @param capped true to define top and bottom closure caps\n */\n public static createDgnBoxWithAxes(origin: Point3d, axes: Matrix3d,\n topOrigin: Point3d,\n baseX: number, baseY: number, topX: number, topY: number,\n capped: boolean): Box | undefined {\n return Box.createDgnBox(origin, axes.columnX(), axes.columnY(), topOrigin,\n baseX, baseY, topX, topY, capped);\n }\n\n /**\n * Create an axis-aligned `Box` primitive for a range.\n * @param range range corners Origin of base rectangle\n * @param capped true to define top and bottom closure caps\n */\n public static createRange(range: Range3d, capped: boolean): Box | undefined {\n if (!range.isNull) {\n const lowPoint = range.low;\n const xSize = range.xLength();\n const ySize = range.yLength();\n const zPoint = range.low.clone();\n zPoint.z = zPoint.z + range.zLength();\n return Box.createDgnBox(\n lowPoint,\n Vector3d.unitX(), Vector3d.unitY(),\n zPoint,\n xSize, ySize, xSize, ySize, capped);\n }\n return undefined;\n }\n /** (property accessor) return the x length at z = 0 */\n public getBaseX(): number { return this._baseX; }\n /** (property accessor) return the y length at z = 0 */\n public getBaseY(): number { return this._baseY; }\n /** (property accessor) return the x length at z = 1 */\n public getTopX(): number { return this._topX; }\n /** (property accessor) return the x length at z = 1 */\n public getTopY(): number { return this._topY; }\n /** (property accessor) return the local coordinates point (0,0,0) to world */\n public getBaseOrigin(): Point3d { return this._localToWorld.multiplyXYZ(0, 0, 0); }\n /** (property accessor) return the local coordinates point (0,0,1) to world */\n public getTopOrigin(): Point3d { return this._localToWorld.multiplyXYZ(0, 0, 1); }\n /** (property accessor) return the local coordinate frame x vector */\n public getVectorX(): Vector3d { return this._localToWorld.matrix.columnX(); }\n /** (property accessor) return the local coordinate frame y vector */\n public getVectorY(): Vector3d { return this._localToWorld.matrix.columnY(); }\n /** (property accessor) return the local coordinate frame z vector */\n public getVectorZ(): Vector3d { return this._localToWorld.matrix.columnZ(); }\n /** Test of `other` is also of class `Box` */\n public isSameGeometryClass(other: any): boolean { return other instanceof Box; }\n /** test for near equality */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof Box) {\n if (this.capped !== other.capped) return false;\n if (!this._localToWorld.isAlmostEqual(other._localToWorld)) return false;\n return Geometry.isSameCoordinate(this._baseX, other._baseX)\n && Geometry.isSameCoordinate(this._baseY, other._baseY)\n && Geometry.isSameCoordinate(this._topX, other._topX)\n && Geometry.isSameCoordinate(this._topY, other._topY);\n }\n return false;\n }\n /** Second step of double dispatch: call `handler.handleBox(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleBox(this);\n }\n /** Return strokes of the cross-section rectangle at local z coordinate */\n public strokeConstantVSection(zFraction: number): LineString3d {\n const ax = Geometry.interpolate(this._baseX, zFraction, this._topX);\n const ay = Geometry.interpolate(this._baseY, zFraction, this._topY);\n const result = LineString3d.create();\n const transform = this._localToWorld;\n const workPoint = Point3d.create();\n transform.multiplyXYZ(0, 0, zFraction, workPoint);\n result.addPoint(workPoint);\n transform.multiplyXYZ(ax, 0, zFraction, workPoint);\n result.addPoint(workPoint);\n transform.multiplyXYZ(ax, ay, zFraction, workPoint);\n result.addPoint(workPoint);\n transform.multiplyXYZ(0, ay, zFraction, workPoint);\n result.addPoint(workPoint);\n transform.multiplyXYZ(0, 0, zFraction, workPoint);\n result.addPoint(workPoint);\n return result;\n }\n /**\n * Returns the 8 corners in x fastest, then y, finally z lexical order.\n */\n public getCorners(): Point3d[] {\n const transform = this._localToWorld;\n const ax = this._baseX;\n const ay = this._baseY;\n const bx = this._topX;\n const by = this._topY;\n return [\n transform.multiplyXYZ(0, 0, 0),\n transform.multiplyXYZ(ax, 0, 0),\n transform.multiplyXYZ(0, ay, 0),\n transform.multiplyXYZ(ax, ay, 0),\n transform.multiplyXYZ(0, 0, 1),\n transform.multiplyXYZ(bx, 0, 1),\n transform.multiplyXYZ(0, by, 1),\n transform.multiplyXYZ(bx, by, 1),\n ];\n }\n\n /**\n * Consider the box sides (not top and bottom) as a (u,v) surface with\n * * v = 0 as the z=0 local plane\n * * v = 1 as the z=1 local plane\n * Return the (rectangular) section at fractional v\n */\n public constantVSection(zFraction: number): CurveCollection {\n const ls = this.strokeConstantVSection(zFraction);\n return Loop.create(ls);\n }\n /** Extend `rangeToExtend` by each of the 8 corners */\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\n const boxTransform = this._localToWorld;\n const ax = this._baseX;\n const ay = this._baseY;\n const bx = this._topX;\n const by = this._topY;\n if (transform) {\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, 0, 0, 0);\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, ax, 0, 0);\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, 0, ay, 0);\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, ax, ay, 0);\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, 0, 0, 1);\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, bx, 0, 1);\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, 0, by, 1);\n rangeToExtend.extendTransformTransformedXYZ(transform, boxTransform, bx, by, 1);\n } else {\n rangeToExtend.extendTransformedXYZ(boxTransform, 0, 0, 0);\n rangeToExtend.extendTransformedXYZ(boxTransform, ax, 0, 0);\n rangeToExtend.extendTransformedXYZ(boxTransform, 0, ay, 0);\n rangeToExtend.extendTransformedXYZ(boxTransform, ax, ay, 0);\n rangeToExtend.extendTransformedXYZ(boxTransform, 0, 0, 1);\n rangeToExtend.extendTransformedXYZ(boxTransform, bx, 0, 1);\n rangeToExtend.extendTransformedXYZ(boxTransform, 0, by, 1);\n rangeToExtend.extendTransformedXYZ(boxTransform, bx, by, 1);\n }\n }\n /**\n * @return true if this is a closed volume.\n */\n public get isClosedVolume(): boolean {\n return this.capped;\n }\n}\n"]}
@@ -84,8 +84,8 @@ export declare class HalfEdgeGraphSearch {
84
84
  /**
85
85
  * Collect arrays gathering faces by connected component.
86
86
  * @param graph graph to inspect
87
- * @param parityEdgeTester (optional) function to test of an edge is a parity change.
88
- * @param parityMask (optional, along with boundaryTestFunction) mask to apply indicating parity. If this is Mask.NULL_MASK, there is no record of parity.
87
+ * @param parityEdgeTester (optional) function to test if an edge is a parity change (e.g., a boundary edge).
88
+ * @param parityMask (optional, along with parityEdgeTester) mask to apply indicating parity. If this is Mask.NULL_MASK, there is no record of parity.
89
89
  */
90
90
  static collectConnectedComponentsWithExteriorParityMasks(graph: HalfEdgeGraph, parityEdgeTester: HalfEdgeTestObject | undefined, parityMask?: HalfEdgeMask): HalfEdge[][];
91
91
  /**
@@ -185,8 +185,8 @@ class HalfEdgeGraphSearch {
185
185
  /**
186
186
  * Collect arrays gathering faces by connected component.
187
187
  * @param graph graph to inspect
188
- * @param parityEdgeTester (optional) function to test of an edge is a parity change.
189
- * @param parityMask (optional, along with boundaryTestFunction) mask to apply indicating parity. If this is Mask.NULL_MASK, there is no record of parity.
188
+ * @param parityEdgeTester (optional) function to test if an edge is a parity change (e.g., a boundary edge).
189
+ * @param parityMask (optional, along with parityEdgeTester) mask to apply indicating parity. If this is Mask.NULL_MASK, there is no record of parity.
190
190
  */
191
191
  static collectConnectedComponentsWithExteriorParityMasks(graph, parityEdgeTester, parityMask = Graph_1.HalfEdgeMask.NULL_MASK) {
192
192
  const components = [];
@@ -1 +1 @@
1
- {"version":3,"file":"HalfEdgeGraphSearch.js","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphSearch.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,mCAAiH;AACjH,2DAAwD;AACxD,mEAAgE;AAQhE;GACG;AACH,MAAa,kBAAkB;IAG7B;;;;OAIG;IACH,YAAmB,IAAkB,EAAE,cAAuB,IAAI;QAChE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IACD,yEAAyE;IAClE,QAAQ,CAAC,IAAc;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC;IAChE,CAAC;CAEF;AAjBD,gDAiBC;AACD,oCAAoC;AACpC,MAAa,mBAAmB;IAE9B;;;OAGG;IACK,MAAM,CAAC,yBAAyB,CAAC,QAAkB,EAAE,IAAY,EAAE,YAAwB,EAAE,eAA2B;QAC9H,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/B,QAAQ,CAAC,iBAAiB,CAAC,CAAC,IAAc,EAAE,EAAE;YAC5C,IAAI,CA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iB,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,cAAc,GAAG,CAAC,IAAc,EAAW,EAAE;YACjD,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACvF,CAAC,CAAC;QACF,MAAM,sBAAsB,GAAG,CAAC,IAAc,EAAE,OAAe,EAAE,EAAE;YACjE,IAAI,OAAO,KAAK,CAAC;gBACf,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjB,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,YAAY,EAAE;YACrC,IAAI,CAAC,mCAAmC,CAAC,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,sBAAsB,CAAC,CAAC;SACnG;QACD,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAjRD,kDAiRC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Topology\n */\n\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask, HalfEdgeToBooleanFunction, NodeToNumberFunction } from \"./Graph\";\nimport { SignedDataSummary } from \"./SignedDataSummary\";\nimport { XYParitySearchContext } from \"./XYParitySearchContext\";\n\n/**\n * Interface for an object that executes boolean tests on edges.\n */\nexport interface HalfEdgeTestObject {\n testEdge(h: HalfEdge): boolean;\n}\n/**\n */\nexport class HalfEdgeMaskTester {\n private _targetMask: HalfEdgeMask;\n private _targetValue: boolean;\n /**\n *\n * @param mask mask to test in `testEdge` function\n * @param targetValue value to match for true return\n */\n public constructor(mask: HalfEdgeMask, targetValue: boolean = true) {\n this._targetMask = mask;\n this._targetValue = targetValue;\n }\n /** Return true if the value of the targetMask matches the targetValue */\n public testEdge(edge: HalfEdge): boolean {\n return edge.isMaskSet(this._targetMask) === this._targetValue;\n }\n\n}\n// Search services for HalfEdgeGraph\nexport class HalfEdgeGraphSearch {\n\n /**\n * * for each node of face, set the mask push to allNodesStack\n * * push the faceSeed on onePerFaceStack[]\n */\n private static pushAndMaskAllNodesInFace(faceSeed: HalfEdge, mask: number, allNodeStack: HalfEdge[], onePerFaceStack: HalfEdge[]) {\n onePerFaceStack.push(faceSeed);\n faceSeed.collectAroundFace((node: HalfEdge) => {\n node.setMask(mask);\n allNodeStack.push(node);\n });\n }\n\n /**\n * Search an array of faceSeed nodes for the face with the most negative area.\n * @param oneCandidateNodePerFace array containing one node from each face to be considered.\n */\n public static findMinimumAreaFace(oneCandidateNodePerFace: HalfEdgeGraph | HalfEdge[],\n faceAreaFunction?: NodeToNumberFunction): HalfEdge {\n const summary = HalfEdgeGraphSearch.collectFaceAreaSummary(oneCandidateNodePerFace, false, faceAreaFunction);\n return summary.largestNegativeItem!;\n }\n /**\n * static method for face area computation -- useful as function parameter in collect FaceAreaSummary.\n * * This simply calls `node.signedFaceArea ()`\n * @param node instance for signedFaceArea call.\n */\n public static signedFaceArea(node: HalfEdge): number { return node.signedFaceArea(); }\n /**\n *\n * Return a summary structure data about face (or other numeric quantity if the caller's areaFunction returns other value)\n * * The default areaFunction computes area of polygonal face.\n * * Callers with curved edge graphs must supply their own area function.\n * @param source graph or array of nodes to examine\n * @param collectAllNodes flag to pass to the SignedDataSummary constructor to control collection of nodes.\n * @param areaFunction function to all to obtain area (or other numeric value)\n */\n public static collectFaceAreaSummary(source: HalfEdgeGraph | HalfEdge[], collectAllNodes: boolean = false,\n areaFunction: NodeToNumberFunction = HalfEdgeGraphSearch.signedFaceArea): SignedDataSummary<HalfEdge> {\n const result = new SignedDataSummary<HalfEdge>(collectAllNodes);\n let allFaces: HalfEdge[];\n\n if (source instanceof HalfEdgeGraph)\n allFaces = source.collectFaceLoops();\n else\n allFaces = source;\n\n for (const node of allFaces) {\n const area = areaFunction(node);\n result.announceItem(node, area);\n }\n return result;\n }\n\n /**\n * * Test if the graph is triangulated.\n * * Return false if:\n * * Positive area face with more than 3 edges\n * * more than 1 negative area face with `allowMultipleNegativeAreaFaces` false\n * * 2-edge faces are ignored.\n */\n public static isTriangulatedCCW(source: HalfEdgeGraph | HalfEdge[], allowMultipleNegativeAreaFaces: boolean = true, numPositiveExceptionsAllowed = 0): boolean {\n let allFaces: HalfEdge[];\n\n if (source instanceof HalfEdgeGraph)\n allFaces = source.collectFaceLoops();\n else\n allFaces = source;\n let numNegative = 0;\n let numPositiveExceptions = 0;\n for (const node of allFaces) {\n const numEdges = node.countEdgesAroundFace();\n if (numEdges >= 3) {\n const area = node.signedFaceArea();\n if (area > 0) {\n if (numEdges > 3) {\n numPositiveExceptions++;\n if (numPositiveExceptions > numPositiveExceptionsAllowed)\n return false;\n }\n } else {\n numNegative++;\n if (numNegative > 1) {\n if (!allowMultipleNegativeAreaFaces)\n return false;\n }\n }\n }\n }\n return true;\n }\n\n /**\n * Search to all accessible faces from given seed.\n * * The returned array contains one representative node in each face of the connected component.\n * * If (nonnull) parity mask is given, on return:\n * * It is entirely set or entirely clear around each face\n * * It is entirely set on all faces that are an even number of face-to-face steps away from the seed.\n * * It is entirely clear on all faces that are an odd number of face-to-face steps away from the seed.\n * @param seedEdge first edge to search.\n * @param visitMask mask applied to all faces as visited.\n * @param parityMask mask to apply (a) to first face, (b) to faces with alternating parity during the search.\n */\n private static parityFloodFromSeed(seedEdge: HalfEdge, visitMask: HalfEdgeMask, parityEdgeTester: HalfEdgeTestObject | undefined, parityMask: HalfEdgeMask): HalfEdge[] {\n const faces: HalfEdge[] = [];\n if (seedEdge.isMaskSet(visitMask)) return faces; // empty\n\n const allMasks = parityMask | visitMask;\n const stack: HalfEdge[] = [];\n // arbitrarily call the seed face exterior ... others will alternate as visited.\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(seedEdge, allMasks, stack, faces); // Start with exterior as mask\n while (stack.length > 0) {\n const p = stack.pop()!;\n const mate = p.edgeMate;\n if (!mate)\n continue;\n if (!mate.isMaskSet(visitMask)) {\n let newState = p.isMaskSet(parityMask);\n if (!parityEdgeTester || parityEdgeTester.testEdge(p))\n newState = !newState;\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(mate, newState ? allMasks : visitMask, stack, faces);\n }\n }\n return faces;\n }\n /**\n * * Search the given faces for the one with the minimum area.\n * * If the mask in that face is OFF, toggle it on (all half edges of) all the faces.\n * * In a properly merged planar subdivision there should be only one true negative area face per component.\n * @param graph parent graph\n * @param parityMask mask which was previously set with alternating parity, but with an arbitrary start face.\n * @param faces array of faces to search.\n */\n private static correctParityInSingleComponent(_graph: HalfEdgeGraph, mask: HalfEdgeMask, faces: HalfEdge[]) {\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(faces);\n if (!exteriorHalfEdge) {\n } else if (exteriorHalfEdge.isMaskSet(mask)) {\n // all should be well .. nothing to do.\n } else {\n // TOGGLE around the face (assuming all are consistent with the seed)\n for (const faceSeed of faces) {\n if (faceSeed.isMaskSet(mask)) {\n faceSeed.clearMaskAroundFace(mask);\n } else {\n faceSeed.setMaskAroundFace(mask);\n }\n }\n }\n }\n /** Apply correctParityInSingleComponent to each array in components. (Quick exit if mask in NULL_MASK) */\n private static correctParityInComponentArrays(graph: HalfEdgeGraph, mask: HalfEdgeMask, components: HalfEdge[][]) {\n if (mask === HalfEdgeMask.NULL_MASK)\n return;\n for (const facesInComponent of components)\n HalfEdgeGraphSearch.correctParityInSingleComponent(graph, mask, facesInComponent);\n }\n /**\n * Collect arrays gathering faces by connected component.\n * @param graph graph to inspect\n * @param parityEdgeTester (optional) function to test of an edge is a parity change.\n * @param parityMask (optional, along with boundaryTestFunction) mask to apply indicating parity. If this is Mask.NULL_MASK, there is no record of parity.\n */\n public static collectConnectedComponentsWithExteriorParityMasks(graph: HalfEdgeGraph, parityEdgeTester: HalfEdgeTestObject | undefined, parityMask: HalfEdgeMask = HalfEdgeMask.NULL_MASK): HalfEdge[][] {\n const components = [];\n const visitMask = HalfEdgeMask.VISITED;\n const allMasks = parityMask | visitMask;\n graph.clearMask(allMasks);\n for (const faceSeed of graph.allHalfEdges) {\n if (!faceSeed.isMaskSet(HalfEdgeMask.VISITED)) {\n const newFaces = HalfEdgeGraphSearch.parityFloodFromSeed(faceSeed, visitMask, parityEdgeTester, parityMask);\n components.push(newFaces);\n }\n }\n HalfEdgeGraphSearch.correctParityInComponentArrays(graph, parityMask, components);\n return components;\n }\n /**\n * Test if (x,y) is inside (1), on an edge (0) or outside (-1) a face.\n * @param seedNode any node on the face loop\n * @param x x coordinate of test point.\n * @param y y coordinate of test point.\n */\n public static pointInOrOnFaceXY(seedNode: HalfEdge, x: number, y: number): number | undefined {\n const context = new XYParitySearchContext(x, y);\n // walk around looking for an accepted node to start the search (seedNode is usually ok!)\n let nodeA = seedNode;\n let nodeB = seedNode.faceSuccessor;\n for (; ; nodeA = nodeB) {\n if (context.tryStartEdge(nodeA.x, nodeA.y, nodeB.x, nodeB.y))\n break;\n if (nodeB === seedNode) {\n // umm.. the face is all on the x axis?\n return context.classifyCounts();\n }\n nodeB = nodeA.faceSuccessor;\n }\n\n // nodeB is the real start node for search ... emit ends of each edge around the face,\n // stopping after emitting nodeB as an edge end.\n let node = nodeB.faceSuccessor;\n for (; ;) {\n if (!context.advance(node.x, node.y)) {\n return context.classifyCounts();\n }\n if (node === nodeB)\n break;\n node = node.faceSuccessor;\n }\n return context.classifyCounts();\n }\n /**\n * Announce nodes that are \"extended face boundary\" by conditions (usually mask of node and mate) in test functions.\n * * After each node, the next candidate in reached by looking \"around the head vertex loop\" for the next boundary.\n * * \"Around the vertex\" from nodeA means\n * * First look at nodeA.faceSuccessor;\n * * Then look at vertexPredecessor around that vertex loop.\n * * Each accepted node is passed to announceNode, and marked with the visit mask.\n * * The counter of the announceEdge function is zero for the first edge, then increases with each edge.\n * @param seed start node.\n * @param isBoundaryEdge\n * @param announceEdge\n */\n public static collectExtendedBoundaryLoopFromSeed(seed: HalfEdge, visitMask: HalfEdgeMask, isBoundaryEdge: HalfEdgeToBooleanFunction,\n announceEdge: (edge: HalfEdge, counter: number) => void) {\n let counter = 0;\n while (!seed.getMask(visitMask) && isBoundaryEdge(seed)) {\n announceEdge(seed, counter++);\n seed.setMask(visitMask);\n const vertexBase = seed.faceSuccessor;\n let candidateAroundVertex = vertexBase;\n for (; ;) {\n if (candidateAroundVertex.getMask(visitMask))\n return;\n if (isBoundaryEdge(candidateAroundVertex)) {\n seed = candidateAroundVertex;\n break;\n }\n candidateAroundVertex = candidateAroundVertex.vertexPredecessor;\n if (candidateAroundVertex === vertexBase)\n break;\n }\n }\n }\n /**\n * Collect arrays of nodes \"around the boundary\" of a graph with extraneous (non-boundary) edges.\n * * The \"boundary\" is nodes that do NOT have the exterior mask, but whose mates DO have the exterior mask.\n * * After each node, the next candidate in reached by looking \"around the head vertex loop\" for the next boundary.\n * * \"Around the vertex\" from nodeA means\n * * First look at nodeA.faceSuccessor;\n * * Then look at vertexPredecessor around that vertex loop.\n * * Each accepted node is passed to announceNode, and marked with the visit mask.\n * @param seed start node.\n * @param isBoundaryNode\n * @param announceNode\n */\n public static collectExtendedBoundaryLoopsInGraph(graph: HalfEdgeGraph, exteriorMask: HalfEdgeMask): HalfEdge[][] {\n const loops: HalfEdge[][] = [];\n const visitMask = graph.grabMask(true);\n const isBoundaryEdge = (edge: HalfEdge): boolean => {\n return edge.getMask(exteriorMask) === 0 && edge.edgeMate.getMask(exteriorMask) !== 0;\n };\n const announceEdgeInBoundary = (edge: HalfEdge, counter: number) => {\n if (counter === 0)\n loops.push([]);\n loops[loops.length - 1].push(edge);\n };\n for (const seed of graph.allHalfEdges) {\n this.collectExtendedBoundaryLoopFromSeed(seed, visitMask, isBoundaryEdge, announceEdgeInBoundary);\n }\n graph.dropMask(visitMask);\n return loops;\n }\n}\n"]}
1
+ {"version":3,"file":"HalfEdgeGraphSearch.js","sourceRoot":"","sources":["../../../src/topology/HalfEdgeGraphSearch.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,mCAAiH;AACjH,2DAAwD;AACxD,mEAAgE;AAQhE;GACG;AACH,MAAa,kBAAkB;IAG7B;;;;OAIG;IACH,YAAmB,IAAkB,EAAE,cAAuB,IAAI;QAChE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IACD,yEAAyE;IAClE,QAAQ,CAAC,IAAc;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC;IAChE,CAAC;CAEF;AAjBD,gDAiBC;AACD,oCAAoC;AACpC,MAAa,mBAAmB;IAE9B;;;OAGG;IACK,MAAM,CAAC,yBAAyB,CAAC,QAAkB,EAAE,IAAY,EAAE,YAAwB,EAAE,eAA2B;QAC9H,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/B,QAAQ,CAAC,iBAAiB,CAAC,CAAC,IAAc,EAAE,EAAE;YAC5C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,mBAAmB,CAAC,uBAAmD,EACnF,gBAAuC;QACvC,MAAM,OAAO,GAAG,mBAAmB,CAAC,sBAAsB,CAAC,uBAAuB,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC;QAC7G,OAAO,OAAO,CAAC,mBAAoB,CAAC;IACtC,CAAC;IACD;;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E;YACjE,IAAI,OAAO,KAAK,CAAC;gBACf,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjB,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,YAAY,EAAE;YACrC,IAAI,CAAC,mCAAmC,CAAC,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,sBAAsB,CAAC,CAAC;SACnG;QACD,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAjRD,kDAiRC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Topology\n */\n\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask, HalfEdgeToBooleanFunction, NodeToNumberFunction } from \"./Graph\";\nimport { SignedDataSummary } from \"./SignedDataSummary\";\nimport { XYParitySearchContext } from \"./XYParitySearchContext\";\n\n/**\n * Interface for an object that executes boolean tests on edges.\n */\nexport interface HalfEdgeTestObject {\n testEdge(h: HalfEdge): boolean;\n}\n/**\n */\nexport class HalfEdgeMaskTester {\n private _targetMask: HalfEdgeMask;\n private _targetValue: boolean;\n /**\n *\n * @param mask mask to test in `testEdge` function\n * @param targetValue value to match for true return\n */\n public constructor(mask: HalfEdgeMask, targetValue: boolean = true) {\n this._targetMask = mask;\n this._targetValue = targetValue;\n }\n /** Return true if the value of the targetMask matches the targetValue */\n public testEdge(edge: HalfEdge): boolean {\n return edge.isMaskSet(this._targetMask) === this._targetValue;\n }\n\n}\n// Search services for HalfEdgeGraph\nexport class HalfEdgeGraphSearch {\n\n /**\n * * for each node of face, set the mask push to allNodesStack\n * * push the faceSeed on onePerFaceStack[]\n */\n private static pushAndMaskAllNodesInFace(faceSeed: HalfEdge, mask: number, allNodeStack: HalfEdge[], onePerFaceStack: HalfEdge[]) {\n onePerFaceStack.push(faceSeed);\n faceSeed.collectAroundFace((node: HalfEdge) => {\n node.setMask(mask);\n allNodeStack.push(node);\n });\n }\n\n /**\n * Search an array of faceSeed nodes for the face with the most negative area.\n * @param oneCandidateNodePerFace array containing one node from each face to be considered.\n */\n public static findMinimumAreaFace(oneCandidateNodePerFace: HalfEdgeGraph | HalfEdge[],\n faceAreaFunction?: NodeToNumberFunction): HalfEdge {\n const summary = HalfEdgeGraphSearch.collectFaceAreaSummary(oneCandidateNodePerFace, false, faceAreaFunction);\n return summary.largestNegativeItem!;\n }\n /**\n * static method for face area computation -- useful as function parameter in collect FaceAreaSummary.\n * * This simply calls `node.signedFaceArea ()`\n * @param node instance for signedFaceArea call.\n */\n public static signedFaceArea(node: HalfEdge): number { return node.signedFaceArea(); }\n /**\n *\n * Return a summary structure data about face (or other numeric quantity if the caller's areaFunction returns other value)\n * * The default areaFunction computes area of polygonal face.\n * * Callers with curved edge graphs must supply their own area function.\n * @param source graph or array of nodes to examine\n * @param collectAllNodes flag to pass to the SignedDataSummary constructor to control collection of nodes.\n * @param areaFunction function to all to obtain area (or other numeric value)\n */\n public static collectFaceAreaSummary(source: HalfEdgeGraph | HalfEdge[], collectAllNodes: boolean = false,\n areaFunction: NodeToNumberFunction = HalfEdgeGraphSearch.signedFaceArea): SignedDataSummary<HalfEdge> {\n const result = new SignedDataSummary<HalfEdge>(collectAllNodes);\n let allFaces: HalfEdge[];\n\n if (source instanceof HalfEdgeGraph)\n allFaces = source.collectFaceLoops();\n else\n allFaces = source;\n\n for (const node of allFaces) {\n const area = areaFunction(node);\n result.announceItem(node, area);\n }\n return result;\n }\n\n /**\n * * Test if the graph is triangulated.\n * * Return false if:\n * * Positive area face with more than 3 edges\n * * more than 1 negative area face with `allowMultipleNegativeAreaFaces` false\n * * 2-edge faces are ignored.\n */\n public static isTriangulatedCCW(source: HalfEdgeGraph | HalfEdge[], allowMultipleNegativeAreaFaces: boolean = true, numPositiveExceptionsAllowed = 0): boolean {\n let allFaces: HalfEdge[];\n\n if (source instanceof HalfEdgeGraph)\n allFaces = source.collectFaceLoops();\n else\n allFaces = source;\n let numNegative = 0;\n let numPositiveExceptions = 0;\n for (const node of allFaces) {\n const numEdges = node.countEdgesAroundFace();\n if (numEdges >= 3) {\n const area = node.signedFaceArea();\n if (area > 0) {\n if (numEdges > 3) {\n numPositiveExceptions++;\n if (numPositiveExceptions > numPositiveExceptionsAllowed)\n return false;\n }\n } else {\n numNegative++;\n if (numNegative > 1) {\n if (!allowMultipleNegativeAreaFaces)\n return false;\n }\n }\n }\n }\n return true;\n }\n\n /**\n * Search to all accessible faces from given seed.\n * * The returned array contains one representative node in each face of the connected component.\n * * If (nonnull) parity mask is given, on return:\n * * It is entirely set or entirely clear around each face\n * * It is entirely set on all faces that are an even number of face-to-face steps away from the seed.\n * * It is entirely clear on all faces that are an odd number of face-to-face steps away from the seed.\n * @param seedEdge first edge to search.\n * @param visitMask mask applied to all faces as visited.\n * @param parityMask mask to apply (a) to first face, (b) to faces with alternating parity during the search.\n */\n private static parityFloodFromSeed(seedEdge: HalfEdge, visitMask: HalfEdgeMask, parityEdgeTester: HalfEdgeTestObject | undefined, parityMask: HalfEdgeMask): HalfEdge[] {\n const faces: HalfEdge[] = [];\n if (seedEdge.isMaskSet(visitMask)) return faces; // empty\n\n const allMasks = parityMask | visitMask;\n const stack: HalfEdge[] = [];\n // arbitrarily call the seed face exterior ... others will alternate as visited.\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(seedEdge, allMasks, stack, faces); // Start with exterior as mask\n while (stack.length > 0) {\n const p = stack.pop()!;\n const mate = p.edgeMate;\n if (!mate)\n continue;\n if (!mate.isMaskSet(visitMask)) {\n let newState = p.isMaskSet(parityMask);\n if (!parityEdgeTester || parityEdgeTester.testEdge(p))\n newState = !newState;\n HalfEdgeGraphSearch.pushAndMaskAllNodesInFace(mate, newState ? allMasks : visitMask, stack, faces);\n }\n }\n return faces;\n }\n /**\n * * Search the given faces for the one with the minimum area.\n * * If the mask in that face is OFF, toggle it on (all half edges of) all the faces.\n * * In a properly merged planar subdivision there should be only one true negative area face per component.\n * @param graph parent graph\n * @param parityMask mask which was previously set with alternating parity, but with an arbitrary start face.\n * @param faces array of faces to search.\n */\n private static correctParityInSingleComponent(_graph: HalfEdgeGraph, mask: HalfEdgeMask, faces: HalfEdge[]) {\n const exteriorHalfEdge = HalfEdgeGraphSearch.findMinimumAreaFace(faces);\n if (!exteriorHalfEdge) {\n } else if (exteriorHalfEdge.isMaskSet(mask)) {\n // all should be well .. nothing to do.\n } else {\n // TOGGLE around the face (assuming all are consistent with the seed)\n for (const faceSeed of faces) {\n if (faceSeed.isMaskSet(mask)) {\n faceSeed.clearMaskAroundFace(mask);\n } else {\n faceSeed.setMaskAroundFace(mask);\n }\n }\n }\n }\n /** Apply correctParityInSingleComponent to each array in components. (Quick exit if mask in NULL_MASK) */\n private static correctParityInComponentArrays(graph: HalfEdgeGraph, mask: HalfEdgeMask, components: HalfEdge[][]) {\n if (mask === HalfEdgeMask.NULL_MASK)\n return;\n for (const facesInComponent of components)\n HalfEdgeGraphSearch.correctParityInSingleComponent(graph, mask, facesInComponent);\n }\n /**\n * Collect arrays gathering faces by connected component.\n * @param graph graph to inspect\n * @param parityEdgeTester (optional) function to test if an edge is a parity change (e.g., a boundary edge).\n * @param parityMask (optional, along with parityEdgeTester) mask to apply indicating parity. If this is Mask.NULL_MASK, there is no record of parity.\n */\n public static collectConnectedComponentsWithExteriorParityMasks(graph: HalfEdgeGraph, parityEdgeTester: HalfEdgeTestObject | undefined, parityMask: HalfEdgeMask = HalfEdgeMask.NULL_MASK): HalfEdge[][] {\n const components = [];\n const visitMask = HalfEdgeMask.VISITED;\n const allMasks = parityMask | visitMask;\n graph.clearMask(allMasks);\n for (const faceSeed of graph.allHalfEdges) {\n if (!faceSeed.isMaskSet(HalfEdgeMask.VISITED)) {\n const newFaces = HalfEdgeGraphSearch.parityFloodFromSeed(faceSeed, visitMask, parityEdgeTester, parityMask);\n components.push(newFaces);\n }\n }\n HalfEdgeGraphSearch.correctParityInComponentArrays(graph, parityMask, components);\n return components;\n }\n /**\n * Test if (x,y) is inside (1), on an edge (0) or outside (-1) a face.\n * @param seedNode any node on the face loop\n * @param x x coordinate of test point.\n * @param y y coordinate of test point.\n */\n public static pointInOrOnFaceXY(seedNode: HalfEdge, x: number, y: number): number | undefined {\n const context = new XYParitySearchContext(x, y);\n // walk around looking for an accepted node to start the search (seedNode is usually ok!)\n let nodeA = seedNode;\n let nodeB = seedNode.faceSuccessor;\n for (; ; nodeA = nodeB) {\n if (context.tryStartEdge(nodeA.x, nodeA.y, nodeB.x, nodeB.y))\n break;\n if (nodeB === seedNode) {\n // umm.. the face is all on the x axis?\n return context.classifyCounts();\n }\n nodeB = nodeA.faceSuccessor;\n }\n\n // nodeB is the real start node for search ... emit ends of each edge around the face,\n // stopping after emitting nodeB as an edge end.\n let node = nodeB.faceSuccessor;\n for (; ;) {\n if (!context.advance(node.x, node.y)) {\n return context.classifyCounts();\n }\n if (node === nodeB)\n break;\n node = node.faceSuccessor;\n }\n return context.classifyCounts();\n }\n /**\n * Announce nodes that are \"extended face boundary\" by conditions (usually mask of node and mate) in test functions.\n * * After each node, the next candidate in reached by looking \"around the head vertex loop\" for the next boundary.\n * * \"Around the vertex\" from nodeA means\n * * First look at nodeA.faceSuccessor;\n * * Then look at vertexPredecessor around that vertex loop.\n * * Each accepted node is passed to announceNode, and marked with the visit mask.\n * * The counter of the announceEdge function is zero for the first edge, then increases with each edge.\n * @param seed start node.\n * @param isBoundaryEdge\n * @param announceEdge\n */\n public static collectExtendedBoundaryLoopFromSeed(seed: HalfEdge, visitMask: HalfEdgeMask, isBoundaryEdge: HalfEdgeToBooleanFunction,\n announceEdge: (edge: HalfEdge, counter: number) => void) {\n let counter = 0;\n while (!seed.getMask(visitMask) && isBoundaryEdge(seed)) {\n announceEdge(seed, counter++);\n seed.setMask(visitMask);\n const vertexBase = seed.faceSuccessor;\n let candidateAroundVertex = vertexBase;\n for (; ;) {\n if (candidateAroundVertex.getMask(visitMask))\n return;\n if (isBoundaryEdge(candidateAroundVertex)) {\n seed = candidateAroundVertex;\n break;\n }\n candidateAroundVertex = candidateAroundVertex.vertexPredecessor;\n if (candidateAroundVertex === vertexBase)\n break;\n }\n }\n }\n /**\n * Collect arrays of nodes \"around the boundary\" of a graph with extraneous (non-boundary) edges.\n * * The \"boundary\" is nodes that do NOT have the exterior mask, but whose mates DO have the exterior mask.\n * * After each node, the next candidate in reached by looking \"around the head vertex loop\" for the next boundary.\n * * \"Around the vertex\" from nodeA means\n * * First look at nodeA.faceSuccessor;\n * * Then look at vertexPredecessor around that vertex loop.\n * * Each accepted node is passed to announceNode, and marked with the visit mask.\n * @param seed start node.\n * @param isBoundaryNode\n * @param announceNode\n */\n public static collectExtendedBoundaryLoopsInGraph(graph: HalfEdgeGraph, exteriorMask: HalfEdgeMask): HalfEdge[][] {\n const loops: HalfEdge[][] = [];\n const visitMask = graph.grabMask(true);\n const isBoundaryEdge = (edge: HalfEdge): boolean => {\n return edge.getMask(exteriorMask) === 0 && edge.edgeMate.getMask(exteriorMask) !== 0;\n };\n const announceEdgeInBoundary = (edge: HalfEdge, counter: number) => {\n if (counter === 0)\n loops.push([]);\n loops[loops.length - 1].push(edge);\n };\n for (const seed of graph.allHalfEdges) {\n this.collectExtendedBoundaryLoopFromSeed(seed, visitMask, isBoundaryEdge, announceEdgeInBoundary);\n }\n graph.dropMask(visitMask);\n return loops;\n }\n}\n"]}
@@ -95,7 +95,7 @@ export declare class CutLoopMergeContext {
95
95
  export declare class PolygonOps {
96
96
  /** Sum areas of triangles from points[0] to each far edge.
97
97
  * * Consider triangles from points[0] to each edge.
98
- * * Sum the areas(absolute, without regard to orientation) all these triangles.
98
+ * * Sum the absolute areas (without regard to orientation) all these triangles.
99
99
  * @returns sum of absolute triangle areas.
100
100
  */
101
101
  static sumTriangleAreas(points: Point3d[] | GrowableXYZArray): number;
@@ -108,8 +108,8 @@ export declare class PolygonOps {
108
108
  static sumTriangleAreasPerpendicularToUpVector(points: Point3d[] | GrowableXYZArray, upVector: Vector3d): number;
109
109
  /** Sum areas of triangles from points[0] to each far edge.
110
110
  * * Consider triangles from points[0] to each edge.
111
- * * Sum the areas(absolute, without regard to orientation) all these triangles.
112
- * @returns sum of absolute triangle areas.
111
+ * * Sum the signed areas of all these triangles. (An area can be negative at a concave corner.)
112
+ * @returns sum of signed triangle areas.
113
113
  */
114
114
  static sumTriangleAreasXY(points: Point3d[]): number;
115
115
  /** These values are the integrated area moment products [xx,xy,xz, x]
@@ -201,7 +201,7 @@ export class CutLoopMergeContext {
201
201
  export class PolygonOps {
202
202
  /** Sum areas of triangles from points[0] to each far edge.
203
203
  * * Consider triangles from points[0] to each edge.
204
- * * Sum the areas(absolute, without regard to orientation) all these triangles.
204
+ * * Sum the absolute areas (without regard to orientation) all these triangles.
205
205
  * @returns sum of absolute triangle areas.
206
206
  */
207
207
  static sumTriangleAreas(points) {
@@ -265,8 +265,8 @@ export class PolygonOps {
265
265
  }
266
266
  /** Sum areas of triangles from points[0] to each far edge.
267
267
  * * Consider triangles from points[0] to each edge.
268
- * * Sum the areas(absolute, without regard to orientation) all these triangles.
269
- * @returns sum of absolute triangle areas.
268
+ * * Sum the signed areas of all these triangles. (An area can be negative at a concave corner.)
269
+ * @returns sum of signed triangle areas.
270
270
  */
271
271
  static sumTriangleAreasXY(points) {
272
272
  let s = 0.0;