@itwin/core-geometry 4.10.0-dev.2 → 4.10.0-dev.22
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.
- package/CHANGELOG.md +31 -1
- package/lib/cjs/Geometry.d.ts +2 -2
- package/lib/cjs/Geometry.js +2 -2
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.d.ts +7 -7
- package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +21 -10
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +64 -37
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +27 -8
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +44 -25
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +10 -12
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +16 -43
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +2 -2
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +1 -0
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +33 -59
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +22 -7
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +128 -68
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +14 -11
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.d.ts +5 -5
- package/lib/cjs/geometry3d/Angle.js +5 -5
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +101 -13
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +156 -57
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +9 -15
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +21 -15
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +6 -5
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +6 -5
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +2 -2
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +4 -2
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +4 -2
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry4d/Map4d.d.ts +5 -5
- package/lib/cjs/geometry4d/Map4d.js +5 -5
- package/lib/cjs/geometry4d/Map4d.js.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.d.ts +4 -7
- package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.js +4 -7
- package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts +37 -36
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +90 -105
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.d.ts +3 -3
- package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/Geometry.d.ts +2 -2
- package/lib/esm/Geometry.js +2 -2
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.d.ts +7 -7
- package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js +1 -1
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +21 -10
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +64 -37
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +27 -8
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +44 -25
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +10 -12
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +16 -43
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +2 -2
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +1 -0
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +33 -59
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +22 -7
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +128 -68
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +14 -11
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/esm/geometry3d/Angle.d.ts +5 -5
- package/lib/esm/geometry3d/Angle.js +5 -5
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +101 -13
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +156 -57
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +9 -15
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +21 -15
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +6 -5
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +6 -5
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +2 -2
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +4 -2
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +4 -2
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry4d/Map4d.d.ts +5 -5
- package/lib/esm/geometry4d/Map4d.js +5 -5
- package/lib/esm/geometry4d/Map4d.js.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.d.ts +4 -7
- package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.js +4 -7
- package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts +37 -36
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +90 -105
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.d.ts +3 -3
- package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js +1 -1
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/package.json +7 -19
|
@@ -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,oEA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AC,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 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,sB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QAAQ,CAAC,MAAM,KAAK,CAAC,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"]}
|
package/lib/cjs/curve/Arc3d.d.ts
CHANGED
|
@@ -245,21 +245,32 @@ export declare class Arc3d extends CurvePrimitive implements BeJSONFunctions {
|
|
|
245
245
|
static create(center: Point3d | undefined, vector0: Vector3d, vector90: Vector3d, sweep?: AngleSweep, result?: Arc3d): Arc3d;
|
|
246
246
|
/**
|
|
247
247
|
* Create an elliptical arc from three points on the ellipse: two points on an axis and one in between.
|
|
248
|
-
* @param
|
|
249
|
-
* @param
|
|
250
|
-
* @param
|
|
251
|
-
* @param sweep angular sweep, measured from `
|
|
252
|
-
* For a half-ellipse from `
|
|
248
|
+
* @param start start of arc, on an axis
|
|
249
|
+
* @param middle point on arc somewhere between `start` and `end`
|
|
250
|
+
* @param end point on arc directly opposite `start`
|
|
251
|
+
* @param sweep angular sweep, measured from `start` in the direction of `middle`.
|
|
252
|
+
* For a half-ellipse from `start` to `end` passing through `middle`, pass `AngleSweep.createStartEndDegrees(0,180)`.
|
|
253
253
|
* Default value is full sweep to create the entire ellipse.
|
|
254
254
|
* @param result optional preallocated result
|
|
255
255
|
* @returns elliptical arc, or undefined if construction impossible.
|
|
256
256
|
*/
|
|
257
|
-
static createStartMiddleEnd(
|
|
257
|
+
static createStartMiddleEnd(start: XYAndZ, middle: XYAndZ, end: XYAndZ, sweep?: AngleSweep, result?: Arc3d): Arc3d | undefined;
|
|
258
258
|
/**
|
|
259
259
|
* Create a circular arc defined by start point, tangent at start point, and end point.
|
|
260
|
-
*
|
|
260
|
+
* * The circular arc is swept from `start` to `end` in the direction of `tangentAtStart`.
|
|
261
|
+
* * If `tangentAtStart` is parallel to the line segment from `start` to `end`, return the line segment.
|
|
261
262
|
*/
|
|
262
263
|
static createCircularStartTangentEnd(start: Point3d, tangentAtStart: Vector3d, end: Point3d, result?: Arc3d): Arc3d | LineSegment3d;
|
|
264
|
+
/**
|
|
265
|
+
* Create a circular arc from start point, tangent at start, radius, optional plane normal, arc sweep.
|
|
266
|
+
* * The vector from start point to center is in the direction of upVector crossed with tangentA.
|
|
267
|
+
* @param start start point.
|
|
268
|
+
* @param tangentAtStart vector in tangent direction at the start.
|
|
269
|
+
* @param radius signed radius.
|
|
270
|
+
* @param upVector optional out-of-plane vector. Defaults to positive Z.
|
|
271
|
+
* @param sweep angular range. If single `Angle` is given, start angle is at 0 degrees (the start point).
|
|
272
|
+
*/
|
|
273
|
+
static createCircularStartTangentRadius(start: Point3d, tangentAtStart: Vector3d, radius: number, upVector?: Vector3d, sweep?: Angle | AngleSweep): Arc3d | undefined;
|
|
263
274
|
/**
|
|
264
275
|
* Create a circular arc defined by start and end points and radius.
|
|
265
276
|
* @param start start point of the arc
|
|
@@ -422,7 +433,7 @@ export declare class Arc3d extends CurvePrimitive implements BeJSONFunctions {
|
|
|
422
433
|
circularRadiusXY(): number | undefined;
|
|
423
434
|
/** If the arc is circular, return its radius. Otherwise return undefined */
|
|
424
435
|
circularRadius(): number | undefined;
|
|
425
|
-
/** Return the larger of the two defining vectors. */
|
|
436
|
+
/** Return the larger length of the two defining vectors. */
|
|
426
437
|
maxVectorLength(): number;
|
|
427
438
|
/**
|
|
428
439
|
* Compute intersections with a plane.
|
|
@@ -516,7 +527,7 @@ export declare class Arc3d extends CurvePrimitive implements BeJSONFunctions {
|
|
|
516
527
|
*/
|
|
517
528
|
toJSON(): any;
|
|
518
529
|
/** Test if this arc is almost equal to another GeometryQuery object */
|
|
519
|
-
isAlmostEqual(otherGeometry: GeometryQuery): boolean;
|
|
530
|
+
isAlmostEqual(otherGeometry: GeometryQuery, distanceTol?: number, radianTol?: number): boolean;
|
|
520
531
|
/** Emit strokes to caller-supplied linestring */
|
|
521
532
|
emitStrokes(dest: LineString3d, options?: StrokeOptions): void;
|
|
522
533
|
/** Emit strokes to caller-supplied handler */
|
|
@@ -567,7 +578,7 @@ export declare class Arc3d extends CurvePrimitive implements BeJSONFunctions {
|
|
|
567
578
|
* * `point` is the `point1` input.
|
|
568
579
|
* * both fractions are zero
|
|
569
580
|
* * `arc` is undefined.
|
|
570
|
-
* @param point0 first point of path
|
|
581
|
+
* @param point0 first point of path (the point before the point of inflection)
|
|
571
582
|
* @param point1 second point of path (the point of inflection)
|
|
572
583
|
* @param point2 third point of path (the point after the point of inflection)
|
|
573
584
|
* @param radius arc radius
|
|
@@ -1 +1 @@
|
|
|
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,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK;IAa9E;;;;;;;OAOG;IACI,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;IAW/C;;;;;;OAMG;IACa,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,kCAAkC,GAAG,OAAO;IAG/G,kGAAkG;IAC3F,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,GAAG,SAAS;IAkBnE;;;;;;;;;;;;;;;;;;;OAmBG;WACW,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY;IAgC9G,8DAA8D;IACvD,uBAAuB,CAAC,WAAW,EAAE,MAAM;IAGlD,6GAA6G;IACtG,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;IAclE;;;OAGG;IACa,iBAAiB,CAC/B,uBAAuB,EAAE,MAAM,GAAG,aAAa,GAC9C,cAAc,GAAG,cAAc,EAAE,GAAG,SAAS;IA4BhD;;;;;OAKG;IACa,uBAAuB,CAAC,GAAG,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;IAItG;;;;OAIG;IACI,sCAAsC,CAAC,OAAO,CAAC,EAAE,iCAAiC,GAAG,UAAU,GAAG,KAAK,GAAG,SAAS;CAS3H"}
|
package/lib/cjs/curve/Arc3d.js
CHANGED
|
@@ -291,19 +291,19 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
291
291
|
}
|
|
292
292
|
/**
|
|
293
293
|
* Create an elliptical arc from three points on the ellipse: two points on an axis and one in between.
|
|
294
|
-
* @param
|
|
295
|
-
* @param
|
|
296
|
-
* @param
|
|
297
|
-
* @param sweep angular sweep, measured from `
|
|
298
|
-
* For a half-ellipse from `
|
|
294
|
+
* @param start start of arc, on an axis
|
|
295
|
+
* @param middle point on arc somewhere between `start` and `end`
|
|
296
|
+
* @param end point on arc directly opposite `start`
|
|
297
|
+
* @param sweep angular sweep, measured from `start` in the direction of `middle`.
|
|
298
|
+
* For a half-ellipse from `start` to `end` passing through `middle`, pass `AngleSweep.createStartEndDegrees(0,180)`.
|
|
299
299
|
* Default value is full sweep to create the entire ellipse.
|
|
300
300
|
* @param result optional preallocated result
|
|
301
301
|
* @returns elliptical arc, or undefined if construction impossible.
|
|
302
302
|
*/
|
|
303
|
-
static createStartMiddleEnd(
|
|
304
|
-
const center = Point3dVector3d_1.Point3d.createAdd2Scaled(
|
|
305
|
-
const vector0 = Point3dVector3d_1.Vector3d.createStartEnd(center,
|
|
306
|
-
const vector1 = Point3dVector3d_1.Vector3d.createStartEnd(center,
|
|
303
|
+
static createStartMiddleEnd(start, middle, end, sweep, result) {
|
|
304
|
+
const center = Point3dVector3d_1.Point3d.createAdd2Scaled(start, 0.5, end, 0.5);
|
|
305
|
+
const vector0 = Point3dVector3d_1.Vector3d.createStartEnd(center, start);
|
|
306
|
+
const vector1 = Point3dVector3d_1.Vector3d.createStartEnd(center, middle);
|
|
307
307
|
const v0DotV1 = vector0.dotProduct(vector1);
|
|
308
308
|
const v0Len2 = vector0.magnitudeSquared();
|
|
309
309
|
if (Math.abs(v0DotV1) >= v0Len2)
|
|
@@ -311,7 +311,7 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
311
311
|
const normal = vector0.crossProduct(vector1);
|
|
312
312
|
const vector90 = normal.unitCrossProductWithDefault(vector0, 0, 0, 0);
|
|
313
313
|
const v1DotV90 = vector1.dotProduct(vector90);
|
|
314
|
-
//
|
|
314
|
+
// solve the standard ellipse equation for the unknown axis length, given local coords of middle (v0.v1/||v0||, v90.v1)
|
|
315
315
|
const v90Len = Geometry_1.Geometry.safeDivideFraction(v0Len2 * v1DotV90, Math.sqrt(v0Len2 * v0Len2 - v0DotV1 * v0DotV1), 0);
|
|
316
316
|
if (Geometry_1.Geometry.isSmallMetricDistanceSquared(v90Len))
|
|
317
317
|
return undefined;
|
|
@@ -320,33 +320,55 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
320
320
|
}
|
|
321
321
|
/**
|
|
322
322
|
* Create a circular arc defined by start point, tangent at start point, and end point.
|
|
323
|
-
*
|
|
323
|
+
* * The circular arc is swept from `start` to `end` in the direction of `tangentAtStart`.
|
|
324
|
+
* * If `tangentAtStart` is parallel to the line segment from `start` to `end`, return the line segment.
|
|
324
325
|
*/
|
|
325
326
|
static createCircularStartTangentEnd(start, tangentAtStart, end, result) {
|
|
326
|
-
//
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
const
|
|
344
|
-
const sweep = AngleSweep_1.AngleSweep.
|
|
327
|
+
// see itwinjs-core\core\geometry\internaldocs\Arc3d.md to clarify below algorithm
|
|
328
|
+
const startToEnd = Point3dVector3d_1.Vector3d.createStartEnd(start, end);
|
|
329
|
+
const frame = Matrix3d_1.Matrix3d.createRigidFromColumns(tangentAtStart, startToEnd, Geometry_1.AxisOrder.XYZ);
|
|
330
|
+
if (frame !== undefined) {
|
|
331
|
+
const vv = startToEnd.dotProduct(startToEnd);
|
|
332
|
+
const vw = frame.dotColumnY(startToEnd);
|
|
333
|
+
const radius = Geometry_1.Geometry.conditionalDivideCoordinate(vv, 2 * vw);
|
|
334
|
+
if (radius !== undefined) {
|
|
335
|
+
const vector0 = frame.columnY();
|
|
336
|
+
vector0.scaleInPlace(-radius); // center to start
|
|
337
|
+
const vector90 = frame.columnX();
|
|
338
|
+
vector90.scaleInPlace(radius);
|
|
339
|
+
const centerToEnd = vector0.plus(startToEnd);
|
|
340
|
+
const sweepAngle = vector0.angleTo(centerToEnd);
|
|
341
|
+
let sweepRadians = sweepAngle.radians; // always positive and less than PI
|
|
342
|
+
if (tangentAtStart.dotProduct(centerToEnd) < 0.0) // sweepRadians is the wrong way
|
|
343
|
+
sweepRadians = 2.0 * Math.PI - sweepRadians;
|
|
344
|
+
const center = start.plusScaled(vector0, -1.0);
|
|
345
|
+
const sweep = AngleSweep_1.AngleSweep.createStartEndRadians(0.0, sweepRadians);
|
|
345
346
|
return Arc3d.create(center, vector0, vector90, sweep, result);
|
|
346
347
|
}
|
|
347
348
|
}
|
|
348
349
|
return LineSegment3d_1.LineSegment3d.create(start, end);
|
|
349
350
|
}
|
|
351
|
+
/**
|
|
352
|
+
* Create a circular arc from start point, tangent at start, radius, optional plane normal, arc sweep.
|
|
353
|
+
* * The vector from start point to center is in the direction of upVector crossed with tangentA.
|
|
354
|
+
* @param start start point.
|
|
355
|
+
* @param tangentAtStart vector in tangent direction at the start.
|
|
356
|
+
* @param radius signed radius.
|
|
357
|
+
* @param upVector optional out-of-plane vector. Defaults to positive Z.
|
|
358
|
+
* @param sweep angular range. If single `Angle` is given, start angle is at 0 degrees (the start point).
|
|
359
|
+
*/
|
|
360
|
+
static createCircularStartTangentRadius(start, tangentAtStart, radius, upVector, sweep) {
|
|
361
|
+
if (upVector === undefined)
|
|
362
|
+
upVector = Point3dVector3d_1.Vector3d.unitZ();
|
|
363
|
+
const vector0 = upVector.unitCrossProduct(tangentAtStart);
|
|
364
|
+
if (vector0 === undefined)
|
|
365
|
+
return undefined;
|
|
366
|
+
const center = start.plusScaled(vector0, radius);
|
|
367
|
+
// reverse the A-to-center vector and bring it up to scale
|
|
368
|
+
vector0.scaleInPlace(-radius);
|
|
369
|
+
const vector90 = tangentAtStart.scaleToLength(Math.abs(radius)); // cannot fail; prior unitCrossProduct would have failed first
|
|
370
|
+
return Arc3d.create(center, vector0, vector90, AngleSweep_1.AngleSweep.create(sweep));
|
|
371
|
+
}
|
|
350
372
|
/**
|
|
351
373
|
* Create a circular arc defined by start and end points and radius.
|
|
352
374
|
* @param start start point of the arc
|
|
@@ -761,7 +783,7 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
761
783
|
circularRadius() {
|
|
762
784
|
return this.isCircular ? this._matrix.columnXMagnitude() : undefined;
|
|
763
785
|
}
|
|
764
|
-
/** Return the larger of the two defining vectors. */
|
|
786
|
+
/** Return the larger length of the two defining vectors. */
|
|
765
787
|
maxVectorLength() {
|
|
766
788
|
return Math.max(this._matrix.columnXMagnitude(), this._matrix.columnYMagnitude());
|
|
767
789
|
}
|
|
@@ -969,12 +991,12 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
969
991
|
};
|
|
970
992
|
}
|
|
971
993
|
/** Test if this arc is almost equal to another GeometryQuery object */
|
|
972
|
-
isAlmostEqual(otherGeometry) {
|
|
994
|
+
isAlmostEqual(otherGeometry, distanceTol = Geometry_1.Geometry.smallMetricDistance, radianTol = Geometry_1.Geometry.smallAngleRadians) {
|
|
973
995
|
if (otherGeometry instanceof Arc3d) {
|
|
974
996
|
const other = otherGeometry;
|
|
975
|
-
return this._center.isAlmostEqual(other._center)
|
|
976
|
-
&& this._matrix.isAlmostEqual(other._matrix)
|
|
977
|
-
&& this._sweep.isAlmostEqualAllowPeriodShift(other._sweep);
|
|
997
|
+
return this._center.isAlmostEqual(other._center, distanceTol)
|
|
998
|
+
&& this._matrix.isAlmostEqual(other._matrix, distanceTol)
|
|
999
|
+
&& this._sweep.isAlmostEqualAllowPeriodShift(other._sweep, radianTol);
|
|
978
1000
|
}
|
|
979
1001
|
return false;
|
|
980
1002
|
}
|
|
@@ -1057,7 +1079,12 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
1057
1079
|
const otherVector0 = this._matrix.multiplyInverse(other.vector0);
|
|
1058
1080
|
const otherVector90 = this._matrix.multiplyInverse(other.vector90);
|
|
1059
1081
|
if (otherOrigin && otherVector0 && otherVector90) {
|
|
1060
|
-
return {
|
|
1082
|
+
return {
|
|
1083
|
+
center: otherOrigin,
|
|
1084
|
+
vector0: otherVector0,
|
|
1085
|
+
vector90: otherVector90,
|
|
1086
|
+
sweep: this.sweep.clone(),
|
|
1087
|
+
};
|
|
1061
1088
|
}
|
|
1062
1089
|
return undefined;
|
|
1063
1090
|
}
|
|
@@ -1075,7 +1102,7 @@ class Arc3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
1075
1102
|
* * `point` is the `point1` input.
|
|
1076
1103
|
* * both fractions are zero
|
|
1077
1104
|
* * `arc` is undefined.
|
|
1078
|
-
* @param point0 first point of path
|
|
1105
|
+
* @param point0 first point of path (the point before the point of inflection)
|
|
1079
1106
|
* @param point1 second point of path (the point of inflection)
|
|
1080
1107
|
* @param point2 third point of path (the point after the point of inflection)
|
|
1081
1108
|
* @param radius arc radius
|