@itwin/core-geometry 4.1.0-dev.67 → 4.1.0-dev.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/lib/cjs/curve/RegionOps.d.ts +1 -0
  2. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  3. package/lib/cjs/curve/RegionOps.js +1 -0
  4. package/lib/cjs/curve/RegionOps.js.map +1 -1
  5. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +4 -4
  6. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  7. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +4 -4
  8. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  9. package/lib/cjs/geometry3d/Plane3d.d.ts +41 -32
  10. package/lib/cjs/geometry3d/Plane3d.d.ts.map +1 -1
  11. package/lib/cjs/geometry3d/Plane3d.js +11 -8
  12. package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
  13. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +37 -34
  14. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  15. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +65 -43
  16. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  17. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  18. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +2 -0
  19. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  20. package/lib/cjs/geometry3d/Transform.d.ts +3 -3
  21. package/lib/cjs/geometry3d/Transform.js +3 -3
  22. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  23. package/lib/esm/curve/RegionOps.d.ts +1 -0
  24. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  25. package/lib/esm/curve/RegionOps.js +1 -0
  26. package/lib/esm/curve/RegionOps.js.map +1 -1
  27. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +4 -4
  28. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  29. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +4 -4
  30. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  31. package/lib/esm/geometry3d/Plane3d.d.ts +41 -32
  32. package/lib/esm/geometry3d/Plane3d.d.ts.map +1 -1
  33. package/lib/esm/geometry3d/Plane3d.js +11 -8
  34. package/lib/esm/geometry3d/Plane3d.js.map +1 -1
  35. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +37 -34
  36. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
  37. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +65 -43
  38. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  39. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  40. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +2 -0
  41. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  42. package/lib/esm/geometry3d/Transform.d.ts +3 -3
  43. package/lib/esm/geometry3d/Transform.js +3 -3
  44. package/lib/esm/geometry3d/Transform.js.map +1 -1
  45. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"PolygonOffsetContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAE1C,4DAAyD;AACzD,sEAAqE;AACrE,kDAA+C;AAC/C,oCAAiC;AAEjC,8CAA2C;AAC3C,gEAAyF;AACzF,sDAAmD;AACnD,oDAAiD;AACjD,kDAA+C;AAC/C,kCAA+B;AAC/B,kCAA+B;AAC/B,4CAAyC;AACzC,oDAAiD;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AG,IAAI,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC3E,IAAI,QAAQ,KAAK,SAAS;oBACxB,IAAI,MAAM,KAAK,SAAS;wBACtB,MAAM,GAAG,QAAQ,CAAC;gBACtB,IAAI,aAAa;oBACf,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;gBACtC,aAAa,GAAG,QAAQ,CAAC;gBACzB,SAAS,GAAG,SAAS,CAAC;aACvB;SACF;QACD,IAAI,MAAM,IAAI,aAAa,IAAI,MAAM,YAAY,WAAI;YACnD,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACpC,uHAAuH;QACvH,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC;QACvC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QACnE,oGAAoG;QACpG,MAAM,YAAY,GAAqB,EAAE,CAAC;QAC1C,KAAK,CAAC,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAC9D,OAAO,qBAAS,CAAC,2BAA2B,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;CACF;AAtGD,kEAsGC","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/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { CurveChain, CurveCollection } from \"../CurveCollection\";\r\nimport { CurveCurve } from \"../CurveCurve\";\r\nimport { CurveCurveApproachType, CurveLocationDetailPair } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { Loop } from \"../Loop\";\r\nimport { Path } from \"../Path\";\r\nimport { RegionOps } from \"../RegionOps\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\n// cspell:word CCWXY\r\n\r\n/**\r\n * Classification of how the joint is constructed.\r\n * @internal\r\n */\r\nenum JointMode {\r\n Unknown = 0, /** used when joint mode is unknown. */\r\n Cap = 1, /** used to annotate a \"Joint\" at the start/end of a curve without wrap (so there's no \"other\" curve). */\r\n Extend = 2, /** used when offset curves do not intersect and needs expanding to connect. */\r\n Trim = -1, /** used when offset curves intersect and still goes beyond the intersection so need trimming. */\r\n JustGeometry = 3, /** unused */\r\n Gap = 4, /** used when joint construction fails, resulting in a gap in the offset filled by a line segment. */\r\n}\r\n\r\n/**\r\n * Control parameters for joint construction.\r\n * * Define a \"joint\" as the common point between adjacent segments of the input curve.\r\n * * Define the \"turn angle\" at a joint to be the angle in [0,pi] between the first derivatives (tangents) of\r\n * the segments at the joint.\r\n * * When creating offsets, if an offset needs to do an \"outside\" turn, the first applicable construction is applied:\r\n * * If the turn angle is larger than `options.minArcDegrees`, a circular arc is constructed to offset the joint.\r\n * * If the turn angle is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to\r\n * single intersection point (to create a sharp corner).\r\n * * If the turn angle is larger than `options.maxChamferDegrees`, the joint is offset with a line string whose edges:\r\n * * lie outside the arc that would have been created by the first construction\r\n * * have uniform turn angle less than `options.maxChamferDegrees`\r\n * * touch the arc at their midpoint (except first and last edge).\r\n * @public\r\n */\r\nexport class JointOptions {\r\n /**\r\n * Smallest arc to construct.\r\n * * If this control angle is 180 degrees or more, arcs are never created.\r\n */\r\n public minArcDegrees = 180.0;\r\n /** Largest turn angle at which to construct a sharp corner, or largest turn angle in a multi-segment chamfer. */\r\n public maxChamferTurnDegrees = 90;\r\n /**\r\n * Whether to remove the internal turn angle upper bound for sharp corner construction.\r\n * * By default, a sharp corner is not created at a joint when the turn angle is too large, so as to avoid offsets whose\r\n * ranges blow up. Internally, this is implemented by applying an upper bound of 120 degrees to `maxChamferTurnDegrees`.\r\n * * When `allowSharpestCorners` is true, this internal upper bound is removed, allowing sharp corners for turn angles\r\n * up to `maxChamferTurnDegrees`.\r\n * * Thus, if you know your input turn angles are no greater than `maxChamferTurnDegrees`, you can create an offset\r\n * with sharp corners at each joint by setting `minArcDegrees` to 180 and `allowSharpestCorners` to true.\r\n */\r\n public allowSharpestCorners = false;\r\n /** Offset distance, positive to left of base curve. */\r\n public leftOffsetDistance: number = 0;\r\n /** Whether to offset elliptical arcs as elliptical arcs (true) or as B-spline curves (false, default). */\r\n public preserveEllipticalArcs = false;\r\n /**\r\n * Construct JointOptions.\r\n * * leftOffsetDistance is required\r\n * * minArcDegrees and maxChamferDegrees are optional.\r\n */\r\n constructor(\r\n leftOffsetDistance: number, minArcDegrees = 180, maxChamferDegrees = 90,\r\n preserveEllipticalArcs = false, allowSharpestCorners = false\r\n ) {\r\n this.leftOffsetDistance = leftOffsetDistance;\r\n this.minArcDegrees = minArcDegrees;\r\n this.maxChamferTurnDegrees = maxChamferDegrees;\r\n this.preserveEllipticalArcs = preserveEllipticalArcs;\r\n this.allowSharpestCorners = allowSharpestCorners;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): JointOptions {\r\n return new JointOptions(\r\n this.leftOffsetDistance, this.minArcDegrees, this.maxChamferTurnDegrees,\r\n this.preserveEllipticalArcs, this.allowSharpestCorners\r\n );\r\n }\r\n /** Copy values of input options */\r\n public setFrom(other: JointOptions) {\r\n this.leftOffsetDistance = other.leftOffsetDistance;\r\n this.minArcDegrees = other.minArcDegrees;\r\n this.maxChamferTurnDegrees = other.maxChamferTurnDegrees;\r\n this.preserveEllipticalArcs = other.preserveEllipticalArcs;\r\n this.allowSharpestCorners = other.allowSharpestCorners;\r\n }\r\n /**\r\n * Parse a number or JointOptions up to JointOptions:\r\n * * If leftOffsetDistanceOptions is a number, create a JointOptions with other options set to default values.\r\n * * If leftOffsetDistanceOrOptions is a JointOptions, return it unchanged.\r\n * @param leftOffsetDistanceOrOptions\r\n */\r\n public static create(leftOffsetDistanceOrOptions: number | JointOptions): JointOptions {\r\n if (leftOffsetDistanceOrOptions instanceof JointOptions)\r\n return leftOffsetDistanceOrOptions;\r\n return new JointOptions(leftOffsetDistanceOrOptions);\r\n }\r\n /**\r\n /** Return true if the options indicate this amount of turn should be handled with an arc. */\r\n public needArc(theta: Angle): boolean {\r\n return Math.abs(theta.degrees) >= this.minArcDegrees;\r\n }\r\n /** Return the number of corners needed to chamfer the given turn angle. */\r\n public numChamferPoints(theta: Angle): number {\r\n const degrees = Math.abs(theta.degrees);\r\n const minStepDegreesClamp = 10;\r\n let maxStepDegreesClamp = 120;\r\n if (this.allowSharpestCorners) {\r\n maxStepDegreesClamp = this.maxChamferTurnDegrees;\r\n }\r\n const stepDegrees = Geometry.clamp(this.maxChamferTurnDegrees, minStepDegreesClamp, maxStepDegreesClamp);\r\n if (degrees <= stepDegrees)\r\n return 1;\r\n return Math.ceil(degrees / stepDegrees);\r\n }\r\n}\r\n\r\n/**\r\n * Options for offsetting a curve.\r\n * @public\r\n */\r\nexport class OffsetOptions {\r\n /** Options for offsetting and joining CurvePrimitives */\r\n public jointOptions: JointOptions;\r\n /** Options for generating a B-spline curve offset */\r\n public strokeOptions: StrokeOptions;\r\n /** Options that are provided are captured. */\r\n constructor(offsetDistanceOrOptions: number | JointOptions, strokeOptions?: StrokeOptions) {\r\n this.jointOptions = JointOptions.create(offsetDistanceOrOptions);\r\n this.strokeOptions = (strokeOptions !== undefined) ? strokeOptions : StrokeOptions.createForCurves();\r\n }\r\n public get minArcDegrees(): number {\r\n return this.jointOptions.minArcDegrees;\r\n }\r\n public set minArcDegrees(value: number) {\r\n this.jointOptions.minArcDegrees = value;\r\n }\r\n public get maxChamferTurnDegrees(): number {\r\n return this.jointOptions.maxChamferTurnDegrees;\r\n }\r\n public set maxChamferTurnDegrees(value: number) {\r\n this.jointOptions.maxChamferTurnDegrees = value;\r\n }\r\n public get allowSharpestCorners(): boolean {\r\n return this.jointOptions.allowSharpestCorners;\r\n }\r\n public set allowSharpestCorners(value: boolean) {\r\n this.jointOptions.allowSharpestCorners = value;\r\n }\r\n public get leftOffsetDistance(): number {\r\n return this.jointOptions.leftOffsetDistance;\r\n }\r\n public set leftOffsetDistance(value: number) {\r\n this.jointOptions.leftOffsetDistance = value;\r\n }\r\n public get preserveEllipticalArcs(): boolean {\r\n return this.jointOptions.preserveEllipticalArcs;\r\n }\r\n public set preserveEllipticalArcs(value: boolean) {\r\n this.jointOptions.preserveEllipticalArcs = value;\r\n }\r\n /**\r\n * Convert variant input into OffsetOptions.\r\n * * If a JointOptions is provided, it is captured.\r\n * * If an OffsetOptions is provided, a reference to it is returned.\r\n */\r\n public static create(offsetDistanceOrOptions: number | JointOptions | OffsetOptions): OffsetOptions {\r\n if (offsetDistanceOrOptions instanceof OffsetOptions)\r\n return offsetDistanceOrOptions;\r\n return new OffsetOptions(offsetDistanceOrOptions);\r\n }\r\n /** Convert variant input into offset distance */\r\n public static getOffsetDistance(offsetDistanceOrOptions: number | JointOptions | OffsetOptions): number {\r\n if (typeof offsetDistanceOrOptions === \"number\")\r\n return offsetDistanceOrOptions;\r\n return offsetDistanceOrOptions.leftOffsetDistance;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): OffsetOptions {\r\n return new OffsetOptions(this.jointOptions.clone(), this.strokeOptions.clone());\r\n }\r\n}\r\n\r\n/**\r\n * Description of geometry around a joint.\r\n * @internal\r\n */\r\nclass Joint {\r\n /** Enumeration of how the joint is constructed */\r\n public flexure: JointMode;\r\n /** Curve before the joint */\r\n public curve0?: CurvePrimitive;\r\n /** Fractional position on curve0 (may be a trim or extension) */\r\n public fraction0?: number;\r\n /** Curve after the joint (may be a trim or extension) */\r\n public curve1?: CurvePrimitive;\r\n /** Fractional position on curve1 */\r\n public fraction1?: number;\r\n /** Curve to be added within the joint */\r\n public jointCurve?: CurvePrimitive;\r\n /** Common point on the original curves */\r\n public swingPoint?: Point3d;\r\n /** Pointer to next joint */\r\n public nextJoint?: Joint;\r\n /** Pointer to previous joint */\r\n public previousJoint?: Joint;\r\n // capture references to all data . . .\r\n public constructor(\r\n curve0: CurvePrimitive | undefined, curve1: CurvePrimitive | undefined, swingPoint: Point3d | undefined\r\n ) {\r\n this.curve0 = curve0;\r\n this.curve1 = curve1;\r\n this.swingPoint = swingPoint;\r\n this.flexure = JointMode.Unknown;\r\n }\r\n /**\r\n * Try to construct an arc transition from ray0 to ray1 with given center.\r\n */\r\n public static constructArc(ray0: Ray3d, center: Point3d | undefined, ray1: Ray3d): Arc3d | undefined {\r\n if (center !== undefined && Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {\r\n const angle = ray0.direction.angleToXY(ray1.direction);\r\n const vector0 = Vector3d.createStartEnd(center, ray0.origin);\r\n const vector90 = vector0.rotate90CCWXY();\r\n return Arc3d.create(center, vector0, vector90, AngleSweep.createStartEndRadians(0.0, angle.radians));\r\n }\r\n return undefined;\r\n }\r\n /** Extract a json object of {curve0:data, fraction0:data, curve1:data, fraction1:data} */\r\n public shallowExtract(): any {\r\n return { curve0: this.curve0, curve1: this.curve1, fraction0: this.fraction0, fraction1: this.fraction1 };\r\n }\r\n /** Establish the nextJoint and previousJoint links from joint0 to joint1. */\r\n public static link(joint0: Joint, joint1: Joint | undefined) {\r\n joint0.nextJoint = joint1;\r\n if (joint1)\r\n joint1.previousJoint = joint0;\r\n if (joint0.curve1 && joint1 && !joint1.curve0)\r\n joint1.curve0 = joint0.curve1;\r\n else if (!joint0.curve1 && joint1 && joint1.curve0)\r\n joint0.curve1 = joint1.curve0;\r\n }\r\n /**\r\n * * If nextJoint and nextJoint.fraction0 are defined, return them.\r\n * * Otherwise return defaultValue\r\n */\r\n public nextJointFraction0(defaultValue: number): number {\r\n if (this.nextJoint && this.nextJoint.fraction0 !== undefined)\r\n return this.nextJoint.fraction0;\r\n return defaultValue;\r\n }\r\n private static addStrokes(destination: LineString3d, curve?: CurvePrimitive) {\r\n if (curve) {\r\n curve.emitStrokes(destination);\r\n }\r\n }\r\n private static addPoint(destination: LineString3d, point: Point3d) {\r\n if (destination.packedPoints.length > 0) {\r\n const pointA = destination.endPoint();\r\n if (!pointA.isAlmostEqual(point))\r\n destination.packedPoints.push(point);\r\n }\r\n }\r\n /** Append stroke points along the offset curve defined by the Joint chain to the destination line string. */\r\n public static collectStrokesFromChain(start: Joint, destination: LineString3d, maxTest: number = 100) {\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(\r\n start,\r\n (joint: Joint) => {\r\n this.addStrokes(destination, joint.jointCurve);\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone();\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\r\n if (curve1) {\r\n if (!joint.jointCurve) {\r\n this.addPoint(destination, curve1.startPoint());\r\n }\r\n }\r\n this.addStrokes(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n },\r\n maxTest\r\n );\r\n }\r\n private static collectPrimitive(destination: CurvePrimitive[], primitive?: CurvePrimitive) {\r\n if (primitive) {\r\n if (destination.length > 0) {\r\n const pointA = destination[destination.length - 1].endPoint();\r\n const pointB = primitive.startPoint();\r\n if (!pointA.isAlmostEqual(pointB)) {\r\n destination.push(LineSegment3d.create(pointA, pointB));\r\n }\r\n }\r\n destination.push(primitive);\r\n }\r\n }\r\n private static adjustJointToPrimitives(joint: Joint) {\r\n const ls = joint.jointCurve;\r\n if (ls instanceof LineString3d) {\r\n if (joint.curve0) {\r\n const curvePoint = joint.curve0.endPoint();\r\n const jointPoint0 = ls.startPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint0))\r\n ls.packedPoints.setAtCheckedPointIndex(0, curvePoint);\r\n }\r\n if (joint.curve1) {\r\n const curvePoint = joint.curve1.startPoint();\r\n const jointPoint1 = ls.endPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint1))\r\n ls.packedPoints.setAtCheckedPointIndex(ls.packedPoints.length - 1, curvePoint);\r\n }\r\n }\r\n }\r\n /** Append CurvePrimitives along the offset curve defined by the Joint chain to the destination array. */\r\n public static collectCurvesFromChain(start: Joint | undefined, destination: CurvePrimitive[], maxTest: number = 100) {\r\n if (start === undefined)\r\n return;\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(\r\n start,\r\n (joint: Joint) => {\r\n this.adjustJointToPrimitives(joint);\r\n this.collectPrimitive(destination, joint.jointCurve);\r\n\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone();\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\r\n this.collectPrimitive(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n },\r\n maxTest\r\n );\r\n }\r\n /** Execute `joint.annotateJointMode()` at all joints on the chain to set some of the joints attributes. */\r\n public static annotateChain(start: Joint | undefined, options: JointOptions, maxTest: number = 100) {\r\n if (start)\r\n Joint.visitJointsOnChain(start, (joint: Joint) => { joint.annotateJointMode(options); return true; }, maxTest);\r\n }\r\n /**\r\n * Visit joints on a chain.\r\n * * terminate on `false` return from `callback`\r\n * @param start first (and, for cyclic chain, final) joint\r\n * @param callback function to call with each Joint as a single parameter.\r\n */\r\n public static visitJointsOnChain(start: Joint, callback: (joint: Joint) => boolean, maxTest: number = 100): boolean {\r\n let joint: Joint | undefined = start;\r\n if (joint) {\r\n let numTest = 0;\r\n while (joint !== undefined) {\r\n if (numTest++ >= maxTest + 5) // allow extra things to happen\r\n return true;\r\n if (!callback(joint))\r\n return false;\r\n joint = joint.nextJoint;\r\n if (joint === start)\r\n break;\r\n }\r\n }\r\n return true;\r\n }\r\n /** NOTE: no assumption on type of curve0, curve1 */\r\n private annotateExtension(options: JointOptions) {\r\n if (this.curve0 && this.curve1) {\r\n const ray0 = this.curve0.fractionToPointAndDerivative(1.0);\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Extend;\r\n const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef()); // angle between the 2 ray lines\r\n if (options.needArc(theta)) {\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc) {\r\n this.jointCurve = arc;\r\n return;\r\n }\r\n }\r\n const numChamferPoints = options.numChamferPoints(theta); // how many interior points in the linestring\r\n if (numChamferPoints <= 1) { // create sharp corner\r\n this.jointCurve = LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);\r\n return;\r\n }\r\n if (numChamferPoints > 1) { // create chamfer corner (a line string)\r\n const radians0 = theta.radians;\r\n const numHalfStep = 2.0 * numChamferPoints;\r\n const halfStepRadians = radians0 / numHalfStep;\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc !== undefined) {\r\n const radialFraction = 1 / Math.cos(halfStepRadians);\r\n const jointCurve = LineString3d.create();\r\n this.jointCurve = jointCurve;\r\n jointCurve.addPoint(ray0.origin); // possibly extend segment or line string\r\n\r\n for (let i = 0; i < numChamferPoints; i++) {\r\n const arcFraction = (1 + 2 * i) / numHalfStep;\r\n jointCurve.addPoint(arc.fractionAndRadialFractionToPoint(arcFraction, radialFraction));\r\n }\r\n jointCurve.addPoint(ray1.origin); // possibly extend segment or line string.\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n // if there is no intersection between the 2 ray lines, fill the gap by a line segment\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n /** Select the index at which summed fraction difference is smallest */\r\n private selectIntersectionIndexByFraction(\r\n fractionA: number, fractionB: number, intersections: CurveLocationDetailPair[]\r\n ): number {\r\n let index = -1;\r\n let aMin = Number.MAX_VALUE;\r\n for (let i = 0; i < intersections.length; i++) {\r\n const a = Math.abs(intersections[i].detailA.fraction - fractionA)\r\n + Math.abs(intersections[i].detailB.fraction - fractionB);\r\n if (a < aMin) {\r\n aMin = a;\r\n index = i;\r\n }\r\n }\r\n return index;\r\n }\r\n /**\r\n * Examine the adjacent geometry to set some of joint attributes:\r\n * * set JointMode: one of Cap, Extend, or Trim\r\n * * set fraction0 and fraction1 of intersection of curve0 and curve1\r\n * * set joint curve\r\n * * this REFERENCES curve0, curve1, fraction0, fraction1\r\n * * this does not reference nextJoint and previousJoint\r\n */\r\n public annotateJointMode(options: JointOptions): void {\r\n if (!this.curve0 && this.curve1) { // joint at the start of the chain\r\n this.flexure = JointMode.Cap;\r\n this.fraction1 = 0.0;\r\n } else if (this.curve0 && !this.curve1) { // joint at the end of the chain\r\n this.flexure = JointMode.Cap;\r\n this.fraction0 = 1.0;\r\n } else if (this.curve0 && this.curve1) { // joints at the middle of the chain\r\n if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) { // joint between colinear segments\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Trim;\r\n } else if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) { // pair of lines\r\n const ray0 = this.curve0.fractionToPointAndDerivative(0.0);\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n this.fraction0 = intersection.detailA.fraction;\r\n this.fraction1 = intersection.detailB.fraction;\r\n if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) { // need to extend\r\n this.annotateExtension(options);\r\n } else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) { // need to trim\r\n this.flexure = JointMode.Trim;\r\n } else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) { // need to fill gap with a single line segment\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n } else { // generic pair of curves\r\n const intersections = CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);\r\n const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);\r\n if (intersectionIndex >= 0) { // need to trim\r\n this.flexure = JointMode.Trim;\r\n this.fraction0 = intersections[intersectionIndex].detailA.fraction;\r\n this.fraction1 = intersections[intersectionIndex].detailB.fraction;\r\n } else { // need to extend\r\n this.annotateExtension(options);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * * Examine the primitive trim fractions between each pair of joints.\r\n * * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at\r\n * surrounding primitives\r\n * @param start\r\n */\r\n public static removeDegeneratePrimitives(\r\n start: Joint, options: JointOptions, maxTest: number\r\n ): { newStart: Joint, numJointRemoved: number } {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n GeometryCoreTestIO.consoleLog(\"\\nENTER removeDegenerates\");\r\n */\r\n let jointA: Joint | undefined = start;\r\n let numRemoved = 0;\r\n const maxRemove = 1;\r\n let numTest = 0;\r\n if (jointA) {\r\n while (jointA !== undefined && numTest++ < maxTest) {\r\n const jointB = jointA.nextJoint;\r\n if (jointA\r\n && jointB\r\n && jointA.previousJoint\r\n && jointB.nextJoint\r\n && jointA.fraction1 !== undefined\r\n && jointB.fraction0 !== undefined\r\n ) {\r\n const f0 = jointA.fraction1;\r\n const f1 = jointB.fraction0;\r\n const g0 = jointB.fraction1;\r\n const g1 = jointB.nextJoint.fraction0;\r\n // f0 and f1 are fractions on the single primitive between these joints.\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\"joint candidate\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(jointA.shallowExtract()));\r\n GeometryCoreTestIO.consoleLog(prettyPrint(jointB.shallowExtract()));\r\n GeometryCoreTestIO.consoleLog(\"FRACTIONS \", { fA1: f0, fB0: f1 });\r\n }\r\n */\r\n const eliminateF = f0 >= f1 || f0 > 1.0;\r\n const eliminateG = (g0 !== undefined && g0 > 1.0) || (g0 !== undefined && g1 !== undefined && g0 >= g1);\r\n if (eliminateF && eliminateG) {\r\n const jointC = jointB.nextJoint;\r\n const newJoint: Joint = new Joint(jointA.curve0, jointC.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointC.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n if (newJoint.nextJoint)\r\n newJoint.nextJoint.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" NEW DOUBLE CUT\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n } else if (eliminateF) {\r\n const newJoint: Joint = new Joint(jointA.curve0, jointB.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointB.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n newJoint.nextJoint!.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" NEW JOINT\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n numRemoved++;\r\n if (jointA === start)\r\n start = newJoint;\r\n jointA = newJoint;\r\n if (numRemoved >= maxRemove) {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n GeometryCoreTestIO.consoleLog(\" EXIT removeDegenerates at maxRemove\\n\");\r\n */\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n }\r\n }\r\n jointA = jointA.nextJoint;\r\n if (jointA === start)\r\n break;\r\n }\r\n }\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n}\r\n\r\n/**\r\n * Context for building a wire offset.\r\n * @internal\r\n */\r\nexport class PolygonWireOffsetContext {\r\n /** Construct a context. */\r\n public constructor() { }\r\n private static _unitAlong = Vector3d.create();\r\n private static _unitPerp = Vector3d.create();\r\n private static _offsetA = Point3d.create();\r\n private static _offsetB = Point3d.create();\r\n // Construct a single offset from base points\r\n private static createOffsetSegment(\r\n basePointA: Point3d, basePointB: Point3d, distance: number\r\n ): CurvePrimitive | undefined {\r\n Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);\r\n if (this._unitAlong.normalizeInPlace()) {\r\n this._unitAlong.rotate90CCWXY(this._unitPerp);\r\n const segment = LineSegment3d.create(\r\n basePointA.plusScaled(this._unitPerp, distance, this._offsetA),\r\n basePointB.plusScaled(this._unitPerp, distance, this._offsetB)\r\n );\r\n CurveChainWireOffsetContext.applyBasePoints(segment, basePointA.clone(), basePointB.clone());\r\n return segment;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Construct a wire (not area) that is offset from given polyline or polygon (which must be in xy-plane or in\r\n * a plane parallel to xy-plane).\r\n * * This is a simple wire offset (in the form of a line string), not an area.\r\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\r\n * * See [[JointOptions]] class doc for offset construction rules.\r\n * @param points a single loop or path\r\n * @param wrap true to offset the wraparound joint. Assumes first = last point.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions\r\n * object.\r\n */\r\n public constructPolygonWireXYOffset(\r\n points: Point3d[], wrap: boolean, leftOffsetDistanceOrOptions: number | JointOptions\r\n ): CurveChain | undefined {\r\n /**\r\n * if \"wrap = true\", then first and last point in the points array must be close; otherwise\r\n * generated offset will be invalid.\r\n */\r\n if (wrap && !points[0].isAlmostEqual(points[points.length - 1])) {\r\n wrap = false;\r\n }\r\n /** create raw offsets as a linked list (joint0) */\r\n const options = JointOptions.create(leftOffsetDistanceOrOptions);\r\n const numPoints = points.length;\r\n let fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[0], points[1], options.leftOffsetDistance);\r\n let joint0 = new Joint(undefined, fragment0, points[0]);\r\n let newJoint;\r\n let previousJoint = joint0;\r\n for (let i = 1; i + 1 < numPoints; i++) {\r\n const fragment1 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance);\r\n newJoint = new Joint(fragment0, fragment1, points[i]);\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n if (wrap)\r\n Joint.link(previousJoint, joint0);\r\n else {\r\n newJoint = new Joint(fragment0, undefined, points[numPoints - 1]);\r\n Joint.link(previousJoint, newJoint);\r\n }\r\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\r\n Joint.annotateChain(joint0, options, numPoints);\r\n /** make limited passes through the Joint chain until no self-intersections are removed */\r\n for (let pass = 0; pass++ < 5;) {\r\n const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);\r\n joint0 = state.newStart;\r\n if (state.numJointRemoved === 0)\r\n break;\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" POST REMOVE DEGENERATES \" + state.numJointRemoved);\r\n Joint.visitJointsOnChain(joint0, (joint: Joint) => { GeometryCoreTestIO.consoleLog(prettyPrint(joint.shallowExtract())); return true; });\r\n }\r\n */\r\n }\r\n // Joint.collectPrimitivesFromChain(joint0, result, numPoints);\r\n /** turn the Joint linked list into a CurveCollection (Loop or Path). trimming is done in collectStrokesFromChain */\r\n const chain = LineString3d.create();\r\n Joint.collectStrokesFromChain(joint0, chain, numPoints);\r\n const n = chain.packedPoints.length;\r\n if (n > 1) {\r\n if (chain.packedPoints.front()!.isAlmostEqual(chain.packedPoints.back()!))\r\n return Loop.create(chain);\r\n else\r\n return Path.create(chain);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Context for building a wire offset from a Path or Loop of CurvePrimitives\r\n * @internal\r\n */\r\nexport class CurveChainWireOffsetContext {\r\n /** construct a context. */\r\n public constructor() { }\r\n /**\r\n * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.\r\n * @param cp curve primitive to annotate\r\n * @param startPoint optional start point\r\n * @param endPoint optional end point\r\n * @return the input CurvePrimitive with annotations\r\n */\r\n public static applyBasePoints(\r\n cp: CurvePrimitive | undefined, startPoint: Point3d | undefined, endPoint: Point3d | undefined\r\n ): CurvePrimitive | undefined {\r\n if (cp !== undefined) {\r\n if (startPoint !== undefined)\r\n (cp as any).baseCurveStart = startPoint;\r\n if (endPoint !== undefined)\r\n (cp as any).baseCurveEnd = endPoint;\r\n }\r\n return cp;\r\n }\r\n /**\r\n * Create the offset of a single primitive as viewed in the xy-plane (ignoring z).\r\n * * each primitive may be labeled (as an `any` object) with start or end point of base curve:\r\n * * `(primitive as any).baseCurveStart: Point3d`\r\n * * `(primitive as any).baseCurveEnd: Point3d`\r\n * @param g primitive to offset\r\n * @param offsetDistanceOrOptions offset distance (positive to left of g), or options object\r\n */\r\n public static createSingleOffsetPrimitiveXY(\r\n g: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions\r\n ): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const offset = g.constructOffsetXY(offsetDistanceOrOptions);\r\n if (offset === undefined)\r\n return undefined;\r\n // decorate each offset with its base curve's endpoints\r\n if (Array.isArray(offset)) {\r\n const basePrims = g.collectCurvePrimitives(undefined, true, true);\r\n if (basePrims.length !== offset.length)\r\n return undefined; // unexpected aggregate curve type!\r\n for (let i = 0; i < basePrims.length; ++i)\r\n this.applyBasePoints(offset[i], basePrims[i].startPoint(), basePrims[i].endPoint());\r\n return offset;\r\n }\r\n return this.applyBasePoints(offset, g.startPoint(), g.endPoint());\r\n }\r\n /**\r\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will\r\n * not detect self intersection among widely separated edges.\r\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\r\n * * See [[JointOptions]] class doc for offset construction rules.\r\n * @param curves base curves.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\r\n */\r\n public static constructCurveXYOffset(\r\n curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions\r\n ): CurveCollection | undefined {\r\n const wrap: boolean = curves instanceof Loop;\r\n const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);\r\n const simpleOffsets: CurvePrimitive[] = [];\r\n /** traverse primitives (children of curves) and create simple offsets of each primitive as an array */\r\n for (const c of curves.children) {\r\n const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);\r\n if (c1 === undefined) {\r\n // bad .. maybe arc to inside?\r\n } else if (c1 instanceof CurvePrimitive) {\r\n simpleOffsets.push(c1);\r\n } else if (Array.isArray(c1)) {\r\n for (const c2 of c1) {\r\n if (c2 instanceof CurvePrimitive)\r\n simpleOffsets.push(c2);\r\n }\r\n }\r\n }\r\n /** create joints between array elements to make offsets as a linked list (joint0) */\r\n let fragment0;\r\n let newJoint;\r\n let previousJoint;\r\n let joint0;\r\n for (const fragment1 of simpleOffsets) {\r\n if (fragment1) {\r\n newJoint = new Joint(fragment0, fragment1, fragment1.fractionToPoint(0.0));\r\n if (newJoint !== undefined)\r\n if (joint0 === undefined)\r\n joint0 = newJoint;\r\n if (previousJoint)\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n }\r\n if (joint0 && previousJoint && curves instanceof Loop)\r\n Joint.link(previousJoint, joint0);\r\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\r\n const numOffset = simpleOffsets.length;\r\n Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);\r\n /** turn the Joint linked list into a CurveCollection. trimming is done in collectCurvesFromChain */\r\n const outputCurves: CurvePrimitive[] = [];\r\n Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);\r\n return RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PolygonOffsetContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAE1C,4DAAyD;AACzD,sEAAqE;AACrE,kDAA+C;AAC/C,oCAAiC;AAEjC,8CAA2C;AAC3C,gEAAyF;AACzF,sDAAmD;AACnD,oDAAiD;AACjD,kDAA+C;AAC/C,kCAA+B;AAC/B,kCAA+B;AAC/B,4CAAyC;AACzC,oDAAiD;AACjD,oBAAoB;AAEpB;;;GAGG;AACH,IAAK,SAOJ;AAPD,WAAK,SAAS;IACZ,+CAAW,CAAA;IACX,uCAAO,CAAA;IACP,6CAAU,CAAA;IACV,0CAAS,CAAA;IACT,yDAAgB,CAAA;IAChB,uCAAO,CAAA;AACT,CAAC,EAPI,SAAS,KAAT,SAAS,Q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f,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;gBACtC,aAAa,GAAG,QAAQ,CAAC;gBACzB,SAAS,GAAG,SAAS,CAAC;aACvB;SACF;QACD,IAAI,MAAM,IAAI,aAAa,IAAI,MAAM,YAAY,WAAI;YACnD,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACpC,uHAAuH;QACvH,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC;QACvC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QACnE,oGAAoG;QACpG,MAAM,YAAY,GAAqB,EAAE,CAAC;QAC1C,KAAK,CAAC,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAC9D,OAAO,qBAAS,CAAC,2BAA2B,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;CACF;AAvGD,kEAuGC","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/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { CurveChain, CurveCollection } from \"../CurveCollection\";\r\nimport { CurveCurve } from \"../CurveCurve\";\r\nimport { CurveCurveApproachType, CurveLocationDetailPair } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { Loop } from \"../Loop\";\r\nimport { Path } from \"../Path\";\r\nimport { RegionOps } from \"../RegionOps\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\n// cspell:word CCWXY\r\n\r\n/**\r\n * Classification of how the joint is constructed.\r\n * @internal\r\n */\r\nenum JointMode {\r\n Unknown = 0, /** used when joint mode is unknown. */\r\n Cap = 1, /** used to annotate a \"Joint\" at the start/end of a curve without wrap (so there's no \"other\" curve). */\r\n Extend = 2, /** used when offset curves do not intersect and needs expanding to connect. */\r\n Trim = -1, /** used when offset curves intersect and still goes beyond the intersection so need trimming. */\r\n JustGeometry = 3, /** unused */\r\n Gap = 4, /** used when joint construction fails, resulting in a gap in the offset filled by a line segment. */\r\n}\r\n\r\n/**\r\n * Control parameters for joint construction.\r\n * * Define a \"joint\" as the common point between adjacent segments of the input curve.\r\n * * Define the \"turn angle\" at a joint to be the angle in [0,pi] between the first derivatives (tangents) of\r\n * the segments at the joint.\r\n * * When creating offsets, if an offset needs to do an \"outside\" turn, the first applicable construction is applied:\r\n * * If the turn angle is larger than `options.minArcDegrees`, a circular arc is constructed to offset the joint.\r\n * * If the turn angle is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to\r\n * single intersection point (to create a sharp corner).\r\n * * If the turn angle is larger than `options.maxChamferDegrees`, the joint is offset with a line string whose edges:\r\n * * lie outside the arc that would have been created by the first construction\r\n * * have uniform turn angle less than `options.maxChamferDegrees`\r\n * * touch the arc at their midpoint (except first and last edge).\r\n * @public\r\n */\r\nexport class JointOptions {\r\n /**\r\n * Smallest arc to construct.\r\n * * If this control angle is 180 degrees or more, arcs are never created.\r\n */\r\n public minArcDegrees = 180.0;\r\n /** Largest turn angle at which to construct a sharp corner, or largest turn angle in a multi-segment chamfer. */\r\n public maxChamferTurnDegrees = 90;\r\n /**\r\n * Whether to remove the internal turn angle upper bound for sharp corner construction.\r\n * * By default, a sharp corner is not created at a joint when the turn angle is too large, so as to avoid offsets whose\r\n * ranges blow up. Internally, this is implemented by applying an upper bound of 120 degrees to `maxChamferTurnDegrees`.\r\n * * When `allowSharpestCorners` is true, this internal upper bound is removed, allowing sharp corners for turn angles\r\n * up to `maxChamferTurnDegrees`.\r\n * * Thus, if you know your input turn angles are no greater than `maxChamferTurnDegrees`, you can create an offset with\r\n * sharp corners at each joint by setting `maxChamferTurnDegrees < minArcDegrees` and `allowSharpestCorners` to true.\r\n */\r\n public allowSharpestCorners = false;\r\n /** Offset distance, positive to left of base curve. */\r\n public leftOffsetDistance: number = 0;\r\n /** Whether to offset elliptical arcs as elliptical arcs (true) or as B-spline curves (false, default). */\r\n public preserveEllipticalArcs = false;\r\n /**\r\n * Construct JointOptions.\r\n * * leftOffsetDistance is required\r\n * * minArcDegrees and maxChamferDegrees are optional.\r\n */\r\n constructor(\r\n leftOffsetDistance: number, minArcDegrees = 180, maxChamferDegrees = 90,\r\n preserveEllipticalArcs = false, allowSharpestCorners = false\r\n ) {\r\n this.leftOffsetDistance = leftOffsetDistance;\r\n this.minArcDegrees = minArcDegrees;\r\n this.maxChamferTurnDegrees = maxChamferDegrees;\r\n this.preserveEllipticalArcs = preserveEllipticalArcs;\r\n this.allowSharpestCorners = allowSharpestCorners;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): JointOptions {\r\n return new JointOptions(\r\n this.leftOffsetDistance, this.minArcDegrees, this.maxChamferTurnDegrees,\r\n this.preserveEllipticalArcs, this.allowSharpestCorners\r\n );\r\n }\r\n /** Copy values of input options */\r\n public setFrom(other: JointOptions) {\r\n this.leftOffsetDistance = other.leftOffsetDistance;\r\n this.minArcDegrees = other.minArcDegrees;\r\n this.maxChamferTurnDegrees = other.maxChamferTurnDegrees;\r\n this.preserveEllipticalArcs = other.preserveEllipticalArcs;\r\n this.allowSharpestCorners = other.allowSharpestCorners;\r\n }\r\n /**\r\n * Parse a number or JointOptions up to JointOptions:\r\n * * If leftOffsetDistanceOptions is a number, create a JointOptions with other options set to default values.\r\n * * If leftOffsetDistanceOrOptions is a JointOptions, return it unchanged.\r\n * @param leftOffsetDistanceOrOptions\r\n */\r\n public static create(leftOffsetDistanceOrOptions: number | JointOptions): JointOptions {\r\n if (leftOffsetDistanceOrOptions instanceof JointOptions)\r\n return leftOffsetDistanceOrOptions;\r\n return new JointOptions(leftOffsetDistanceOrOptions);\r\n }\r\n /** Return true if the options indicate this amount of turn should be handled with an arc. */\r\n public needArc(theta: Angle): boolean {\r\n return Math.abs(theta.degrees) >= this.minArcDegrees;\r\n }\r\n /** Return the number of corners needed to chamfer the given turn angle. */\r\n public numChamferPoints(theta: Angle): number {\r\n const degrees = Math.abs(theta.degrees);\r\n const minStepDegreesClamp = 10;\r\n let maxStepDegreesClamp = 120;\r\n if (this.allowSharpestCorners) {\r\n maxStepDegreesClamp = this.maxChamferTurnDegrees;\r\n }\r\n const stepDegrees = Geometry.clamp(this.maxChamferTurnDegrees, minStepDegreesClamp, maxStepDegreesClamp);\r\n if (degrees <= stepDegrees)\r\n return 1;\r\n return Math.ceil(degrees / stepDegrees);\r\n }\r\n}\r\n\r\n/**\r\n * Options for offsetting a curve.\r\n * @public\r\n */\r\nexport class OffsetOptions {\r\n /** Options for offsetting and joining CurvePrimitives */\r\n public jointOptions: JointOptions;\r\n /** Options for generating a B-spline curve offset */\r\n public strokeOptions: StrokeOptions;\r\n /** Options that are provided are captured. */\r\n constructor(offsetDistanceOrOptions: number | JointOptions, strokeOptions?: StrokeOptions) {\r\n this.jointOptions = JointOptions.create(offsetDistanceOrOptions);\r\n this.strokeOptions = (strokeOptions !== undefined) ? strokeOptions : StrokeOptions.createForCurves();\r\n }\r\n public get minArcDegrees(): number {\r\n return this.jointOptions.minArcDegrees;\r\n }\r\n public set minArcDegrees(value: number) {\r\n this.jointOptions.minArcDegrees = value;\r\n }\r\n public get maxChamferTurnDegrees(): number {\r\n return this.jointOptions.maxChamferTurnDegrees;\r\n }\r\n public set maxChamferTurnDegrees(value: number) {\r\n this.jointOptions.maxChamferTurnDegrees = value;\r\n }\r\n public get allowSharpestCorners(): boolean {\r\n return this.jointOptions.allowSharpestCorners;\r\n }\r\n public set allowSharpestCorners(value: boolean) {\r\n this.jointOptions.allowSharpestCorners = value;\r\n }\r\n public get leftOffsetDistance(): number {\r\n return this.jointOptions.leftOffsetDistance;\r\n }\r\n public set leftOffsetDistance(value: number) {\r\n this.jointOptions.leftOffsetDistance = value;\r\n }\r\n public get preserveEllipticalArcs(): boolean {\r\n return this.jointOptions.preserveEllipticalArcs;\r\n }\r\n public set preserveEllipticalArcs(value: boolean) {\r\n this.jointOptions.preserveEllipticalArcs = value;\r\n }\r\n /**\r\n * Convert variant input into OffsetOptions.\r\n * * If a JointOptions is provided, it is captured.\r\n * * If an OffsetOptions is provided, a reference to it is returned.\r\n */\r\n public static create(offsetDistanceOrOptions: number | JointOptions | OffsetOptions): OffsetOptions {\r\n if (offsetDistanceOrOptions instanceof OffsetOptions)\r\n return offsetDistanceOrOptions;\r\n return new OffsetOptions(offsetDistanceOrOptions);\r\n }\r\n /** Convert variant input into offset distance */\r\n public static getOffsetDistance(offsetDistanceOrOptions: number | JointOptions | OffsetOptions): number {\r\n if (typeof offsetDistanceOrOptions === \"number\")\r\n return offsetDistanceOrOptions;\r\n return offsetDistanceOrOptions.leftOffsetDistance;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): OffsetOptions {\r\n return new OffsetOptions(this.jointOptions.clone(), this.strokeOptions.clone());\r\n }\r\n}\r\n\r\n/**\r\n * Description of geometry around a joint.\r\n * @internal\r\n */\r\nclass Joint {\r\n /** Enumeration of how the joint is constructed */\r\n public flexure: JointMode;\r\n /** Curve before the joint */\r\n public curve0?: CurvePrimitive;\r\n /** Fractional position on curve0 (may be a trim or extension) */\r\n public fraction0?: number;\r\n /** Curve after the joint (may be a trim or extension) */\r\n public curve1?: CurvePrimitive;\r\n /** Fractional position on curve1 */\r\n public fraction1?: number;\r\n /** Curve to be added within the joint */\r\n public jointCurve?: CurvePrimitive;\r\n /** Common point on the original curves */\r\n public swingPoint?: Point3d;\r\n /** Pointer to next joint */\r\n public nextJoint?: Joint;\r\n /** Pointer to previous joint */\r\n public previousJoint?: Joint;\r\n // capture references to all data . . .\r\n public constructor(\r\n curve0: CurvePrimitive | undefined, curve1: CurvePrimitive | undefined, swingPoint: Point3d | undefined\r\n ) {\r\n this.curve0 = curve0;\r\n this.curve1 = curve1;\r\n this.swingPoint = swingPoint;\r\n this.flexure = JointMode.Unknown;\r\n }\r\n /**\r\n * Try to construct an arc transition from ray0 to ray1 with given center.\r\n */\r\n public static constructArc(ray0: Ray3d, center: Point3d | undefined, ray1: Ray3d): Arc3d | undefined {\r\n if (center !== undefined && Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {\r\n const angle = ray0.direction.angleToXY(ray1.direction);\r\n const vector0 = Vector3d.createStartEnd(center, ray0.origin);\r\n const vector90 = vector0.rotate90CCWXY();\r\n return Arc3d.create(center, vector0, vector90, AngleSweep.createStartEndRadians(0.0, angle.radians));\r\n }\r\n return undefined;\r\n }\r\n /** Extract a json object of {curve0:data, fraction0:data, curve1:data, fraction1:data} */\r\n public shallowExtract(): any {\r\n return { curve0: this.curve0, curve1: this.curve1, fraction0: this.fraction0, fraction1: this.fraction1 };\r\n }\r\n /** Establish the nextJoint and previousJoint links from joint0 to joint1. */\r\n public static link(joint0: Joint, joint1: Joint | undefined) {\r\n joint0.nextJoint = joint1;\r\n if (joint1)\r\n joint1.previousJoint = joint0;\r\n if (joint0.curve1 && joint1 && !joint1.curve0)\r\n joint1.curve0 = joint0.curve1;\r\n else if (!joint0.curve1 && joint1 && joint1.curve0)\r\n joint0.curve1 = joint1.curve0;\r\n }\r\n /**\r\n * * If nextJoint and nextJoint.fraction0 are defined, return them.\r\n * * Otherwise return defaultValue\r\n */\r\n public nextJointFraction0(defaultValue: number): number {\r\n if (this.nextJoint && this.nextJoint.fraction0 !== undefined)\r\n return this.nextJoint.fraction0;\r\n return defaultValue;\r\n }\r\n private static addStrokes(destination: LineString3d, curve?: CurvePrimitive) {\r\n if (curve) {\r\n curve.emitStrokes(destination);\r\n }\r\n }\r\n private static addPoint(destination: LineString3d, point: Point3d) {\r\n if (destination.packedPoints.length > 0) {\r\n const pointA = destination.endPoint();\r\n if (!pointA.isAlmostEqual(point))\r\n destination.packedPoints.push(point);\r\n }\r\n }\r\n /** Append stroke points along the offset curve defined by the Joint chain to the destination line string. */\r\n public static collectStrokesFromChain(start: Joint, destination: LineString3d, maxTest: number = 100) {\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(\r\n start,\r\n (joint: Joint) => {\r\n this.addStrokes(destination, joint.jointCurve);\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone();\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\r\n if (curve1) {\r\n if (!joint.jointCurve) {\r\n this.addPoint(destination, curve1.startPoint());\r\n }\r\n }\r\n this.addStrokes(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n },\r\n maxTest\r\n );\r\n }\r\n private static collectPrimitive(destination: CurvePrimitive[], primitive?: CurvePrimitive) {\r\n if (primitive) {\r\n if (destination.length > 0) {\r\n const pointA = destination[destination.length - 1].endPoint();\r\n const pointB = primitive.startPoint();\r\n if (!pointA.isAlmostEqual(pointB)) {\r\n destination.push(LineSegment3d.create(pointA, pointB));\r\n }\r\n }\r\n destination.push(primitive);\r\n }\r\n }\r\n private static adjustJointToPrimitives(joint: Joint) {\r\n const ls = joint.jointCurve;\r\n if (ls instanceof LineString3d) {\r\n if (joint.curve0) {\r\n const curvePoint = joint.curve0.endPoint();\r\n const jointPoint0 = ls.startPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint0))\r\n ls.packedPoints.setAtCheckedPointIndex(0, curvePoint);\r\n }\r\n if (joint.curve1) {\r\n const curvePoint = joint.curve1.startPoint();\r\n const jointPoint1 = ls.endPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint1))\r\n ls.packedPoints.setAtCheckedPointIndex(ls.packedPoints.length - 1, curvePoint);\r\n }\r\n }\r\n }\r\n /** Append CurvePrimitives along the offset curve defined by the Joint chain to the destination array. */\r\n public static collectCurvesFromChain(start: Joint | undefined, destination: CurvePrimitive[], maxTest: number = 100) {\r\n if (start === undefined)\r\n return;\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(\r\n start,\r\n (joint: Joint) => {\r\n this.adjustJointToPrimitives(joint);\r\n this.collectPrimitive(destination, joint.jointCurve);\r\n\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone();\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\r\n this.collectPrimitive(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n },\r\n maxTest\r\n );\r\n }\r\n /** Execute `joint.annotateJointMode()` at all joints on the chain to set some of the joints attributes. */\r\n public static annotateChain(start: Joint | undefined, options: JointOptions, maxTest: number = 100) {\r\n if (start)\r\n Joint.visitJointsOnChain(start, (joint: Joint) => { joint.annotateJointMode(options); return true; }, maxTest);\r\n }\r\n /**\r\n * Visit joints on a chain.\r\n * * terminate on `false` return from `callback`\r\n * @param start first (and, for cyclic chain, final) joint\r\n * @param callback function to call with each Joint as a single parameter.\r\n */\r\n public static visitJointsOnChain(start: Joint, callback: (joint: Joint) => boolean, maxTest: number = 100): boolean {\r\n let joint: Joint | undefined = start;\r\n if (joint) {\r\n let numTest = 0;\r\n while (joint !== undefined) {\r\n if (numTest++ >= maxTest + 5) // allow extra things to happen\r\n return true;\r\n if (!callback(joint))\r\n return false;\r\n joint = joint.nextJoint;\r\n if (joint === start)\r\n break;\r\n }\r\n }\r\n return true;\r\n }\r\n /** NOTE: no assumption on type of curve0, curve1 */\r\n private annotateExtension(options: JointOptions) {\r\n if (this.curve0 && this.curve1) {\r\n const ray0 = this.curve0.fractionToPointAndDerivative(1.0);\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Extend;\r\n const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef()); // angle between the 2 ray lines\r\n if (options.needArc(theta)) {\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc) {\r\n this.jointCurve = arc;\r\n return;\r\n }\r\n }\r\n const numChamferPoints = options.numChamferPoints(theta); // how many interior points in the linestring\r\n if (numChamferPoints <= 1) { // create sharp corner\r\n this.jointCurve = LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);\r\n return;\r\n }\r\n if (numChamferPoints > 1) { // create chamfer corner (a line string)\r\n const radians0 = theta.radians;\r\n const numHalfStep = 2.0 * numChamferPoints;\r\n const halfStepRadians = radians0 / numHalfStep;\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc !== undefined) {\r\n const radialFraction = 1 / Math.cos(halfStepRadians);\r\n const jointCurve = LineString3d.create();\r\n this.jointCurve = jointCurve;\r\n jointCurve.addPoint(ray0.origin); // possibly extend segment or line string\r\n\r\n for (let i = 0; i < numChamferPoints; i++) {\r\n const arcFraction = (1 + 2 * i) / numHalfStep;\r\n jointCurve.addPoint(arc.fractionAndRadialFractionToPoint(arcFraction, radialFraction));\r\n }\r\n jointCurve.addPoint(ray1.origin); // possibly extend segment or line string.\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n // if there is no intersection between the 2 ray lines, fill the gap by a line segment\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n /** Select the index at which summed fraction difference is smallest */\r\n private selectIntersectionIndexByFraction(\r\n fractionA: number, fractionB: number, intersections: CurveLocationDetailPair[]\r\n ): number {\r\n let index = -1;\r\n let aMin = Number.MAX_VALUE;\r\n for (let i = 0; i < intersections.length; i++) {\r\n const a = Math.abs(intersections[i].detailA.fraction - fractionA)\r\n + Math.abs(intersections[i].detailB.fraction - fractionB);\r\n if (a < aMin) {\r\n aMin = a;\r\n index = i;\r\n }\r\n }\r\n return index;\r\n }\r\n /**\r\n * Examine the adjacent geometry to set some of joint attributes:\r\n * * set JointMode: one of Cap, Extend, or Trim\r\n * * set fraction0 and fraction1 of intersection of curve0 and curve1\r\n * * set joint curve\r\n * * this REFERENCES curve0, curve1, fraction0, fraction1\r\n * * this does not reference nextJoint and previousJoint\r\n */\r\n public annotateJointMode(options: JointOptions): void {\r\n if (!this.curve0 && this.curve1) { // joint at the start of the chain\r\n this.flexure = JointMode.Cap;\r\n this.fraction1 = 0.0;\r\n } else if (this.curve0 && !this.curve1) { // joint at the end of the chain\r\n this.flexure = JointMode.Cap;\r\n this.fraction0 = 1.0;\r\n } else if (this.curve0 && this.curve1) { // joints at the middle of the chain\r\n if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) { // joint between colinear segments\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Trim;\r\n } else if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) { // pair of lines\r\n const ray0 = this.curve0.fractionToPointAndDerivative(0.0);\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n this.fraction0 = intersection.detailA.fraction;\r\n this.fraction1 = intersection.detailB.fraction;\r\n if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) { // need to extend\r\n this.annotateExtension(options);\r\n } else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) { // need to trim\r\n this.flexure = JointMode.Trim;\r\n } else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) { // need to fill gap with a single line segment\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n } else { // generic pair of curves\r\n const intersections = CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);\r\n const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);\r\n if (intersectionIndex >= 0) { // need to trim\r\n this.flexure = JointMode.Trim;\r\n this.fraction0 = intersections[intersectionIndex].detailA.fraction;\r\n this.fraction1 = intersections[intersectionIndex].detailB.fraction;\r\n } else { // need to extend\r\n this.annotateExtension(options);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * * Examine the primitive trim fractions between each pair of joints.\r\n * * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at\r\n * surrounding primitives\r\n * @param start\r\n */\r\n public static removeDegeneratePrimitives(\r\n start: Joint, options: JointOptions, maxTest: number\r\n ): { newStart: Joint, numJointRemoved: number } {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n GeometryCoreTestIO.consoleLog(\"\\nENTER removeDegenerates\");\r\n */\r\n let jointA: Joint | undefined = start;\r\n let numRemoved = 0;\r\n const maxRemove = 1;\r\n let numTest = 0;\r\n if (jointA) {\r\n while (jointA !== undefined && numTest++ < maxTest) {\r\n const jointB = jointA.nextJoint;\r\n if (jointA\r\n && jointB\r\n && jointA.previousJoint\r\n && jointB.nextJoint\r\n && jointA.fraction1 !== undefined\r\n && jointB.fraction0 !== undefined\r\n ) {\r\n const f0 = jointA.fraction1;\r\n const f1 = jointB.fraction0;\r\n const g0 = jointB.fraction1;\r\n const g1 = jointB.nextJoint.fraction0;\r\n // f0 and f1 are fractions on the single primitive between these joints.\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\"joint candidate\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(jointA.shallowExtract()));\r\n GeometryCoreTestIO.consoleLog(prettyPrint(jointB.shallowExtract()));\r\n GeometryCoreTestIO.consoleLog(\"FRACTIONS \", { fA1: f0, fB0: f1 });\r\n }\r\n */\r\n const eliminateF = f0 >= f1 || f0 > 1.0;\r\n const eliminateG = (g0 !== undefined && g0 > 1.0) || (g0 !== undefined && g1 !== undefined && g0 >= g1);\r\n if (eliminateF && eliminateG) {\r\n const jointC = jointB.nextJoint;\r\n const newJoint: Joint = new Joint(jointA.curve0, jointC.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointC.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n if (newJoint.nextJoint)\r\n newJoint.nextJoint.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" NEW DOUBLE CUT\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n } else if (eliminateF) {\r\n const newJoint: Joint = new Joint(jointA.curve0, jointB.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointB.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n newJoint.nextJoint!.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" NEW JOINT\");\r\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n numRemoved++;\r\n if (jointA === start)\r\n start = newJoint;\r\n jointA = newJoint;\r\n if (numRemoved >= maxRemove) {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n GeometryCoreTestIO.consoleLog(\" EXIT removeDegenerates at maxRemove\\n\");\r\n */\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n }\r\n }\r\n jointA = jointA.nextJoint;\r\n if (jointA === start)\r\n break;\r\n }\r\n }\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n}\r\n\r\n/**\r\n * Context for building a wire offset.\r\n * @internal\r\n */\r\nexport class PolygonWireOffsetContext {\r\n /** Construct a context. */\r\n public constructor() { }\r\n private static _unitAlong = Vector3d.create();\r\n private static _unitPerp = Vector3d.create();\r\n private static _offsetA = Point3d.create();\r\n private static _offsetB = Point3d.create();\r\n // Construct a single offset from base points\r\n private static createOffsetSegment(\r\n basePointA: Point3d, basePointB: Point3d, distance: number\r\n ): CurvePrimitive | undefined {\r\n Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);\r\n if (this._unitAlong.normalizeInPlace()) {\r\n this._unitAlong.rotate90CCWXY(this._unitPerp);\r\n const segment = LineSegment3d.create(\r\n basePointA.plusScaled(this._unitPerp, distance, this._offsetA),\r\n basePointB.plusScaled(this._unitPerp, distance, this._offsetB)\r\n );\r\n CurveChainWireOffsetContext.applyBasePoints(segment, basePointA.clone(), basePointB.clone());\r\n return segment;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Construct a wire (not area) that is offset from given polyline or polygon (which must be in xy-plane or in\r\n * a plane parallel to xy-plane).\r\n * * This is a simple wire offset (in the form of a line string), not an area.\r\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\r\n * * See [[JointOptions]] class doc for offset construction rules.\r\n * @param points a single loop or path\r\n * @param wrap true to offset the wraparound joint. Assumes first = last point.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions\r\n * object.\r\n */\r\n public constructPolygonWireXYOffset(\r\n points: Point3d[], wrap: boolean, leftOffsetDistanceOrOptions: number | JointOptions\r\n ): CurveChain | undefined {\r\n /**\r\n * if \"wrap = true\", then first and last point in the points array must be close; otherwise\r\n * generated offset will be invalid.\r\n */\r\n if (wrap && !points[0].isAlmostEqual(points[points.length - 1])) {\r\n wrap = false;\r\n }\r\n /** create raw offsets as a linked list (joint0) */\r\n const options = JointOptions.create(leftOffsetDistanceOrOptions);\r\n const numPoints = points.length;\r\n let fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[0], points[1], options.leftOffsetDistance);\r\n let joint0 = new Joint(undefined, fragment0, points[0]);\r\n let newJoint;\r\n let previousJoint = joint0;\r\n for (let i = 1; i + 1 < numPoints; i++) {\r\n const fragment1 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance);\r\n newJoint = new Joint(fragment0, fragment1, points[i]);\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n if (wrap)\r\n Joint.link(previousJoint, joint0);\r\n else {\r\n newJoint = new Joint(fragment0, undefined, points[numPoints - 1]);\r\n Joint.link(previousJoint, newJoint);\r\n }\r\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\r\n Joint.annotateChain(joint0, options, numPoints);\r\n /** make limited passes through the Joint chain until no self-intersections are removed */\r\n for (let pass = 0; pass++ < 5;) {\r\n const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);\r\n joint0 = state.newStart;\r\n if (state.numJointRemoved === 0)\r\n break;\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n GeometryCoreTestIO.consoleLog(\" POST REMOVE DEGENERATES \" + state.numJointRemoved);\r\n Joint.visitJointsOnChain(joint0, (joint: Joint) => { GeometryCoreTestIO.consoleLog(prettyPrint(joint.shallowExtract())); return true; });\r\n }\r\n */\r\n }\r\n // Joint.collectPrimitivesFromChain(joint0, result, numPoints);\r\n /** turn the Joint linked list into a CurveCollection (Loop or Path). trimming is done in collectStrokesFromChain */\r\n const chain = LineString3d.create();\r\n Joint.collectStrokesFromChain(joint0, chain, numPoints);\r\n const n = chain.packedPoints.length;\r\n if (n > 1) {\r\n if (chain.packedPoints.front()!.isAlmostEqual(chain.packedPoints.back()!))\r\n return Loop.create(chain);\r\n else\r\n return Path.create(chain);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Context for building a wire offset from a Path or Loop of CurvePrimitives\r\n * @internal\r\n */\r\nexport class CurveChainWireOffsetContext {\r\n /** construct a context. */\r\n public constructor() { }\r\n /**\r\n * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.\r\n * @param cp curve primitive to annotate\r\n * @param startPoint optional start point\r\n * @param endPoint optional end point\r\n * @return the input CurvePrimitive with annotations\r\n */\r\n public static applyBasePoints(\r\n cp: CurvePrimitive | undefined, startPoint: Point3d | undefined, endPoint: Point3d | undefined\r\n ): CurvePrimitive | undefined {\r\n if (cp !== undefined) {\r\n if (startPoint !== undefined)\r\n (cp as any).baseCurveStart = startPoint;\r\n if (endPoint !== undefined)\r\n (cp as any).baseCurveEnd = endPoint;\r\n }\r\n return cp;\r\n }\r\n /**\r\n * Create the offset of a single primitive as viewed in the xy-plane (ignoring z).\r\n * * each primitive may be labeled (as an `any` object) with start or end point of base curve:\r\n * * `(primitive as any).baseCurveStart: Point3d`\r\n * * `(primitive as any).baseCurveEnd: Point3d`\r\n * @param g primitive to offset\r\n * @param offsetDistanceOrOptions offset distance (positive to left of g), or options object\r\n */\r\n public static createSingleOffsetPrimitiveXY(\r\n g: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions\r\n ): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const offset = g.constructOffsetXY(offsetDistanceOrOptions);\r\n if (offset === undefined)\r\n return undefined;\r\n // decorate each offset with its base curve's endpoints\r\n if (Array.isArray(offset)) {\r\n const basePrims = g.collectCurvePrimitives(undefined, true, true);\r\n if (basePrims.length !== offset.length)\r\n return undefined; // unexpected aggregate curve type!\r\n for (let i = 0; i < basePrims.length; ++i)\r\n this.applyBasePoints(offset[i], basePrims[i].startPoint(), basePrims[i].endPoint());\r\n return offset;\r\n }\r\n return this.applyBasePoints(offset, g.startPoint(), g.endPoint());\r\n }\r\n /**\r\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will\r\n * not detect self intersection among widely separated edges.\r\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\r\n * * See [[JointOptions]] class doc for offset construction rules.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/Offset\r\n * @param curves base curves.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\r\n */\r\n public static constructCurveXYOffset(\r\n curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions\r\n ): CurveCollection | undefined {\r\n const wrap: boolean = curves instanceof Loop;\r\n const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);\r\n const simpleOffsets: CurvePrimitive[] = [];\r\n /** traverse primitives (children of curves) and create simple offsets of each primitive as an array */\r\n for (const c of curves.children) {\r\n const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);\r\n if (c1 === undefined) {\r\n // bad .. maybe arc to inside?\r\n } else if (c1 instanceof CurvePrimitive) {\r\n simpleOffsets.push(c1);\r\n } else if (Array.isArray(c1)) {\r\n for (const c2 of c1) {\r\n if (c2 instanceof CurvePrimitive)\r\n simpleOffsets.push(c2);\r\n }\r\n }\r\n }\r\n /** create joints between array elements to make offsets as a linked list (joint0) */\r\n let fragment0;\r\n let newJoint;\r\n let previousJoint;\r\n let joint0;\r\n for (const fragment1 of simpleOffsets) {\r\n if (fragment1) {\r\n newJoint = new Joint(fragment0, fragment1, fragment1.fractionToPoint(0.0));\r\n if (newJoint !== undefined)\r\n if (joint0 === undefined)\r\n joint0 = newJoint;\r\n if (previousJoint)\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n }\r\n if (joint0 && previousJoint && curves instanceof Loop)\r\n Joint.link(previousJoint, joint0);\r\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\r\n const numOffset = simpleOffsets.length;\r\n Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);\r\n /** turn the Joint linked list into a CurveCollection. trimming is done in collectCurvesFromChain */\r\n const outputCurves: CurvePrimitive[] = [];\r\n Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);\r\n return RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);\r\n }\r\n}\r\n"]}
@@ -48,44 +48,48 @@ import { Point3d, Vector3d } from "./Point3dVector3d";
48
48
  * @public
49
49
  */
50
50
  export declare abstract class Plane3d implements PlaneAltitudeEvaluator {
51
- /** Return the altitude of spacePoint above or below the plane. (Below is negative)
51
+ /**
52
+ * Return the altitude of spacePoint above or below the plane. (Below is negative)
52
53
  * * MUST BE IMPLEMENTED BY DERIVED CLASSES
53
- */
54
+ */
54
55
  abstract altitude(spacePoint: Point3d): number;
55
56
  /** Returns true if spacePoint is within distance tolerance of the plane. */
56
57
  isPointInPlane(spacePoint: Point3d, tolerance?: number): boolean;
57
- /** return a value -1, 0, 1 giving a signed indicator of whether the toleranced altitude of the point is
58
- * negative, near zero, or positive.
58
+ /**
59
+ * Return a value -1, 0, 1 giving a signed indicator of whether the toleranced altitude of the point is
60
+ * negative, near zero, or positive.
59
61
  *
60
- */
62
+ */
61
63
  classifyAltitude(point: Point3d, tolerance?: number): -1 | 0 | 1;
62
- /** return a value -1, 0, 1 giving a signed indicator of whether the toleranced altitude of x,y,z is
63
- * negative, near zero, or positive.
64
+ /**
65
+ * Return a value -1, 0, 1 giving a signed indicator of whether the toleranced altitude of x,y,z is
66
+ * negative, near zero, or positive.
64
67
  *
65
- */
68
+ */
66
69
  classifyAltitudeXYZ(x: number, y: number, z: number, tolerance?: number): -1 | 0 | 1;
67
70
  /**
68
- * Return the x component of the normal used to evaluate altitude.
69
- * * MUST BE IMPLEMENTED BY DERIVED CLASSES
70
- * * See [[Plane3d]] note about scaling.
71
- */
71
+ * Return the x component of the normal used to evaluate altitude.
72
+ * * MUST BE IMPLEMENTED BY DERIVED CLASSES
73
+ * * See [[Plane3d]] note about scaling.
74
+ */
72
75
  abstract normalX(): number;
73
76
  /**
74
- * Return the y component of the normal used to evaluate altitude.
75
- * * MUST BE IMPLEMENTED BY DERIVED CLASSES
76
- * * See [[Plane3d]] note about scaling.
77
+ * Return the y component of the normal used to evaluate altitude.
78
+ * * MUST BE IMPLEMENTED BY DERIVED CLASSES
79
+ * * See [[Plane3d]] note about scaling.
77
80
  */
78
81
  abstract normalY(): number;
79
82
  /**
80
83
  * Return the z component of the normal used to evaluate altitude.
81
- * * MUST BE IMPLEMENTED BY DERIVED CLASSES
82
- * * See [[Plane3d]] note about scaling.
84
+ * * MUST BE IMPLEMENTED BY DERIVED CLASSES
85
+ * * See [[Plane3d]] note about scaling.
83
86
  */
84
87
  abstract normalZ(): number;
85
88
  /**
86
89
  * Return the unit normal for the plane.
87
90
  * * The abstract base class implementation assembles the normal from normalX, normalY, normalZ calls.
88
- * * Derived classes should (but are not required to) override for maximum efficiency if the separate normal calls cause repeated normalization.
91
+ * * Derived classes should (but are not required to) override for maximum efficiency if the separate normal calls
92
+ * cause repeated normalization.
89
93
  * @param result
90
94
  */
91
95
  getUnitNormal(result?: Vector3d): Vector3d | undefined;
@@ -94,33 +98,38 @@ export declare abstract class Plane3d implements PlaneAltitudeEvaluator {
94
98
  * * Default implementation projects the origin (0,0,0) to the plane.
95
99
  * * Classes that have a preferred origin for their plane should override.
96
100
  * * Classes with a purely implicit equation of their plane can accept the default implementation
97
- * */
101
+ */
98
102
  getAnyPointOnPlane(result?: Point3d): Point3d;
99
- /** Return the altitude of weighted spacePoint above or below the plane. (Below is negative)
103
+ /**
104
+ * Return the altitude of weighted spacePoint above or below the plane. (Below is negative)
100
105
  * * MUST BE IMPLEMENTED BY DERIVED CLASSES
101
- * * See [[Plane3d]] note about scaling.
102
- */
106
+ * * See [[Plane3d]] note about scaling.
107
+ */
103
108
  abstract weightedAltitude(spacePoint: Point4d): number;
104
- /** Return the dot product of spaceVector (x,y,z) with the plane's unit normal. This tells the rate of change of altitude
105
- * for a point moving at speed one along the spaceVector.
109
+ /**
110
+ * Return the dot product of spaceVector (x,y,z) with the plane's unit normal. This tells the rate of change of
111
+ * altitude for a point moving at speed one along the spaceVector.
106
112
  * * MUST BE IMPLEMENTED BY DERIVED CLASSES
107
- * * See [[Plane3d]] note about scaling.
113
+ * * See [[Plane3d]] note about scaling.
108
114
  */
109
115
  abstract velocityXYZ(x: number, y: number, z: number): number;
110
- /** Return the dot product of spaceVector with the plane's unit normal. This tells the rate of change of altitude
116
+ /**
117
+ * Return the dot product of spaceVector with the plane's unit normal. This tells the rate of change of altitude
111
118
  * for a point moving at speed one along the spaceVector.
112
119
  * * MUST BE IMPLEMENTED BY DERIVED CLASSES
113
- * * See [[Plane3d]] note about scaling.
120
+ * * See [[Plane3d]] note about scaling.
114
121
  */
115
122
  abstract velocity(spaceVector: Vector3d): number;
116
- /** Return the altitude of a point given as separate x,y,z components.
123
+ /**
124
+ * Return the altitude of a point given as separate x,y,z components.
117
125
  * * MUST BE IMPLEMENTED BY DERIVED CLASSES
118
- * * See [[Plane3d]] note about scaling.
119
- */
126
+ * * See [[Plane3d]] note about scaling.
127
+ */
120
128
  abstract altitudeXYZ(x: number, y: number, z: number): number;
121
- /** Return the projection of spacePoint onto the plane.
129
+ /**
130
+ * Return the projection of spacePoint onto the plane.
122
131
  * * MUST BE IMPLEMENTED BY DERIVED CLASSES
123
- */
132
+ */
124
133
  abstract projectPointToPlane(spacePoint: Point3d, result?: Point3d): Point3d;
125
134
  }
126
135
  //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aACa,OAAO,IAAI,MAAM;IACjC;;;;;;OAMG;IACI,aAAa,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS;IAG7D;;;;;OAKG;IACI,kBAAkB,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAGpD;;;;OAIG;aACa,gBAAgB,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM;IAC7D;;;;;OAKG;aACa,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM;IACpE;;;;;OAKG;aACa,QAAQ,CAAC,WAAW,EAAE,QAAQ,GAAG,MAAM;IACvD;;;;OAIG;aACa,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM;IACpE;;;OAGG;aACa,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;CACpF"}
@@ -58,24 +58,27 @@ class Plane3d {
58
58
  isPointInPlane(spacePoint, tolerance = Geometry_1.Geometry.smallMetricDistance) {
59
59
  return Math.abs(this.altitude(spacePoint)) <= tolerance;
60
60
  }
61
- /** return a value -1, 0, 1 giving a signed indicator of whether the toleranced altitude of the point is
62
- * negative, near zero, or positive.
61
+ /**
62
+ * Return a value -1, 0, 1 giving a signed indicator of whether the toleranced altitude of the point is
63
+ * negative, near zero, or positive.
63
64
  *
64
- */
65
+ */
65
66
  classifyAltitude(point, tolerance = Geometry_1.Geometry.smallMetricDistance) {
66
67
  return Geometry_1.Geometry.split3Way01(this.altitude(point), tolerance);
67
68
  }
68
- /** return a value -1, 0, 1 giving a signed indicator of whether the toleranced altitude of x,y,z is
69
- * negative, near zero, or positive.
69
+ /**
70
+ * Return a value -1, 0, 1 giving a signed indicator of whether the toleranced altitude of x,y,z is
71
+ * negative, near zero, or positive.
70
72
  *
71
- */
73
+ */
72
74
  classifyAltitudeXYZ(x, y, z, tolerance = Geometry_1.Geometry.smallMetricDistance) {
73
75
  return Geometry_1.Geometry.split3Way01(this.altitudeXYZ(x, y, z), tolerance);
74
76
  }
75
77
  /**
76
78
  * Return the unit normal for the plane.
77
79
  * * The abstract base class implementation assembles the normal from normalX, normalY, normalZ calls.
78
- * * Derived classes should (but are not required to) override for maximum efficiency if the separate normal calls cause repeated normalization.
80
+ * * Derived classes should (but are not required to) override for maximum efficiency if the separate normal calls
81
+ * cause repeated normalization.
79
82
  * @param result
80
83
  */
81
84
  getUnitNormal(result) {
@@ -86,7 +89,7 @@ class Plane3d {
86
89
  * * Default implementation projects the origin (0,0,0) to the plane.
87
90
  * * Classes that have a preferred origin for their plane should override.
88
91
  * * Classes with a purely implicit equation of their plane can accept the default implementation
89
- * */
92
+ */
90
93
  getAnyPointOnPlane(result) {
91
94
  return this.projectPointToPlane(Point3dVector3d_1.Point3d.create(0, 0, 0), result);
92
95
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Plane3d.js","sourceRoot":"","sources":["../../../src/geometry3d/Plane3d.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,0CAA+D;AAE/D,uDAAsD;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAsB,OAAO;IAM3B,4EAA4E;IACrE,cAAc,CAAC,UAAmB,EAAE,YAAoB,mBAAQ,CAAC,mBAAmB;QACzF,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,IAAI,SAAS,CAAC;IAC1D,CAAC;IACD;;;MAGE;IACK,gBAAgB,CAAC,KAAc,EAAE,YAAoB,mBAAQ,CAAC,mBAAmB;QACtF,OAAO,mBAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;IAC/D,CAAC;IACD;;;MAGE;IACK,mBAAmB,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,YAAoB,mBAAQ,CAAC,mBAAmB;QAC1G,OAAO,mBAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IACpE,CAAC;IAmBD;;;;;OAKG;IACI,aAAa,CAAC,MAAiB;QACpC,OAAO,0BAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;IAC3F,CAAC;IACD;;;;;SAKK;IACE,kBAAkB,CAAC,MAAgB;QACxC,OAAO,IAAI,CAAC,mBAAmB,CAAC,yBAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACnE,CAAC;CA6BF;AAxFD,0BAwFC","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\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\n\r\n/**\r\n * Plane3d is the abstract base class for multiple 3d plane representations:\r\n * * [[Plane3dByOriginAndUnitNormal]] -- plane defined by origin and normal, with no preferred in-plane directions\r\n * * [[Plane3dByOriginAndVectors]] -- plane defined by origin and 2 vectors in the plane, with normal implied by the vectors' cross product\r\n * * [[Point4d]] -- homogeneous form of xyzw plane.\r\n * * [[ClipPlane]] -- implicit plane with additional markup as used by compound clip structures such as [[ConvexClipPlaneSet]] and [[UnionOfConvexClipPlaneSets]]\r\n *\r\n * As an abstract base class, Plane3d demands that its derived classes implement queries to answer questions\r\n * about the plane's normal and the altitude of points above or below the plane. (Altitude is measured perpendicular to the plane.)\r\n * These abstract methods are:\r\n * * altitude(Point3d), altitudeXYZ(x,y,z), and altitudeXYZW(Point4d) -- evaluate altitude\r\n * * normalX(), normalY(), normalZ() -- return components of the plane's normal vector.\r\n * * velocity(Vector3d), velocityXYZ(x,y,z) -- return dot product of the input vector with the plane normal.\r\n * * projectPointToPlane (spacePoint: Point3d) -- return projection of spacePoint into the plane.\r\n *\r\n * The Plane3d base class also provides implementations of several queries which it can implement by calling the abstract queries.\r\n * * Derived classes may choose to override these default implementations using private knowledge of what they have stored.\r\n * * isPointInPlane(spacePoint, tolerance?) -- test if spacePoint is in the plane with tolerance. Default tolerance is small metric distance\r\n * * classifyAltitude (spacePoint, tolerance?), classifyAltitudeXYZ (x,y,z,tolerance?) -- return -1,0,1 indicating if spacePoint's altitude\r\n * is negative, near zero, or positive.\r\n *\r\n * Notes about scaling and signs in methods that compute altitudes, normal components and velocities:\r\n * * The term \"altitude\" indicates a _signed_ distance from the plane.\r\n * * altitude zero is _on_ the plane\r\n * * positive altitudes are on one side\r\n * * negatives are on the other.\r\n * * Altitude values and normal components are not strictly required to be true cartesian distance. If the calling code happens to use \"distance scaled by 1000X\" it\r\n * understands that it can be OK for its plane implementation to have that scaling.\r\n * * By convention, derived classes whose definitions (normals and vectors in plane) are simple cartesian are expected\r\n * to return true distances. This applies to:\r\n * * [[Plane3dByOriginAndUnitNormal]] and [[ClipPlane]]\r\n * * These maintain a stored unit normal so the altitude calculations are inherently true cartesian distance.\r\n * * [[Plane3dByOriginAndVectors]] -- this is a bit expensive because\r\n * * the normal is the cross product of the defining vectors.\r\n * * that cross product is not typically unit\r\n * * normalization adds to the cost of computing off-plane distances\r\n * * Since a main purpose of using this class is often to navigate a skewed, non-unit grid, occasional off-plane queries are not likely to be important.\r\n * * \"4 dimensional\" (homogeneous coordinate planes) ([[Point4d]] and [[PlaneByOriginAndVectors4d]])\r\n * * typically do _not_ force their coefficients to any distance-based normalization\r\n * * are typically used for calculations in spaces with skewing effects do to perspective, and true distances are not required.\r\n * * In all classes, the `weightedAltitude` method is free to be scaled distance.\r\n * @public\r\n */\r\nexport abstract class Plane3d implements PlaneAltitudeEvaluator {\r\n /** Return the altitude of spacePoint above or below the plane. (Below is negative)\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n */\r\n public abstract altitude(spacePoint: Point3d): number;\r\n\r\n /** Returns true if spacePoint is within distance tolerance of the plane. */\r\n public isPointInPlane(spacePoint: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n return Math.abs(this.altitude(spacePoint)) <= tolerance;\r\n }\r\n /** return a value -1, 0, 1 giving a signed indicator of whether the toleranced altitude of the point is\r\n * negative, near zero, or positive.\r\n *\r\n */\r\n public classifyAltitude(point: Point3d, tolerance: number = Geometry.smallMetricDistance): -1 | 0 | 1 {\r\n return Geometry.split3Way01(this.altitude(point), tolerance);\r\n }\r\n /** return a value -1, 0, 1 giving a signed indicator of whether the toleranced altitude of x,y,z is\r\n * negative, near zero, or positive.\r\n *\r\n */\r\n public classifyAltitudeXYZ(x: number, y: number, z: number, tolerance: number = Geometry.smallMetricDistance): -1 | 0 | 1 {\r\n return Geometry.split3Way01(this.altitudeXYZ(x, y, z), tolerance);\r\n }\r\n /**\r\n * Return the x component of the normal used to evaluate altitude.\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n * * See [[Plane3d]] note about scaling.\r\n */\r\n public abstract normalX(): number;\r\n /**\r\n * Return the y component of the normal used to evaluate altitude.\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n * * See [[Plane3d]] note about scaling.\r\n */\r\n public abstract normalY(): number;\r\n /**\r\n * Return the z component of the normal used to evaluate altitude.\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n * * See [[Plane3d]] note about scaling.\r\n */\r\n public abstract normalZ(): number;\r\n /**\r\n * Return the unit normal for the plane.\r\n * * The abstract base class implementation assembles the normal from normalX, normalY, normalZ calls.\r\n * * Derived classes should (but are not required to) override for maximum efficiency if the separate normal calls cause repeated normalization.\r\n * @param result\r\n */\r\n public getUnitNormal(result?: Vector3d): Vector3d | undefined {\r\n return Vector3d.createNormalized(this.normalX(), this.normalY(), this.normalZ(), result);\r\n }\r\n /**\r\n * Return any point on the plane.\r\n * * Default implementation projects the origin (0,0,0) to the plane.\r\n * * Classes that have a preferred origin for their plane should override.\r\n * * Classes with a purely implicit equation of their plane can accept the default implementation\r\n * */\r\n public getAnyPointOnPlane(result?: Point3d): Point3d {\r\n return this.projectPointToPlane(Point3d.create(0, 0, 0), result);\r\n }\r\n /** Return the altitude of weighted spacePoint above or below the plane. (Below is negative)\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n * * See [[Plane3d]] note about scaling.\r\n */\r\n public abstract weightedAltitude(spacePoint: Point4d): number;\r\n\r\n /** Return the dot product of spaceVector (x,y,z) with the plane's unit normal. This tells the rate of change of altitude\r\n * for a point moving at speed one along the spaceVector.\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n * * See [[Plane3d]] note about scaling.\r\n */\r\n public abstract velocityXYZ(x: number, y: number, z: number): number;\r\n /** Return the dot product of spaceVector with the plane's unit normal. This tells the rate of change of altitude\r\n * for a point moving at speed one along the spaceVector.\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n * * See [[Plane3d]] note about scaling.\r\n */\r\n public abstract velocity(spaceVector: Vector3d): number;\r\n /** Return the altitude of a point given as separate x,y,z components.\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n * * See [[Plane3d]] note about scaling.\r\n */\r\n public abstract altitudeXYZ(x: number, y: number, z: number): number;\r\n\r\n /** Return the projection of spacePoint onto the plane.\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n */\r\n public abstract projectPointToPlane(spacePoint: Point3d, result?: Point3d): Point3d;\r\n}\r\n"]}
1
+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0BAgGC","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\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { Point4d } from \"../geometry4d/Point4d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\n\r\n/**\r\n * Plane3d is the abstract base class for multiple 3d plane representations:\r\n * * [[Plane3dByOriginAndUnitNormal]] -- plane defined by origin and normal, with no preferred in-plane directions\r\n * * [[Plane3dByOriginAndVectors]] -- plane defined by origin and 2 vectors in the plane, with normal implied by the vectors' cross product\r\n * * [[Point4d]] -- homogeneous form of xyzw plane.\r\n * * [[ClipPlane]] -- implicit plane with additional markup as used by compound clip structures such as [[ConvexClipPlaneSet]] and [[UnionOfConvexClipPlaneSets]]\r\n *\r\n * As an abstract base class, Plane3d demands that its derived classes implement queries to answer questions\r\n * about the plane's normal and the altitude of points above or below the plane. (Altitude is measured perpendicular to the plane.)\r\n * These abstract methods are:\r\n * * altitude(Point3d), altitudeXYZ(x,y,z), and altitudeXYZW(Point4d) -- evaluate altitude\r\n * * normalX(), normalY(), normalZ() -- return components of the plane's normal vector.\r\n * * velocity(Vector3d), velocityXYZ(x,y,z) -- return dot product of the input vector with the plane normal.\r\n * * projectPointToPlane (spacePoint: Point3d) -- return projection of spacePoint into the plane.\r\n *\r\n * The Plane3d base class also provides implementations of several queries which it can implement by calling the abstract queries.\r\n * * Derived classes may choose to override these default implementations using private knowledge of what they have stored.\r\n * * isPointInPlane(spacePoint, tolerance?) -- test if spacePoint is in the plane with tolerance. Default tolerance is small metric distance\r\n * * classifyAltitude (spacePoint, tolerance?), classifyAltitudeXYZ (x,y,z,tolerance?) -- return -1,0,1 indicating if spacePoint's altitude\r\n * is negative, near zero, or positive.\r\n *\r\n * Notes about scaling and signs in methods that compute altitudes, normal components and velocities:\r\n * * The term \"altitude\" indicates a _signed_ distance from the plane.\r\n * * altitude zero is _on_ the plane\r\n * * positive altitudes are on one side\r\n * * negatives are on the other.\r\n * * Altitude values and normal components are not strictly required to be true cartesian distance. If the calling code happens to use \"distance scaled by 1000X\" it\r\n * understands that it can be OK for its plane implementation to have that scaling.\r\n * * By convention, derived classes whose definitions (normals and vectors in plane) are simple cartesian are expected\r\n * to return true distances. This applies to:\r\n * * [[Plane3dByOriginAndUnitNormal]] and [[ClipPlane]]\r\n * * These maintain a stored unit normal so the altitude calculations are inherently true cartesian distance.\r\n * * [[Plane3dByOriginAndVectors]] -- this is a bit expensive because\r\n * * the normal is the cross product of the defining vectors.\r\n * * that cross product is not typically unit\r\n * * normalization adds to the cost of computing off-plane distances\r\n * * Since a main purpose of using this class is often to navigate a skewed, non-unit grid, occasional off-plane queries are not likely to be important.\r\n * * \"4 dimensional\" (homogeneous coordinate planes) ([[Point4d]] and [[PlaneByOriginAndVectors4d]])\r\n * * typically do _not_ force their coefficients to any distance-based normalization\r\n * * are typically used for calculations in spaces with skewing effects do to perspective, and true distances are not required.\r\n * * In all classes, the `weightedAltitude` method is free to be scaled distance.\r\n * @public\r\n */\r\nexport abstract class Plane3d implements PlaneAltitudeEvaluator {\r\n /**\r\n * Return the altitude of spacePoint above or below the plane. (Below is negative)\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n */\r\n public abstract altitude(spacePoint: Point3d): number;\r\n /** Returns true if spacePoint is within distance tolerance of the plane. */\r\n public isPointInPlane(spacePoint: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n return Math.abs(this.altitude(spacePoint)) <= tolerance;\r\n }\r\n /**\r\n * Return a value -1, 0, 1 giving a signed indicator of whether the toleranced altitude of the point is\r\n * negative, near zero, or positive.\r\n *\r\n */\r\n public classifyAltitude(point: Point3d, tolerance: number = Geometry.smallMetricDistance): -1 | 0 | 1 {\r\n return Geometry.split3Way01(this.altitude(point), tolerance);\r\n }\r\n /**\r\n * Return a value -1, 0, 1 giving a signed indicator of whether the toleranced altitude of x,y,z is\r\n * negative, near zero, or positive.\r\n *\r\n */\r\n public classifyAltitudeXYZ(\r\n x: number, y: number, z: number, tolerance: number = Geometry.smallMetricDistance\r\n ): -1 | 0 | 1 {\r\n return Geometry.split3Way01(this.altitudeXYZ(x, y, z), tolerance);\r\n }\r\n /**\r\n * Return the x component of the normal used to evaluate altitude.\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n * * See [[Plane3d]] note about scaling.\r\n */\r\n public abstract normalX(): number;\r\n /**\r\n * Return the y component of the normal used to evaluate altitude.\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n * * See [[Plane3d]] note about scaling.\r\n */\r\n public abstract normalY(): number;\r\n /**\r\n * Return the z component of the normal used to evaluate altitude.\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n * * See [[Plane3d]] note about scaling.\r\n */\r\n public abstract normalZ(): number;\r\n /**\r\n * Return the unit normal for the plane.\r\n * * The abstract base class implementation assembles the normal from normalX, normalY, normalZ calls.\r\n * * Derived classes should (but are not required to) override for maximum efficiency if the separate normal calls\r\n * cause repeated normalization.\r\n * @param result\r\n */\r\n public getUnitNormal(result?: Vector3d): Vector3d | undefined {\r\n return Vector3d.createNormalized(this.normalX(), this.normalY(), this.normalZ(), result);\r\n }\r\n /**\r\n * Return any point on the plane.\r\n * * Default implementation projects the origin (0,0,0) to the plane.\r\n * * Classes that have a preferred origin for their plane should override.\r\n * * Classes with a purely implicit equation of their plane can accept the default implementation\r\n */\r\n public getAnyPointOnPlane(result?: Point3d): Point3d {\r\n return this.projectPointToPlane(Point3d.create(0, 0, 0), result);\r\n }\r\n /**\r\n * Return the altitude of weighted spacePoint above or below the plane. (Below is negative)\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n * * See [[Plane3d]] note about scaling.\r\n */\r\n public abstract weightedAltitude(spacePoint: Point4d): number;\r\n /**\r\n * Return the dot product of spaceVector (x,y,z) with the plane's unit normal. This tells the rate of change of\r\n * altitude for a point moving at speed one along the spaceVector.\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n * * See [[Plane3d]] note about scaling.\r\n */\r\n public abstract velocityXYZ(x: number, y: number, z: number): number;\r\n /**\r\n * Return the dot product of spaceVector with the plane's unit normal. This tells the rate of change of altitude\r\n * for a point moving at speed one along the spaceVector.\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n * * See [[Plane3d]] note about scaling.\r\n */\r\n public abstract velocity(spaceVector: Vector3d): number;\r\n /**\r\n * Return the altitude of a point given as separate x,y,z components.\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n * * See [[Plane3d]] note about scaling.\r\n */\r\n public abstract altitudeXYZ(x: number, y: number, z: number): number;\r\n /**\r\n * Return the projection of spacePoint onto the plane.\r\n * * MUST BE IMPLEMENTED BY DERIVED CLASSES\r\n */\r\n public abstract projectPointToPlane(spacePoint: Point3d, result?: Point3d): Point3d;\r\n}\r\n"]}