@itwin/core-geometry 4.10.0-dev.18 → 4.10.0-dev.20

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 (78) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/curve/Arc3d.d.ts +21 -10
  3. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  4. package/lib/cjs/curve/Arc3d.js +58 -36
  5. package/lib/cjs/curve/Arc3d.js.map +1 -1
  6. package/lib/cjs/curve/CurveFactory.d.ts +10 -12
  7. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  8. package/lib/cjs/curve/CurveFactory.js +16 -43
  9. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  10. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +2 -2
  11. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  12. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +2 -2
  13. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  14. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +1 -1
  15. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  16. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
  17. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +14 -11
  18. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  19. package/lib/cjs/geometry3d/AngleSweep.d.ts +10 -6
  20. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  21. package/lib/cjs/geometry3d/AngleSweep.js +15 -12
  22. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  23. package/lib/cjs/geometry3d/PolygonOps.js +2 -2
  24. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  25. package/lib/cjs/geometry4d/Map4d.d.ts +5 -5
  26. package/lib/cjs/geometry4d/Map4d.js +5 -5
  27. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  28. package/lib/cjs/geometry4d/Matrix4d.d.ts +4 -7
  29. package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
  30. package/lib/cjs/geometry4d/Matrix4d.js +4 -7
  31. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  32. package/lib/cjs/numerics/Polynomials.d.ts +2 -2
  33. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  34. package/lib/cjs/numerics/Polynomials.js +14 -20
  35. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  36. package/lib/cjs/polyface/PolyfaceClip.d.ts +3 -3
  37. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  38. package/lib/cjs/polyface/PolyfaceClip.js +1 -1
  39. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  40. package/lib/esm/curve/Arc3d.d.ts +21 -10
  41. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  42. package/lib/esm/curve/Arc3d.js +58 -36
  43. package/lib/esm/curve/Arc3d.js.map +1 -1
  44. package/lib/esm/curve/CurveFactory.d.ts +10 -12
  45. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  46. package/lib/esm/curve/CurveFactory.js +16 -43
  47. package/lib/esm/curve/CurveFactory.js.map +1 -1
  48. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +2 -2
  49. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  50. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +2 -2
  51. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  52. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +1 -1
  53. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  54. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
  55. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +14 -11
  56. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  57. package/lib/esm/geometry3d/AngleSweep.d.ts +10 -6
  58. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  59. package/lib/esm/geometry3d/AngleSweep.js +15 -12
  60. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  61. package/lib/esm/geometry3d/PolygonOps.js +2 -2
  62. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  63. package/lib/esm/geometry4d/Map4d.d.ts +5 -5
  64. package/lib/esm/geometry4d/Map4d.js +5 -5
  65. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  66. package/lib/esm/geometry4d/Matrix4d.d.ts +4 -7
  67. package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
  68. package/lib/esm/geometry4d/Matrix4d.js +4 -7
  69. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  70. package/lib/esm/numerics/Polynomials.d.ts +2 -2
  71. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  72. package/lib/esm/numerics/Polynomials.js +14 -20
  73. package/lib/esm/numerics/Polynomials.js.map +1 -1
  74. package/lib/esm/polyface/PolyfaceClip.d.ts +3 -3
  75. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  76. package/lib/esm/polyface/PolyfaceClip.js +1 -1
  77. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  78. package/package.json +4 -4
