@itwin/core-geometry 4.10.0-dev.3 → 4.10.0-dev.6

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 (69) hide show
  1. package/lib/cjs/Geometry.d.ts +2 -2
  2. package/lib/cjs/Geometry.js +2 -2
  3. package/lib/cjs/Geometry.js.map +1 -1
  4. package/lib/cjs/clipping/ClipPrimitive.d.ts +7 -7
  5. package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
  6. package/lib/cjs/clipping/ClipPrimitive.js +1 -1
  7. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  8. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +27 -8
  9. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  10. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +44 -25
  11. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  12. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +1 -0
  13. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  14. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +30 -56
  15. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  16. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +22 -7
  17. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
  18. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +127 -67
  19. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  20. package/lib/cjs/geometry3d/Angle.d.ts +5 -5
  21. package/lib/cjs/geometry3d/Angle.js +5 -5
  22. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  23. package/lib/cjs/geometry3d/AngleSweep.d.ts +91 -7
  24. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  25. package/lib/cjs/geometry3d/AngleSweep.js +141 -45
  26. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  27. package/lib/cjs/geometry3d/Matrix3d.d.ts +7 -14
  28. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  29. package/lib/cjs/geometry3d/Matrix3d.js +19 -14
  30. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  31. package/lib/cjs/geometry3d/Transform.d.ts +4 -2
  32. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  33. package/lib/cjs/geometry3d/Transform.js +4 -2
  34. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  35. package/lib/esm/Geometry.d.ts +2 -2
  36. package/lib/esm/Geometry.js +2 -2
  37. package/lib/esm/Geometry.js.map +1 -1
  38. package/lib/esm/clipping/ClipPrimitive.d.ts +7 -7
  39. package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
  40. package/lib/esm/clipping/ClipPrimitive.js +1 -1
  41. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  42. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +27 -8
  43. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  44. package/lib/esm/curve/CurveChainWithDistanceIndex.js +44 -25
  45. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  46. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +1 -0
  47. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  48. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +30 -56
  49. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  50. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +22 -7
  51. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
  52. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +127 -67
  53. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  54. package/lib/esm/geometry3d/Angle.d.ts +5 -5
  55. package/lib/esm/geometry3d/Angle.js +5 -5
  56. package/lib/esm/geometry3d/Angle.js.map +1 -1
  57. package/lib/esm/geometry3d/AngleSweep.d.ts +91 -7
  58. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  59. package/lib/esm/geometry3d/AngleSweep.js +141 -45
  60. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  61. package/lib/esm/geometry3d/Matrix3d.d.ts +7 -14
  62. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  63. package/lib/esm/geometry3d/Matrix3d.js +19 -14
  64. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  65. package/lib/esm/geometry3d/Transform.d.ts +4 -2
  66. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  67. package/lib/esm/geometry3d/Transform.js +4 -2
  68. package/lib/esm/geometry3d/Transform.js.map +1 -1
  69. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"ClipPrimitive.js","sourceRoot":"","sources":["../../../src/clipping/ClipPrimitive.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AACvC,mEAAyD;AACzD,mEAAkE;AAClE,yDAAsD;AAGtD,uDAAoD;AAEpD,6CAA0E;AAC1E,6DAAyD;AACzD,2CAAwC;AACxC,2CAA4D;AAC5D,6DAA0D;AAC1D,6EAA2G;AAC3G,2EAAoE;AACpE,6DAA0D;AAC1D,2DAAwD;AAGxD,mBAAmB;AACnB,oBAAoB;AACpB;;;GAGG;AACH,IAAY,sBAmBX;AAnBD,WAAY,sBAAsB;IAChC,gBAAgB;IAChB,mEAAW,CAAA;IACX,kBAAkB;IAClB,mEAAW,CAAA;IACX,mBAAmB;IACnB,qEAAY,CAAA;IACZ,kBAAkB;IAClB,mEAAW,CAAA;IACX,mBAAmB;IACnB,qEAAY,CAAA;IACZ,kBAAkB;IAClB,oEAAW,CAAA;IACX,mBAAmB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QACzD,OAAO,OAAO,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC;IACxC,CAAC;IACD,wFAAwF;IACjF,sBAAsB,CAAC,KAAc;QAC1C,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS;YACrC,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;IACD,0FAA0F;IACnF,wBAAwB,CAAC,KAAc;QAC5C,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS;YACvC,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC;CACF;AA1dD,8BA0dC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { TransformProps, XYZProps } from \"../geometry3d/XYZProps\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"../topology/Graph\";\r\nimport { Triangulator } from \"../topology/Triangulation\";\r\nimport { ClipPlane } from \"./ClipPlane\";\r\nimport { Clipper, ClipPlaneContainment } from \"./ClipUtils\";\r\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\r\nimport { UnionOfConvexClipPlaneSets, UnionOfConvexClipPlaneSetsProps } from \"./UnionOfConvexClipPlaneSets\";\r\nimport { AlternatingCCTreeNode } from \"./AlternatingConvexClipTree\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { PolylineOps } from \"../geometry3d/PolylineOps\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\r\n// cspell:word zlow\r\n// cspell:word zhigh\r\n/**\r\n * Bit mask type for referencing subsets of 6 planes of range box.\r\n * @public\r\n */\r\nexport enum ClipMaskXYZRangePlanes {\r\n /** no planes */\r\n None = 0x00,\r\n /** low x plane */\r\n XLow = 0x01,\r\n /** high x plane */\r\n XHigh = 0x02,\r\n /** low y plane */\r\n YLow = 0x04,\r\n /** high y plane */\r\n YHigh = 0x08,\r\n /** low z plane */\r\n ZLow = 0x10,\r\n /** high z plane */\r\n ZHigh = 0x20,\r\n /** all x and y planes, neither z plane */\r\n XAndY = 0x0f,\r\n /** all 6 planes */\r\n All = 0x3f,\r\n}\r\n\r\n/**\r\n * Wire format describing a [[ClipPrimitive]] defined by a set of clip planes.\r\n * @public\r\n */\r\nexport interface ClipPrimitivePlanesProps {\r\n planes?: {\r\n /** The set of clip planes. */\r\n clips?: UnionOfConvexClipPlaneSetsProps;\r\n /** `true` if the primitive is a hole. */\r\n invisible?: boolean;\r\n };\r\n}\r\n\r\n/**\r\n * Wire format describing a [[ClipShape]].\r\n * @public\r\n */\r\nexport interface ClipPrimitiveShapeProps {\r\n /** The clip polygon. */\r\n shape?: {\r\n /** The points describing the polygon. */\r\n points?: XYZProps[];\r\n /** Transform applied to the polygon. */\r\n trans?: TransformProps;\r\n /** Lower bound on Z. */\r\n zlow?: number;\r\n /** Upper bound on Z. */\r\n zhigh?: number;\r\n /** `true` if this shape is a mask. */\r\n mask?: boolean;\r\n /** `true` if this shape is invisible. */\r\n invisible?: boolean;\r\n };\r\n}\r\n\r\n/** Wire format describing a [[ClipPrimitive]].\r\n * @public\r\n */\r\nexport type ClipPrimitiveProps = ClipPrimitivePlanesProps | ClipPrimitiveShapeProps;\r\n\r\n/**\r\n * * ClipPrimitive is a base class for clipping implementations that use\r\n * * A UnionOfConvexClipPlaneSets designated \"clipPlanes\".\r\n * * An \"invisible\" flag.\r\n * * When constructed directly, objects of type ClipPrimitive (directly, not through a derived class) will have just planes.\r\n * * Derived classes (e.g. ClipShape) carry additional data such as a swept shape.\r\n * * ClipPrimitive can be constructed with no planes.\r\n * * Derived class is responsible for filling the plane sets.\r\n * * At discretion of derived classes, plane construction can be done at construction time or \"on demand when\" queries\r\n * call `ensurePlaneSets ()`\r\n * * ClipPrimitive can be constructed directly with planes (and no derived class).\r\n * * That the prevailing use is via a ClipShape derived class.\r\n * * The ClipShape has an \"isMask\" property\r\n * * isMask === false means the plane sets should cover the inside of its polygon.\r\n * * isMask === true means the plane sets should cover the outside of its polygon.\r\n * * Note that the ClipShape's `isMask` property and the ClipPrimitive's `isInvisible` property are distinct controls.\r\n * * In normal usage, callers get \"outside\" clip behavior using ONLY the ClipShape isMask property.\r\n * * The ClipShape happens to pass the _invisible bit down to ClipPlanes that it creates.\r\n * * At that level, the flag controls whether the cut edges are produced on the plane\r\n * @public\r\n */\r\nexport class ClipPrimitive implements Clipper {\r\n /** The (union of) convex regions. */\r\n protected _clipPlanes?: UnionOfConvexClipPlaneSets;\r\n /** If true, pointInside inverts the sense of the pointInside for the _clipPlanes */\r\n protected _invisible: boolean;\r\n /**\r\n * Get a reference to the `UnionOfConvexClipPlaneSets`.\r\n * * It triggers construction of the sets by `this.ensurePlaneSets()`.\r\n * * Derived class typically caches the set on the first such call.\r\n */\r\n public fetchClipPlanesRef(): UnionOfConvexClipPlaneSets | undefined {\r\n this.ensurePlaneSets();\r\n return this._clipPlanes;\r\n }\r\n /** Ask if this primitive is a hole. */\r\n public get invisible(): boolean {\r\n return this._invisible;\r\n }\r\n protected constructor(planeSet?: UnionOfConvexClipPlaneSets | undefined, isInvisible: boolean = false) {\r\n this._clipPlanes = planeSet;\r\n this._invisible = isInvisible;\r\n }\r\n /**\r\n * Create a ClipPrimitive, capturing the supplied plane set as the clip planes.\r\n * @param planes clipper\r\n * @param isInvisible set the invisible flag on the ClipPrimitive\r\n */\r\n public static createCapture(\r\n planes: UnionOfConvexClipPlaneSets | ConvexClipPlaneSet | undefined, isInvisible: boolean = false,\r\n ): ClipPrimitive {\r\n let planeData;\r\n if (planes instanceof UnionOfConvexClipPlaneSets)\r\n planeData = planes;\r\n if (planes instanceof ConvexClipPlaneSet)\r\n planeData = UnionOfConvexClipPlaneSets.createConvexSets([planes]);\r\n\r\n return new ClipPrimitive(planeData, isInvisible);\r\n }\r\n /** Emit json form of the clip planes */\r\n public toJSON(): ClipPrimitiveProps {\r\n const planes: ClipPrimitivePlanesProps[\"planes\"] = {};\r\n if (this._clipPlanes)\r\n planes.clips = this._clipPlanes.toJSON();\r\n\r\n if (this._invisible)\r\n planes.invisible = true;\r\n\r\n return { planes };\r\n }\r\n /**\r\n * Returns true if the planes are present.\r\n * * This can be false (for instance) if a ClipShape is holding a polygon but has not yet been asked to construct\r\n * the planes.\r\n */\r\n public arePlanesDefined(): boolean {\r\n return this._clipPlanes !== undefined;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): ClipPrimitive {\r\n const newPlanes = this._clipPlanes ? this._clipPlanes.clone() : undefined;\r\n const result = new ClipPrimitive(newPlanes, this._invisible);\r\n return result;\r\n }\r\n /**\r\n * Trigger (if needed) computation of plane sets (if applicable) in the derived class.\r\n * * Base class is no op.\r\n * * In derived class, on first call create planes sets from defining data (e.g. swept shape).\r\n * * In derived class, if planes are present leave them alone.\r\n */\r\n public ensurePlaneSets() { }\r\n /**\r\n * Return true if the point lies inside/on this polygon (or not inside/on if this polygon is a mask). Otherwise,\r\n * return false.\r\n * * Note that a derived class may choose to (a) implement its own test using its defining data, or (b) accept\r\n * this implementation using planes that it inserted in the base class.\r\n */\r\n public pointInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\r\n this.ensurePlaneSets();\r\n let inside = true;\r\n if (this._clipPlanes)\r\n inside = this._clipPlanes.isPointOnOrInside(point, onTolerance);\r\n return inside;\r\n }\r\n /**\r\n * Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public isPointOnOrInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\r\n this.ensurePlaneSets();\r\n let inside = true;\r\n if (this._clipPlanes)\r\n inside = this._clipPlanes.isPointOnOrInside(point, onTolerance);\r\n return inside;\r\n }\r\n /**\r\n * Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public announceClippedSegmentIntervals(\r\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\r\n ): boolean {\r\n this.ensurePlaneSets();\r\n let hasInsideParts = false;\r\n if (this._clipPlanes)\r\n hasInsideParts = this._clipPlanes.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announce);\r\n return hasInsideParts;\r\n }\r\n /**\r\n * Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n this.ensurePlaneSets();\r\n let hasInsideParts = false;\r\n if (this._clipPlanes)\r\n hasInsideParts = this._clipPlanes.announceClippedArcIntervals(arc, announce);\r\n return hasInsideParts;\r\n }\r\n /**\r\n * Multiply all ClipPlanes DPoint4d by matrix.\r\n * @param matrix matrix to apply.\r\n * @param invert if true, use in verse of the matrix.\r\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter).\r\n * @param matrix matrix to apply.\r\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding\r\n * effect on the plane is the inverse transpose of matrixA.\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n */\r\n public multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\r\n if (invert) { // form inverse once here, reuse for all planes\r\n const inverse = matrix.createInverse();\r\n if (!inverse)\r\n return false;\r\n return this.multiplyPlanesByMatrix4d(inverse, false, transpose);\r\n }\r\n if (this._clipPlanes)\r\n this._clipPlanes.multiplyPlanesByMatrix4d(matrix);\r\n return true;\r\n }\r\n /** Apply a transform to the clipper (e.g. transform all planes). */\r\n public transformInPlace(transform: Transform): boolean {\r\n if (this._clipPlanes)\r\n this._clipPlanes.transformInPlace(transform);\r\n return true;\r\n }\r\n /** Sets both the clip plane set and the mask set visibility */\r\n public setInvisible(invisible: boolean) {\r\n this._invisible = invisible;\r\n }\r\n /**\r\n * Return true if any plane of the primary clipPlanes has (a) non-zero z component in its normal vector and\r\n * (b) finite distance from origin.\r\n */\r\n public containsZClip(): boolean {\r\n if (this.fetchClipPlanesRef() !== undefined)\r\n for (const convexSet of this._clipPlanes!.convexSets)\r\n for (const plane of convexSet.planes)\r\n if (Math.abs(plane.inwardNormalRef.z) > 1.0e-6 && Math.abs(plane.distance) !== Number.MAX_VALUE)\r\n return true;\r\n return false;\r\n }\r\n /**\r\n * Quick test of whether the given points fall completely inside or outside.\r\n * @param points points to test.\r\n * @param ignoreInvisibleSetting if true, do the test with the clip planes and return that, ignoring the\r\n * invisible setting.\r\n */\r\n public classifyPointContainment(points: Point3d[], ignoreInvisibleSetting: boolean): ClipPlaneContainment {\r\n this.ensurePlaneSets();\r\n const planes = this._clipPlanes;\r\n let inside = ClipPlaneContainment.StronglyInside;\r\n if (planes)\r\n inside = planes.classifyPointContainment(points, false);\r\n if (this._invisible && !ignoreInvisibleSetting)\r\n switch (inside) {\r\n case ClipPlaneContainment.StronglyInside:\r\n return ClipPlaneContainment.StronglyOutside;\r\n case ClipPlaneContainment.StronglyOutside:\r\n return ClipPlaneContainment.StronglyInside;\r\n case ClipPlaneContainment.Ambiguous:\r\n return ClipPlaneContainment.Ambiguous;\r\n }\r\n return inside;\r\n }\r\n /**\r\n * Promote json object form to class instance.\r\n * * First try to convert to a ClipShape.\r\n * * then try as a standalone instance of the base class ClipPrimitive.\r\n */\r\n public static fromJSON(json: ClipPrimitiveProps | undefined): ClipPrimitive | undefined {\r\n if (!json)\r\n return undefined;\r\n const shape = ClipShape.fromClipShapeJSON(json as ClipPrimitiveShapeProps);\r\n if (shape)\r\n return shape;\r\n return ClipPrimitive.fromJSONClipPrimitive(json as ClipPrimitivePlanesProps);\r\n }\r\n /** Specific converter producing the base class ClipPrimitive. */\r\n public static fromJSONClipPrimitive(json: ClipPrimitivePlanesProps | undefined): ClipPrimitive | undefined {\r\n const planes = json?.planes;\r\n if (!planes)\r\n return undefined;\r\n\r\n const clipPlanes = planes.clips ? UnionOfConvexClipPlaneSets.fromJSON(planes.clips) : undefined;\r\n const invisible = undefined !== planes.invisible ? planes.invisible : false;\r\n return new ClipPrimitive(clipPlanes, invisible);\r\n }\r\n}\r\n\r\n/** Internal helper class holding XYZ components that serves as a representation of polygon edges defined by clip planes */\r\nclass PolyEdge {\r\n public pointA: Point3d;\r\n public pointB: Point3d;\r\n public normal: Vector3d;\r\n\r\n public constructor(origin: Point3d, next: Point3d, normal: Vector3d, z: number) {\r\n this.pointA = Point3d.create(origin.x, origin.y, z);\r\n this.pointB = Point3d.create(next.x, next.y, z);\r\n this.normal = normal;\r\n }\r\n // Assume both normals are unit length.\r\n // old logic: use difference of (previously computed) normals as perpendicular to bisector.\r\n public static makeUnitPerpendicularToBisector(edgeA: PolyEdge, edgeB: PolyEdge, reverse: boolean): Vector3d | undefined {\r\n let candidate = edgeB.normal.minus(edgeA.normal);\r\n if (candidate.normalize(candidate) === undefined) {\r\n candidate = Vector3d.createStartEnd(edgeA.pointA, edgeB.pointB);\r\n if (candidate.normalize(candidate) === undefined)\r\n return undefined;\r\n }\r\n if (reverse)\r\n candidate.scale(-1.0, candidate);\r\n return candidate;\r\n }\r\n}\r\n\r\n/**\r\n * A clipping volume defined by a shape (an array of 3d points using only x and y dimensions).\r\n * May be given either a ClipPlaneSet to store directly, or an array of polygon points as well as other parameters\r\n * for parsing ClipPlanes from the shape later.\r\n * @public\r\n */\r\nexport class ClipShape extends ClipPrimitive {\r\n /** Points of the polygon, in the xy plane of the local coordinate system. */\r\n protected _polygon: Point3d[];\r\n /** optional low z (in local coordinates). */\r\n protected _zLow?: number;\r\n /** optional high z (in local coordinates). */\r\n protected _zHigh?: number;\r\n /** true if this is considered a hole (keep geometry outside of the polygon). */\r\n protected _isMask: boolean;\r\n /** transform from local to world. */\r\n protected _transformFromClip?: Transform;\r\n /** Transform from world to local. */\r\n protected _transformToClip?: Transform;\r\n\r\n protected constructor(\r\n polygon: Point3d[] = [], zLow?: number, zHigh?: number, transform?: Transform, isMask: boolean = false, invisible: boolean = false,\r\n ) {\r\n super(undefined, invisible); // ClipPlaneSets will be set up later after storing points\r\n this._isMask = false;\r\n this._polygon = polygon;\r\n this.initSecondaryProps(isMask, zLow, zHigh, transform);\r\n }\r\n /** Returns true if this ClipShape is marked as invisible. */\r\n public override get invisible(): boolean {\r\n return this._invisible;\r\n }\r\n /** Return this transformFromClip, which may be undefined. */\r\n public get transformFromClip(): Transform | undefined {\r\n return this._transformFromClip;\r\n }\r\n /** Return this transformToClip, which may be undefined. */\r\n public get transformToClip(): Transform | undefined {\r\n return this._transformToClip;\r\n }\r\n /** Returns true if this ClipShape's transforms are currently set. */\r\n public get transformValid(): boolean {\r\n return this.transformFromClip !== undefined;\r\n }\r\n /** Returns true if this ClipShape's lower z boundary is set. */\r\n public get zLowValid(): boolean {\r\n return this._zLow !== undefined;\r\n }\r\n /** Returns true if this ClipShape's upper z boundary is set. */\r\n public get zHighValid(): boolean {\r\n return this._zHigh !== undefined;\r\n }\r\n /** Return true if this ClipShape has a local to world transform */\r\n public get transformIsValid(): boolean {\r\n return this._transformFromClip !== undefined;\r\n }\r\n /** Return this zLow, which may be undefined. */\r\n public get zLow(): number | undefined {\r\n return this._zLow;\r\n }\r\n /** Return this zHigh, which may be undefined. */\r\n public get zHigh(): number | undefined {\r\n return this._zHigh;\r\n }\r\n /** Returns a reference to this ClipShape's polygon array. */\r\n public get polygon(): Point3d[] {\r\n return this._polygon;\r\n }\r\n /** Returns true if this ClipShape is a masking set. */\r\n public get isMask(): boolean {\r\n return this._isMask;\r\n }\r\n /** Sets the polygon points array of this ClipShape to the array given (by reference). */\r\n public setPolygon(polygon: Point3d[]) {\r\n // Add closure point\r\n if (!polygon[0].isAlmostEqual(polygon[polygon.length - 1]))\r\n polygon.push(polygon[0].clone());\r\n this._polygon = polygon;\r\n }\r\n /**\r\n * If the ClipShape's associated `UnionOfConvexClipPlaneSets` is defined, do nothing.\r\n * If the ClipShape's associated `UnionOfConvexClipPlaneSets` is undefined, generate it from the `ClipShape`\r\n * and transform.\r\n */\r\n public override ensurePlaneSets() {\r\n if (this._clipPlanes !== undefined)\r\n return;\r\n this._clipPlanes = UnionOfConvexClipPlaneSets.createEmpty();\r\n this.parseClipPlanes(this._clipPlanes);\r\n if (this._transformFromClip)\r\n this._clipPlanes.transformInPlace(this._transformFromClip);\r\n }\r\n /**\r\n * Initialize the members of the ClipShape class that may at times be undefined.\r\n * zLow and zHigh default to Number.MAX_VALUE, and the transform defaults to an identity transform.\r\n */\r\n public initSecondaryProps(isMask: boolean, zLow?: number, zHigh?: number, transform?: Transform) {\r\n this._isMask = isMask;\r\n this._zLow = zLow;\r\n this._zHigh = zHigh;\r\n\r\n if (transform !== undefined) {\r\n this._transformFromClip = transform;\r\n this._transformToClip = transform.inverse(); // could be undefined\r\n } else {\r\n this._transformFromClip = Transform.createIdentity();\r\n this._transformToClip = Transform.createIdentity();\r\n }\r\n }\r\n /** Emit json object form */\r\n public override toJSON(): ClipPrimitiveShapeProps {\r\n const shape: ClipPrimitiveShapeProps[\"shape\"] = {\r\n points: this._polygon.map((pt) => pt.toJSON()),\r\n };\r\n if (this.invisible)\r\n shape.invisible = true;\r\n if (this._transformFromClip && !this._transformFromClip.isIdentity)\r\n shape.trans = this._transformFromClip.toJSON();\r\n if (this.isMask)\r\n shape.mask = true;\r\n if (typeof (this.zLow) !== \"undefined\" && this.zLow !== -Number.MAX_VALUE)\r\n shape.zlow = this.zLow;\r\n if (typeof (this.zHigh) !== \"undefined\" && this.zHigh !== Number.MAX_VALUE)\r\n shape.zhigh = this.zHigh;\r\n return { shape };\r\n }\r\n /** Parse `json` to a clip shape. */\r\n public static fromClipShapeJSON(json: ClipPrimitiveShapeProps | undefined, result?: ClipShape): ClipShape | undefined {\r\n const shape = json?.shape;\r\n if (!shape)\r\n return undefined;\r\n const points: Point3d[] = shape.points ? shape.points.map((pt) => Point3d.fromJSON(pt)) : [];\r\n const trans = shape.trans ? Transform.fromJSON(shape.trans) : undefined;\r\n const zLow = typeof shape.zlow === \"number\" ? shape.zlow : undefined;\r\n const zHigh = typeof shape.zhigh === \"number\" ? shape.zhigh : undefined;\r\n const isMask = typeof shape.mask === \"boolean\" && shape.mask;\r\n const invisible = typeof shape.invisible === \"boolean\" && shape.invisible;\r\n\r\n return ClipShape.createShape(points, zLow, zHigh, trans, isMask, invisible, result);\r\n }\r\n /** Returns a new ClipShape that is a deep copy of the ClipShape given */\r\n public static createFrom(other: ClipShape, result?: ClipShape): ClipShape {\r\n const retVal = ClipShape.createEmpty(false, false, undefined, result);\r\n retVal._invisible = other._invisible;\r\n for (const point of other._polygon) {\r\n retVal._polygon.push(point.clone());\r\n }\r\n retVal._isMask = other._isMask;\r\n retVal._zLow = other._zLow;\r\n retVal._zHigh = other._zHigh;\r\n retVal._transformToClip = other._transformToClip ? other._transformToClip.clone() : undefined;\r\n retVal._transformFromClip = other._transformFromClip ? other._transformFromClip.clone() : undefined;\r\n return retVal;\r\n }\r\n /** Create a new ClipShape from an array of points that make up a 2d shape (stores a deep copy of these points). */\r\n public static createShape(\r\n polygon: Point3d[] = [],\r\n zLow?: number,\r\n zHigh?: number,\r\n transform?: Transform,\r\n isMask: boolean = false,\r\n invisible: boolean = false,\r\n result?: ClipShape,\r\n ): ClipShape | undefined {\r\n if (polygon.length < 3)\r\n return undefined;\r\n const pPoints = polygon.slice(0);\r\n // Add closure point.\r\n if (pPoints[0].isAlmostEqual(pPoints[pPoints.length - 1]))\r\n pPoints[0].clone(pPoints[pPoints.length - 1]);\r\n else\r\n pPoints.push(pPoints[0].clone());\r\n if (result) {\r\n result._clipPlanes = undefined; // Start as undefined\r\n result._invisible = invisible;\r\n result._polygon = pPoints;\r\n result.initSecondaryProps(isMask, zLow, zHigh, transform);\r\n return result;\r\n } else {\r\n return new ClipShape(pPoints, zLow, zHigh, transform, isMask, invisible);\r\n }\r\n }\r\n /**\r\n * Create a ClipShape that exists as a 3 dimensional box of the range given. Optionally choose to\r\n * also store this shape's zLow and zHigh members from the range through the use of a RangePlaneBitMask.\r\n */\r\n public static createBlock(\r\n extremities: Range3d,\r\n clipMask: ClipMaskXYZRangePlanes,\r\n isMask: boolean = false,\r\n invisible: boolean = false,\r\n transform?: Transform,\r\n result?: ClipShape,\r\n ): ClipShape {\r\n const low = extremities.low;\r\n const high = extremities.high;\r\n const blockPoints: Point3d[] = [];\r\n for (let i = 0; i < 5; i++)\r\n blockPoints.push(Point3d.create());\r\n blockPoints[0].x = blockPoints[3].x = blockPoints[4].x = low.x;\r\n blockPoints[1].x = blockPoints[2].x = high.x;\r\n blockPoints[0].y = blockPoints[1].y = blockPoints[4].y = low.y;\r\n blockPoints[2].y = blockPoints[3].y = high.y;\r\n return ClipShape.createShape(\r\n blockPoints,\r\n (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZLow)) ? low.z : undefined,\r\n (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZHigh)) ? high.z : undefined,\r\n transform,\r\n isMask,\r\n invisible,\r\n result,\r\n )!;\r\n }\r\n /** Creates a new ClipShape with undefined members and a polygon points array of zero length. */\r\n public static createEmpty(\r\n isMask = false, invisible: boolean = false, transform?: Transform, result?: ClipShape,\r\n ): ClipShape {\r\n if (result) {\r\n result._clipPlanes = undefined;\r\n result._invisible = invisible;\r\n result._polygon.length = 0;\r\n result.initSecondaryProps(isMask, undefined, undefined, transform);\r\n return result;\r\n }\r\n return new ClipShape([], undefined, undefined, transform, isMask, invisible);\r\n }\r\n /** Checks to ensure that the member polygon has an area, and that the polygon is closed. */\r\n public get isValidPolygon(): boolean {\r\n if (this._polygon.length < 3)\r\n return false;\r\n if (!this._polygon[0].isExactEqual(this._polygon[this._polygon.length - 1]))\r\n return false;\r\n return true;\r\n }\r\n /** Returns a deep copy of this instance of ClipShape, storing in an optional result. */\r\n public override clone(result?: ClipShape): ClipShape {\r\n return ClipShape.createFrom(this, result);\r\n }\r\n /**\r\n * Given the current polygon data, parses clip planes that together form an object, storing the result in\r\n * the set given, either clip planes or mask planes.\r\n */\r\n private parseClipPlanes(set: UnionOfConvexClipPlaneSets) {\r\n const points = this._polygon;\r\n if (points.length === 3 && !this._isMask && points[0].isExactEqual(points[points.length - 1])) {\r\n this.parseLinearPlanes(set, this._polygon[0], this._polygon[1]);\r\n return true;\r\n }\r\n if (!this.isMask) {\r\n const direction = PolygonOps.testXYPolygonTurningDirections(this.polygon);\r\n if (direction !== 0) {\r\n this.parseConvexPolygonPlanes(set, this._polygon, direction, false);\r\n return true;\r\n }\r\n }\r\n // REMARK: Pass all polygons to non-convex case. It will funnel\r\n // to concave case as appropriate.\r\n this.parsePolygonPlanes(set, this._polygon, this.isMask);\r\n return true;\r\n }\r\n /**\r\n * Given a start and end point, populate the given UnionOfConvexClipPlaneSets with ConvexClipPlaneSets\r\n * defining the bounded region of linear planes. Returns true if successful.\r\n */\r\n private parseLinearPlanes(\r\n set: UnionOfConvexClipPlaneSets, start: Point3d, end: Point3d, cameraFocalLength?: number,\r\n ): boolean {\r\n // Handles the degenerate case of 2 distinct points (used by select by line).\r\n const normal = start.vectorTo(end);\r\n if (normal.magnitude() === 0.0)\r\n return false;\r\n normal.normalize(normal);\r\n const convexSet = ConvexClipPlaneSet.createEmpty();\r\n if (cameraFocalLength === undefined) {\r\n const perpendicular = Vector2d.create(-normal.y, normal.x);\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndPoint(Vector3d.create(normal.x, normal.y), Point3d.createFrom(start), this._invisible)!,\r\n );\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndPoint(Vector3d.create(-normal.x, -normal.y), Point3d.createFrom(end), this._invisible)!,\r\n );\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndPoint(Vector3d.create(perpendicular.x, perpendicular.y), Point3d.createFrom(start), this._invisible)!,\r\n );\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndPoint(Vector3d.create(-perpendicular.x, -perpendicular.y), Point3d.createFrom(start), this._invisible)!,\r\n );\r\n } else {\r\n const start3d = Point3d.create(start.x, start.y, -cameraFocalLength);\r\n const end3d = Point3d.create(end.x, end.y, -cameraFocalLength);\r\n const vecEnd3d = Vector3d.createFrom(end3d);\r\n const perpendicular = vecEnd3d.crossProduct(Vector3d.createFrom(start3d)).normalize();\r\n let endNormal = Vector3d.createFrom(start3d).crossProduct(perpendicular!).normalize();\r\n convexSet.planes.push(ClipPlane.createNormalAndDistance(perpendicular!, 0.0, this._invisible)!);\r\n convexSet.planes.push(ClipPlane.createNormalAndDistance(endNormal!, 0.0, this._invisible)!);\r\n perpendicular!.negate();\r\n endNormal = vecEnd3d.crossProduct(perpendicular!).normalize();\r\n convexSet.planes.push(ClipPlane.createNormalAndDistance(perpendicular!, 0.0, this._invisible)!);\r\n convexSet.planes.push(ClipPlane.createNormalAndDistance(endNormal!, 0.0, this._invisible)!);\r\n }\r\n convexSet.addZClipPlanes(this._invisible, this._zLow, this._zHigh);\r\n set.addConvexSet(convexSet);\r\n return true;\r\n }\r\n /**\r\n * Given a convex polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets with\r\n * ConvexClipPlaneSets defining the bounded region. Returns true if successful.\r\n */\r\n private parseConvexPolygonPlanes(\r\n set: UnionOfConvexClipPlaneSets,\r\n polygon: Point3d[],\r\n direction: number,\r\n buildExteriorClipper: boolean,\r\n cameraFocalLength?: number,\r\n ): boolean {\r\n const samePointTolerance = 1.0e-8; // This could possibly be replaced with more widely used constants\r\n const edges: PolyEdge[] = [];\r\n // const reverse = (direction < 0) !== this._isMask;\r\n const reverse = direction < 0;\r\n for (let i = 0; i < polygon.length - 1; i++) {\r\n const z = (cameraFocalLength === undefined) ? 0.0 : -cameraFocalLength;\r\n const dir = Vector3d.createStartEnd(polygon[i], polygon[i + 1]);\r\n const magnitude = dir.magnitude();\r\n dir.normalize(dir);\r\n if (magnitude > samePointTolerance) {\r\n const normal = Vector3d.create(reverse ? dir.y : -dir.y, reverse ? -dir.x : dir.x);\r\n edges.push(new PolyEdge(polygon[i], polygon[i + 1], normal, z));\r\n }\r\n }\r\n if (edges.length < 3) {\r\n return false;\r\n }\r\n if (buildExteriorClipper) {\r\n const last = edges.length - 1;\r\n for (let i = 0; i <= last; i++) {\r\n const edge = edges[i];\r\n const prevEdge = edges[i ? (i - 1) : last];\r\n const nextEdge = edges[(i === last) ? 0 : (i + 1)];\r\n const convexSet = ConvexClipPlaneSet.createEmpty();\r\n const previousPerpendicular = PolyEdge.makeUnitPerpendicularToBisector(prevEdge, edge, !reverse);\r\n const nextPerpendicular = PolyEdge.makeUnitPerpendicularToBisector(edge, nextEdge, reverse);\r\n // Create three-sided fans from each edge. Note we could define the correct region\r\n // with only two planes for edge, but cannot then designate the \"interior\" status of the edges accurately.\r\n\r\n if (previousPerpendicular)\r\n convexSet.planes.push(ClipPlane.createNormalAndPoint(previousPerpendicular, edge.pointA, this._invisible, true)!);\r\n convexSet.planes.push(ClipPlane.createNormalAndPoint(edge.normal, edge.pointB, this._invisible, false)!);\r\n if (nextPerpendicular)\r\n convexSet.planes.push(ClipPlane.createNormalAndPoint(nextPerpendicular, nextEdge.pointA, this._invisible, true)!);\r\n set.addConvexSet(convexSet);\r\n set.addOutsideZClipSets(this._invisible, this._zLow, this._zHigh);\r\n }\r\n } else {\r\n const convexSet = ConvexClipPlaneSet.createEmpty();\r\n if (cameraFocalLength === undefined) {\r\n for (const edge of edges)\r\n convexSet.planes.push(ClipPlane.createNormalAndPoint(Vector3d.create(edge.normal.x, edge.normal.y), edge.pointA)!);\r\n } else {\r\n if (reverse)\r\n for (const edge of edges)\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndDistance(\r\n Vector3d.createFrom(edge.pointA).crossProduct(Vector3d.createFrom(edge.pointB)).normalize()!, 0.0,\r\n )!,\r\n );\r\n else\r\n for (const edge of edges)\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndDistance(\r\n Vector3d.createFrom(edge.pointB).crossProduct(Vector3d.createFrom(edge.pointA)).normalize()!, 0.0,\r\n )!,\r\n );\r\n }\r\n convexSet.addZClipPlanes(this._invisible, this._zLow, this._zHigh);\r\n set.addConvexSet(convexSet);\r\n }\r\n return true;\r\n }\r\n /**\r\n * Given a (possibly non-convex) polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets\r\n * with multiple ConvexClipPlaneSets defining the bounded region. Returns true if successful.\r\n */\r\n private parsePolygonPlanes(set: UnionOfConvexClipPlaneSets, polygon: Point3d[], isMask: boolean, cameraFocalLength?: number,\r\n ): boolean {\r\n const cleanPolygon = PolylineOps.compressDanglers(polygon, true);\r\n const announceFace = (_graph: HalfEdgeGraph, edge: HalfEdge): boolean => {\r\n if (!edge.isMaskSet(HalfEdgeMask.EXTERIOR)) {\r\n const convexFacetPoints = edge.collectAroundFace((node: HalfEdge): any => {\r\n if (!node.isMaskSet(HalfEdgeMask.EXTERIOR))\r\n return Point3d.create(node.x, node.y, 0);\r\n });\r\n // parseConvexPolygonPlanes expects a closed loop (pushing the reference doesn't matter)\r\n convexFacetPoints.push(convexFacetPoints[0].clone());\r\n const direction = PolygonOps.testXYPolygonTurningDirections(convexFacetPoints); // ###TODO: Can we expect a direction coming out of graph facet?\r\n this.parseConvexPolygonPlanes(set, convexFacetPoints, direction, false, cameraFocalLength);\r\n }\r\n return true;\r\n };\r\n if (isMask) {\r\n const polygonA = Point3dArray.clonePoint3dArray(cleanPolygon);\r\n const hullAndInlets = AlternatingCCTreeNode.createHullAndInletsForPolygon(polygonA);\r\n const allLoops = hullAndInlets.extractLoops();\r\n if (allLoops.length === 0)\r\n return false;\r\n const hull = allLoops[0];\r\n const direction1 = PolygonOps.testXYPolygonTurningDirections(hull); // ###TODO: Can we expect a direction coming out of graph facet?\r\n this.parseConvexPolygonPlanes(set, hull, -direction1, true, cameraFocalLength);\r\n for (let i = 1; i < allLoops.length; i++) {\r\n const triangulatedPolygon = Triangulator.createTriangulatedGraphFromSingleLoop(allLoops[i]);\r\n if (triangulatedPolygon) {\r\n Triangulator.flipTriangles(triangulatedPolygon);\r\n triangulatedPolygon.announceFaceLoops(announceFace);\r\n }\r\n }\r\n return true;\r\n } else {\r\n const triangulatedPolygon = Triangulator.createTriangulatedGraphFromSingleLoop(cleanPolygon);\r\n if (triangulatedPolygon === undefined)\r\n return false;\r\n Triangulator.flipTriangles(triangulatedPolygon);\r\n triangulatedPolygon.announceFaceLoops(announceFace);\r\n }\r\n return true;\r\n }\r\n /**\r\n * Multiply all ClipPlanes DPoint4d by matrix.\r\n * @param matrix matrix to apply.\r\n * @param invert if true, use in verse of the matrix.\r\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter).\r\n * @param matrix matrix to apply.\r\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect\r\n * on the plane is the inverse transpose of matrixA.\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n */\r\n public override multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\r\n this.ensurePlaneSets();\r\n return super.multiplyPlanesByMatrix4d(matrix, invert, transpose);\r\n }\r\n /**\r\n * Apply `transform` to the local to world (`transformFromClip`) transform.\r\n * * The world to local transform (`transformToClip` is recomputed from the (changed) `transformToClip`\r\n * * the transform is passed to the base class to be applied to clip plane form of the clipper.\r\n */\r\n public override transformInPlace(transform: Transform): boolean {\r\n if (transform.isIdentity)\r\n return true;\r\n super.transformInPlace(transform);\r\n if (this._transformFromClip)\r\n transform.multiplyTransformTransform(this._transformFromClip, this._transformFromClip);\r\n else\r\n this._transformFromClip = transform.clone();\r\n this._transformToClip = this._transformFromClip.inverse(); // could be undefined\r\n return true;\r\n }\r\n /**\r\n * Return true if\r\n * * at least one point is defined\r\n * * The local to world transform (transformFromClip) either\r\n * * is undefined\r\n * * has no xy parts in its column Z (local frame Z is parallel to global Z)\r\n */\r\n public get isXYPolygon(): boolean {\r\n if (this._polygon.length === 0) // Note: This is a lenient check, as points array could also contain less than 3 points (not a polygon)\r\n return false;\r\n if (this._transformFromClip === undefined)\r\n return true;\r\n const zVector = this._transformFromClip.matrix.columnZ();\r\n return zVector.magnitudeXY() < 1.0e-8;\r\n }\r\n /** Transform the input point in place using this instance's `transformToClip` member */\r\n public performTransformToClip(point: Point3d): void {\r\n if (this._transformToClip !== undefined)\r\n this._transformToClip.multiplyPoint3d(point, point);\r\n }\r\n /** Transform the input point in place using this instance's `transformFromClip` member */\r\n public performTransformFromClip(point: Point3d): void {\r\n if (this._transformFromClip !== undefined)\r\n this._transformFromClip.multiplyPoint3d(point, point);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ClipPrimitive.js","sourceRoot":"","sources":["../../../src/clipping/ClipPrimitive.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AACvC,mEAAyD;AACzD,mEAAkE;AAClE,yDAAsD;AAGtD,uDAAoD;AAEpD,6CAA0E;AAC1E,6DAAyD;AACzD,2CAAwC;AACxC,2CAA4D;AAC5D,6DAA0D;AAC1D,6EAA2G;AAC3G,2EAAoE;AACpE,6DAA0D;AAC1D,2DAAwD;AAGxD,mBAAmB;AACnB,oBAAoB;AACpB;;;GAGG;AACH,IAAY,sBAmBX;AAnBD,WAAY,sBAAsB;IAChC,gBAAgB;IAChB,mE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C,EAAE,uGAAuG;YACrI,OAAO,KAAK,CAAC;QACf,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS;YACvC,OAAO,IAAI,CAAC;QACd,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACzD,OAAO,OAAO,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC;IACxC,CAAC;IACD,wFAAwF;IACjF,sBAAsB,CAAC,KAAc;QAC1C,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS;YACrC,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;IACD,0FAA0F;IACnF,wBAAwB,CAAC,KAAc;QAC5C,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS;YACvC,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC;CACF;AA1dD,8BA0dC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { PolygonOps } from \"../geometry3d/PolygonOps\";\r\nimport { TransformProps, XYZProps } from \"../geometry3d/XYZProps\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\r\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"../topology/Graph\";\r\nimport { Triangulator } from \"../topology/Triangulation\";\r\nimport { ClipPlane } from \"./ClipPlane\";\r\nimport { Clipper, ClipPlaneContainment } from \"./ClipUtils\";\r\nimport { ConvexClipPlaneSet } from \"./ConvexClipPlaneSet\";\r\nimport { UnionOfConvexClipPlaneSets, UnionOfConvexClipPlaneSetsProps } from \"./UnionOfConvexClipPlaneSets\";\r\nimport { AlternatingCCTreeNode } from \"./AlternatingConvexClipTree\";\r\nimport { Point3dArray } from \"../geometry3d/PointHelpers\";\r\nimport { PolylineOps } from \"../geometry3d/PolylineOps\";\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { AnnounceNumberNumber, AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\r\n// cspell:word zlow\r\n// cspell:word zhigh\r\n/**\r\n * Bit mask type for referencing subsets of 6 planes of range box.\r\n * @public\r\n */\r\nexport enum ClipMaskXYZRangePlanes {\r\n /** no planes */\r\n None = 0x00,\r\n /** low x plane */\r\n XLow = 0x01,\r\n /** high x plane */\r\n XHigh = 0x02,\r\n /** low y plane */\r\n YLow = 0x04,\r\n /** high y plane */\r\n YHigh = 0x08,\r\n /** low z plane */\r\n ZLow = 0x10,\r\n /** high z plane */\r\n ZHigh = 0x20,\r\n /** all x and y planes, neither z plane */\r\n XAndY = 0x0f,\r\n /** all 6 planes */\r\n All = 0x3f,\r\n}\r\n\r\n/**\r\n * Wire format describing a [[ClipPrimitive]] defined by a set of clip planes.\r\n * @public\r\n */\r\nexport interface ClipPrimitivePlanesProps {\r\n planes?: {\r\n /** The set of clip planes. */\r\n clips?: UnionOfConvexClipPlaneSetsProps;\r\n /** `true` if the primitive is invisible. */\r\n invisible?: boolean;\r\n };\r\n}\r\n\r\n/**\r\n * Wire format describing a [[ClipShape]].\r\n * @public\r\n */\r\nexport interface ClipPrimitiveShapeProps {\r\n /** The clip polygon. */\r\n shape?: {\r\n /** Points of the polygon, in the xy plane of the local coordinate system. */\r\n points?: XYZProps[];\r\n /** Transform from local to world. */\r\n trans?: TransformProps;\r\n /** Lower bound on z (in local coordinates). */\r\n zlow?: number;\r\n /** Upper bound on z (in local coordinates). */\r\n zhigh?: number;\r\n /** `true` if this shape is considered a hole (keep geometry outside of the polygon). */\r\n mask?: boolean;\r\n /** `true` if this shape is invisible. */\r\n invisible?: boolean;\r\n };\r\n}\r\n\r\n/** Wire format describing a [[ClipPrimitive]].\r\n * @public\r\n */\r\nexport type ClipPrimitiveProps = ClipPrimitivePlanesProps | ClipPrimitiveShapeProps;\r\n\r\n/**\r\n * * ClipPrimitive is a base class for clipping implementations that use\r\n * * A UnionOfConvexClipPlaneSets designated \"clipPlanes\".\r\n * * An \"invisible\" flag.\r\n * * When constructed directly, objects of type ClipPrimitive (directly, not through a derived class) will have just planes.\r\n * * Derived classes (e.g. ClipShape) carry additional data such as a swept shape.\r\n * * ClipPrimitive can be constructed with no planes.\r\n * * Derived class is responsible for filling the plane sets.\r\n * * At discretion of derived classes, plane construction can be done at construction time or \"on demand when\" queries\r\n * call `ensurePlaneSets ()`\r\n * * ClipPrimitive can be constructed directly with planes (and no derived class).\r\n * * The prevailing use is via a ClipShape derived class.\r\n * * The ClipShape has an \"isMask\" property\r\n * * isMask === false means the plane sets should cover the inside of its polygon.\r\n * * isMask === true means the plane sets should cover the outside of its polygon.\r\n * * Note that the ClipShape's `isMask` property and the ClipPrimitive's `isInvisible` property are distinct controls.\r\n * * In normal usage, callers get \"outside\" clip behavior using ONLY the ClipShape isMask property.\r\n * * The ClipShape happens to pass the _invisible bit down to ClipPlanes that it creates.\r\n * * At that level, the flag controls whether the cut edges are produced on the plane\r\n * @public\r\n */\r\nexport class ClipPrimitive implements Clipper {\r\n /** The (union of) convex regions. */\r\n protected _clipPlanes?: UnionOfConvexClipPlaneSets;\r\n /** If true, pointInside inverts the sense of the pointInside for the _clipPlanes */\r\n protected _invisible: boolean;\r\n /**\r\n * Get a reference to the `UnionOfConvexClipPlaneSets`.\r\n * * It triggers construction of the sets by `this.ensurePlaneSets()`.\r\n * * Derived class typically caches the set on the first such call.\r\n */\r\n public fetchClipPlanesRef(): UnionOfConvexClipPlaneSets | undefined {\r\n this.ensurePlaneSets();\r\n return this._clipPlanes;\r\n }\r\n /** Ask if this primitive is a hole. */\r\n public get invisible(): boolean {\r\n return this._invisible;\r\n }\r\n protected constructor(planeSet?: UnionOfConvexClipPlaneSets | undefined, isInvisible: boolean = false) {\r\n this._clipPlanes = planeSet;\r\n this._invisible = isInvisible;\r\n }\r\n /**\r\n * Create a ClipPrimitive, capturing the supplied plane set as the clip planes.\r\n * @param planes clipper\r\n * @param isInvisible set the invisible flag on the ClipPrimitive\r\n */\r\n public static createCapture(\r\n planes: UnionOfConvexClipPlaneSets | ConvexClipPlaneSet | undefined, isInvisible: boolean = false,\r\n ): ClipPrimitive {\r\n let planeData;\r\n if (planes instanceof UnionOfConvexClipPlaneSets)\r\n planeData = planes;\r\n if (planes instanceof ConvexClipPlaneSet)\r\n planeData = UnionOfConvexClipPlaneSets.createConvexSets([planes]);\r\n\r\n return new ClipPrimitive(planeData, isInvisible);\r\n }\r\n /** Emit json form of the clip planes */\r\n public toJSON(): ClipPrimitiveProps {\r\n const planes: ClipPrimitivePlanesProps[\"planes\"] = {};\r\n if (this._clipPlanes)\r\n planes.clips = this._clipPlanes.toJSON();\r\n\r\n if (this._invisible)\r\n planes.invisible = true;\r\n\r\n return { planes };\r\n }\r\n /**\r\n * Returns true if the planes are present.\r\n * * This can be false (for instance) if a ClipShape is holding a polygon but has not yet been asked to construct\r\n * the planes.\r\n */\r\n public arePlanesDefined(): boolean {\r\n return this._clipPlanes !== undefined;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): ClipPrimitive {\r\n const newPlanes = this._clipPlanes ? this._clipPlanes.clone() : undefined;\r\n const result = new ClipPrimitive(newPlanes, this._invisible);\r\n return result;\r\n }\r\n /**\r\n * Trigger (if needed) computation of plane sets (if applicable) in the derived class.\r\n * * Base class is no op.\r\n * * In derived class, on first call create planes sets from defining data (e.g. swept shape).\r\n * * In derived class, if planes are present leave them alone.\r\n */\r\n public ensurePlaneSets() { }\r\n /**\r\n * Return true if the point lies inside/on this polygon (or not inside/on if this polygon is a mask). Otherwise,\r\n * return false.\r\n * * Note that a derived class may choose to (a) implement its own test using its defining data, or (b) accept\r\n * this implementation using planes that it inserted in the base class.\r\n */\r\n public pointInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\r\n this.ensurePlaneSets();\r\n let inside = true;\r\n if (this._clipPlanes)\r\n inside = this._clipPlanes.isPointOnOrInside(point, onTolerance);\r\n return inside;\r\n }\r\n /**\r\n * Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public isPointOnOrInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean {\r\n this.ensurePlaneSets();\r\n let inside = true;\r\n if (this._clipPlanes)\r\n inside = this._clipPlanes.isPointOnOrInside(point, onTolerance);\r\n return inside;\r\n }\r\n /**\r\n * Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public announceClippedSegmentIntervals(\r\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber,\r\n ): boolean {\r\n this.ensurePlaneSets();\r\n let hasInsideParts = false;\r\n if (this._clipPlanes)\r\n hasInsideParts = this._clipPlanes.announceClippedSegmentIntervals(f0, f1, pointA, pointB, announce);\r\n return hasInsideParts;\r\n }\r\n /**\r\n * Method from [[Clipper]] interface.\r\n * * Implement as dispatch to clipPlaneSets as supplied by derived class.\r\n */\r\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n this.ensurePlaneSets();\r\n let hasInsideParts = false;\r\n if (this._clipPlanes)\r\n hasInsideParts = this._clipPlanes.announceClippedArcIntervals(arc, announce);\r\n return hasInsideParts;\r\n }\r\n /**\r\n * Multiply all ClipPlanes DPoint4d by matrix.\r\n * @param matrix matrix to apply.\r\n * @param invert if true, use in verse of the matrix.\r\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter).\r\n * @param matrix matrix to apply.\r\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding\r\n * effect on the plane is the inverse transpose of matrixA.\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n */\r\n public multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\r\n if (invert) { // form inverse once here, reuse for all planes\r\n const inverse = matrix.createInverse();\r\n if (!inverse)\r\n return false;\r\n return this.multiplyPlanesByMatrix4d(inverse, false, transpose);\r\n }\r\n if (this._clipPlanes)\r\n this._clipPlanes.multiplyPlanesByMatrix4d(matrix);\r\n return true;\r\n }\r\n /** Apply a transform to the clipper (e.g. transform all planes). */\r\n public transformInPlace(transform: Transform): boolean {\r\n if (this._clipPlanes)\r\n this._clipPlanes.transformInPlace(transform);\r\n return true;\r\n }\r\n /** Sets both the clip plane set and the mask set visibility */\r\n public setInvisible(invisible: boolean) {\r\n this._invisible = invisible;\r\n }\r\n /**\r\n * Return true if any plane of the primary clipPlanes has (a) non-zero z component in its normal vector and\r\n * (b) finite distance from origin.\r\n */\r\n public containsZClip(): boolean {\r\n if (this.fetchClipPlanesRef() !== undefined)\r\n for (const convexSet of this._clipPlanes!.convexSets)\r\n for (const plane of convexSet.planes)\r\n if (Math.abs(plane.inwardNormalRef.z) > 1.0e-6 && Math.abs(plane.distance) !== Number.MAX_VALUE)\r\n return true;\r\n return false;\r\n }\r\n /**\r\n * Quick test of whether the given points fall completely inside or outside.\r\n * @param points points to test.\r\n * @param ignoreInvisibleSetting if true, do the test with the clip planes and return that, ignoring the\r\n * invisible setting.\r\n */\r\n public classifyPointContainment(points: Point3d[], ignoreInvisibleSetting: boolean): ClipPlaneContainment {\r\n this.ensurePlaneSets();\r\n const planes = this._clipPlanes;\r\n let inside = ClipPlaneContainment.StronglyInside;\r\n if (planes)\r\n inside = planes.classifyPointContainment(points, false);\r\n if (this._invisible && !ignoreInvisibleSetting)\r\n switch (inside) {\r\n case ClipPlaneContainment.StronglyInside:\r\n return ClipPlaneContainment.StronglyOutside;\r\n case ClipPlaneContainment.StronglyOutside:\r\n return ClipPlaneContainment.StronglyInside;\r\n case ClipPlaneContainment.Ambiguous:\r\n return ClipPlaneContainment.Ambiguous;\r\n }\r\n return inside;\r\n }\r\n /**\r\n * Promote json object form to class instance.\r\n * * First try to convert to a ClipShape.\r\n * * then try as a standalone instance of the base class ClipPrimitive.\r\n */\r\n public static fromJSON(json: ClipPrimitiveProps | undefined): ClipPrimitive | undefined {\r\n if (!json)\r\n return undefined;\r\n const shape = ClipShape.fromClipShapeJSON(json as ClipPrimitiveShapeProps);\r\n if (shape)\r\n return shape;\r\n return ClipPrimitive.fromJSONClipPrimitive(json as ClipPrimitivePlanesProps);\r\n }\r\n /** Specific converter producing the base class ClipPrimitive. */\r\n public static fromJSONClipPrimitive(json: ClipPrimitivePlanesProps | undefined): ClipPrimitive | undefined {\r\n const planes = json?.planes;\r\n if (!planes)\r\n return undefined;\r\n\r\n const clipPlanes = planes.clips ? UnionOfConvexClipPlaneSets.fromJSON(planes.clips) : undefined;\r\n const invisible = undefined !== planes.invisible ? planes.invisible : false;\r\n return new ClipPrimitive(clipPlanes, invisible);\r\n }\r\n}\r\n\r\n/** Internal helper class holding XYZ components that serves as a representation of polygon edges defined by clip planes */\r\nclass PolyEdge {\r\n public pointA: Point3d;\r\n public pointB: Point3d;\r\n public normal: Vector3d;\r\n\r\n public constructor(origin: Point3d, next: Point3d, normal: Vector3d, z: number) {\r\n this.pointA = Point3d.create(origin.x, origin.y, z);\r\n this.pointB = Point3d.create(next.x, next.y, z);\r\n this.normal = normal;\r\n }\r\n // Assume both normals are unit length.\r\n // old logic: use difference of (previously computed) normals as perpendicular to bisector.\r\n public static makeUnitPerpendicularToBisector(edgeA: PolyEdge, edgeB: PolyEdge, reverse: boolean): Vector3d | undefined {\r\n let candidate = edgeB.normal.minus(edgeA.normal);\r\n if (candidate.normalize(candidate) === undefined) {\r\n candidate = Vector3d.createStartEnd(edgeA.pointA, edgeB.pointB);\r\n if (candidate.normalize(candidate) === undefined)\r\n return undefined;\r\n }\r\n if (reverse)\r\n candidate.scale(-1.0, candidate);\r\n return candidate;\r\n }\r\n}\r\n\r\n/**\r\n * A clipping volume defined by a shape (an array of 3d points using only x and y dimensions).\r\n * May be given either a ClipPlaneSet to store directly, or an array of polygon points as well as other parameters\r\n * for parsing ClipPlanes from the shape later.\r\n * @public\r\n */\r\nexport class ClipShape extends ClipPrimitive {\r\n /** Points of the polygon, in the xy plane of the local coordinate system. */\r\n protected _polygon: Point3d[];\r\n /** optional low z (in local coordinates). */\r\n protected _zLow?: number;\r\n /** optional high z (in local coordinates). */\r\n protected _zHigh?: number;\r\n /** true if this is considered a hole (keep geometry outside of the polygon). */\r\n protected _isMask: boolean;\r\n /** transform from local to world. */\r\n protected _transformFromClip?: Transform;\r\n /** Transform from world to local. */\r\n protected _transformToClip?: Transform;\r\n\r\n protected constructor(\r\n polygon: Point3d[] = [], zLow?: number, zHigh?: number, transform?: Transform, isMask: boolean = false, invisible: boolean = false,\r\n ) {\r\n super(undefined, invisible); // ClipPlaneSets will be set up later after storing points\r\n this._isMask = false;\r\n this._polygon = polygon;\r\n this.initSecondaryProps(isMask, zLow, zHigh, transform);\r\n }\r\n /** Returns true if this ClipShape is marked as invisible. */\r\n public override get invisible(): boolean {\r\n return this._invisible;\r\n }\r\n /** Return this transformFromClip, which may be undefined. */\r\n public get transformFromClip(): Transform | undefined {\r\n return this._transformFromClip;\r\n }\r\n /** Return this transformToClip, which may be undefined. */\r\n public get transformToClip(): Transform | undefined {\r\n return this._transformToClip;\r\n }\r\n /** Returns true if this ClipShape's transforms are currently set. */\r\n public get transformValid(): boolean {\r\n return this.transformFromClip !== undefined;\r\n }\r\n /** Returns true if this ClipShape's lower z boundary is set. */\r\n public get zLowValid(): boolean {\r\n return this._zLow !== undefined;\r\n }\r\n /** Returns true if this ClipShape's upper z boundary is set. */\r\n public get zHighValid(): boolean {\r\n return this._zHigh !== undefined;\r\n }\r\n /** Return true if this ClipShape has a local to world transform */\r\n public get transformIsValid(): boolean {\r\n return this._transformFromClip !== undefined;\r\n }\r\n /** Return this zLow, which may be undefined. */\r\n public get zLow(): number | undefined {\r\n return this._zLow;\r\n }\r\n /** Return this zHigh, which may be undefined. */\r\n public get zHigh(): number | undefined {\r\n return this._zHigh;\r\n }\r\n /** Returns a reference to this ClipShape's polygon array. */\r\n public get polygon(): Point3d[] {\r\n return this._polygon;\r\n }\r\n /** Returns true if this ClipShape is a masking set. */\r\n public get isMask(): boolean {\r\n return this._isMask;\r\n }\r\n /** Sets the polygon points array of this ClipShape to the array given (by reference). */\r\n public setPolygon(polygon: Point3d[]) {\r\n // Add closure point\r\n if (!polygon[0].isAlmostEqual(polygon[polygon.length - 1]))\r\n polygon.push(polygon[0].clone());\r\n this._polygon = polygon;\r\n }\r\n /**\r\n * If the ClipShape's associated `UnionOfConvexClipPlaneSets` is defined, do nothing.\r\n * If the ClipShape's associated `UnionOfConvexClipPlaneSets` is undefined, generate it from the `ClipShape`\r\n * and transform.\r\n */\r\n public override ensurePlaneSets() {\r\n if (this._clipPlanes !== undefined)\r\n return;\r\n this._clipPlanes = UnionOfConvexClipPlaneSets.createEmpty();\r\n this.parseClipPlanes(this._clipPlanes);\r\n if (this._transformFromClip)\r\n this._clipPlanes.transformInPlace(this._transformFromClip);\r\n }\r\n /**\r\n * Initialize the members of the ClipShape class that may at times be undefined.\r\n * zLow and zHigh default to Number.MAX_VALUE, and the transform defaults to an identity transform.\r\n */\r\n public initSecondaryProps(isMask: boolean, zLow?: number, zHigh?: number, transform?: Transform) {\r\n this._isMask = isMask;\r\n this._zLow = zLow;\r\n this._zHigh = zHigh;\r\n\r\n if (transform !== undefined) {\r\n this._transformFromClip = transform;\r\n this._transformToClip = transform.inverse(); // could be undefined\r\n } else {\r\n this._transformFromClip = Transform.createIdentity();\r\n this._transformToClip = Transform.createIdentity();\r\n }\r\n }\r\n /** Emit json object form */\r\n public override toJSON(): ClipPrimitiveShapeProps {\r\n const shape: ClipPrimitiveShapeProps[\"shape\"] = {\r\n points: this._polygon.map((pt) => pt.toJSON()),\r\n };\r\n if (this.invisible)\r\n shape.invisible = true;\r\n if (this._transformFromClip && !this._transformFromClip.isIdentity)\r\n shape.trans = this._transformFromClip.toJSON();\r\n if (this.isMask)\r\n shape.mask = true;\r\n if (typeof (this.zLow) !== \"undefined\" && this.zLow !== -Number.MAX_VALUE)\r\n shape.zlow = this.zLow;\r\n if (typeof (this.zHigh) !== \"undefined\" && this.zHigh !== Number.MAX_VALUE)\r\n shape.zhigh = this.zHigh;\r\n return { shape };\r\n }\r\n /** Parse `json` to a clip shape. */\r\n public static fromClipShapeJSON(json: ClipPrimitiveShapeProps | undefined, result?: ClipShape): ClipShape | undefined {\r\n const shape = json?.shape;\r\n if (!shape)\r\n return undefined;\r\n const points: Point3d[] = shape.points ? shape.points.map((pt) => Point3d.fromJSON(pt)) : [];\r\n const trans = shape.trans ? Transform.fromJSON(shape.trans) : undefined;\r\n const zLow = typeof shape.zlow === \"number\" ? shape.zlow : undefined;\r\n const zHigh = typeof shape.zhigh === \"number\" ? shape.zhigh : undefined;\r\n const isMask = typeof shape.mask === \"boolean\" && shape.mask;\r\n const invisible = typeof shape.invisible === \"boolean\" && shape.invisible;\r\n\r\n return ClipShape.createShape(points, zLow, zHigh, trans, isMask, invisible, result);\r\n }\r\n /** Returns a new ClipShape that is a deep copy of the ClipShape given */\r\n public static createFrom(other: ClipShape, result?: ClipShape): ClipShape {\r\n const retVal = ClipShape.createEmpty(false, false, undefined, result);\r\n retVal._invisible = other._invisible;\r\n for (const point of other._polygon) {\r\n retVal._polygon.push(point.clone());\r\n }\r\n retVal._isMask = other._isMask;\r\n retVal._zLow = other._zLow;\r\n retVal._zHigh = other._zHigh;\r\n retVal._transformToClip = other._transformToClip ? other._transformToClip.clone() : undefined;\r\n retVal._transformFromClip = other._transformFromClip ? other._transformFromClip.clone() : undefined;\r\n return retVal;\r\n }\r\n /** Create a new ClipShape from an array of points that make up a 2d shape (stores a deep copy of these points). */\r\n public static createShape(\r\n polygon: Point3d[] = [],\r\n zLow?: number,\r\n zHigh?: number,\r\n transform?: Transform,\r\n isMask: boolean = false,\r\n invisible: boolean = false,\r\n result?: ClipShape,\r\n ): ClipShape | undefined {\r\n if (polygon.length < 3)\r\n return undefined;\r\n const pPoints = polygon.slice(0);\r\n // Add closure point.\r\n if (pPoints[0].isAlmostEqual(pPoints[pPoints.length - 1]))\r\n pPoints[0].clone(pPoints[pPoints.length - 1]);\r\n else\r\n pPoints.push(pPoints[0].clone());\r\n if (result) {\r\n result._clipPlanes = undefined; // Start as undefined\r\n result._invisible = invisible;\r\n result._polygon = pPoints;\r\n result.initSecondaryProps(isMask, zLow, zHigh, transform);\r\n return result;\r\n } else {\r\n return new ClipShape(pPoints, zLow, zHigh, transform, isMask, invisible);\r\n }\r\n }\r\n /**\r\n * Create a ClipShape that exists as a 3 dimensional box of the range given. Optionally choose to\r\n * also store this shape's zLow and zHigh members from the range through the use of a RangePlaneBitMask.\r\n */\r\n public static createBlock(\r\n extremities: Range3d,\r\n clipMask: ClipMaskXYZRangePlanes,\r\n isMask: boolean = false,\r\n invisible: boolean = false,\r\n transform?: Transform,\r\n result?: ClipShape,\r\n ): ClipShape {\r\n const low = extremities.low;\r\n const high = extremities.high;\r\n const blockPoints: Point3d[] = [];\r\n for (let i = 0; i < 5; i++)\r\n blockPoints.push(Point3d.create());\r\n blockPoints[0].x = blockPoints[3].x = blockPoints[4].x = low.x;\r\n blockPoints[1].x = blockPoints[2].x = high.x;\r\n blockPoints[0].y = blockPoints[1].y = blockPoints[4].y = low.y;\r\n blockPoints[2].y = blockPoints[3].y = high.y;\r\n return ClipShape.createShape(\r\n blockPoints,\r\n (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZLow)) ? low.z : undefined,\r\n (ClipMaskXYZRangePlanes.None !== (clipMask & ClipMaskXYZRangePlanes.ZHigh)) ? high.z : undefined,\r\n transform,\r\n isMask,\r\n invisible,\r\n result,\r\n )!;\r\n }\r\n /** Creates a new ClipShape with undefined members and a polygon points array of zero length. */\r\n public static createEmpty(\r\n isMask = false, invisible: boolean = false, transform?: Transform, result?: ClipShape,\r\n ): ClipShape {\r\n if (result) {\r\n result._clipPlanes = undefined;\r\n result._invisible = invisible;\r\n result._polygon.length = 0;\r\n result.initSecondaryProps(isMask, undefined, undefined, transform);\r\n return result;\r\n }\r\n return new ClipShape([], undefined, undefined, transform, isMask, invisible);\r\n }\r\n /** Checks to ensure that the member polygon has an area, and that the polygon is closed. */\r\n public get isValidPolygon(): boolean {\r\n if (this._polygon.length < 3)\r\n return false;\r\n if (!this._polygon[0].isExactEqual(this._polygon[this._polygon.length - 1]))\r\n return false;\r\n return true;\r\n }\r\n /** Returns a deep copy of this instance of ClipShape, storing in an optional result. */\r\n public override clone(result?: ClipShape): ClipShape {\r\n return ClipShape.createFrom(this, result);\r\n }\r\n /**\r\n * Given the current polygon data, parses clip planes that together form an object, storing the result in\r\n * the set given, either clip planes or mask planes.\r\n */\r\n private parseClipPlanes(set: UnionOfConvexClipPlaneSets) {\r\n const points = this._polygon;\r\n if (points.length === 3 && !this._isMask && points[0].isExactEqual(points[points.length - 1])) {\r\n this.parseLinearPlanes(set, this._polygon[0], this._polygon[1]);\r\n return true;\r\n }\r\n if (!this.isMask) {\r\n const direction = PolygonOps.testXYPolygonTurningDirections(this.polygon);\r\n if (direction !== 0) {\r\n this.parseConvexPolygonPlanes(set, this._polygon, direction, false);\r\n return true;\r\n }\r\n }\r\n // REMARK: Pass all polygons to non-convex case. It will funnel\r\n // to concave case as appropriate.\r\n this.parsePolygonPlanes(set, this._polygon, this.isMask);\r\n return true;\r\n }\r\n /**\r\n * Given a start and end point, populate the given UnionOfConvexClipPlaneSets with ConvexClipPlaneSets\r\n * defining the bounded region of linear planes. Returns true if successful.\r\n */\r\n private parseLinearPlanes(\r\n set: UnionOfConvexClipPlaneSets, start: Point3d, end: Point3d, cameraFocalLength?: number,\r\n ): boolean {\r\n // Handles the degenerate case of 2 distinct points (used by select by line).\r\n const normal = start.vectorTo(end);\r\n if (normal.magnitude() === 0.0)\r\n return false;\r\n normal.normalize(normal);\r\n const convexSet = ConvexClipPlaneSet.createEmpty();\r\n if (cameraFocalLength === undefined) {\r\n const perpendicular = Vector2d.create(-normal.y, normal.x);\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndPoint(Vector3d.create(normal.x, normal.y), Point3d.createFrom(start), this._invisible)!,\r\n );\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndPoint(Vector3d.create(-normal.x, -normal.y), Point3d.createFrom(end), this._invisible)!,\r\n );\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndPoint(Vector3d.create(perpendicular.x, perpendicular.y), Point3d.createFrom(start), this._invisible)!,\r\n );\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndPoint(Vector3d.create(-perpendicular.x, -perpendicular.y), Point3d.createFrom(start), this._invisible)!,\r\n );\r\n } else {\r\n const start3d = Point3d.create(start.x, start.y, -cameraFocalLength);\r\n const end3d = Point3d.create(end.x, end.y, -cameraFocalLength);\r\n const vecEnd3d = Vector3d.createFrom(end3d);\r\n const perpendicular = vecEnd3d.crossProduct(Vector3d.createFrom(start3d)).normalize();\r\n let endNormal = Vector3d.createFrom(start3d).crossProduct(perpendicular!).normalize();\r\n convexSet.planes.push(ClipPlane.createNormalAndDistance(perpendicular!, 0.0, this._invisible)!);\r\n convexSet.planes.push(ClipPlane.createNormalAndDistance(endNormal!, 0.0, this._invisible)!);\r\n perpendicular!.negate();\r\n endNormal = vecEnd3d.crossProduct(perpendicular!).normalize();\r\n convexSet.planes.push(ClipPlane.createNormalAndDistance(perpendicular!, 0.0, this._invisible)!);\r\n convexSet.planes.push(ClipPlane.createNormalAndDistance(endNormal!, 0.0, this._invisible)!);\r\n }\r\n convexSet.addZClipPlanes(this._invisible, this._zLow, this._zHigh);\r\n set.addConvexSet(convexSet);\r\n return true;\r\n }\r\n /**\r\n * Given a convex polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets with\r\n * ConvexClipPlaneSets defining the bounded region. Returns true if successful.\r\n */\r\n private parseConvexPolygonPlanes(\r\n set: UnionOfConvexClipPlaneSets,\r\n polygon: Point3d[],\r\n direction: number,\r\n buildExteriorClipper: boolean,\r\n cameraFocalLength?: number,\r\n ): boolean {\r\n const samePointTolerance = 1.0e-8; // This could possibly be replaced with more widely used constants\r\n const edges: PolyEdge[] = [];\r\n // const reverse = (direction < 0) !== this._isMask;\r\n const reverse = direction < 0;\r\n for (let i = 0; i < polygon.length - 1; i++) {\r\n const z = (cameraFocalLength === undefined) ? 0.0 : -cameraFocalLength;\r\n const dir = Vector3d.createStartEnd(polygon[i], polygon[i + 1]);\r\n const magnitude = dir.magnitude();\r\n dir.normalize(dir);\r\n if (magnitude > samePointTolerance) {\r\n const normal = Vector3d.create(reverse ? dir.y : -dir.y, reverse ? -dir.x : dir.x);\r\n edges.push(new PolyEdge(polygon[i], polygon[i + 1], normal, z));\r\n }\r\n }\r\n if (edges.length < 3) {\r\n return false;\r\n }\r\n if (buildExteriorClipper) {\r\n const last = edges.length - 1;\r\n for (let i = 0; i <= last; i++) {\r\n const edge = edges[i];\r\n const prevEdge = edges[i ? (i - 1) : last];\r\n const nextEdge = edges[(i === last) ? 0 : (i + 1)];\r\n const convexSet = ConvexClipPlaneSet.createEmpty();\r\n const previousPerpendicular = PolyEdge.makeUnitPerpendicularToBisector(prevEdge, edge, !reverse);\r\n const nextPerpendicular = PolyEdge.makeUnitPerpendicularToBisector(edge, nextEdge, reverse);\r\n // Create three-sided fans from each edge. Note we could define the correct region\r\n // with only two planes for edge, but cannot then designate the \"interior\" status of the edges accurately.\r\n\r\n if (previousPerpendicular)\r\n convexSet.planes.push(ClipPlane.createNormalAndPoint(previousPerpendicular, edge.pointA, this._invisible, true)!);\r\n convexSet.planes.push(ClipPlane.createNormalAndPoint(edge.normal, edge.pointB, this._invisible, false)!);\r\n if (nextPerpendicular)\r\n convexSet.planes.push(ClipPlane.createNormalAndPoint(nextPerpendicular, nextEdge.pointA, this._invisible, true)!);\r\n set.addConvexSet(convexSet);\r\n set.addOutsideZClipSets(this._invisible, this._zLow, this._zHigh);\r\n }\r\n } else {\r\n const convexSet = ConvexClipPlaneSet.createEmpty();\r\n if (cameraFocalLength === undefined) {\r\n for (const edge of edges)\r\n convexSet.planes.push(ClipPlane.createNormalAndPoint(Vector3d.create(edge.normal.x, edge.normal.y), edge.pointA)!);\r\n } else {\r\n if (reverse)\r\n for (const edge of edges)\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndDistance(\r\n Vector3d.createFrom(edge.pointA).crossProduct(Vector3d.createFrom(edge.pointB)).normalize()!, 0.0,\r\n )!,\r\n );\r\n else\r\n for (const edge of edges)\r\n convexSet.planes.push(\r\n ClipPlane.createNormalAndDistance(\r\n Vector3d.createFrom(edge.pointB).crossProduct(Vector3d.createFrom(edge.pointA)).normalize()!, 0.0,\r\n )!,\r\n );\r\n }\r\n convexSet.addZClipPlanes(this._invisible, this._zLow, this._zHigh);\r\n set.addConvexSet(convexSet);\r\n }\r\n return true;\r\n }\r\n /**\r\n * Given a (possibly non-convex) polygon defined as an array of points, populate the given UnionOfConvexClipPlaneSets\r\n * with multiple ConvexClipPlaneSets defining the bounded region. Returns true if successful.\r\n */\r\n private parsePolygonPlanes(set: UnionOfConvexClipPlaneSets, polygon: Point3d[], isMask: boolean, cameraFocalLength?: number,\r\n ): boolean {\r\n const cleanPolygon = PolylineOps.compressDanglers(polygon, true);\r\n const announceFace = (_graph: HalfEdgeGraph, edge: HalfEdge): boolean => {\r\n if (!edge.isMaskSet(HalfEdgeMask.EXTERIOR)) {\r\n const convexFacetPoints = edge.collectAroundFace((node: HalfEdge): any => {\r\n if (!node.isMaskSet(HalfEdgeMask.EXTERIOR))\r\n return Point3d.create(node.x, node.y, 0);\r\n });\r\n // parseConvexPolygonPlanes expects a closed loop (pushing the reference doesn't matter)\r\n convexFacetPoints.push(convexFacetPoints[0].clone());\r\n const direction = PolygonOps.testXYPolygonTurningDirections(convexFacetPoints); // ###TODO: Can we expect a direction coming out of graph facet?\r\n this.parseConvexPolygonPlanes(set, convexFacetPoints, direction, false, cameraFocalLength);\r\n }\r\n return true;\r\n };\r\n if (isMask) {\r\n const polygonA = Point3dArray.clonePoint3dArray(cleanPolygon);\r\n const hullAndInlets = AlternatingCCTreeNode.createHullAndInletsForPolygon(polygonA);\r\n const allLoops = hullAndInlets.extractLoops();\r\n if (allLoops.length === 0)\r\n return false;\r\n const hull = allLoops[0];\r\n const direction1 = PolygonOps.testXYPolygonTurningDirections(hull); // ###TODO: Can we expect a direction coming out of graph facet?\r\n this.parseConvexPolygonPlanes(set, hull, -direction1, true, cameraFocalLength);\r\n for (let i = 1; i < allLoops.length; i++) {\r\n const triangulatedPolygon = Triangulator.createTriangulatedGraphFromSingleLoop(allLoops[i]);\r\n if (triangulatedPolygon) {\r\n Triangulator.flipTriangles(triangulatedPolygon);\r\n triangulatedPolygon.announceFaceLoops(announceFace);\r\n }\r\n }\r\n return true;\r\n } else {\r\n const triangulatedPolygon = Triangulator.createTriangulatedGraphFromSingleLoop(cleanPolygon);\r\n if (triangulatedPolygon === undefined)\r\n return false;\r\n Triangulator.flipTriangles(triangulatedPolygon);\r\n triangulatedPolygon.announceFaceLoops(announceFace);\r\n }\r\n return true;\r\n }\r\n /**\r\n * Multiply all ClipPlanes DPoint4d by matrix.\r\n * @param matrix matrix to apply.\r\n * @param invert if true, use in verse of the matrix.\r\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter).\r\n * @param matrix matrix to apply.\r\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding effect\r\n * on the plane is the inverse transpose of matrixA.\r\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\r\n * * Both params default to true to get the full effect of transforming space.\r\n */\r\n public override multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\r\n this.ensurePlaneSets();\r\n return super.multiplyPlanesByMatrix4d(matrix, invert, transpose);\r\n }\r\n /**\r\n * Apply `transform` to the local to world (`transformFromClip`) transform.\r\n * * The world to local transform (`transformToClip` is recomputed from the (changed) `transformToClip`\r\n * * the transform is passed to the base class to be applied to clip plane form of the clipper.\r\n */\r\n public override transformInPlace(transform: Transform): boolean {\r\n if (transform.isIdentity)\r\n return true;\r\n super.transformInPlace(transform);\r\n if (this._transformFromClip)\r\n transform.multiplyTransformTransform(this._transformFromClip, this._transformFromClip);\r\n else\r\n this._transformFromClip = transform.clone();\r\n this._transformToClip = this._transformFromClip.inverse(); // could be undefined\r\n return true;\r\n }\r\n /**\r\n * Return true if\r\n * * at least one point is defined\r\n * * The local to world transform (transformFromClip) either\r\n * * is undefined\r\n * * has no xy parts in its column Z (local frame Z is parallel to global Z)\r\n */\r\n public get isXYPolygon(): boolean {\r\n if (this._polygon.length === 0) // Note: This is a lenient check, as points array could also contain less than 3 points (not a polygon)\r\n return false;\r\n if (this._transformFromClip === undefined)\r\n return true;\r\n const zVector = this._transformFromClip.matrix.columnZ();\r\n return zVector.magnitudeXY() < 1.0e-8;\r\n }\r\n /** Transform the input point in place using this instance's `transformToClip` member */\r\n public performTransformToClip(point: Point3d): void {\r\n if (this._transformToClip !== undefined)\r\n this._transformToClip.multiplyPoint3d(point, point);\r\n }\r\n /** Transform the input point in place using this instance's `transformFromClip` member */\r\n public performTransformFromClip(point: Point3d): void {\r\n if (this._transformFromClip !== undefined)\r\n this._transformFromClip.multiplyPoint3d(point, point);\r\n }\r\n}\r\n"]}