@@ -43,17 +43,17 @@ export declare class PolyfaceClip {
43
43
  * * Return all surviving clip as a new mesh.
44
44
  * * WARNING: The new mesh is "points only" -- parameters, normals, etc are not interpolated
45
45
  */
46
- static clipPolyfaceClipPlaneWithClosureFace(polyface: Polyface, clipper: ClipPlane, insideClip?: boolean, buildClosureFaces?: boolean): Polyface;
46
+ static clipPolyfaceClipPlaneWithClosureFace(polyface: Polyface, clipper: ClipPlane, insideClip?: boolean, buildClosureFaces?: boolean): IndexedPolyface;
47
47
  /** Clip each facet of polyface to the ClipPlane.
48
48
  * * Return all surviving clip as a new mesh.
49
49
  * * WARNING: The new mesh is "points only" -- parameters, normals, etc are not interpolated
50
50
  */
51
- static clipPolyfaceClipPlane(polyface: Polyface, clipper: ClipPlane, insideClip?: boolean, buildClosureFaces?: boolean): Polyface;
51
+ static clipPolyfaceClipPlane(polyface: Polyface, clipper: ClipPlane, insideClip?: boolean, buildClosureFaces?: boolean): IndexedPolyface;
52
52
  /** Clip each facet of polyface to the ClipPlane.
53
53
  * * Return surviving clip as a new mesh.
54
54
  * * WARNING: The new mesh is "points only".
55
55
  */
56
- static clipPolyfaceConvexClipPlaneSet(polyface: Polyface, clipper: ConvexClipPlaneSet): Polyface;
56
+ static clipPolyfaceConvexClipPlaneSet(polyface: Polyface, clipper: ConvexClipPlaneSet): IndexedPolyface;
57
57
  /** Clip each facet of polyface to the the clippers.
58
58
  * * Add inside, outside fragments to builderA, builderB
59
59
  * * This does not consider params, normals, colors. Just points.
@@ -1 +1 @@
1
- {"version":3,"file":"PolyfaceClip.d.ts","sourceRoot":"","sources":["../../../src/polyface/PolyfaceClip.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAY,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG/D,OAAO,EAAW,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAQlE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;A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B,EAAE,WAAW,EAAE,uBAAuB;IAqBvI;;;;;;OAMG;WACW,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,GAAG,kBAAkB,GAAG,0BAA0B,EAAE,WAAW,EAAE,uBAAuB,EACpK,YAAY,GAAE,MAAU;IAS1B;;;;QAII;WACU,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,GAAG,kBAAkB,GAAG,QAAQ,GAAG,SAAS;IAQ7G;;;;;;;;OAQG;WACW,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,eAAe,GAAG,SAAS;IAgB5J;;;;;MAKE;IACF,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAYlC;;OAEG;WACW,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,GAAG,YAAY,EAAE;IAe9F;;;;;;;;;;;;;;OAcG;WACW,+CAA+C,CAAC,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAChH,cAAc,EAAE,eAAe,GAAG,SAAS,EAC3C,aAAa,EAAE,eAAe,GAAG,SAAS;IAsC5C;;;;;;;;;;;;;;;;OAgBG;WACW,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,GAAG;QAAE,WAAW,EAAE,eAAe,CAAC;QAAC,UAAU,EAAE,eAAe,CAAA;KAAE;CAe5I"}
@@ -208,7 +208,7 @@ class PolyfaceClip {
208
208
  this.addRegion(builder, child);
209
209
  }
210
210
  else {
211
- (0, core_bentley_1.assert)(!"unexpected region encountered");
211
+ (0, core_bentley_1.assert)(false, "unexpected region encountered");
212
212
  }
213
213
  }
214
214
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PolyfaceClip.js","sourceRoot":"","sources":["../../../src/polyface/Polyface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AM,GAAG,CAAC,EAAE,CAAC;oBACtB,mGAAmG;oBACnG,2CAA8B,CAAC,oCAAoC,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;oBACvH,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,cAAc;wBACpC,cAAc,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;oBACnD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa;wBACnC,aAAa,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;gBACpD,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACI,MAAM,CAAC,cAAc,CAAC,KAAsB,EAAE,KAAsB;QACzE,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QACvC,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QACvC,MAAM,cAAc,GAAG,iCAAe,CAAC,MAAM,EAAE,CAAC;QAChD,MAAM,aAAa,GAAG,iCAAe,CAAC,MAAM,EAAE,CAAC;QAC/C,cAAc,CAAC,uBAAuB,EAAE,CAAC;QACzC,IAAI,CAAC,+CAA+C,CAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;QACxG,cAAc,CAAC,uBAAuB,EAAE,CAAC;QACzC,aAAa,CAAC,uBAAuB,EAAE,CAAC;QACxC,IAAI,CAAC,+CAA+C,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;QACxG,OAAO;YACL,WAAW,EAAE,cAAc,CAAC,aAAa,EAAE;YAC3C,UAAU,EAAE,aAAa,CAAC,aAAa,EAAE;SAC1C,CAAC;IACJ,CAAC;CACF;AArhBD,oCAqhBC","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 Polyface\n */\n\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\nimport { assert } from \"@itwin/core-bentley\";\nimport { ClipPlane } from \"../clipping/ClipPlane\";\nimport { ConvexClipPlaneSet } from \"../clipping/ConvexClipPlaneSet\";\nimport { UnionOfConvexClipPlaneSets } from \"../clipping/UnionOfConvexClipPlaneSets\";\nimport { AnyRegion } from \"../curve/CurveTypes\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { RegionBinaryOpType, RegionOps } from \"../curve/RegionOps\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { UnionRegion } from \"../curve/UnionRegion\";\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\nimport { FrameBuilder } from \"../geometry3d/FrameBuilder\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { IndexedXYZCollectionPolygonOps, PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range1d, Range2d, Range3d } from \"../geometry3d/Range\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SweepContour } from \"../solid/SweepContour\";\nimport { ChainMergeContext } from \"../topology/ChainMerge\";\nimport { RangeSearch } from \"./multiclip/RangeSearch\";\nimport { IndexedPolyface, Polyface, PolyfaceVisitor } from \"./Polyface\";\nimport { PolyfaceBuilder } from \"./PolyfaceBuilder\";\nimport { PolyfaceQuery } from \"./PolyfaceQuery\";\n\n/**\n * carrier for a point array with an index into UnionOfConvexClipPlaneSets\n * @private\n */\nclass ClipCandidate {\n public nextConvexSetIndex: number;\n public points: GrowableXYZArray;\n public constructor(points: GrowableXYZArray, nextConvexSetIndex: number) {\n this.nextConvexSetIndex = nextConvexSetIndex;\n this.points = points;\n }\n}\n\n/**\n * A pair of [[PolyfaceBuilder]] objects, for use by clippers that emit inside and outside parts.\n * * @public\n */\nexport class ClippedPolyfaceBuilders {\n /** An available builder. Typically the \"inside\" parts */\n public builderA?: PolyfaceBuilder;\n /** An available builder. Typically the \"outside\" parts */\n public builderB?: PolyfaceBuilder;\n /** request to construct cut faces */\n public buildClosureFaces?: boolean;\n private constructor(builderA: PolyfaceBuilder | undefined, builderB: PolyfaceBuilder | undefined, buildClosureFaces: boolean = false) {\n this.builderA = builderA;\n this.builderB = builderB;\n this.buildClosureFaces = buildClosureFaces;\n }\n /**\n * Static constructor with default options for the builders.\n * @param keepInside whether to collect clipped facets inside the clipper to `this.builderA` (default true)\n * @param keepOutside whether to collect clipped facets outside the clipper to `this.builderB` (default false)\n * @param buildSideFaces whether to add side facets to active builders (default false)\n */\n public static create(keepInside: boolean = true, keepOutside: boolean = false, buildSideFaces: boolean = false) {\n return new ClippedPolyfaceBuilders(keepInside ? PolyfaceBuilder.create() : undefined, keepOutside ? PolyfaceBuilder.create() : undefined, buildSideFaces);\n }\n\n /**\n * Return the computed facets from the selected builder.\n * @param selector the polyface to return: 0 - builderA (typically inside facets), 1 - builderB (typically outside facets)\n * @param fixup whether to clean up the polyface\n * @param tolerance compression tolerance (default [[Geometry.smallMetricDistance]]).\n */\n public claimPolyface(selector: 0 | 1, fixup: boolean, tolerance: number = Geometry.smallMetricDistance): IndexedPolyface | undefined {\n const builder = selector === 0 ? this.builderA : this.builderB;\n if (builder) {\n let polyface = builder.claimPolyface(true, tolerance);\n if (fixup) {\n polyface = PolyfaceQuery.cloneWithTVertexFixup(polyface);\n polyface = PolyfaceQuery.cloneWithDanglingEdgesRemoved(polyface);\n }\n return polyface;\n }\n return undefined;\n }\n}\n/** PolyfaceClip is a static class gathering operations using Polyfaces and clippers.\n * @public\n */\nexport class PolyfaceClip {\n /** Clip each facet of polyface to the ClipPlane.\n * * Return all surviving clip as a new mesh.\n * * WARNING: The new mesh is \"points only\" -- parameters, normals, etc are not interpolated\n */\n public static clipPolyfaceClipPlaneWithClosureFace(polyface: Polyface, clipper: ClipPlane, insideClip: boolean = true, buildClosureFaces: boolean = true) {\n return this.clipPolyfaceClipPlane(polyface, clipper, insideClip, buildClosureFaces);\n }\n /** Clip each facet of polyface to the ClipPlane.\n * * Return all surviving clip as a new mesh.\n * * WARNING: The new mesh is \"points only\" -- parameters, normals, etc are not interpolated\n */\n public static clipPolyfaceClipPlane(polyface: Polyface, clipper: ClipPlane, insideClip: boolean = true, buildClosureFaces: boolean = false): Polyface {\n const builders = ClippedPolyfaceBuilders.create(insideClip, !insideClip, buildClosureFaces);\n this.clipPolyfaceInsideOutside(polyface, clipper, builders);\n return builders.claimPolyface(insideClip ? 0 : 1, true)!;\n }\n\n /** Clip each facet of polyface to the ClipPlane.\n * * Return surviving clip as a new mesh.\n * * WARNING: The new mesh is \"points only\".\n */\n public static clipPolyfaceConvexClipPlaneSet(polyface: Polyface, clipper: ConvexClipPlaneSet): Polyface {\n const visitor = polyface.createVisitor(0);\n const builder = PolyfaceBuilder.create();\n const work = new GrowableXYZArray(10);\n for (visitor.reset(); visitor.moveToNextFacet();) {\n clipper.clipConvexPolygonInPlace(visitor.point, work);\n if (visitor.point.length > 2)\n builder.addPolygonGrowableXYZArray(visitor.point);\n }\n return builder.claimPolyface(true);\n }\n\n /** Clip each facet of polyface to the the clippers.\n * * Add inside, outside fragments to builderA, builderB\n * * This does not consider params, normals, colors. Just points.\n * * outputSelect determines how the clip output is structured\n * * 0 outputs all shards -- this may have many interior edges.\n * * 1 stitches shards together to get cleaner facets.\n */\n public static clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface: Polyface | PolyfaceVisitor, allClippers: UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelector: number = 1) {\n if (polyface instanceof Polyface) {\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface.createVisitor(0), allClippers, destination, outputSelector);\n return;\n }\n const builderA = destination.builderA;\n const builderB = destination.builderB;\n const visitor = polyface; // alias; we have a visitor now\n const cache = new GrowableXYZArrayCache();\n const insideShards: GrowableXYZArray[] = [];\n const outsideShards: GrowableXYZArray[] = [];\n const residualPolygons: ClipCandidate[] = [];\n let candidate: ClipCandidate | undefined;\n const outsideParts: GrowableXYZArray[] = [];\n\n const numConvexSet = allClippers.convexSets.length;\n for (visitor.reset(); visitor.moveToNextFacet();) {\n residualPolygons.push(new ClipCandidate(cache.grabAndFill(visitor.point), 0));\n while ((candidate = residualPolygons.pop()) !== undefined) {\n const convexSetIndex = candidate.nextConvexSetIndex;\n if (convexSetIndex >= numConvexSet) {\n // ths remnant polygon is OUT ...\n if (candidate.points.length > 2)\n outsideShards.push(candidate.points);\n } else {\n const clipper = allClippers.convexSets[convexSetIndex];\n outsideParts.length = 0; // NO NO -- why isn't it empty from prior step cleanup?\n const insidePart = clipper.clipInsidePushOutside(candidate.points, outsideParts, cache);\n if (insidePart) {\n if (insidePart.length > 2)\n insideShards.push(insidePart);\n // Keep outside parts active for clip by later facets . . .\n for (const outsidePolygon of outsideParts) {\n residualPolygons.push(new ClipCandidate(outsidePolygon, convexSetIndex + 1));\n }\n } else {\n // Nothing was insidePart. The outside parts might be split by intermediate steps -- but all the pieces are there.\n candidate.nextConvexSetIndex++;\n residualPolygons.push(candidate);\n }\n outsideParts.length = 0;\n }\n }\n if (outsideShards.length === 0) {\n builderA?.addPolygonGrowableXYZArray(visitor.point);\n } else if (insideShards.length === 0) {\n // the facet spanned clippers but is intact outside\n builderB?.addPolygonGrowableXYZArray(visitor.point);\n } else {\n const localToWorld = FrameBuilder.createRightHandedFrame(undefined, visitor.point);\n let worldToLocal: Transform | undefined;\n if (outputSelector === 1 && localToWorld !== undefined\n && undefined !== (worldToLocal = localToWorld.inverse())) {\n this.cleanupAndAddRegion(builderA, insideShards, worldToLocal, localToWorld);\n this.cleanupAndAddRegion(builderB, outsideShards, worldToLocal, localToWorld);\n } else {\n for (const shard of insideShards)\n this.addPolygonToBuilderAndDropToCache(shard, builderA, cache);\n for (const shard of outsideShards)\n this.addPolygonToBuilderAndDropToCache(shard, builderB, cache);\n }\n }\n outsideShards.length = 0;\n insideShards.length = 0;\n }\n cache.dropAllToCache(outsideParts);\n if (destination.buildClosureFaces) {\n for (const clipper of allClippers.convexSets) {\n this.buildClosureFacesForConvexSet(visitor, clipper, destination, cache);\n }\n }\n }\n private static addRegion(builder: PolyfaceBuilder | undefined, region: AnyRegion | undefined) {\n if (builder !== undefined && region !== undefined) {\n if (region instanceof Loop && region.children.length === 1 && region.children[0] instanceof LineString3d) {\n builder.addPolygonGrowableXYZArray(region.children[0].packedPoints);\n } else if (region instanceof UnionRegion) {\n for (const child of region.children)\n this.addRegion(builder, child);\n } else {\n assert(!\"unexpected region encountered\");\n }\n }\n }\n // WARNING: shards are transformed into local system, not reverted!!!\n private static cleanupAndAddRegion(builder: PolyfaceBuilder | undefined, shards: GrowableXYZArray[],\n worldToLocal: Transform | undefined, localToWorld: Transform | undefined) {\n if (builder !== undefined && shards.length > 0) {\n if (worldToLocal)\n GrowableXYZArray.multiplyTransformInPlace(worldToLocal, shards);\n const outsidePieces = RegionOps.polygonBooleanXYToLoops(shards, RegionBinaryOpType.Union, []);\n if (outsidePieces && outsidePieces.children.length > 0) {\n RegionOps.consolidateAdjacentPrimitives(outsidePieces); // source of the T-vertices removed in claimPolyface\n const options = new StrokeOptions();\n options.maximizeConvexFacets = true;\n const localFacets = RegionOps.facetRegionXY(outsidePieces, options);\n if (localFacets) {\n // prefer to add non-convex facets\n builder.addIndexedPolyface(localFacets, false, localToWorld);\n } else { // failsafe; we don't expect to get here\n if (localToWorld)\n outsidePieces.tryTransformInPlace(localToWorld);\n this.addRegion(builder, outsidePieces); // possibly non-convex!\n }\n }\n }\n }\n private static addPolygonToBuilderAndDropToCache(polygon: GrowableXYZArray | undefined, builder: PolyfaceBuilder | undefined, cache: GrowableXYZArrayCache) {\n if (polygon) {\n if (builder)\n builder.addPolygonGrowableXYZArray(polygon);\n cache.dropToCache(polygon);\n }\n }\n private static addPolygonArrayToBuilderAndDropToCache(polygonArray: GrowableXYZArray[], builder: PolyfaceBuilder | undefined, cache: GrowableXYZArrayCache) {\n let polygon;\n while ((polygon = polygonArray.pop()) !== undefined) {\n this.addPolygonToBuilderAndDropToCache(polygon, builder, cache);\n }\n }\n private static createChainContextsForConvexClipPlaneSet(clipper: ConvexClipPlaneSet): ChainMergeContext[] {\n const chainContexts = [];\n for (const plane of clipper.planes) {\n if (!plane.interior) {\n const c = ChainMergeContext.create();\n c.plane = plane;\n c.convexClipper = clipper;\n chainContexts.push(c);\n }\n }\n return chainContexts;\n }\n\n /** Clip each facet of polyface to the the clippers.\n * * Add inside, outside fragments to builderA, builderB\n * * This does not consider params, normals, colors. Just points.\n * @internal\n */\n public static clipPolyfaceConvexClipPlaneSetToBuilders(polyface: Polyface, clipper: ConvexClipPlaneSet, destination: ClippedPolyfaceBuilders) {\n const builderA = destination.builderA;\n const builderB = destination.builderB;\n const visitor = polyface.createVisitor(0);\n const cache = new GrowableXYZArrayCache();\n const outsideParts: GrowableXYZArray[] = [];\n for (visitor.reset(); visitor.moveToNextFacet();) {\n // !!! currentCandidates and next candidates are empty at this point !!!\n const insidePart = clipper.clipInsidePushOutside(visitor.point, outsideParts, cache);\n if (insidePart === undefined) {\n // everything is out ... outsideParts might be fragmented. Save only the original polygon\n builderB?.addPolygonGrowableXYZArray(visitor.point);\n cache.dropToCache(insidePart);\n cache.dropAllToCache(outsideParts);\n }\n this.addPolygonToBuilderAndDropToCache(insidePart, builderA, cache);\n this.addPolygonArrayToBuilderAndDropToCache(outsideParts, builderB, cache);\n }\n this.buildClosureFacesForConvexSet(visitor, clipper, destination, cache);\n }\n /**\n *\n * @param visitor visitor for all facets of interest (entire polyface)\n * @param clipper ConvexClipPlaneSet to apply\n * @param destination builders to receive inside, outside parts\n * @param cache GrowableArray cache.\n */\n private static buildClosureFacesForConvexSet(visitor: PolyfaceVisitor, clipper: ConvexClipPlaneSet, destination: ClippedPolyfaceBuilders,\n cache: GrowableXYZArrayCache) {\n if (destination.buildClosureFaces) {\n const chainContexts = this.createChainContextsForConvexClipPlaneSet(clipper);\n const workPoints = cache.grabFromCache();\n const facetPoints = cache.grabFromCache();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n for (const chainContext of chainContexts) {\n const plane = chainContext.plane;\n facetPoints.clear();\n facetPoints.pushFrom(visitor.point);\n IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(plane!, facetPoints, workPoints);\n chainContext.addSegmentsOnPlane(facetPoints, true);\n }\n }\n cache.dropToCache(facetPoints);\n cache.dropToCache(workPoints);\n for (const chainContext of chainContexts) {\n this.addClosureFacets(chainContext, destination, cache);\n }\n }\n }\n\n /**\n *\n * @param visitor visitor for all facets of interest (entire polyface)\n * @param clipper ConvexClipPlaneSet to apply\n * @param destination builders to receive inside, outside parts\n * @param cache GrowableArray cache.\n */\n private static buildClosureFacesForPlane(visitor: PolyfaceVisitor, plane: PlaneAltitudeEvaluator, destination: ClippedPolyfaceBuilders,\n cache: GrowableXYZArrayCache) {\n if (destination.buildClosureFaces) {\n const chainContext = ChainMergeContext.create();\n chainContext.plane = plane;\n const workPoints = cache.grabFromCache();\n const facetPoints = cache.grabFromCache();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n facetPoints.clear();\n facetPoints.pushFrom(visitor.point);\n IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(plane, facetPoints, workPoints);\n chainContext.addSegmentsOnPlane(facetPoints, true);\n }\n cache.dropToCache(facetPoints);\n cache.dropToCache(workPoints);\n this.addClosureFacets(chainContext, destination, cache);\n }\n }\n private static evaluateInwardPlaneNormal(plane: PlaneAltitudeEvaluator, scale: number): Vector3d {\n return Vector3d.create(plane.velocityXYZ(scale, 0, 0), plane.velocityXYZ(0, scale, 0), plane.velocityXYZ(0, 0, scale));\n }\n /**\n * * Triangulate the contour.\n * * Add all the triangles to both builders\n * * reversed in builderB.\n */\n private static addClippedContour(contour: SweepContour, clipper: ConvexClipPlaneSet | undefined, destination: ClippedPolyfaceBuilders, cache: GrowableXYZArrayCache) {\n const polygonA = cache.grabFromCache();\n const polygonB = cache.grabFromCache();\n if (destination.builderB)\n destination.builderB.toggleReversedFacetFlag();\n contour.announceFacets((facets: IndexedPolyface) => {\n const visitor = facets.createVisitor();\n // The contour facets are convex .. easy clip ..\n for (visitor.reset(); visitor.moveToNextFacet();) {\n polygonA.clear();\n polygonA.pushFromGrowableXYZArray(visitor.point);\n clipper?.clipConvexPolygonInPlace(polygonA, polygonB);\n if (polygonA.length > 2) {\n destination.builderA?.addPolygonGrowableXYZArray(polygonA);\n destination.builderB?.addPolygonGrowableXYZArray(polygonA);\n }\n }\n }, undefined);\n if (destination.builderB)\n destination.builderB.toggleReversedFacetFlag();\n cache.dropToCache(polygonA);\n cache.dropToCache(polygonB);\n }\n\n /**\n * Gather loops out of the ChainMergeContext. Add to destination arrays.\n * @param chainContext ASSUMED TO HAVE A PLANE\n * @param destination\n */\n private static addClosureFacets(chainContext: ChainMergeContext, destination: ClippedPolyfaceBuilders, cache: GrowableXYZArrayCache) {\n const clipper = chainContext.convexClipper;\n const plane = chainContext.plane!;\n const outwardNormal = this.evaluateInwardPlaneNormal(plane, -1.0);\n chainContext.clusterAndMergeVerticesXYZ();\n const loops = chainContext.collectMaximalGrowableXYZArrays();\n if (loops.length > 1) {\n const loopSets = PolygonOps.sortOuterAndHoleLoops(loops, outwardNormal);\n for (const loopSet of loopSets) {\n PolygonOps.orientLoopsCCWForOutwardNormalInPlace(loopSet, outwardNormal);\n const contour = SweepContour.createForPolygon(loopSet, outwardNormal);\n if (contour !== undefined) {\n if (clipper) {\n this.addClippedContour(contour, clipper, destination, cache);\n } else {\n if (destination.builderA)\n contour.emitFacets(destination.builderA, false);\n if (destination.builderB)\n contour.emitFacets(destination.builderB, true);\n }\n }\n }\n } else {\n PolygonOps.orientLoopsCCWForOutwardNormalInPlace(loops, outwardNormal);\n const contour = SweepContour.createForPolygon(loops, outwardNormal);\n if (contour !== undefined) {\n if (clipper) {\n this.addClippedContour(contour, clipper, destination, cache);\n } else {\n if (destination.builderA)\n contour.emitFacets(destination.builderA, false);\n if (destination.builderB)\n contour.emitFacets(destination.builderB, true);\n }\n }\n }\n }\n\n /** Clip each facet of polyface to the the clippers.\n * * Add inside, outside fragments to builderA, builderB\n * * This does not consider params, normals, colors. Just points.\n * @internal\n */\n public static clipPolyfaceClipPlaneToBuilders(polyface: Polyface, clipper: PlaneAltitudeEvaluator, destination: ClippedPolyfaceBuilders) {\n const builderA = destination.builderA;\n const builderB = destination.builderB;\n const visitor = polyface.createVisitor(0);\n const cache = new GrowableXYZArrayCache();\n const inside = cache.grabFromCache();\n const outside = cache.grabFromCache();\n const range = Range1d.createNull();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n // !!! currentCandidates and next candidates are empty at this point !!!\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(clipper, visitor.point, inside, outside, range);\n if (builderA)\n builderA.addPolygonGrowableXYZArray(inside);\n if (builderB)\n builderB.addPolygonGrowableXYZArray(outside);\n }\n this.buildClosureFacesForPlane(visitor, clipper, destination, cache);\n cache.dropToCache(inside);\n cache.dropToCache(outside);\n }\n\n /** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet\n * * accumulate inside and outside facets -- to destination.builderA and destination.builderB\n * * if `destination.buildClosureFaces` is set, and also build closure facets\n * * This method parses the variant input types and calls a more specific method.\n * * WARNING: The new mesh is \"points only\".\n * * outputSelect applies only for UnionOfConvexClipPlaneSets -- see [[PolyfaceClip.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders]]\n */\n public static clipPolyfaceInsideOutside(polyface: Polyface, clipper: ClipPlane | ConvexClipPlaneSet | UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders,\n outputSelect: number = 0) {\n if (clipper instanceof ClipPlane) {\n this.clipPolyfaceClipPlaneToBuilders(polyface, clipper, destination);\n } else if (clipper instanceof ConvexClipPlaneSet) {\n this.clipPolyfaceConvexClipPlaneSetToBuilders(polyface, clipper, destination);\n } else if (clipper instanceof UnionOfConvexClipPlaneSets) {\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface, clipper, destination, outputSelect);\n }\n }\n /** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet\n * * This method parses the variant input types and calls a more specific method.\n * * To get both inside and outside parts, use clipPolyfaceInsideOutside\n * * WARNING: The new mesh is \"points only\".\n */\n public static clipPolyface(polyface: Polyface, clipper: ClipPlane | ConvexClipPlaneSet): Polyface | undefined {\n if (clipper instanceof ClipPlane)\n return this.clipPolyfaceClipPlane(polyface, clipper);\n if (clipper instanceof ConvexClipPlaneSet)\n return this.clipPolyfaceConvexClipPlaneSet(polyface, clipper);\n // (The if tests exhaust the type space -- this line is unreachable.)\n return undefined;\n }\n /**\n * Drape the region onto the mesh.\n * * This method computes the portion of the input mesh that lies inside the clipper generated from sweeping the input region in the given direction.\n * @param mesh input mesh, untouched\n * @param region planar region to drape onto mesh\n * @param sweepVector optional sweep direction for region, magnitude unused. If undefined, sweep is along the region normal.\n * @param options how to stroke the region boundary\n * @returns clipped facets. No other mesh data but vertices appear in output.\n */\n public static drapeRegion(mesh: Polyface | PolyfaceVisitor, region: AnyRegion, sweepVector?: Vector3d, options?: StrokeOptions): IndexedPolyface | undefined {\n if (mesh instanceof Polyface)\n return this.drapeRegion(mesh.createVisitor(0), region, sweepVector, options);\n const contour = SweepContour.createForLinearSweep(region);\n if (!contour)\n return undefined;\n let sweep = sweepVector;\n if (sweepVector && contour.localToWorld.matrix.dotColumnZ(sweepVector) < 0.0)\n sweep = sweepVector.scale(-1); // avoid inverted clipper\n const clipper = contour.sweepToUnionOfConvexClipPlaneSets(sweep, false, false, options);\n if (!clipper)\n return undefined;\n const builders = ClippedPolyfaceBuilders.create(true); // we want only the facets inside the clipper\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(mesh, clipper, builders, 1);\n return builders.claimPolyface(0, true);\n }\n /** Find consecutive points around a polygon (with implied closure edge) that are ON a plane\n * @param points array of points around polygon. Closure edge is implied.\n * @param chainContext context receiving edges\n * @param point0 work point\n * @param point1 work point\n */\n private static collectEdgesOnPlane(points: GrowableXYZArray, clipper: ClipPlane, chainContext: ChainMergeContext, point0: Point3d, point1: Point3d) {\n const n = points.length;\n if (n > 1) {\n points.getPoint3dAtUncheckedPointIndex(n - 1, point0);\n for (let i = 0; i < n; i++) {\n points.getPoint3dAtUncheckedPointIndex(i, point1);\n if (clipper.isPointOn(point0) && clipper.isPointOn(point1))\n chainContext.addSegment(point0, point1);\n point0.setFromPoint3d(point1);\n }\n }\n }\n /** Intersect each facet with the clip plane. (Producing intersection edges.)\n * * Return all edges chained as array of LineString3d.\n */\n public static sectionPolyfaceClipPlane(polyface: Polyface, clipper: ClipPlane): LineString3d[] {\n const chainContext = ChainMergeContext.create();\n\n const visitor = polyface.createVisitor(0);\n const work = new GrowableXYZArray(10);\n const point0 = Point3d.create();\n const point1 = Point3d.create();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n clipper.clipConvexPolygonInPlace(visitor.point, work, true);\n this.collectEdgesOnPlane(visitor.point, clipper, chainContext, point0, point1);\n }\n chainContext.clusterAndMergeVerticesXYZ();\n return chainContext.collectMaximalChains();\n }\n\n /**\n * * Split facets of mesh \"A\" into parts that are\n * * under mesh \"B\"\n * * over mesh \"B\"\n * * both meshes are represented by visitors rather than the meshes themselves\n * * If the data in-hand is a mesh, call with `mesh.createVisitor`\n * * The respective clip parts are fed to caller-supplied builders.\n * * Caller may set either or both builders to toggle facet order (e.g. toggle the lower facets to make them \"point down\" in cut-fill application)\n * * This step is commonly one-half of \"cut fill\".\n * * A \"cut fill\" wrapper will call this twice with the visitor and builder roles reversed.\n * * Both polyfaces are assumed convex with CCW orientation viewed from above.\n * @param visitorA iterator over polyface to be split.\n * @param visitorB iterator over polyface that acts as a splitter\n * @param orientUnderMeshDownward if true, the \"meshAUnderB\" output is oriented with its normals reversed so it can act as the bottom side of a cut-fill pair.\n */\n public static clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorA: PolyfaceVisitor, visitorB: PolyfaceVisitor,\n builderAUnderB: PolyfaceBuilder | undefined,\n builderAOverB: PolyfaceBuilder | undefined) {\n const rangeDataA = PolyfaceQuery.collectRangeLengthData(visitorA);\n const searchA = RangeSearch.create2dSearcherForRangeLengthData<number>(rangeDataA);\n if (!searchA)\n return;\n const range = Range3d.create();\n for (visitorA.reset(); visitorA.moveToNextFacet();) {\n visitorA.point.setRange(range);\n searchA.addRange(range, visitorA.currentReadIndex());\n }\n const xyClip = new GrowableXYZArray(10);\n const workArray = new GrowableXYZArray(10);\n const xyFrustum = ConvexClipPlaneSet.createEmpty();\n const below = new GrowableXYZArray(10);\n const above = new GrowableXYZArray(10);\n const planeOfFacet = ClipPlane.createNormalAndPointXYZXYZ(0, 0, 1, 0, 0, 0)!;\n const altitudeRange = Range1d.createNull();\n\n for (visitorB.reset(); visitorB.moveToNextFacet();) {\n visitorB.point.setRange(range);\n ConvexClipPlaneSet.setPlaneAndXYLoopCCW(visitorB.point, planeOfFacet, xyFrustum);\n searchA.searchRange2d(range, (_rangeA: Range2d, readIndexA: number) => {\n visitorA.moveToReadIndex(readIndexA);\n xyFrustum.polygonClip(visitorA.point, xyClip, workArray);\n // builderAOverB.addPolygonGrowableXYZArray(xyClip);\n if (xyClip.length > 0) {\n // planeOfFacet.convexPolygonSplitInsideOutsideGrowableArrays(xyClip, below, above, altitudeRange);\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(planeOfFacet, xyClip, below, above, altitudeRange);\n if (below.length > 0 && builderAUnderB)\n builderAUnderB.addPolygonGrowableXYZArray(below);\n if (above.length > 0 && builderAOverB)\n builderAOverB.addPolygonGrowableXYZArray(above);\n }\n return true;\n });\n }\n }\n\n /**\n * * Split facets into vertically overlapping sections\n * * both meshes are represented by visitors rather than the meshes themselves\n * * If the data in-hand is a mesh, call with `mesh.createVisitor`\n * * The respective clip parts are returned as separate meshes.\n * * Caller may set either or both builders to toggle facet order (e.g. toggle the lower facets to make them \"point down\" in cut-fill application)\n * * Both polyfaces are assumed convex with CCW orientation viewed from above.\n * * Each output contains some facets from meshA and some from meshB:\n * * meshAUnderB -- areas where meshA is underneath mesh B.\n * * If A is \"design surface\" and B is existing DTM, this is \"cut\" volume\n * * meshAOverB -- areas where meshB is over meshB.\n * * If A is \"design surface\" and B is existing DTM, this is \"fill\" volume\n *\n * @param visitorA iterator over polyface to be split.\n * @param visitorB iterator over polyface that acts as a splitter\n * @param orientUnderMeshDownward if true, the \"meshAUnderB\" output is oriented with its normals reversed so it can act as the bottom side of a cut-fill pair.\n */\n public static computeCutFill(meshA: IndexedPolyface, meshB: IndexedPolyface): { meshAUnderB: IndexedPolyface, meshAOverB: IndexedPolyface } {\n const visitorA = meshA.createVisitor();\n const visitorB = meshB.createVisitor();\n const builderAUnderB = PolyfaceBuilder.create();\n const builderAOverB = PolyfaceBuilder.create();\n builderAUnderB.toggleReversedFacetFlag();\n this.clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorA, visitorB, builderAUnderB, builderAOverB);\n builderAUnderB.toggleReversedFacetFlag();\n builderAOverB.toggleReversedFacetFlag();\n this.clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorB, visitorA, builderAOverB, builderAUnderB);\n return {\n meshAUnderB: builderAUnderB.claimPolyface(),\n meshAOverB: builderAOverB.claimPolyface(),\n };\n }\n}\n"]}
1
+ {"version":3,"file":"PolyfaceClip.js","sourceRoot":"","sources":["../../../src/polyface/PolyfaceClip.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,mEAAmE;AACnE,sDAA6C;AAC7C,qDAAkD;AAClD,uEAAoE;AACpE,uFAAoF;AAEpF,wDAAqD;AACrD,wCAAqC;AACrC,kDAAmE;AACnE,0DAAuD;AACvD,sDAAmD;AAC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;wBACpC,cAAc,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;oBACnD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa;wBACnC,aAAa,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;gBACpD,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACI,MAAM,CAAC,cAAc,CAAC,KAAsB,EAAE,KAAsB;QACzE,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QACvC,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QACvC,MAAM,cAAc,GAAG,iCAAe,CAAC,MAAM,EAAE,CAAC;QAChD,MAAM,aAAa,GAAG,iCAAe,CAAC,MAAM,EAAE,CAAC;QAC/C,cAAc,CAAC,uBAAuB,EAAE,CAAC;QACzC,IAAI,CAAC,+CAA+C,CAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;QACxG,cAAc,CAAC,uBAAuB,EAAE,CAAC;QACzC,aAAa,CAAC,uBAAuB,EAAE,CAAC;QACxC,IAAI,CAAC,+CAA+C,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;QACxG,OAAO;YACL,WAAW,EAAE,cAAc,CAAC,aAAa,EAAE;YAC3C,UAAU,EAAE,aAAa,CAAC,aAAa,EAAE;SAC1C,CAAC;IACJ,CAAC;CACF;AArhBD,oCAqhBC","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 Polyface\n */\n\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\nimport { assert } from \"@itwin/core-bentley\";\nimport { ClipPlane } from \"../clipping/ClipPlane\";\nimport { ConvexClipPlaneSet } from \"../clipping/ConvexClipPlaneSet\";\nimport { UnionOfConvexClipPlaneSets } from \"../clipping/UnionOfConvexClipPlaneSets\";\nimport { AnyRegion } from \"../curve/CurveTypes\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { RegionBinaryOpType, RegionOps } from \"../curve/RegionOps\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { UnionRegion } from \"../curve/UnionRegion\";\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\nimport { FrameBuilder } from \"../geometry3d/FrameBuilder\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { IndexedXYZCollectionPolygonOps, PolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range1d, Range2d, Range3d } from \"../geometry3d/Range\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SweepContour } from \"../solid/SweepContour\";\nimport { ChainMergeContext } from \"../topology/ChainMerge\";\nimport { RangeSearch } from \"./multiclip/RangeSearch\";\nimport { IndexedPolyface, Polyface, PolyfaceVisitor } from \"./Polyface\";\nimport { PolyfaceBuilder } from \"./PolyfaceBuilder\";\nimport { PolyfaceQuery } from \"./PolyfaceQuery\";\n\n/**\n * carrier for a point array with an index into UnionOfConvexClipPlaneSets\n * @private\n */\nclass ClipCandidate {\n public nextConvexSetIndex: number;\n public points: GrowableXYZArray;\n public constructor(points: GrowableXYZArray, nextConvexSetIndex: number) {\n this.nextConvexSetIndex = nextConvexSetIndex;\n this.points = points;\n }\n}\n\n/**\n * A pair of [[PolyfaceBuilder]] objects, for use by clippers that emit inside and outside parts.\n * * @public\n */\nexport class ClippedPolyfaceBuilders {\n /** An available builder. Typically the \"inside\" parts */\n public builderA?: PolyfaceBuilder;\n /** An available builder. Typically the \"outside\" parts */\n public builderB?: PolyfaceBuilder;\n /** request to construct cut faces */\n public buildClosureFaces?: boolean;\n private constructor(builderA: PolyfaceBuilder | undefined, builderB: PolyfaceBuilder | undefined, buildClosureFaces: boolean = false) {\n this.builderA = builderA;\n this.builderB = builderB;\n this.buildClosureFaces = buildClosureFaces;\n }\n /**\n * Static constructor with default options for the builders.\n * @param keepInside whether to collect clipped facets inside the clipper to `this.builderA` (default true)\n * @param keepOutside whether to collect clipped facets outside the clipper to `this.builderB` (default false)\n * @param buildSideFaces whether to add side facets to active builders (default false)\n */\n public static create(keepInside: boolean = true, keepOutside: boolean = false, buildSideFaces: boolean = false) {\n return new ClippedPolyfaceBuilders(keepInside ? PolyfaceBuilder.create() : undefined, keepOutside ? PolyfaceBuilder.create() : undefined, buildSideFaces);\n }\n\n /**\n * Return the computed facets from the selected builder.\n * @param selector the polyface to return: 0 - builderA (typically inside facets), 1 - builderB (typically outside facets)\n * @param fixup whether to clean up the polyface\n * @param tolerance compression tolerance (default [[Geometry.smallMetricDistance]]).\n */\n public claimPolyface(selector: 0 | 1, fixup: boolean, tolerance: number = Geometry.smallMetricDistance): IndexedPolyface | undefined {\n const builder = selector === 0 ? this.builderA : this.builderB;\n if (builder) {\n let polyface = builder.claimPolyface(true, tolerance);\n if (fixup) {\n polyface = PolyfaceQuery.cloneWithTVertexFixup(polyface);\n polyface = PolyfaceQuery.cloneWithDanglingEdgesRemoved(polyface);\n }\n return polyface;\n }\n return undefined;\n }\n}\n/** PolyfaceClip is a static class gathering operations using Polyfaces and clippers.\n * @public\n */\nexport class PolyfaceClip {\n /** Clip each facet of polyface to the ClipPlane.\n * * Return all surviving clip as a new mesh.\n * * WARNING: The new mesh is \"points only\" -- parameters, normals, etc are not interpolated\n */\n public static clipPolyfaceClipPlaneWithClosureFace(polyface: Polyface, clipper: ClipPlane, insideClip: boolean = true, buildClosureFaces: boolean = true): IndexedPolyface {\n return this.clipPolyfaceClipPlane(polyface, clipper, insideClip, buildClosureFaces);\n }\n /** Clip each facet of polyface to the ClipPlane.\n * * Return all surviving clip as a new mesh.\n * * WARNING: The new mesh is \"points only\" -- parameters, normals, etc are not interpolated\n */\n public static clipPolyfaceClipPlane(polyface: Polyface, clipper: ClipPlane, insideClip: boolean = true, buildClosureFaces: boolean = false): IndexedPolyface {\n const builders = ClippedPolyfaceBuilders.create(insideClip, !insideClip, buildClosureFaces);\n this.clipPolyfaceInsideOutside(polyface, clipper, builders);\n return builders.claimPolyface(insideClip ? 0 : 1, true)!;\n }\n\n /** Clip each facet of polyface to the ClipPlane.\n * * Return surviving clip as a new mesh.\n * * WARNING: The new mesh is \"points only\".\n */\n public static clipPolyfaceConvexClipPlaneSet(polyface: Polyface, clipper: ConvexClipPlaneSet): IndexedPolyface {\n const visitor = polyface.createVisitor(0);\n const builder = PolyfaceBuilder.create();\n const work = new GrowableXYZArray(10);\n for (visitor.reset(); visitor.moveToNextFacet();) {\n clipper.clipConvexPolygonInPlace(visitor.point, work);\n if (visitor.point.length > 2)\n builder.addPolygonGrowableXYZArray(visitor.point);\n }\n return builder.claimPolyface(true);\n }\n\n /** Clip each facet of polyface to the the clippers.\n * * Add inside, outside fragments to builderA, builderB\n * * This does not consider params, normals, colors. Just points.\n * * outputSelect determines how the clip output is structured\n * * 0 outputs all shards -- this may have many interior edges.\n * * 1 stitches shards together to get cleaner facets.\n */\n public static clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface: Polyface | PolyfaceVisitor, allClippers: UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders, outputSelector: number = 1) {\n if (polyface instanceof Polyface) {\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface.createVisitor(0), allClippers, destination, outputSelector);\n return;\n }\n const builderA = destination.builderA;\n const builderB = destination.builderB;\n const visitor = polyface; // alias; we have a visitor now\n const cache = new GrowableXYZArrayCache();\n const insideShards: GrowableXYZArray[] = [];\n const outsideShards: GrowableXYZArray[] = [];\n const residualPolygons: ClipCandidate[] = [];\n let candidate: ClipCandidate | undefined;\n const outsideParts: GrowableXYZArray[] = [];\n\n const numConvexSet = allClippers.convexSets.length;\n for (visitor.reset(); visitor.moveToNextFacet();) {\n residualPolygons.push(new ClipCandidate(cache.grabAndFill(visitor.point), 0));\n while ((candidate = residualPolygons.pop()) !== undefined) {\n const convexSetIndex = candidate.nextConvexSetIndex;\n if (convexSetIndex >= numConvexSet) {\n // ths remnant polygon is OUT ...\n if (candidate.points.length > 2)\n outsideShards.push(candidate.points);\n } else {\n const clipper = allClippers.convexSets[convexSetIndex];\n outsideParts.length = 0; // NO NO -- why isn't it empty from prior step cleanup?\n const insidePart = clipper.clipInsidePushOutside(candidate.points, outsideParts, cache);\n if (insidePart) {\n if (insidePart.length > 2)\n insideShards.push(insidePart);\n // Keep outside parts active for clip by later facets . . .\n for (const outsidePolygon of outsideParts) {\n residualPolygons.push(new ClipCandidate(outsidePolygon, convexSetIndex + 1));\n }\n } else {\n // Nothing was insidePart. The outside parts might be split by intermediate steps -- but all the pieces are there.\n candidate.nextConvexSetIndex++;\n residualPolygons.push(candidate);\n }\n outsideParts.length = 0;\n }\n }\n if (outsideShards.length === 0) {\n builderA?.addPolygonGrowableXYZArray(visitor.point);\n } else if (insideShards.length === 0) {\n // the facet spanned clippers but is intact outside\n builderB?.addPolygonGrowableXYZArray(visitor.point);\n } else {\n const localToWorld = FrameBuilder.createRightHandedFrame(undefined, visitor.point);\n let worldToLocal: Transform | undefined;\n if (outputSelector === 1 && localToWorld !== undefined\n && undefined !== (worldToLocal = localToWorld.inverse())) {\n this.cleanupAndAddRegion(builderA, insideShards, worldToLocal, localToWorld);\n this.cleanupAndAddRegion(builderB, outsideShards, worldToLocal, localToWorld);\n } else {\n for (const shard of insideShards)\n this.addPolygonToBuilderAndDropToCache(shard, builderA, cache);\n for (const shard of outsideShards)\n this.addPolygonToBuilderAndDropToCache(shard, builderB, cache);\n }\n }\n outsideShards.length = 0;\n insideShards.length = 0;\n }\n cache.dropAllToCache(outsideParts);\n if (destination.buildClosureFaces) {\n for (const clipper of allClippers.convexSets) {\n this.buildClosureFacesForConvexSet(visitor, clipper, destination, cache);\n }\n }\n }\n private static addRegion(builder: PolyfaceBuilder | undefined, region: AnyRegion | undefined) {\n if (builder !== undefined && region !== undefined) {\n if (region instanceof Loop && region.children.length === 1 && region.children[0] instanceof LineString3d) {\n builder.addPolygonGrowableXYZArray(region.children[0].packedPoints);\n } else if (region instanceof UnionRegion) {\n for (const child of region.children)\n this.addRegion(builder, child);\n } else {\n assert(false, \"unexpected region encountered\");\n }\n }\n }\n // WARNING: shards are transformed into local system, not reverted!!!\n private static cleanupAndAddRegion(builder: PolyfaceBuilder | undefined, shards: GrowableXYZArray[],\n worldToLocal: Transform | undefined, localToWorld: Transform | undefined) {\n if (builder !== undefined && shards.length > 0) {\n if (worldToLocal)\n GrowableXYZArray.multiplyTransformInPlace(worldToLocal, shards);\n const outsidePieces = RegionOps.polygonBooleanXYToLoops(shards, RegionBinaryOpType.Union, []);\n if (outsidePieces && outsidePieces.children.length > 0) {\n RegionOps.consolidateAdjacentPrimitives(outsidePieces); // source of the T-vertices removed in claimPolyface\n const options = new StrokeOptions();\n options.maximizeConvexFacets = true;\n const localFacets = RegionOps.facetRegionXY(outsidePieces, options);\n if (localFacets) {\n // prefer to add non-convex facets\n builder.addIndexedPolyface(localFacets, false, localToWorld);\n } else { // failsafe; we don't expect to get here\n if (localToWorld)\n outsidePieces.tryTransformInPlace(localToWorld);\n this.addRegion(builder, outsidePieces); // possibly non-convex!\n }\n }\n }\n }\n private static addPolygonToBuilderAndDropToCache(polygon: GrowableXYZArray | undefined, builder: PolyfaceBuilder | undefined, cache: GrowableXYZArrayCache) {\n if (polygon) {\n if (builder)\n builder.addPolygonGrowableXYZArray(polygon);\n cache.dropToCache(polygon);\n }\n }\n private static addPolygonArrayToBuilderAndDropToCache(polygonArray: GrowableXYZArray[], builder: PolyfaceBuilder | undefined, cache: GrowableXYZArrayCache) {\n let polygon;\n while ((polygon = polygonArray.pop()) !== undefined) {\n this.addPolygonToBuilderAndDropToCache(polygon, builder, cache);\n }\n }\n private static createChainContextsForConvexClipPlaneSet(clipper: ConvexClipPlaneSet): ChainMergeContext[] {\n const chainContexts = [];\n for (const plane of clipper.planes) {\n if (!plane.interior) {\n const c = ChainMergeContext.create();\n c.plane = plane;\n c.convexClipper = clipper;\n chainContexts.push(c);\n }\n }\n return chainContexts;\n }\n\n /** Clip each facet of polyface to the the clippers.\n * * Add inside, outside fragments to builderA, builderB\n * * This does not consider params, normals, colors. Just points.\n * @internal\n */\n public static clipPolyfaceConvexClipPlaneSetToBuilders(polyface: Polyface, clipper: ConvexClipPlaneSet, destination: ClippedPolyfaceBuilders) {\n const builderA = destination.builderA;\n const builderB = destination.builderB;\n const visitor = polyface.createVisitor(0);\n const cache = new GrowableXYZArrayCache();\n const outsideParts: GrowableXYZArray[] = [];\n for (visitor.reset(); visitor.moveToNextFacet();) {\n // !!! currentCandidates and next candidates are empty at this point !!!\n const insidePart = clipper.clipInsidePushOutside(visitor.point, outsideParts, cache);\n if (insidePart === undefined) {\n // everything is out ... outsideParts might be fragmented. Save only the original polygon\n builderB?.addPolygonGrowableXYZArray(visitor.point);\n cache.dropToCache(insidePart);\n cache.dropAllToCache(outsideParts);\n }\n this.addPolygonToBuilderAndDropToCache(insidePart, builderA, cache);\n this.addPolygonArrayToBuilderAndDropToCache(outsideParts, builderB, cache);\n }\n this.buildClosureFacesForConvexSet(visitor, clipper, destination, cache);\n }\n /**\n *\n * @param visitor visitor for all facets of interest (entire polyface)\n * @param clipper ConvexClipPlaneSet to apply\n * @param destination builders to receive inside, outside parts\n * @param cache GrowableArray cache.\n */\n private static buildClosureFacesForConvexSet(visitor: PolyfaceVisitor, clipper: ConvexClipPlaneSet, destination: ClippedPolyfaceBuilders,\n cache: GrowableXYZArrayCache) {\n if (destination.buildClosureFaces) {\n const chainContexts = this.createChainContextsForConvexClipPlaneSet(clipper);\n const workPoints = cache.grabFromCache();\n const facetPoints = cache.grabFromCache();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n for (const chainContext of chainContexts) {\n const plane = chainContext.plane;\n facetPoints.clear();\n facetPoints.pushFrom(visitor.point);\n IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(plane!, facetPoints, workPoints);\n chainContext.addSegmentsOnPlane(facetPoints, true);\n }\n }\n cache.dropToCache(facetPoints);\n cache.dropToCache(workPoints);\n for (const chainContext of chainContexts) {\n this.addClosureFacets(chainContext, destination, cache);\n }\n }\n }\n\n /**\n *\n * @param visitor visitor for all facets of interest (entire polyface)\n * @param clipper ConvexClipPlaneSet to apply\n * @param destination builders to receive inside, outside parts\n * @param cache GrowableArray cache.\n */\n private static buildClosureFacesForPlane(visitor: PolyfaceVisitor, plane: PlaneAltitudeEvaluator, destination: ClippedPolyfaceBuilders,\n cache: GrowableXYZArrayCache) {\n if (destination.buildClosureFaces) {\n const chainContext = ChainMergeContext.create();\n chainContext.plane = plane;\n const workPoints = cache.grabFromCache();\n const facetPoints = cache.grabFromCache();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n facetPoints.clear();\n facetPoints.pushFrom(visitor.point);\n IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(plane, facetPoints, workPoints);\n chainContext.addSegmentsOnPlane(facetPoints, true);\n }\n cache.dropToCache(facetPoints);\n cache.dropToCache(workPoints);\n this.addClosureFacets(chainContext, destination, cache);\n }\n }\n private static evaluateInwardPlaneNormal(plane: PlaneAltitudeEvaluator, scale: number): Vector3d {\n return Vector3d.create(plane.velocityXYZ(scale, 0, 0), plane.velocityXYZ(0, scale, 0), plane.velocityXYZ(0, 0, scale));\n }\n /**\n * * Triangulate the contour.\n * * Add all the triangles to both builders\n * * reversed in builderB.\n */\n private static addClippedContour(contour: SweepContour, clipper: ConvexClipPlaneSet | undefined, destination: ClippedPolyfaceBuilders, cache: GrowableXYZArrayCache) {\n const polygonA = cache.grabFromCache();\n const polygonB = cache.grabFromCache();\n if (destination.builderB)\n destination.builderB.toggleReversedFacetFlag();\n contour.announceFacets((facets: IndexedPolyface) => {\n const visitor = facets.createVisitor();\n // The contour facets are convex .. easy clip ..\n for (visitor.reset(); visitor.moveToNextFacet();) {\n polygonA.clear();\n polygonA.pushFromGrowableXYZArray(visitor.point);\n clipper?.clipConvexPolygonInPlace(polygonA, polygonB);\n if (polygonA.length > 2) {\n destination.builderA?.addPolygonGrowableXYZArray(polygonA);\n destination.builderB?.addPolygonGrowableXYZArray(polygonA);\n }\n }\n }, undefined);\n if (destination.builderB)\n destination.builderB.toggleReversedFacetFlag();\n cache.dropToCache(polygonA);\n cache.dropToCache(polygonB);\n }\n\n /**\n * Gather loops out of the ChainMergeContext. Add to destination arrays.\n * @param chainContext ASSUMED TO HAVE A PLANE\n * @param destination\n */\n private static addClosureFacets(chainContext: ChainMergeContext, destination: ClippedPolyfaceBuilders, cache: GrowableXYZArrayCache) {\n const clipper = chainContext.convexClipper;\n const plane = chainContext.plane!;\n const outwardNormal = this.evaluateInwardPlaneNormal(plane, -1.0);\n chainContext.clusterAndMergeVerticesXYZ();\n const loops = chainContext.collectMaximalGrowableXYZArrays();\n if (loops.length > 1) {\n const loopSets = PolygonOps.sortOuterAndHoleLoops(loops, outwardNormal);\n for (const loopSet of loopSets) {\n PolygonOps.orientLoopsCCWForOutwardNormalInPlace(loopSet, outwardNormal);\n const contour = SweepContour.createForPolygon(loopSet, outwardNormal);\n if (contour !== undefined) {\n if (clipper) {\n this.addClippedContour(contour, clipper, destination, cache);\n } else {\n if (destination.builderA)\n contour.emitFacets(destination.builderA, false);\n if (destination.builderB)\n contour.emitFacets(destination.builderB, true);\n }\n }\n }\n } else {\n PolygonOps.orientLoopsCCWForOutwardNormalInPlace(loops, outwardNormal);\n const contour = SweepContour.createForPolygon(loops, outwardNormal);\n if (contour !== undefined) {\n if (clipper) {\n this.addClippedContour(contour, clipper, destination, cache);\n } else {\n if (destination.builderA)\n contour.emitFacets(destination.builderA, false);\n if (destination.builderB)\n contour.emitFacets(destination.builderB, true);\n }\n }\n }\n }\n\n /** Clip each facet of polyface to the the clippers.\n * * Add inside, outside fragments to builderA, builderB\n * * This does not consider params, normals, colors. Just points.\n * @internal\n */\n public static clipPolyfaceClipPlaneToBuilders(polyface: Polyface, clipper: PlaneAltitudeEvaluator, destination: ClippedPolyfaceBuilders) {\n const builderA = destination.builderA;\n const builderB = destination.builderB;\n const visitor = polyface.createVisitor(0);\n const cache = new GrowableXYZArrayCache();\n const inside = cache.grabFromCache();\n const outside = cache.grabFromCache();\n const range = Range1d.createNull();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n // !!! currentCandidates and next candidates are empty at this point !!!\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(clipper, visitor.point, inside, outside, range);\n if (builderA)\n builderA.addPolygonGrowableXYZArray(inside);\n if (builderB)\n builderB.addPolygonGrowableXYZArray(outside);\n }\n this.buildClosureFacesForPlane(visitor, clipper, destination, cache);\n cache.dropToCache(inside);\n cache.dropToCache(outside);\n }\n\n /** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet\n * * accumulate inside and outside facets -- to destination.builderA and destination.builderB\n * * if `destination.buildClosureFaces` is set, and also build closure facets\n * * This method parses the variant input types and calls a more specific method.\n * * WARNING: The new mesh is \"points only\".\n * * outputSelect applies only for UnionOfConvexClipPlaneSets -- see [[PolyfaceClip.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders]]\n */\n public static clipPolyfaceInsideOutside(polyface: Polyface, clipper: ClipPlane | ConvexClipPlaneSet | UnionOfConvexClipPlaneSets, destination: ClippedPolyfaceBuilders,\n outputSelect: number = 0) {\n if (clipper instanceof ClipPlane) {\n this.clipPolyfaceClipPlaneToBuilders(polyface, clipper, destination);\n } else if (clipper instanceof ConvexClipPlaneSet) {\n this.clipPolyfaceConvexClipPlaneSetToBuilders(polyface, clipper, destination);\n } else if (clipper instanceof UnionOfConvexClipPlaneSets) {\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(polyface, clipper, destination, outputSelect);\n }\n }\n /** Clip each facet of polyface to the ClipPlane or ConvexClipPlaneSet\n * * This method parses the variant input types and calls a more specific method.\n * * To get both inside and outside parts, use clipPolyfaceInsideOutside\n * * WARNING: The new mesh is \"points only\".\n */\n public static clipPolyface(polyface: Polyface, clipper: ClipPlane | ConvexClipPlaneSet): Polyface | undefined {\n if (clipper instanceof ClipPlane)\n return this.clipPolyfaceClipPlane(polyface, clipper);\n if (clipper instanceof ConvexClipPlaneSet)\n return this.clipPolyfaceConvexClipPlaneSet(polyface, clipper);\n // (The if tests exhaust the type space -- this line is unreachable.)\n return undefined;\n }\n /**\n * Drape the region onto the mesh.\n * * This method computes the portion of the input mesh that lies inside the clipper generated from sweeping the input region in the given direction.\n * @param mesh input mesh, untouched\n * @param region planar region to drape onto mesh\n * @param sweepVector optional sweep direction for region, magnitude unused. If undefined, sweep is along the region normal.\n * @param options how to stroke the region boundary\n * @returns clipped facets. No other mesh data but vertices appear in output.\n */\n public static drapeRegion(mesh: Polyface | PolyfaceVisitor, region: AnyRegion, sweepVector?: Vector3d, options?: StrokeOptions): IndexedPolyface | undefined {\n if (mesh instanceof Polyface)\n return this.drapeRegion(mesh.createVisitor(0), region, sweepVector, options);\n const contour = SweepContour.createForLinearSweep(region);\n if (!contour)\n return undefined;\n let sweep = sweepVector;\n if (sweepVector && contour.localToWorld.matrix.dotColumnZ(sweepVector) < 0.0)\n sweep = sweepVector.scale(-1); // avoid inverted clipper\n const clipper = contour.sweepToUnionOfConvexClipPlaneSets(sweep, false, false, options);\n if (!clipper)\n return undefined;\n const builders = ClippedPolyfaceBuilders.create(true); // we want only the facets inside the clipper\n this.clipPolyfaceUnionOfConvexClipPlaneSetsToBuilders(mesh, clipper, builders, 1);\n return builders.claimPolyface(0, true);\n }\n /** Find consecutive points around a polygon (with implied closure edge) that are ON a plane\n * @param points array of points around polygon. Closure edge is implied.\n * @param chainContext context receiving edges\n * @param point0 work point\n * @param point1 work point\n */\n private static collectEdgesOnPlane(points: GrowableXYZArray, clipper: ClipPlane, chainContext: ChainMergeContext, point0: Point3d, point1: Point3d) {\n const n = points.length;\n if (n > 1) {\n points.getPoint3dAtUncheckedPointIndex(n - 1, point0);\n for (let i = 0; i < n; i++) {\n points.getPoint3dAtUncheckedPointIndex(i, point1);\n if (clipper.isPointOn(point0) && clipper.isPointOn(point1))\n chainContext.addSegment(point0, point1);\n point0.setFromPoint3d(point1);\n }\n }\n }\n /** Intersect each facet with the clip plane. (Producing intersection edges.)\n * * Return all edges chained as array of LineString3d.\n */\n public static sectionPolyfaceClipPlane(polyface: Polyface, clipper: ClipPlane): LineString3d[] {\n const chainContext = ChainMergeContext.create();\n\n const visitor = polyface.createVisitor(0);\n const work = new GrowableXYZArray(10);\n const point0 = Point3d.create();\n const point1 = Point3d.create();\n for (visitor.reset(); visitor.moveToNextFacet();) {\n clipper.clipConvexPolygonInPlace(visitor.point, work, true);\n this.collectEdgesOnPlane(visitor.point, clipper, chainContext, point0, point1);\n }\n chainContext.clusterAndMergeVerticesXYZ();\n return chainContext.collectMaximalChains();\n }\n\n /**\n * * Split facets of mesh \"A\" into parts that are\n * * under mesh \"B\"\n * * over mesh \"B\"\n * * both meshes are represented by visitors rather than the meshes themselves\n * * If the data in-hand is a mesh, call with `mesh.createVisitor`\n * * The respective clip parts are fed to caller-supplied builders.\n * * Caller may set either or both builders to toggle facet order (e.g. toggle the lower facets to make them \"point down\" in cut-fill application)\n * * This step is commonly one-half of \"cut fill\".\n * * A \"cut fill\" wrapper will call this twice with the visitor and builder roles reversed.\n * * Both polyfaces are assumed convex with CCW orientation viewed from above.\n * @param visitorA iterator over polyface to be split.\n * @param visitorB iterator over polyface that acts as a splitter\n * @param orientUnderMeshDownward if true, the \"meshAUnderB\" output is oriented with its normals reversed so it can act as the bottom side of a cut-fill pair.\n */\n public static clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorA: PolyfaceVisitor, visitorB: PolyfaceVisitor,\n builderAUnderB: PolyfaceBuilder | undefined,\n builderAOverB: PolyfaceBuilder | undefined) {\n const rangeDataA = PolyfaceQuery.collectRangeLengthData(visitorA);\n const searchA = RangeSearch.create2dSearcherForRangeLengthData<number>(rangeDataA);\n if (!searchA)\n return;\n const range = Range3d.create();\n for (visitorA.reset(); visitorA.moveToNextFacet();) {\n visitorA.point.setRange(range);\n searchA.addRange(range, visitorA.currentReadIndex());\n }\n const xyClip = new GrowableXYZArray(10);\n const workArray = new GrowableXYZArray(10);\n const xyFrustum = ConvexClipPlaneSet.createEmpty();\n const below = new GrowableXYZArray(10);\n const above = new GrowableXYZArray(10);\n const planeOfFacet = ClipPlane.createNormalAndPointXYZXYZ(0, 0, 1, 0, 0, 0)!;\n const altitudeRange = Range1d.createNull();\n\n for (visitorB.reset(); visitorB.moveToNextFacet();) {\n visitorB.point.setRange(range);\n ConvexClipPlaneSet.setPlaneAndXYLoopCCW(visitorB.point, planeOfFacet, xyFrustum);\n searchA.searchRange2d(range, (_rangeA: Range2d, readIndexA: number) => {\n visitorA.moveToReadIndex(readIndexA);\n xyFrustum.polygonClip(visitorA.point, xyClip, workArray);\n // builderAOverB.addPolygonGrowableXYZArray(xyClip);\n if (xyClip.length > 0) {\n // planeOfFacet.convexPolygonSplitInsideOutsideGrowableArrays(xyClip, below, above, altitudeRange);\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(planeOfFacet, xyClip, below, above, altitudeRange);\n if (below.length > 0 && builderAUnderB)\n builderAUnderB.addPolygonGrowableXYZArray(below);\n if (above.length > 0 && builderAOverB)\n builderAOverB.addPolygonGrowableXYZArray(above);\n }\n return true;\n });\n }\n }\n\n /**\n * * Split facets into vertically overlapping sections\n * * both meshes are represented by visitors rather than the meshes themselves\n * * If the data in-hand is a mesh, call with `mesh.createVisitor`\n * * The respective clip parts are returned as separate meshes.\n * * Caller may set either or both builders to toggle facet order (e.g. toggle the lower facets to make them \"point down\" in cut-fill application)\n * * Both polyfaces are assumed convex with CCW orientation viewed from above.\n * * Each output contains some facets from meshA and some from meshB:\n * * meshAUnderB -- areas where meshA is underneath mesh B.\n * * If A is \"design surface\" and B is existing DTM, this is \"cut\" volume\n * * meshAOverB -- areas where meshB is over meshB.\n * * If A is \"design surface\" and B is existing DTM, this is \"fill\" volume\n *\n * @param visitorA iterator over polyface to be split.\n * @param visitorB iterator over polyface that acts as a splitter\n * @param orientUnderMeshDownward if true, the \"meshAUnderB\" output is oriented with its normals reversed so it can act as the bottom side of a cut-fill pair.\n */\n public static computeCutFill(meshA: IndexedPolyface, meshB: IndexedPolyface): { meshAUnderB: IndexedPolyface, meshAOverB: IndexedPolyface } {\n const visitorA = meshA.createVisitor();\n const visitorB = meshB.createVisitor();\n const builderAUnderB = PolyfaceBuilder.create();\n const builderAOverB = PolyfaceBuilder.create();\n builderAUnderB.toggleReversedFacetFlag();\n this.clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorA, visitorB, builderAUnderB, builderAOverB);\n builderAUnderB.toggleReversedFacetFlag();\n builderAOverB.toggleReversedFacetFlag();\n this.clipPolyfaceUnderOverConvexPolyfaceIntoBuilders(visitorB, visitorA, builderAOverB, builderAUnderB);\n return {\n meshAUnderB: builderAUnderB.claimPolyface(),\n meshAOverB: builderAOverB.claimPolyface(),\n };\n }\n}\n"]}
@@ -245,21 +245,32 @@ export declare class Arc3d extends CurvePrimitive implements BeJSONFunctions {
245
245
  static create(center: Point3d | undefined, vector0: Vector3d, vector90: Vector3d, sweep?: AngleSweep, result?: Arc3d): Arc3d;
246
246
  /**
247
247
  * Create an elliptical arc from three points on the ellipse: two points on an axis and one in between.
248
- * @param point0 start of arc, on an axis
249
- * @param point1 point on arc somewhere between `point0` and `point2`
250
- * @param point2 point on arc directly opposite `point0`
251
- * @param sweep angular sweep, measured from `point0` in the direction of `point1`.
252
- * For a half-ellipse from `point0` to `point2` passing through `point1`, pass `AngleSweep.createStartEndDegrees(0,180)`.
248
+ * @param start start of arc, on an axis
249
+ * @param middle point on arc somewhere between `start` and `end`
250
+ * @param end point on arc directly opposite `start`
251
+ * @param sweep angular sweep, measured from `start` in the direction of `middle`.
252
+ * For a half-ellipse from `start` to `end` passing through `middle`, pass `AngleSweep.createStartEndDegrees(0,180)`.
253
253
  * Default value is full sweep to create the entire ellipse.
254
254
  * @param result optional preallocated result
255
255
  * @returns elliptical arc, or undefined if construction impossible.
256
256
  */
257
- static createStartMiddleEnd(point0: XYAndZ, point1: XYAndZ, point2: XYAndZ, sweep?: AngleSweep, result?: Arc3d): Arc3d | undefined;
257
+ static createStartMiddleEnd(start: XYAndZ, middle: XYAndZ, end: XYAndZ, sweep?: AngleSweep, result?: Arc3d): Arc3d | undefined;
258
258
  /**
259
259
  * Create a circular arc defined by start point, tangent at start point, and end point.
260
- * If tangent is parallel to line segment from start to end, return the line segment.
260
+ * * The circular arc is swept from `start` to `end` in the direction of `tangentAtStart`.
261
+ * * If `tangentAtStart` is parallel to the line segment from `start` to `end`, return the line segment.
261
262
  */
262
263
  static createCircularStartTangentEnd(start: Point3d, tangentAtStart: Vector3d, end: Point3d, result?: Arc3d): Arc3d | LineSegment3d;
264
+ /**
265
+ * Create a circular arc from start point, tangent at start, radius, optional plane normal, arc sweep.
266
+ * * The vector from start point to center is in the direction of upVector crossed with tangentA.
267
+ * @param start start point.
268
+ * @param tangentAtStart vector in tangent direction at the start.
269
+ * @param radius signed radius.
270
+ * @param upVector optional out-of-plane vector. Defaults to positive Z.
271
+ * @param sweep angular range. If single `Angle` is given, start angle is at 0 degrees (the start point).
272
+ */
273
+ static createCircularStartTangentRadius(start: Point3d, tangentAtStart: Vector3d, radius: number, upVector?: Vector3d, sweep?: Angle | AngleSweep): Arc3d | undefined;
263
274
  /**
264
275
  * Create a circular arc defined by start and end points and radius.
265
276
  * @param start start point of the arc
@@ -422,7 +433,7 @@ export declare class Arc3d extends CurvePrimitive implements BeJSONFunctions {
422
433
  circularRadiusXY(): number | undefined;
423
434
  /** If the arc is circular, return its radius. Otherwise return undefined */
424
435
  circularRadius(): number | undefined;
425
- /** Return the larger of the two defining vectors. */
436
+ /** Return the larger length of the two defining vectors. */
426
437
  maxVectorLength(): number;
427
438
  /**
428
439
  * Compute intersections with a plane.
@@ -516,7 +527,7 @@ export declare class Arc3d extends CurvePrimitive implements BeJSONFunctions {
516
527
  */
517
528
  toJSON(): any;
518
529
  /** Test if this arc is almost equal to another GeometryQuery object */
519
- isAlmostEqual(otherGeometry: GeometryQuery): boolean;
530
+ isAlmostEqual(otherGeometry: GeometryQuery, distanceTol?: number, radianTol?: number): boolean;
520
531
  /** Emit strokes to caller-supplied linestring */
521
532
  emitStrokes(dest: LineString3d, options?: StrokeOptions): void;
522
533
  /** Emit strokes to caller-supplied handler */
@@ -567,7 +578,7 @@ export declare class Arc3d extends CurvePrimitive implements BeJSONFunctions {
567
578
  * * `point` is the `point1` input.
568
579
  * * both fractions are zero
569
580
  * * `arc` is undefined.
570
- * @param point0 first point of path. (the point before the point of inflection)
581
+ * @param point0 first point of path (the point before the point of inflection)
571
582
  * @param point1 second point of path (the point of inflection)
572
583
  * @param point2 third point of path (the point after the point of inflection)
573
584
  * @param radius arc radius
@@ -1 +1 @@
1
- {"version":3,"file":"Arc3d.d.ts","sourceRoot":"","sources":["../../../src/curve/Arc3d.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAa,eAAe,EAAY,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,O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G,MAAM;IAclE;;;OAGG;IACa,iBAAiB,CAC/B,uBAAuB,EAAE,MAAM,GAAG,aAAa,GAC9C,cAAc,GAAG,cAAc,EAAE,GAAG,SAAS;IA4BhD;;;;;OAKG;IACa,uBAAuB,CAAC,GAAG,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;IAItG;;;;OAIG;IACI,sCAAsC,CAAC,OAAO,CAAC,EAAE,iCAAiC,GAAG,UAAU,GAAG,KAAK,GAAG,SAAS;CAS3H"}
@@ -287,19 +287,19 @@ export class Arc3d extends CurvePrimitive {
287
287
  }
288
288
  /**
289
289
  * Create an elliptical arc from three points on the ellipse: two points on an axis and one in between.
290
- * @param point0 start of arc, on an axis
291
- * @param point1 point on arc somewhere between `point0` and `point2`
292
- * @param point2 point on arc directly opposite `point0`
293
- * @param sweep angular sweep, measured from `point0` in the direction of `point1`.
294
- * For a half-ellipse from `point0` to `point2` passing through `point1`, pass `AngleSweep.createStartEndDegrees(0,180)`.
290
+ * @param start start of arc, on an axis
291
+ * @param middle point on arc somewhere between `start` and `end`
292
+ * @param end point on arc directly opposite `start`
293
+ * @param sweep angular sweep, measured from `start` in the direction of `middle`.
294
+ * For a half-ellipse from `start` to `end` passing through `middle`, pass `AngleSweep.createStartEndDegrees(0,180)`.
295
295
  * Default value is full sweep to create the entire ellipse.
296
296
  * @param result optional preallocated result
297
297
  * @returns elliptical arc, or undefined if construction impossible.
298
298
  */
299
- static createStartMiddleEnd(point0, point1, point2, sweep, result) {
300
- const center = Point3d.createAdd2Scaled(point0, 0.5, point2, 0.5);
301
- const vector0 = Vector3d.createStartEnd(center, point0);
302
- const vector1 = Vector3d.createStartEnd(center, point1);
299
+ static createStartMiddleEnd(start, middle, end, sweep, result) {
300
+ const center = Point3d.createAdd2Scaled(start, 0.5, end, 0.5);
301
+ const vector0 = Vector3d.createStartEnd(center, start);
302
+ const vector1 = Vector3d.createStartEnd(center, middle);
303
303
  const v0DotV1 = vector0.dotProduct(vector1);
304
304
  const v0Len2 = vector0.magnitudeSquared();
305
305
  if (Math.abs(v0DotV1) >= v0Len2)
@@ -307,7 +307,7 @@ export class Arc3d extends CurvePrimitive {
307
307
  const normal = vector0.crossProduct(vector1);
308
308
  const vector90 = normal.unitCrossProductWithDefault(vector0, 0, 0, 0);
309
309
  const v1DotV90 = vector1.dotProduct(vector90);
310
- // Solve the standard ellipse equation for the unknown axis length, given local coords of point1 (v0.v1/||v0||, v90.v1)
310
+ // solve the standard ellipse equation for the unknown axis length, given local coords of middle (v0.v1/||v0||, v90.v1)
311
311
  const v90Len = Geometry.safeDivideFraction(v0Len2 * v1DotV90, Math.sqrt(v0Len2 * v0Len2 - v0DotV1 * v0DotV1), 0);
312
312
  if (Geometry.isSmallMetricDistanceSquared(v90Len))
313
313
  return undefined;
@@ -316,33 +316,55 @@ export class Arc3d extends CurvePrimitive {
316
316
  }
317
317
  /**
318
318
  * Create a circular arc defined by start point, tangent at start point, and end point.
319
- * If tangent is parallel to line segment from start to end, return the line segment.
319
+ * * The circular arc is swept from `start` to `end` in the direction of `tangentAtStart`.
320
+ * * If `tangentAtStart` is parallel to the line segment from `start` to `end`, return the line segment.
320
321
  */
321
322
  static createCircularStartTangentEnd(start, tangentAtStart, end, result) {
322
- // To find the circle passing through start and end with tangentAtStart at start:
323
- // - find line 1: the perpendicular bisector of the line from start to end.
324
- // - find line 2: the perpendicular to the tangentAtStart.
325
- // - intersection of the two lines would be the circle center.
326
- const vector = Vector3d.createStartEnd(start, end);
327
- const normal = tangentAtStart.crossProduct(vector).normalize();
328
- if (normal) {
329
- const vectorPerp = normal.crossProduct(vector);
330
- const tangentPerp = normal.crossProduct(tangentAtStart);
331
- const midPoint = start.plusScaled(vector, 0.5);
332
- const lineSeg1 = LineSegment3d.create(start, start.plusScaled(tangentPerp, 1));
333
- const lineSeg2 = LineSegment3d.create(midPoint, midPoint.plusScaled(vectorPerp, 1));
334
- const intersection = LineSegment3d.closestApproach(lineSeg1, true, lineSeg2, true);
335
- if (intersection) {
336
- const center = intersection.detailA.point;
337
- const vector0 = Vector3d.createStartEnd(center, start);
338
- const vector90 = normal.crossProduct(vector0);
339
- const endVector = Vector3d.createStartEnd(center, end);
340
- const sweep = AngleSweep.create(vector0.signedAngleTo(endVector, normal));
323
+ // see itwinjs-core\core\geometry\internaldocs\Arc3d.md to clarify below algorithm
324
+ const startToEnd = Vector3d.createStartEnd(start, end);
325
+ const frame = Matrix3d.createRigidFromColumns(tangentAtStart, startToEnd, AxisOrder.XYZ);
326
+ if (frame !== undefined) {
327
+ const vv = startToEnd.dotProduct(startToEnd);
328
+ const vw = frame.dotColumnY(startToEnd);
329
+ const radius = Geometry.conditionalDivideCoordinate(vv, 2 * vw);
330
+ if (radius !== undefined) {
331
+ const vector0 = frame.columnY();
332
+ vector0.scaleInPlace(-radius); // center to start
333
+ const vector90 = frame.columnX();
334
+ vector90.scaleInPlace(radius);
335
+ const centerToEnd = vector0.plus(startToEnd);
336
+ const sweepAngle = vector0.angleTo(centerToEnd);
337
+ let sweepRadians = sweepAngle.radians; // always positive and less than PI
338
+ if (tangentAtStart.dotProduct(centerToEnd) < 0.0) // sweepRadians is the wrong way
339
+ sweepRadians = 2.0 * Math.PI - sweepRadians;
340
+ const center = start.plusScaled(vector0, -1.0);
341
+ const sweep = AngleSweep.createStartEndRadians(0.0, sweepRadians);
341
342
  return Arc3d.create(center, vector0, vector90, sweep, result);
342
343
  }
343
344
  }
344
345
  return LineSegment3d.create(start, end);
345
346
  }
347
+ /**
348
+ * Create a circular arc from start point, tangent at start, radius, optional plane normal, arc sweep.
349
+ * * The vector from start point to center is in the direction of upVector crossed with tangentA.
350
+ * @param start start point.
351
+ * @param tangentAtStart vector in tangent direction at the start.
352
+ * @param radius signed radius.
353
+ * @param upVector optional out-of-plane vector. Defaults to positive Z.
354
+ * @param sweep angular range. If single `Angle` is given, start angle is at 0 degrees (the start point).
355
+ */
356
+ static createCircularStartTangentRadius(start, tangentAtStart, radius, upVector, sweep) {
357
+ if (upVector === undefined)
358
+ upVector = Vector3d.unitZ();
359
+ const vector0 = upVector.unitCrossProduct(tangentAtStart);
360
+ if (vector0 === undefined)
361
+ return undefined;
362
+ const center = start.plusScaled(vector0, radius);
363
+ // reverse the A-to-center vector and bring it up to scale
364
+ vector0.scaleInPlace(-radius);
365
+ const vector90 = tangentAtStart.scaleToLength(Math.abs(radius)); // cannot fail; prior unitCrossProduct would have failed first
366
+ return Arc3d.create(center, vector0, vector90, AngleSweep.create(sweep));
367
+ }
346
368
  /**
347
369
  * Create a circular arc defined by start and end points and radius.
348
370
  * @param start start point of the arc
@@ -757,7 +779,7 @@ export class Arc3d extends CurvePrimitive {
757
779
  circularRadius() {
758
780
  return this.isCircular ? this._matrix.columnXMagnitude() : undefined;
759
781
  }
760
- /** Return the larger of the two defining vectors. */
782
+ /** Return the larger length of the two defining vectors. */
761
783
  maxVectorLength() {
762
784
  return Math.max(this._matrix.columnXMagnitude(), this._matrix.columnYMagnitude());
763
785
  }
@@ -965,12 +987,12 @@ export class Arc3d extends CurvePrimitive {
965
987
  };
966
988
  }
967
989
  /** Test if this arc is almost equal to another GeometryQuery object */
968
- isAlmostEqual(otherGeometry) {
990
+ isAlmostEqual(otherGeometry, distanceTol = Geometry.smallMetricDistance, radianTol = Geometry.smallAngleRadians) {
969
991
  if (otherGeometry instanceof Arc3d) {
970
992
  const other = otherGeometry;
971
- return this._center.isAlmostEqual(other._center)
972
- && this._matrix.isAlmostEqual(other._matrix)
973
- && this._sweep.isAlmostEqualAllowPeriodShift(other._sweep);
993
+ return this._center.isAlmostEqual(other._center, distanceTol)
994
+ && this._matrix.isAlmostEqual(other._matrix, distanceTol)
995
+ && this._sweep.isAlmostEqualAllowPeriodShift(other._sweep, radianTol);
974
996
  }
975
997
  return false;
976
998
  }
@@ -1076,7 +1098,7 @@ export class Arc3d extends CurvePrimitive {
1076
1098
  * * `point` is the `point1` input.
1077
1099
  * * both fractions are zero
1078
1100
  * * `arc` is undefined.
1079
- * @param point0 first point of path. (the point before the point of inflection)
1101
+ * @param point0 first point of path (the point before the point of inflection)
1080
1102
  * @param point1 second point of path (the point of inflection)
1081
1103
  * @param point2 third point of path (the point after the point of inflection)
1082
1104
  * @param radius arc radius