@@ -59,7 +59,14 @@ export declare class PathFragment {
59
59
  * Note that proportional calculation does NOT account for non-uniform parameterization in the child curve.
60
60
  */
61
61
  chainDistanceToInterpolatedChildFraction(distance: number): number;
62
- /** Convert the given chainDistance to a fraction along this childCurve using `moveSignedDistanceFromFraction`. */
62
+ /**
63
+ * Convert the given chainDistance to a fraction along this childCurve using `moveSignedDistanceFromFraction`.
64
+ * @param chainDistance signed distance along the chain.
65
+ * @param allowExtrapolation whether to extrapolate off the start of the chain if `chainDistance` is negative,
66
+ * or off the end of the chain if `chainDistance` is more than `chainLength`. Extending the chain in this manner
67
+ * may result in significant inaccuracy, especially for negative distances.
68
+ * @return fraction local to the relevant chain primitive corresponding to the chain position at `chainDistance`.
69
+ */
63
70
  chainDistanceToAccurateChildFraction(chainDistance: number, allowExtrapolation?: boolean): number;
64
71
  /**
65
72
  * Return the scale factor to map childCurve fraction derivatives to chain fraction derivatives.
@@ -109,8 +116,9 @@ export declare class CurveChainWithDistanceIndex extends CurvePrimitive {
109
116
  /**
110
117
  * Create a clone, transformed and with its own distance index.
111
118
  * @param transform transform to apply in the clone.
119
+ * @param options how finely to stroke the path to create the distance index
112
120
  */
113
- cloneTransformed(transform: Transform): CurveChainWithDistanceIndex | undefined;
121
+ cloneTransformed(transform: Transform, options?: StrokeOptions): CurveChainWithDistanceIndex | undefined;
114
122
  /**
115
123
  * Reference to the contained path.
116
124
  * * Do not modify the path. The distance index will be wrong.
@@ -121,10 +129,20 @@ export declare class CurveChainWithDistanceIndex extends CurvePrimitive {
121
129
  * * Do not modify.
122
130
  */
123
131
  get fragments(): PathFragment[];
124
- /** Return a deep clone */
125
- clone(): CurveChainWithDistanceIndex;
126
- /** Return a deep clone */
127
- clonePartialCurve(fractionA: number, fractionB: number): CurveChainWithDistanceIndex | undefined;
132
+ /**
133
+ * Return a deep clone with its own distance index.
134
+ * @param options how finely to stroke the path to create the distance index
135
+ */
136
+ clone(options?: StrokeOptions): CurveChainWithDistanceIndex;
137
+ /**
138
+ * Return a portion of this curve with its own distance index.
139
+ * * Passing a chain detail containing a `childDetail` is more accurate for extending the instance beyond [0,1].
140
+ * Such details are returned by e.g., [[CurveCurve.intersectionXYPairs]].
141
+ * @param fractionA start fraction or chain detail
142
+ * @param fractionB end fraction or chain detail
143
+ * @param options how finely to stroke the path to create the distance index
144
+ */
145
+ clonePartialCurve(fractionA: number | CurveLocationDetail, fractionB: number | CurveLocationDetail, options?: StrokeOptions): CurveChainWithDistanceIndex | undefined;
128
146
  /**
129
147
  * Ask if the curve is within tolerance of a plane.
130
148
  * @returns Returns true if the curve is completely within tolerance of the plane.
@@ -309,8 +327,9 @@ export declare class CurveChainWithDistanceIndex extends CurvePrimitive {
309
327
  projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined;
310
328
  /**
311
329
  * Compute the global chain detail corresponding to a local child detail.
312
- * @param childDetail the local (fragment) detail, captured.
313
- * @returns newly allocated global (chain) detail with `childDetail` field pointing to the input, and `a` field copied from the input
330
+ * @param childDetail the local (fragment) detail, captured as-is.
331
+ * @returns newly allocated global (chain) detail with its `childDetail` field pointing to the input, and its `a`
332
+ * field copied from the input.
314
333
  */
315
334
  computeChainDetail(childDetail: CurveLocationDetail): CurveLocationDetail | undefined;
316
335
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"CurveChainWithDistanceIndex.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveChainWithDistanceIndex.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAA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M,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,mBAAmB,GACnG,mBAAmB;IActB;;;;;;;;OAQG;WACW,yBAAyB,CACrC,KAAK,GAAE,OAAc,GACpB;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE;IAYrF;;;;;;;;;OASG;IACa,YAAY,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,2BAA2B,GAAG,mBAAmB,GAAG,SAAS;IA0CvH;;;;;OAKG;IACa,iBAAiB,CAC/B,uBAAuB,EAAE,MAAM,GAAG,aAAa,GAC9C,cAAc,GAAG,cAAc,EAAE,GAAG,SAAS;IAchD;;;;;;;OAOG;IACa,uBAAuB,CAAC,GAAG,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;IAGtG;;;;;OAKG;IACI,kBAAkB,CAAC,WAAW,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,SAAS;IAc5F;;;;;;;;;;;OAWG;WACW,+BAA+B,CAAC,KAAK,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,2BAA2B,EAAE,MAAM,CAAC,EAAE,2BAA2B,EAAE,gBAAgB,CAAC,EAAE,OAAO,GAAG,uBAAuB,EAAE;CAmBnO"}
@@ -78,7 +78,14 @@ class PathFragment {
78
78
  chainDistanceToInterpolatedChildFraction(distance) {
79
79
  return Geometry_1.Geometry.inverseInterpolate(this.childFraction0, this.chainDistance0, this.childFraction1, this.chainDistance1, distance, this.childFraction0); // the interval must have nonzero length so division should be safe
80
80
  }
81
- /** Convert the given chainDistance to a fraction along this childCurve using `moveSignedDistanceFromFraction`. */
81
+ /**
82
+ * Convert the given chainDistance to a fraction along this childCurve using `moveSignedDistanceFromFraction`.
83
+ * @param chainDistance signed distance along the chain.
84
+ * @param allowExtrapolation whether to extrapolate off the start of the chain if `chainDistance` is negative,
85
+ * or off the end of the chain if `chainDistance` is more than `chainLength`. Extending the chain in this manner
86
+ * may result in significant inaccuracy, especially for negative distances.
87
+ * @return fraction local to the relevant chain primitive corresponding to the chain position at `chainDistance`.
88
+ */
82
89
  chainDistanceToAccurateChildFraction(chainDistance, allowExtrapolation) {
83
90
  const childDetail = this.childCurve.moveSignedDistanceFromFraction(this.childFraction0, chainDistance - this.chainDistance0, allowExtrapolation ?? false);
84
91
  return childDetail.fraction;
@@ -200,18 +207,19 @@ class CurveChainWithDistanceIndex extends CurvePrimitive_1.CurvePrimitive {
200
207
  super();
201
208
  /** String name for schema properties */
202
209
  this.curvePrimitiveType = "curveChainWithDistanceIndex";
203
- this._path = path instanceof Path_1.Path ? path : Path_1.Path.create(...path.children);
210
+ this._path = path instanceof Path_1.Path ? path : Path_1.Path.create(...path.children); // Loop semantics would be confusing
204
211
  this._fragments = fragments;
205
212
  this._totalLength = fragments.length > 0 ? fragments[fragments.length - 1].chainDistance1 : 0;
206
213
  }
207
214
  /**
208
215
  * Create a clone, transformed and with its own distance index.
209
216
  * @param transform transform to apply in the clone.
217
+ * @param options how finely to stroke the path to create the distance index
210
218
  */
211
- cloneTransformed(transform) {
219
+ cloneTransformed(transform, options) {
212
220
  const c = this._path.clone();
213
221
  if (c.tryTransformInPlace(transform))
214
- return CurveChainWithDistanceIndex.createCapture(c);
222
+ return CurveChainWithDistanceIndex.createCapture(c, options);
215
223
  return undefined;
216
224
  }
217
225
  /**
@@ -228,24 +236,34 @@ class CurveChainWithDistanceIndex extends CurvePrimitive_1.CurvePrimitive {
228
236
  get fragments() {
229
237
  return this._fragments;
230
238
  }
231
- /** Return a deep clone */
232
- clone() {
239
+ /**
240
+ * Return a deep clone with its own distance index.
241
+ * @param options how finely to stroke the path to create the distance index
242
+ */
243
+ clone(options) {
233
244
  const c = this._path.clone();
234
- return CurveChainWithDistanceIndex.createCapture(c);
245
+ return CurveChainWithDistanceIndex.createCapture(c, options);
235
246
  }
236
- /** Return a deep clone */
237
- clonePartialCurve(fractionA, fractionB) {
238
- if (fractionA === fractionB)
247
+ /**
248
+ * Return a portion of this curve with its own distance index.
249
+ * * Passing a chain detail containing a `childDetail` is more accurate for extending the instance beyond [0,1].
250
+ * Such details are returned by e.g., [[CurveCurve.intersectionXYPairs]].
251
+ * @param fractionA start fraction or chain detail
252
+ * @param fractionB end fraction or chain detail
253
+ * @param options how finely to stroke the path to create the distance index
254
+ */
255
+ clonePartialCurve(fractionA, fractionB, options) {
256
+ const haveDetailA = fractionA instanceof CurveLocationDetail_1.CurveLocationDetail;
257
+ const haveDetailB = fractionB instanceof CurveLocationDetail_1.CurveLocationDetail;
258
+ let chainFractionA = haveDetailA ? fractionA.fraction : fractionA;
259
+ let chainFractionB = haveDetailB ? fractionB.fraction : fractionB;
260
+ if (chainFractionA === chainFractionB)
239
261
  return undefined;
240
- let fracA = fractionA;
241
- let fracB = fractionB;
242
- const reversed = fractionA > fractionB;
243
- if (reversed) {
244
- fracA = fractionB;
245
- fracB = fractionA;
246
- }
247
- const chainDistanceA = fracA * this._totalLength;
248
- const chainDistanceB = fracB * this._totalLength;
262
+ const reversed = chainFractionA > chainFractionB;
263
+ if (reversed)
264
+ [chainFractionA, chainFractionB] = [chainFractionB, chainFractionA];
265
+ const chainDistanceA = chainFractionA * this._totalLength;
266
+ const chainDistanceB = chainFractionB * this._totalLength;
249
267
  const fragmentA = this.chainDistanceToFragment(chainDistanceA, true);
250
268
  if (undefined === fragmentA)
251
269
  return undefined;
@@ -258,8 +276,8 @@ class CurveChainWithDistanceIndex extends CurvePrimitive_1.CurvePrimitive {
258
276
  const childCurveIndexB = this._path.childIndex(fragmentB.childCurve, true);
259
277
  if (undefined === childCurveIndexB)
260
278
  return undefined;
261
- const childFractionA = fragmentA.chainDistanceToAccurateChildFraction(chainDistanceA, true);
262
- const childFractionB = fragmentB.chainDistanceToAccurateChildFraction(chainDistanceB, true);
279
+ const childFractionA = haveDetailA && fractionA.childDetail ? fractionA.childDetail.fraction : fragmentA.chainDistanceToAccurateChildFraction(chainDistanceA, true);
280
+ const childFractionB = haveDetailB && fractionB.childDetail ? fractionB.childDetail.fraction : fragmentB.chainDistanceToAccurateChildFraction(chainDistanceB, true);
263
281
  // add a (possibly reversed) partial clone to newPath
264
282
  const newPath = Path_1.Path.create();
265
283
  const addPartialChild = (childCurve, childFraction0, childFraction1, reversedClone) => {
@@ -285,7 +303,7 @@ class CurveChainWithDistanceIndex extends CurvePrimitive_1.CurvePrimitive {
285
303
  if (fragmentA.childCurve === fragmentB.childCurve) {
286
304
  // the two distances are within the same curve.
287
305
  if (addPartialChild(fragmentA.childCurve, childFractionA, childFractionB, reversed))
288
- return CurveChainWithDistanceIndex.createCapture(newPath); // singleton -- children[] does not need to be reversed.
306
+ return CurveChainWithDistanceIndex.createCapture(newPath, options); // singleton -- children[] does not need to be reversed.
289
307
  return undefined;
290
308
  }
291
309
  addPartialChild(this._path.children[childCurveIndexA], childFractionA, 1.0, reversed);
@@ -297,7 +315,7 @@ class CurveChainWithDistanceIndex extends CurvePrimitive_1.CurvePrimitive {
297
315
  // This reverses array entries but not orientation within each curve ...
298
316
  if (reversed)
299
317
  newPath.children.reverse();
300
- return CurveChainWithDistanceIndex.createCapture(newPath);
318
+ return CurveChainWithDistanceIndex.createCapture(newPath, options);
301
319
  }
302
320
  /**
303
321
  * Ask if the curve is within tolerance of a plane.
@@ -734,8 +752,9 @@ class CurveChainWithDistanceIndex extends CurvePrimitive_1.CurvePrimitive {
734
752
  }
735
753
  /**
736
754
  * Compute the global chain detail corresponding to a local child detail.
737
- * @param childDetail the local (fragment) detail, captured.
738
- * @returns newly allocated global (chain) detail with `childDetail` field pointing to the input, and `a` field copied from the input
755
+ * @param childDetail the local (fragment) detail, captured as-is.
756
+ * @returns newly allocated global (chain) detail with its `childDetail` field pointing to the input, and its `a`
757
+ * field copied from the input.
739
758
  */
740
759
  computeChainDetail(childDetail) {
741
760
  if (!childDetail.curve)