@itwin/core-geometry 5.0.0-dev.32 → 5.0.0-dev.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Constant.js +17 -17
- package/lib/cjs/Constant.js.map +1 -1
- package/lib/cjs/Geometry.js +35 -35
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.js +2 -2
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js +2 -2
- package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js +1 -1
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +1 -1
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.js +1 -1
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js +3 -3
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/curve/Arc3d.js +14 -14
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +4 -4
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/LineString3d.js +5 -5
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +5 -5
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +13 -13
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +5 -5
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +5 -5
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +4 -4
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +2 -2
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.js +16 -16
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +8 -8
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/OrderedRotationAngles.js +2 -2
- package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +5 -5
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +23 -23
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +3 -3
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/cjs/geometry3d/Range.js +4 -4
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.js +13 -13
- package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
- package/lib/cjs/numerics/PascalCoefficients.js +1 -1
- package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
- package/lib/cjs/numerics/PolarData.js +1 -1
- package/lib/cjs/numerics/PolarData.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +26 -26
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/numerics/Quadrature.js +20 -20
- package/lib/cjs/numerics/Quadrature.js.map +1 -1
- package/lib/cjs/polyface/BoxTopology.js +67 -67
- package/lib/cjs/polyface/BoxTopology.js.map +1 -1
- package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js +2 -2
- package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +4 -4
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +5 -5
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +7 -7
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/multiclip/RangeSearch.js +5 -5
- package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js +22 -22
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +107 -107
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/topology/ChainMerge.js +4 -4
- package/lib/cjs/topology/ChainMerge.js.map +1 -1
- package/lib/cjs/topology/Graph.js +5 -5
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js +2 -2
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/cjs/topology/Triangulation.js +11 -11
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/esm/Constant.js +17 -17
- package/lib/esm/Constant.js.map +1 -1
- package/lib/esm/Geometry.js +35 -35
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/KnotVector.js +2 -2
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js +2 -2
- package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.js +1 -1
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +1 -1
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ClipVector.js +1 -1
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js +3 -3
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/curve/Arc3d.js +14 -14
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +4 -4
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/LineString3d.js +5 -5
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +5 -5
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +13 -13
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +5 -5
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +5 -5
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +4 -4
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js +2 -2
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/geometry3d/Angle.js +16 -16
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +8 -8
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/OrderedRotationAngles.js +2 -2
- package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +5 -5
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +23 -23
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +3 -3
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/esm/geometry3d/Range.js +4 -4
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/numerics/ClusterableArray.js +13 -13
- package/lib/esm/numerics/ClusterableArray.js.map +1 -1
- package/lib/esm/numerics/PascalCoefficients.js +1 -1
- package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
- package/lib/esm/numerics/PolarData.js +1 -1
- package/lib/esm/numerics/PolarData.js.map +1 -1
- package/lib/esm/numerics/Polynomials.js +26 -26
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/numerics/Quadrature.js +20 -20
- package/lib/esm/numerics/Quadrature.js.map +1 -1
- package/lib/esm/polyface/BoxTopology.js +67 -67
- package/lib/esm/polyface/BoxTopology.js.map +1 -1
- package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js +2 -2
- package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +4 -4
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +5 -5
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +7 -7
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/multiclip/RangeSearch.js +5 -5
- package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.js +22 -22
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +107 -107
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/topology/ChainMerge.js +4 -4
- package/lib/esm/topology/ChainMerge.js.map +1 -1
- package/lib/esm/topology/Graph.js +5 -5
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js +2 -2
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/esm/topology/Triangulation.js +11 -11
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/package.json +4 -4
|
@@ -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;AAC1C,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,oDAA+D;AAC/D,kCAA+B;AAC/B,4CAAyC;AAEzC,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,QAOb;AAED;;;GAGG;AACH,MAAM,KAAK;IAmBT,yCAAyC;IACzC,YACE,MAAkC,EAAE,MAAkC,EAAE,UAA+B;QAEvG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,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G,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;AArGD,kEAqGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry } from \"../../Geometry\";\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { Arc3d } from \"../Arc3d\";\nimport { CurveChain, CurveCollection } from \"../CurveCollection\";\nimport { CurveCurve } from \"../CurveCurve\";\nimport { CurveCurveApproachType, CurveLocationDetailPair } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { LineSegment3d } from \"../LineSegment3d\";\nimport { LineString3d } from \"../LineString3d\";\nimport { Loop } from \"../Loop\";\nimport { JointOptions, OffsetOptions } from \"../OffsetOptions\";\nimport { Path } from \"../Path\";\nimport { RegionOps } from \"../RegionOps\";\n\n// cspell:word CCWXY\n\n/**\n * Classification of how the joint is constructed.\n * @internal\n */\nenum JointMode {\n Unknown = 0, /** used when joint mode is unknown. */\n Cap = 1, /** used to annotate a \"Joint\" at the start/end of a curve without wrap (so there's no \"other\" curve). */\n Extend = 2, /** used when offset curves do not intersect and needs expanding to connect. */\n Trim = -1, /** used when offset curves intersect and still goes beyond the intersection so need trimming. */\n JustGeometry = 3, /** unused */\n Gap = 4, /** used when joint construction fails, resulting in a gap in the offset filled by a line segment. */\n}\n\n/**\n * Description of geometry around a joint.\n * @internal\n */\nclass Joint {\n /** Enumeration of how the joint is constructed. */\n public flexure: JointMode;\n /** Curve before the joint. */\n public curve0?: CurvePrimitive;\n /** Fractional position on curve0 (may be a trim or extension). */\n public fraction0?: number;\n /** Curve after the joint (may be a trim or extension). */\n public curve1?: CurvePrimitive;\n /** Fractional position on curve1. */\n public fraction1?: number;\n /** Curve to be added within the joint. */\n public jointCurve?: CurvePrimitive;\n /** Common point on the original curves. */\n public swingPoint?: Point3d;\n /** Pointer to next joint. */\n public nextJoint?: Joint;\n /** Pointer to previous joint. */\n public previousJoint?: Joint;\n // capture references to all data members\n public constructor(\n curve0: CurvePrimitive | undefined, curve1: CurvePrimitive | undefined, swingPoint: Point3d | undefined,\n ) {\n this.curve0 = curve0;\n this.curve1 = curve1;\n this.swingPoint = swingPoint;\n this.flexure = JointMode.Unknown;\n }\n /**\n * Try to construct an arc transition from ray0 to ray1 with given center.\n */\n public static constructArc(ray0: Ray3d, center: Point3d | undefined, ray1: Ray3d): Arc3d | undefined {\n if (center !== undefined && Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {\n const angle = ray0.direction.angleToXY(ray1.direction);\n const vector0 = Vector3d.createStartEnd(center, ray0.origin);\n const vector90 = vector0.rotate90CCWXY();\n return Arc3d.create(center, vector0, vector90, AngleSweep.createStartEndRadians(0.0, angle.radians));\n }\n return undefined;\n }\n /** Extract a json object of {curve0:data, fraction0:data, curve1:data, fraction1:data} */\n public shallowExtract(): any {\n return { curve0: this.curve0, curve1: this.curve1, fraction0: this.fraction0, fraction1: this.fraction1 };\n }\n /** Establish the nextJoint and previousJoint links from joint0 to joint1. */\n public static link(joint0: Joint, joint1: Joint | undefined) {\n joint0.nextJoint = joint1;\n if (joint1)\n joint1.previousJoint = joint0;\n if (joint0.curve1 && joint1 && !joint1.curve0)\n joint1.curve0 = joint0.curve1;\n else if (!joint0.curve1 && joint1 && joint1.curve0)\n joint0.curve1 = joint1.curve0;\n }\n /**\n * * If nextJoint and nextJoint.fraction0 are defined, return them.\n * * Otherwise return defaultValue\n */\n public nextJointFraction0(defaultValue: number): number {\n if (this.nextJoint && this.nextJoint.fraction0 !== undefined)\n return this.nextJoint.fraction0;\n return defaultValue;\n }\n private static addStrokes(destination: LineString3d, curve?: CurvePrimitive) {\n if (curve) {\n curve.emitStrokes(destination);\n }\n }\n private static addPoint(destination: LineString3d, point: Point3d) {\n if (destination.packedPoints.length > 0) {\n const pointA = destination.endPoint();\n if (!pointA.isAlmostEqual(point))\n destination.packedPoints.push(point);\n }\n }\n /** Append stroke points along the offset curve defined by the Joint chain to the destination line string. */\n public static collectStrokesFromChain(start: Joint, destination: LineString3d, maxTest: number = 100) {\n let numOut = -2 * maxTest; // allow extra things to happen\n Joint.visitJointsOnChain(\n start,\n (joint: Joint) => {\n this.addStrokes(destination, joint.jointCurve);\n if (joint.curve1 && joint.fraction1 !== undefined) {\n const fA = joint.fraction1;\n const fB = joint.nextJointFraction0(1.0);\n let curve1;\n if (fA === 0.0 && fB === 1.0)\n curve1 = joint.curve1.clone();\n else if (fA < fB)\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\n if (curve1) {\n if (!joint.jointCurve) {\n this.addPoint(destination, curve1.startPoint());\n }\n }\n this.addStrokes(destination, curve1);\n }\n return numOut++ < maxTest;\n },\n maxTest,\n );\n }\n private static collectPrimitive(destination: CurvePrimitive[], primitive?: CurvePrimitive) {\n if (primitive) {\n if (destination.length > 0) {\n const pointA = destination[destination.length - 1].endPoint();\n const pointB = primitive.startPoint();\n if (!pointA.isAlmostEqual(pointB)) {\n destination.push(LineSegment3d.create(pointA, pointB));\n }\n }\n destination.push(primitive);\n }\n }\n private static adjustJointToPrimitives(joint: Joint) {\n const ls = joint.jointCurve;\n if (ls instanceof LineString3d) {\n if (joint.curve0) {\n const curvePoint = joint.curve0.endPoint();\n const jointPoint0 = ls.startPoint();\n if (!curvePoint.isAlmostEqual(jointPoint0))\n ls.packedPoints.setAtCheckedPointIndex(0, curvePoint);\n }\n if (joint.curve1) {\n const curvePoint = joint.curve1.startPoint();\n const jointPoint1 = ls.endPoint();\n if (!curvePoint.isAlmostEqual(jointPoint1))\n ls.packedPoints.setAtCheckedPointIndex(ls.packedPoints.length - 1, curvePoint);\n }\n }\n }\n /** Append CurvePrimitives along the offset curve defined by the Joint chain to the destination array. */\n public static collectCurvesFromChain(start: Joint | undefined, destination: CurvePrimitive[], maxTest: number = 100) {\n if (start === undefined)\n return;\n let numOut = -2 * maxTest; // allow extra things to happen\n Joint.visitJointsOnChain(\n start,\n (joint: Joint) => {\n this.adjustJointToPrimitives(joint);\n this.collectPrimitive(destination, joint.jointCurve);\n if (joint.curve1 && joint.fraction1 !== undefined) {\n const fA = joint.fraction1;\n const fB = joint.nextJointFraction0(1.0);\n let curve1;\n if (fA === 0.0 && fB === 1.0)\n curve1 = joint.curve1.clone();\n else if (fA < fB)\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\n this.collectPrimitive(destination, curve1);\n }\n return numOut++ < maxTest;\n },\n maxTest,\n );\n }\n /**\n * Execute `joint.annotateJointMode()` at all joints on the chain to set some of the joints' attributes,\n * such as whether to extend both curves to intersection or to fill the gap between curves.\n */\n public static annotateChain(start: Joint | undefined, options: JointOptions, maxTest: number = 100) {\n if (start)\n Joint.visitJointsOnChain(start, (joint: Joint) => { joint.annotateJointMode(options); return true; }, maxTest);\n }\n /**\n * Visit joints on a chain.\n * * Terminates if `callback` returns `false`.\n * @param start first (and, for cyclic chain, final) joint.\n * @param callback function to call with each Joint as a single parameter.\n * @param maxTest\n */\n public static visitJointsOnChain(start: Joint, callback: (joint: Joint) => boolean, maxTest: number = 100): boolean {\n let joint: Joint | undefined = start;\n if (joint) {\n let numTest = 0;\n while (joint !== undefined) {\n if (numTest++ >= maxTest + 5) // allow extra things to happen\n return true;\n if (!callback(joint))\n return false;\n joint = joint.nextJoint;\n if (joint === start)\n break;\n }\n }\n return true;\n }\n /** NOTE: no assumption on type of curve0, curve1 */\n private annotateExtension(options: JointOptions) {\n if (this.curve0 && this.curve1) {\n const ray0 = this.curve0.fractionToPointAndDerivative(1.0);\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\n ray0.direction.z = ray1.direction.z = 0.0; // xy-offset\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\n if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n this.flexure = JointMode.Extend;\n const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef()); // angle between the 2 ray lines\n if (options.needArc(theta)) {\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\n if (arc) {\n this.jointCurve = arc;\n return;\n }\n }\n const numChamferPoints = options.numChamferPoints(theta); // how many interior points in the linestring\n if (numChamferPoints <= 1) { // create sharp corner\n this.jointCurve = LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);\n return;\n }\n if (numChamferPoints > 1) { // create chamfer corner (a line string)\n const radians0 = theta.radians;\n const numHalfStep = 2.0 * numChamferPoints;\n const halfStepRadians = radians0 / numHalfStep;\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\n if (arc !== undefined) {\n const radialFraction = 1 / Math.cos(halfStepRadians);\n const jointCurve = LineString3d.create();\n this.jointCurve = jointCurve;\n jointCurve.addPoint(ray0.origin); // possibly extend segment or line string\n\n for (let i = 0; i < numChamferPoints; i++) {\n const arcFraction = (1 + 2 * i) / numHalfStep;\n jointCurve.addPoint(arc.fractionAndRadialFractionToPoint(arcFraction, radialFraction));\n }\n jointCurve.addPoint(ray1.origin); // possibly extend segment or line string.\n return;\n }\n }\n }\n }\n // if there is no intersection between the 2 ray lines, fill the gap by a line segment\n this.flexure = JointMode.Gap;\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n }\n }\n /** Select the index at which summed fraction difference is smallest */\n private selectIntersectionIndexByFraction(\n fractionA: number, fractionB: number, intersections: CurveLocationDetailPair[],\n ): number {\n let index = -1;\n let aMin = Number.MAX_VALUE;\n for (let i = 0; i < intersections.length; i++) {\n const a = Math.abs(intersections[i].detailA.fraction - fractionA)\n + Math.abs(intersections[i].detailB.fraction - fractionB);\n if (a < aMin) {\n aMin = a;\n index = i;\n }\n }\n return index;\n }\n /**\n * Examine the adjacent geometry to set some of joint attributes:\n * * set JointMode: one of Cap, Extend, or Trim\n * * set fraction0 and fraction1 of intersection of curve0 and curve1\n * * set joint curve\n * * this REFERENCES curve0, curve1, fraction0, fraction1\n * * this does not reference nextJoint and previousJoint\n */\n public annotateJointMode(options: JointOptions): void {\n if (!this.curve0 && this.curve1) { // joint at the start of the chain\n this.flexure = JointMode.Cap;\n this.fraction1 = 0.0;\n } else if (this.curve0 && !this.curve1) { // joint at the end of the chain\n this.flexure = JointMode.Cap;\n this.fraction0 = 1.0;\n } else if (this.curve0 && this.curve1) { // joints at the middle of the chain\n if (this.curve0.endPoint().isAlmostEqualXY(this.curve1.startPoint())) { // joint between colinear xy-segments\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n this.flexure = JointMode.Trim;\n } else if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) { // pair of lines\n const ray0 = this.curve0.fractionToPointAndDerivative(0.0);\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\n ray0.direction.z = ray1.direction.z = 0.0; // xy-offset\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\n if (intersection.approachType === CurveCurveApproachType.Intersection || intersection.approachType === CurveCurveApproachType.PerpendicularChord) {\n this.fraction0 = intersection.detailA.fraction;\n this.fraction1 = intersection.detailB.fraction;\n if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) { // need to extend\n this.annotateExtension(options);\n } else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) { // need to trim\n this.flexure = JointMode.Trim;\n } else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) { // need to fill gap with a single line segment\n this.flexure = JointMode.Gap;\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n }\n }\n } else { // generic pair of curves\n const intersections = CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);\n const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);\n if (intersectionIndex >= 0) { // need to trim\n this.flexure = JointMode.Trim;\n this.fraction0 = intersections[intersectionIndex].detailA.fraction;\n this.fraction1 = intersections[intersectionIndex].detailB.fraction;\n } else { // need to extend\n this.annotateExtension(options);\n }\n }\n }\n }\n /**\n * * Examine the primitive trim fractions between each pair of joints.\n * * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at\n * surrounding primitives\n * @param start\n */\n public static removeDegeneratePrimitives(\n start: Joint, options: JointOptions, maxTest: number,\n ): { newStart: Joint, numJointRemoved: number } {\n /*\n if (Checker.noisy.PolygonOffset)\n GeometryCoreTestIO.consoleLog(\"\\nENTER removeDegenerates\");\n */\n let jointA: Joint | undefined = start;\n let numRemoved = 0;\n const maxRemove = 1;\n let numTest = 0;\n if (jointA) {\n while (jointA !== undefined && numTest++ < maxTest) {\n const jointB = jointA.nextJoint;\n if (jointA\n && jointB\n && jointA.previousJoint\n && jointB.nextJoint\n && jointA.fraction1 !== undefined\n && jointB.fraction0 !== undefined\n ) {\n const f0 = jointA.fraction1;\n const f1 = jointB.fraction0;\n const g0 = jointB.fraction1;\n const g1 = jointB.nextJoint.fraction0;\n // f0 and f1 are fractions on the single primitive between these joints.\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\"joint candidate\");\n GeometryCoreTestIO.consoleLog(prettyPrint(jointA.shallowExtract()));\n GeometryCoreTestIO.consoleLog(prettyPrint(jointB.shallowExtract()));\n GeometryCoreTestIO.consoleLog(\"FRACTIONS \", { fA1: f0, fB0: f1 });\n }\n */\n const eliminateF = f0 >= f1 || f0 > 1.0;\n const eliminateG = (g0 !== undefined && g0 > 1.0) || (g0 !== undefined && g1 !== undefined && g0 >= g1);\n if (eliminateF && eliminateG) {\n const jointC = jointB.nextJoint;\n const newJoint: Joint = new Joint(jointA.curve0, jointC.curve1, undefined);\n Joint.link(jointA.previousJoint, newJoint);\n Joint.link(newJoint, jointC.nextJoint);\n newJoint.annotateJointMode(options);\n newJoint.previousJoint!.annotateJointMode(options);\n if (newJoint.nextJoint)\n newJoint.nextJoint.annotateJointMode(options);\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\" NEW DOUBLE CUT\");\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\n }\n */\n } else if (eliminateF) {\n const newJoint: Joint = new Joint(jointA.curve0, jointB.curve1, undefined);\n Joint.link(jointA.previousJoint, newJoint);\n Joint.link(newJoint, jointB.nextJoint);\n newJoint.annotateJointMode(options);\n newJoint.previousJoint!.annotateJointMode(options);\n newJoint.nextJoint!.annotateJointMode(options);\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\" NEW JOINT\");\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\n }\n */\n numRemoved++;\n if (jointA === start)\n start = newJoint;\n jointA = newJoint;\n if (numRemoved >= maxRemove) {\n /*\n if (Checker.noisy.PolygonOffset)\n GeometryCoreTestIO.consoleLog(\" EXIT removeDegenerates at maxRemove\\n\");\n */\n return { newStart: start, numJointRemoved: numRemoved };\n }\n }\n }\n jointA = jointA.nextJoint;\n if (jointA === start)\n break;\n }\n }\n return { newStart: start, numJointRemoved: numRemoved };\n }\n}\n\n/**\n * Context for building a wire xy-offset.\n * @internal\n */\nexport class PolygonWireOffsetContext {\n /** Construct a context. */\n public constructor() { }\n private static _unitAlong = Vector3d.create();\n private static _unitPerp = Vector3d.create();\n private static _offsetA = Point3d.create();\n private static _offsetB = Point3d.create();\n // Construct a single offset from base points\n private static createOffsetSegment(\n basePointA: Point3d, basePointB: Point3d, distance: number,\n ): CurvePrimitive | undefined {\n Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);\n this._unitAlong.z = 0.0; // xy-offset\n if (this._unitAlong.normalizeInPlace()) {\n this._unitAlong.rotate90CCWXY(this._unitPerp);\n const segment = LineSegment3d.create(\n basePointA.plusScaled(this._unitPerp, distance, this._offsetA),\n basePointB.plusScaled(this._unitPerp, distance, this._offsetB),\n );\n CurveChainWireOffsetContext.applyBasePoints(segment, basePointA.clone(), basePointB.clone());\n return segment;\n }\n return undefined;\n }\n /**\n * Construct a wire (not area) that is offset from given polyline or polygon.\n * * For best results, points should be in a horizontal plane because z-coordinates are ignored.\n * * This is a simple wire offset (in the form of a line string), not an area.\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\n * * See [[JointOptions]] class doc for offset construction rules.\n * @param points a single loop or path\n * @param wrap true to offset the wraparound joint. Assumes first = last point.\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions\n * object.\n */\n public constructPolygonWireXYOffset(\n points: Point3d[], wrap: boolean, leftOffsetDistanceOrOptions: number | JointOptions,\n ): CurveChain | undefined {\n if (wrap && !points[0].isAlmostEqual(points[points.length - 1]))\n wrap = false; // no wrap possible for polylines\n // create raw offset segments as a linked list of Joints, starting with joint0\n const options = JointOptions.create(leftOffsetDistanceOrOptions);\n const numPoints = points.length;\n let fragment0: CurvePrimitive | undefined;\n let joint0, previousJoint: Joint | undefined;\n for (let i = 0; i + 1 < numPoints; ++i) {\n if (!previousJoint) { // start the linked list at the first nontrivial xy-segment\n if (fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance))\n previousJoint = joint0 = new Joint(undefined, fragment0, points[i]);\n } else {\n const fragment1 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance);\n if (fragment1) { // append the next nontrivial xy-segment\n const newJoint = new Joint(fragment0, fragment1, points[i]);\n Joint.link(previousJoint, newJoint);\n previousJoint = newJoint;\n fragment0 = fragment1;\n }\n }\n }\n if (!fragment0 || !previousJoint || !joint0)\n return undefined; // no edge with positive xy-length\n const lastJoint = wrap ? joint0 : new Joint(fragment0, undefined, points[numPoints - 1]);\n Joint.link(previousJoint, lastJoint);\n Joint.annotateChain(joint0, options, numPoints);\n // make limited passes through the Joint chain until no self-intersections are removed\n for (let pass = 0; pass++ < 5;) {\n const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);\n joint0 = state.newStart;\n if (state.numJointRemoved === 0)\n break;\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\" POST REMOVE DEGENERATES \" + state.numJointRemoved);\n Joint.visitJointsOnChain(joint0, (joint: Joint) => { GeometryCoreTestIO.consoleLog(prettyPrint(joint.shallowExtract())); return true; });\n }\n */\n }\n const chain = LineString3d.create();\n Joint.collectStrokesFromChain(joint0, chain, numPoints); // compute offset corners (by extension/trim)\n const n = chain.packedPoints.length;\n if (n > 1) {\n if (chain.packedPoints.front()!.isAlmostEqual(chain.packedPoints.back()!))\n return Loop.create(chain);\n else\n return Path.create(chain);\n }\n return undefined;\n }\n}\n\n/**\n * Context for building a wire xy-offset from a Path or Loop of CurvePrimitives\n * @internal\n */\nexport class CurveChainWireOffsetContext {\n /** construct a context. */\n public constructor() { }\n /**\n * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.\n * @param cp curve primitive to annotate\n * @param startPoint optional start point\n * @param endPoint optional end point\n * @return the input CurvePrimitive with annotations\n */\n public static applyBasePoints(\n cp: CurvePrimitive | undefined, startPoint: Point3d | undefined, endPoint: Point3d | undefined,\n ): CurvePrimitive | undefined {\n if (cp !== undefined) {\n if (startPoint !== undefined)\n (cp as any).baseCurveStart = startPoint;\n if (endPoint !== undefined)\n (cp as any).baseCurveEnd = endPoint;\n }\n return cp;\n }\n /**\n * Create the offset of a single curve primitive as viewed in the xy-plane (ignoring z).\n * * Each primitive may be labeled (as an `any` object) with start or end point of base curve:\n * * `(primitive as any).baseCurveStart: Point3d`\n * * `(primitive as any).baseCurveEnd: Point3d`\n * @param curve primitive to offset\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object\n */\n public static createSingleOffsetPrimitiveXY(\n curve: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions,\n ): CurvePrimitive | CurvePrimitive[] | undefined {\n const offset = curve.constructOffsetXY(offsetDistanceOrOptions);\n if (offset === undefined)\n return undefined;\n // decorate each offset with its base curve's endpoints\n if (Array.isArray(offset)) {\n const basePrims = curve.collectCurvePrimitives(undefined, true, true);\n if (basePrims.length !== offset.length)\n return undefined; // unexpected aggregate curve type!\n for (let i = 0; i < basePrims.length; ++i)\n this.applyBasePoints(offset[i], basePrims[i].startPoint(), basePrims[i].endPoint());\n return offset;\n }\n return this.applyBasePoints(offset, curve.startPoint(), curve.endPoint());\n }\n /**\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will\n * not detect self intersection among widely separated edges.\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/Offset\n * @param curves base curves.\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\n */\n public static constructCurveXYOffset(\n curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions,\n ): CurveCollection | undefined {\n const wrap: boolean = curves instanceof Loop;\n const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);\n const simpleOffsets: CurvePrimitive[] = [];\n /** traverse primitives (children of curves) and create simple offsets of each primitive as an array */\n for (const c of curves.children) {\n const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);\n if (c1 === undefined) {\n // bad; maybe arc to inside?\n } else if (c1 instanceof CurvePrimitive) {\n simpleOffsets.push(c1);\n } else if (Array.isArray(c1)) {\n for (const c2 of c1) {\n if (c2 instanceof CurvePrimitive)\n simpleOffsets.push(c2);\n }\n }\n }\n /** create joints between array elements to make offsets as a linked list (joint0) */\n let fragment0;\n let newJoint;\n let previousJoint;\n let joint0;\n for (const fragment1 of simpleOffsets) {\n if (fragment1) {\n newJoint = new Joint(fragment0, fragment1, fragment1.fractionToPoint(0.0));\n if (newJoint !== undefined)\n if (joint0 === undefined)\n joint0 = newJoint;\n if (previousJoint)\n Joint.link(previousJoint, newJoint);\n previousJoint = newJoint;\n fragment0 = fragment1;\n }\n }\n if (joint0 && previousJoint && curves instanceof Loop)\n Joint.link(previousJoint, joint0);\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\n const numOffset = simpleOffsets.length;\n Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);\n /** turn the Joint linked list into a CurveCollection. trimming is done in collectCurvesFromChain */\n const outputCurves: CurvePrimitive[] = [];\n Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);\n return RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PolygonOffsetContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAC1C,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,oDAA+D;AAC/D,kCAA+B;AAC/B,4CAAyC;AAEzC,oBAAoB;AAEpB;;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,CAAC;gBACtB,IAAI,aAAa;oBACf,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;gBACtC,aAAa,GAAG,QAAQ,CAAC;gBACzB,SAAS,GAAG,SAAS,CAAC;YACxB,CAAC;QACH,CAAC;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;AArGD,kEAqGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry } from \"../../Geometry\";\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { Arc3d } from \"../Arc3d\";\nimport { CurveChain, CurveCollection } from \"../CurveCollection\";\nimport { CurveCurve } from \"../CurveCurve\";\nimport { CurveCurveApproachType, CurveLocationDetailPair } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { LineSegment3d } from \"../LineSegment3d\";\nimport { LineString3d } from \"../LineString3d\";\nimport { Loop } from \"../Loop\";\nimport { JointOptions, OffsetOptions } from \"../OffsetOptions\";\nimport { Path } from \"../Path\";\nimport { RegionOps } from \"../RegionOps\";\n\n// cspell:word CCWXY\n\n/**\n * Classification of how the joint is constructed.\n * @internal\n */\nenum JointMode {\n Unknown = 0, /** used when joint mode is unknown. */\n Cap = 1, /** used to annotate a \"Joint\" at the start/end of a curve without wrap (so there's no \"other\" curve). */\n Extend = 2, /** used when offset curves do not intersect and needs expanding to connect. */\n Trim = -1, /** used when offset curves intersect and still goes beyond the intersection so need trimming. */\n JustGeometry = 3, /** unused */\n Gap = 4, /** used when joint construction fails, resulting in a gap in the offset filled by a line segment. */\n}\n\n/**\n * Description of geometry around a joint.\n * @internal\n */\nclass Joint {\n /** Enumeration of how the joint is constructed. */\n public flexure: JointMode;\n /** Curve before the joint. */\n public curve0?: CurvePrimitive;\n /** Fractional position on curve0 (may be a trim or extension). */\n public fraction0?: number;\n /** Curve after the joint (may be a trim or extension). */\n public curve1?: CurvePrimitive;\n /** Fractional position on curve1. */\n public fraction1?: number;\n /** Curve to be added within the joint. */\n public jointCurve?: CurvePrimitive;\n /** Common point on the original curves. */\n public swingPoint?: Point3d;\n /** Pointer to next joint. */\n public nextJoint?: Joint;\n /** Pointer to previous joint. */\n public previousJoint?: Joint;\n // capture references to all data members\n public constructor(\n curve0: CurvePrimitive | undefined, curve1: CurvePrimitive | undefined, swingPoint: Point3d | undefined,\n ) {\n this.curve0 = curve0;\n this.curve1 = curve1;\n this.swingPoint = swingPoint;\n this.flexure = JointMode.Unknown;\n }\n /**\n * Try to construct an arc transition from ray0 to ray1 with given center.\n */\n public static constructArc(ray0: Ray3d, center: Point3d | undefined, ray1: Ray3d): Arc3d | undefined {\n if (center !== undefined && Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {\n const angle = ray0.direction.angleToXY(ray1.direction);\n const vector0 = Vector3d.createStartEnd(center, ray0.origin);\n const vector90 = vector0.rotate90CCWXY();\n return Arc3d.create(center, vector0, vector90, AngleSweep.createStartEndRadians(0.0, angle.radians));\n }\n return undefined;\n }\n /** Extract a json object of {curve0:data, fraction0:data, curve1:data, fraction1:data} */\n public shallowExtract(): any {\n return { curve0: this.curve0, curve1: this.curve1, fraction0: this.fraction0, fraction1: this.fraction1 };\n }\n /** Establish the nextJoint and previousJoint links from joint0 to joint1. */\n public static link(joint0: Joint, joint1: Joint | undefined) {\n joint0.nextJoint = joint1;\n if (joint1)\n joint1.previousJoint = joint0;\n if (joint0.curve1 && joint1 && !joint1.curve0)\n joint1.curve0 = joint0.curve1;\n else if (!joint0.curve1 && joint1 && joint1.curve0)\n joint0.curve1 = joint1.curve0;\n }\n /**\n * * If nextJoint and nextJoint.fraction0 are defined, return them.\n * * Otherwise return defaultValue\n */\n public nextJointFraction0(defaultValue: number): number {\n if (this.nextJoint && this.nextJoint.fraction0 !== undefined)\n return this.nextJoint.fraction0;\n return defaultValue;\n }\n private static addStrokes(destination: LineString3d, curve?: CurvePrimitive) {\n if (curve) {\n curve.emitStrokes(destination);\n }\n }\n private static addPoint(destination: LineString3d, point: Point3d) {\n if (destination.packedPoints.length > 0) {\n const pointA = destination.endPoint();\n if (!pointA.isAlmostEqual(point))\n destination.packedPoints.push(point);\n }\n }\n /** Append stroke points along the offset curve defined by the Joint chain to the destination line string. */\n public static collectStrokesFromChain(start: Joint, destination: LineString3d, maxTest: number = 100) {\n let numOut = -2 * maxTest; // allow extra things to happen\n Joint.visitJointsOnChain(\n start,\n (joint: Joint) => {\n this.addStrokes(destination, joint.jointCurve);\n if (joint.curve1 && joint.fraction1 !== undefined) {\n const fA = joint.fraction1;\n const fB = joint.nextJointFraction0(1.0);\n let curve1;\n if (fA === 0.0 && fB === 1.0)\n curve1 = joint.curve1.clone();\n else if (fA < fB)\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\n if (curve1) {\n if (!joint.jointCurve) {\n this.addPoint(destination, curve1.startPoint());\n }\n }\n this.addStrokes(destination, curve1);\n }\n return numOut++ < maxTest;\n },\n maxTest,\n );\n }\n private static collectPrimitive(destination: CurvePrimitive[], primitive?: CurvePrimitive) {\n if (primitive) {\n if (destination.length > 0) {\n const pointA = destination[destination.length - 1].endPoint();\n const pointB = primitive.startPoint();\n if (!pointA.isAlmostEqual(pointB)) {\n destination.push(LineSegment3d.create(pointA, pointB));\n }\n }\n destination.push(primitive);\n }\n }\n private static adjustJointToPrimitives(joint: Joint) {\n const ls = joint.jointCurve;\n if (ls instanceof LineString3d) {\n if (joint.curve0) {\n const curvePoint = joint.curve0.endPoint();\n const jointPoint0 = ls.startPoint();\n if (!curvePoint.isAlmostEqual(jointPoint0))\n ls.packedPoints.setAtCheckedPointIndex(0, curvePoint);\n }\n if (joint.curve1) {\n const curvePoint = joint.curve1.startPoint();\n const jointPoint1 = ls.endPoint();\n if (!curvePoint.isAlmostEqual(jointPoint1))\n ls.packedPoints.setAtCheckedPointIndex(ls.packedPoints.length - 1, curvePoint);\n }\n }\n }\n /** Append CurvePrimitives along the offset curve defined by the Joint chain to the destination array. */\n public static collectCurvesFromChain(start: Joint | undefined, destination: CurvePrimitive[], maxTest: number = 100) {\n if (start === undefined)\n return;\n let numOut = -2 * maxTest; // allow extra things to happen\n Joint.visitJointsOnChain(\n start,\n (joint: Joint) => {\n this.adjustJointToPrimitives(joint);\n this.collectPrimitive(destination, joint.jointCurve);\n if (joint.curve1 && joint.fraction1 !== undefined) {\n const fA = joint.fraction1;\n const fB = joint.nextJointFraction0(1.0);\n let curve1;\n if (fA === 0.0 && fB === 1.0)\n curve1 = joint.curve1.clone();\n else if (fA < fB)\n curve1 = joint.curve1.clonePartialCurve(fA, fB); // trimming is done by clonePartialCurve\n this.collectPrimitive(destination, curve1);\n }\n return numOut++ < maxTest;\n },\n maxTest,\n );\n }\n /**\n * Execute `joint.annotateJointMode()` at all joints on the chain to set some of the joints' attributes,\n * such as whether to extend both curves to intersection or to fill the gap between curves.\n */\n public static annotateChain(start: Joint | undefined, options: JointOptions, maxTest: number = 100) {\n if (start)\n Joint.visitJointsOnChain(start, (joint: Joint) => { joint.annotateJointMode(options); return true; }, maxTest);\n }\n /**\n * Visit joints on a chain.\n * * Terminates if `callback` returns `false`.\n * @param start first (and, for cyclic chain, final) joint.\n * @param callback function to call with each Joint as a single parameter.\n * @param maxTest\n */\n public static visitJointsOnChain(start: Joint, callback: (joint: Joint) => boolean, maxTest: number = 100): boolean {\n let joint: Joint | undefined = start;\n if (joint) {\n let numTest = 0;\n while (joint !== undefined) {\n if (numTest++ >= maxTest + 5) // allow extra things to happen\n return true;\n if (!callback(joint))\n return false;\n joint = joint.nextJoint;\n if (joint === start)\n break;\n }\n }\n return true;\n }\n /** NOTE: no assumption on type of curve0, curve1 */\n private annotateExtension(options: JointOptions) {\n if (this.curve0 && this.curve1) {\n const ray0 = this.curve0.fractionToPointAndDerivative(1.0);\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\n ray0.direction.z = ray1.direction.z = 0.0; // xy-offset\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\n if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n this.flexure = JointMode.Extend;\n const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef()); // angle between the 2 ray lines\n if (options.needArc(theta)) {\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\n if (arc) {\n this.jointCurve = arc;\n return;\n }\n }\n const numChamferPoints = options.numChamferPoints(theta); // how many interior points in the linestring\n if (numChamferPoints <= 1) { // create sharp corner\n this.jointCurve = LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);\n return;\n }\n if (numChamferPoints > 1) { // create chamfer corner (a line string)\n const radians0 = theta.radians;\n const numHalfStep = 2.0 * numChamferPoints;\n const halfStepRadians = radians0 / numHalfStep;\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\n if (arc !== undefined) {\n const radialFraction = 1 / Math.cos(halfStepRadians);\n const jointCurve = LineString3d.create();\n this.jointCurve = jointCurve;\n jointCurve.addPoint(ray0.origin); // possibly extend segment or line string\n\n for (let i = 0; i < numChamferPoints; i++) {\n const arcFraction = (1 + 2 * i) / numHalfStep;\n jointCurve.addPoint(arc.fractionAndRadialFractionToPoint(arcFraction, radialFraction));\n }\n jointCurve.addPoint(ray1.origin); // possibly extend segment or line string.\n return;\n }\n }\n }\n }\n // if there is no intersection between the 2 ray lines, fill the gap by a line segment\n this.flexure = JointMode.Gap;\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n }\n }\n /** Select the index at which summed fraction difference is smallest */\n private selectIntersectionIndexByFraction(\n fractionA: number, fractionB: number, intersections: CurveLocationDetailPair[],\n ): number {\n let index = -1;\n let aMin = Number.MAX_VALUE;\n for (let i = 0; i < intersections.length; i++) {\n const a = Math.abs(intersections[i].detailA.fraction - fractionA)\n + Math.abs(intersections[i].detailB.fraction - fractionB);\n if (a < aMin) {\n aMin = a;\n index = i;\n }\n }\n return index;\n }\n /**\n * Examine the adjacent geometry to set some of joint attributes:\n * * set JointMode: one of Cap, Extend, or Trim\n * * set fraction0 and fraction1 of intersection of curve0 and curve1\n * * set joint curve\n * * this REFERENCES curve0, curve1, fraction0, fraction1\n * * this does not reference nextJoint and previousJoint\n */\n public annotateJointMode(options: JointOptions): void {\n if (!this.curve0 && this.curve1) { // joint at the start of the chain\n this.flexure = JointMode.Cap;\n this.fraction1 = 0.0;\n } else if (this.curve0 && !this.curve1) { // joint at the end of the chain\n this.flexure = JointMode.Cap;\n this.fraction0 = 1.0;\n } else if (this.curve0 && this.curve1) { // joints at the middle of the chain\n if (this.curve0.endPoint().isAlmostEqualXY(this.curve1.startPoint())) { // joint between colinear xy-segments\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n this.flexure = JointMode.Trim;\n } else if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) { // pair of lines\n const ray0 = this.curve0.fractionToPointAndDerivative(0.0);\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\n ray0.direction.z = ray1.direction.z = 0.0; // xy-offset\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1); // intersection of the 2 ray lines\n if (intersection.approachType === CurveCurveApproachType.Intersection || intersection.approachType === CurveCurveApproachType.PerpendicularChord) {\n this.fraction0 = intersection.detailA.fraction;\n this.fraction1 = intersection.detailB.fraction;\n if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) { // need to extend\n this.annotateExtension(options);\n } else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) { // need to trim\n this.flexure = JointMode.Trim;\n } else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) { // need to fill gap with a single line segment\n this.flexure = JointMode.Gap;\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\n this.fraction0 = 1.0;\n this.fraction1 = 0.0;\n }\n }\n } else { // generic pair of curves\n const intersections = CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);\n const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);\n if (intersectionIndex >= 0) { // need to trim\n this.flexure = JointMode.Trim;\n this.fraction0 = intersections[intersectionIndex].detailA.fraction;\n this.fraction1 = intersections[intersectionIndex].detailB.fraction;\n } else { // need to extend\n this.annotateExtension(options);\n }\n }\n }\n }\n /**\n * * Examine the primitive trim fractions between each pair of joints.\n * * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at\n * surrounding primitives\n * @param start\n */\n public static removeDegeneratePrimitives(\n start: Joint, options: JointOptions, maxTest: number,\n ): { newStart: Joint, numJointRemoved: number } {\n /*\n if (Checker.noisy.PolygonOffset)\n GeometryCoreTestIO.consoleLog(\"\\nENTER removeDegenerates\");\n */\n let jointA: Joint | undefined = start;\n let numRemoved = 0;\n const maxRemove = 1;\n let numTest = 0;\n if (jointA) {\n while (jointA !== undefined && numTest++ < maxTest) {\n const jointB = jointA.nextJoint;\n if (jointA\n && jointB\n && jointA.previousJoint\n && jointB.nextJoint\n && jointA.fraction1 !== undefined\n && jointB.fraction0 !== undefined\n ) {\n const f0 = jointA.fraction1;\n const f1 = jointB.fraction0;\n const g0 = jointB.fraction1;\n const g1 = jointB.nextJoint.fraction0;\n // f0 and f1 are fractions on the single primitive between these joints.\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\"joint candidate\");\n GeometryCoreTestIO.consoleLog(prettyPrint(jointA.shallowExtract()));\n GeometryCoreTestIO.consoleLog(prettyPrint(jointB.shallowExtract()));\n GeometryCoreTestIO.consoleLog(\"FRACTIONS \", { fA1: f0, fB0: f1 });\n }\n */\n const eliminateF = f0 >= f1 || f0 > 1.0;\n const eliminateG = (g0 !== undefined && g0 > 1.0) || (g0 !== undefined && g1 !== undefined && g0 >= g1);\n if (eliminateF && eliminateG) {\n const jointC = jointB.nextJoint;\n const newJoint: Joint = new Joint(jointA.curve0, jointC.curve1, undefined);\n Joint.link(jointA.previousJoint, newJoint);\n Joint.link(newJoint, jointC.nextJoint);\n newJoint.annotateJointMode(options);\n newJoint.previousJoint!.annotateJointMode(options);\n if (newJoint.nextJoint)\n newJoint.nextJoint.annotateJointMode(options);\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\" NEW DOUBLE CUT\");\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\n }\n */\n } else if (eliminateF) {\n const newJoint: Joint = new Joint(jointA.curve0, jointB.curve1, undefined);\n Joint.link(jointA.previousJoint, newJoint);\n Joint.link(newJoint, jointB.nextJoint);\n newJoint.annotateJointMode(options);\n newJoint.previousJoint!.annotateJointMode(options);\n newJoint.nextJoint!.annotateJointMode(options);\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\" NEW JOINT\");\n GeometryCoreTestIO.consoleLog(prettyPrint(newJoint.shallowExtract()));\n }\n */\n numRemoved++;\n if (jointA === start)\n start = newJoint;\n jointA = newJoint;\n if (numRemoved >= maxRemove) {\n /*\n if (Checker.noisy.PolygonOffset)\n GeometryCoreTestIO.consoleLog(\" EXIT removeDegenerates at maxRemove\\n\");\n */\n return { newStart: start, numJointRemoved: numRemoved };\n }\n }\n }\n jointA = jointA.nextJoint;\n if (jointA === start)\n break;\n }\n }\n return { newStart: start, numJointRemoved: numRemoved };\n }\n}\n\n/**\n * Context for building a wire xy-offset.\n * @internal\n */\nexport class PolygonWireOffsetContext {\n /** Construct a context. */\n public constructor() { }\n private static _unitAlong = Vector3d.create();\n private static _unitPerp = Vector3d.create();\n private static _offsetA = Point3d.create();\n private static _offsetB = Point3d.create();\n // Construct a single offset from base points\n private static createOffsetSegment(\n basePointA: Point3d, basePointB: Point3d, distance: number,\n ): CurvePrimitive | undefined {\n Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);\n this._unitAlong.z = 0.0; // xy-offset\n if (this._unitAlong.normalizeInPlace()) {\n this._unitAlong.rotate90CCWXY(this._unitPerp);\n const segment = LineSegment3d.create(\n basePointA.plusScaled(this._unitPerp, distance, this._offsetA),\n basePointB.plusScaled(this._unitPerp, distance, this._offsetB),\n );\n CurveChainWireOffsetContext.applyBasePoints(segment, basePointA.clone(), basePointB.clone());\n return segment;\n }\n return undefined;\n }\n /**\n * Construct a wire (not area) that is offset from given polyline or polygon.\n * * For best results, points should be in a horizontal plane because z-coordinates are ignored.\n * * This is a simple wire offset (in the form of a line string), not an area.\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\n * * See [[JointOptions]] class doc for offset construction rules.\n * @param points a single loop or path\n * @param wrap true to offset the wraparound joint. Assumes first = last point.\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or JointOptions\n * object.\n */\n public constructPolygonWireXYOffset(\n points: Point3d[], wrap: boolean, leftOffsetDistanceOrOptions: number | JointOptions,\n ): CurveChain | undefined {\n if (wrap && !points[0].isAlmostEqual(points[points.length - 1]))\n wrap = false; // no wrap possible for polylines\n // create raw offset segments as a linked list of Joints, starting with joint0\n const options = JointOptions.create(leftOffsetDistanceOrOptions);\n const numPoints = points.length;\n let fragment0: CurvePrimitive | undefined;\n let joint0, previousJoint: Joint | undefined;\n for (let i = 0; i + 1 < numPoints; ++i) {\n if (!previousJoint) { // start the linked list at the first nontrivial xy-segment\n if (fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance))\n previousJoint = joint0 = new Joint(undefined, fragment0, points[i]);\n } else {\n const fragment1 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance);\n if (fragment1) { // append the next nontrivial xy-segment\n const newJoint = new Joint(fragment0, fragment1, points[i]);\n Joint.link(previousJoint, newJoint);\n previousJoint = newJoint;\n fragment0 = fragment1;\n }\n }\n }\n if (!fragment0 || !previousJoint || !joint0)\n return undefined; // no edge with positive xy-length\n const lastJoint = wrap ? joint0 : new Joint(fragment0, undefined, points[numPoints - 1]);\n Joint.link(previousJoint, lastJoint);\n Joint.annotateChain(joint0, options, numPoints);\n // make limited passes through the Joint chain until no self-intersections are removed\n for (let pass = 0; pass++ < 5;) {\n const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);\n joint0 = state.newStart;\n if (state.numJointRemoved === 0)\n break;\n /*\n if (Checker.noisy.PolygonOffset) {\n GeometryCoreTestIO.consoleLog(\" POST REMOVE DEGENERATES \" + state.numJointRemoved);\n Joint.visitJointsOnChain(joint0, (joint: Joint) => { GeometryCoreTestIO.consoleLog(prettyPrint(joint.shallowExtract())); return true; });\n }\n */\n }\n const chain = LineString3d.create();\n Joint.collectStrokesFromChain(joint0, chain, numPoints); // compute offset corners (by extension/trim)\n const n = chain.packedPoints.length;\n if (n > 1) {\n if (chain.packedPoints.front()!.isAlmostEqual(chain.packedPoints.back()!))\n return Loop.create(chain);\n else\n return Path.create(chain);\n }\n return undefined;\n }\n}\n\n/**\n * Context for building a wire xy-offset from a Path or Loop of CurvePrimitives\n * @internal\n */\nexport class CurveChainWireOffsetContext {\n /** construct a context. */\n public constructor() { }\n /**\n * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.\n * @param cp curve primitive to annotate\n * @param startPoint optional start point\n * @param endPoint optional end point\n * @return the input CurvePrimitive with annotations\n */\n public static applyBasePoints(\n cp: CurvePrimitive | undefined, startPoint: Point3d | undefined, endPoint: Point3d | undefined,\n ): CurvePrimitive | undefined {\n if (cp !== undefined) {\n if (startPoint !== undefined)\n (cp as any).baseCurveStart = startPoint;\n if (endPoint !== undefined)\n (cp as any).baseCurveEnd = endPoint;\n }\n return cp;\n }\n /**\n * Create the offset of a single curve primitive as viewed in the xy-plane (ignoring z).\n * * Each primitive may be labeled (as an `any` object) with start or end point of base curve:\n * * `(primitive as any).baseCurveStart: Point3d`\n * * `(primitive as any).baseCurveEnd: Point3d`\n * @param curve primitive to offset\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object\n */\n public static createSingleOffsetPrimitiveXY(\n curve: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions,\n ): CurvePrimitive | CurvePrimitive[] | undefined {\n const offset = curve.constructOffsetXY(offsetDistanceOrOptions);\n if (offset === undefined)\n return undefined;\n // decorate each offset with its base curve's endpoints\n if (Array.isArray(offset)) {\n const basePrims = curve.collectCurvePrimitives(undefined, true, true);\n if (basePrims.length !== offset.length)\n return undefined; // unexpected aggregate curve type!\n for (let i = 0; i < basePrims.length; ++i)\n this.applyBasePoints(offset[i], basePrims[i].startPoint(), basePrims[i].endPoint());\n return offset;\n }\n return this.applyBasePoints(offset, curve.startPoint(), curve.endPoint());\n }\n /**\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will\n * not detect self intersection among widely separated edges.\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/Offset\n * @param curves base curves.\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\n */\n public static constructCurveXYOffset(\n curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions,\n ): CurveCollection | undefined {\n const wrap: boolean = curves instanceof Loop;\n const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);\n const simpleOffsets: CurvePrimitive[] = [];\n /** traverse primitives (children of curves) and create simple offsets of each primitive as an array */\n for (const c of curves.children) {\n const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);\n if (c1 === undefined) {\n // bad; maybe arc to inside?\n } else if (c1 instanceof CurvePrimitive) {\n simpleOffsets.push(c1);\n } else if (Array.isArray(c1)) {\n for (const c2 of c1) {\n if (c2 instanceof CurvePrimitive)\n simpleOffsets.push(c2);\n }\n }\n }\n /** create joints between array elements to make offsets as a linked list (joint0) */\n let fragment0;\n let newJoint;\n let previousJoint;\n let joint0;\n for (const fragment1 of simpleOffsets) {\n if (fragment1) {\n newJoint = new Joint(fragment0, fragment1, fragment1.fractionToPoint(0.0));\n if (newJoint !== undefined)\n if (joint0 === undefined)\n joint0 = newJoint;\n if (previousJoint)\n Joint.link(previousJoint, newJoint);\n previousJoint = newJoint;\n fragment0 = fragment1;\n }\n }\n if (joint0 && previousJoint && curves instanceof Loop)\n Joint.link(previousJoint, joint0);\n /** annotateChain sets some of the joints attributes (including how to extend curves or fill the gap between curves) */\n const numOffset = simpleOffsets.length;\n Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);\n /** turn the Joint linked list into a CurveCollection. trimming is done in collectCurvesFromChain */\n const outputCurves: CurvePrimitive[] = [];\n Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);\n return RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);\n }\n}\n"]}
|
|
@@ -48,6 +48,8 @@ class IntegratedSpiral3d extends TransitionSpiral3d_1.TransitionSpiral3d {
|
|
|
48
48
|
this._curvature01 = Segment1d_1.Segment1d.create(0, 1);
|
|
49
49
|
this.refreshComputedProperties();
|
|
50
50
|
}
|
|
51
|
+
/** default spiral type name. (clothoid) */
|
|
52
|
+
static { this.defaultSpiralType = "clothoid"; }
|
|
51
53
|
/** use the integrated function to return an angle at fractional position. */
|
|
52
54
|
globalFractionToBearingRadians(fraction) {
|
|
53
55
|
const areaFraction = this._evaluator.fractionToArea(fraction);
|
|
@@ -364,8 +366,6 @@ class IntegratedSpiral3d extends TransitionSpiral3d_1.TransitionSpiral3d {
|
|
|
364
366
|
}
|
|
365
367
|
}
|
|
366
368
|
exports.IntegratedSpiral3d = IntegratedSpiral3d;
|
|
367
|
-
/** default spiral type name. (clothoid) */
|
|
368
|
-
IntegratedSpiral3d.defaultSpiralType = "clothoid";
|
|
369
369
|
// at load time, initialize gauss quadrature workspace
|
|
370
370
|
IntegratedSpiral3d.initWorkSpace();
|
|
371
371
|
//# sourceMappingURL=IntegratedSpiral3d.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegratedSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/IntegratedSpiral3d.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6DAA0D;AAC1D,0DAAuD;AACvD,4DAAyD;AACzD,0DAAuD;AACvD,kDAA+C;AAC/C,iEAA8D;AAC9D,uFAAoF;AACpF,0DAAuD;AACvD,sEAA2D;AAC3D,wDAAqD;AAGrD,6CAAqD;AACrD,oDAAiD;AAEjD,kDAA+C;AAC/C,0FAAuF;AAEvF;;;;;;;GAOG;AACH,MAAa,kBAAmB,SAAQ,uCAAkB;IAexD,0EAA0E;IAC1E,IAAW,aAAa,KAAmB,OAAO,IAAI,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,C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C;mBACvE,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AAjZH,gDAkZC;AAxWC,2CAA2C;AACpB,oCAAiB,GAAG,UAAU,AAAb,CAAc;AAwWxD,sDAAsD;AACtD,kBAAkB,CAAC,aAAa,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { TransitionSpiral3d } from \"./TransitionSpiral3d\";\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\nimport { Transform } from \"../../geometry3d/Transform\";\nimport { LineString3d } from \"../LineString3d\";\nimport { NormalizedTransition } from \"./NormalizedTransition\";\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\nimport { Quadrature } from \"../../numerics/Quadrature\";\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\nimport { Angle } from \"../../geometry3d/Angle\";\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { AxisOrder, Geometry } from \"../../Geometry\";\nimport { StrokeOptions } from \"../StrokeOptions\";\nimport { GeometryHandler, IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { Plane3dByOriginAndVectors } from \"../../geometry3d/Plane3dByOriginAndVectors\";\nimport { GeometryQuery } from \"../GeometryQuery\";\n/**\n * An IntegratedSpiral3d is a curve defined by integrating its curvature.\n * * The first integral of curvature (with respect to distance along the curve) is the bearing angle (in radians)\n * * Integrating (cos(theta), sin(theta)) gives displacement from the start point, and thus the actual curve position.\n * * The curvature functions of interest are all symmetric snap functions in the NormalizedTransition class.\n * * `TransitionConditionalProperties` implements the computations of the interrelationship of radii, bearing, and length.\n * @public\n */\nexport class IntegratedSpiral3d extends TransitionSpiral3d {\n /** String name for schema properties */\n public readonly curvePrimitiveType = \"transitionSpiral\";\n\n /** start and end radii as a Segment1d */\n public radius01: Segment1d;\n /** start and end bearings as an AngleSweep */\n public bearing01: AngleSweep;\n /** stroked approximation of entire spiral. */\n private _globalStrokes: LineString3d;\n /** stroked approximation of active spiral.\n * * Same count as global -- possibly overly fine, but it gives some consistency between same clothoid constructed as partial versus complete.\n * * If no trimming, this points to the same place as the _globalStrokes !!! Don't double transform!!!\n */\n private _activeStrokes?: LineString3d;\n /** Return the internal stroked form of the (possibly partial) spiral */\n public get activeStrokes(): LineString3d { return this._activeStrokes !== undefined ? this._activeStrokes : this._globalStrokes; }\n private _evaluator: NormalizedTransition;\n /** Total curve arc length (computed) */\n private _arcLength01: number;\n /** Curvatures (inverse radii) at start and end */\n private _curvature01: Segment1d;\n /** evaluator for transition */\n // constructor demands all bearing, radius, and length data -- caller determines usual dependency of \"any 4 determine the 5th\"\n private constructor(spiralType: string | undefined,\n evaluator: NormalizedTransition,\n radius01: Segment1d,\n bearing01: AngleSweep,\n activeFractionInterval: Segment1d,\n localToWorld: Transform,\n arcLength: number,\n properties: TransitionConditionalProperties | undefined) {\n super(spiralType, localToWorld, activeFractionInterval, properties);\n this._evaluator = evaluator;\n this.radius01 = radius01;\n this.bearing01 = bearing01;\n this._arcLength01 = arcLength;\n this._globalStrokes = LineString3d.create();\n // initialize for compiler -- but this will be recomputed in refreshComputeProperties ...\n this._curvature01 = Segment1d.create(0, 1);\n this.refreshComputedProperties();\n }\n /** default spiral type name. (clothoid) */\n public static readonly defaultSpiralType = \"clothoid\";\n\n /** use the integrated function to return an angle at fractional position. */\n\n public globalFractionToBearingRadians(fraction: number): number {\n const areaFraction = this._evaluator.fractionToArea(fraction);\n const dx = this._arcLength01;\n return this.bearing01.startRadians + areaFraction * dx * this._curvature01.signedDelta() + fraction * this._curvature01.x0 * dx;\n }\n /** use the integrated function to return an angle at fractional position. */\n public globalFractionToCurvature(fraction: number): number {\n const f = this._evaluator.fractionToCurvatureFraction(fraction);\n return this._curvature01.fractionToPoint(f);\n }\n\n /** Return the bearing at given fraction of the active interval .... */\n\n public fractionToBearingRadians(activeFraction: number): number {\n const fraction = this.activeFractionInterval.fractionToPoint(activeFraction);\n return this.bearing01.startRadians + fraction * this._arcLength01 * (this._curvature01.x0 + 0.5 * fraction * (this._curvature01.x1 - this._curvature01.x0));\n }\n /** Return the curvature at given fraction of the active interval ...\n * * The `undefined` result is to match the abstract class -- it cannot actually occur.\n */\n public override fractionToCurvature(activeFraction: number): number | undefined {\n // BUG? active interval\n return this._curvature01.fractionToPoint(this.activeFractionInterval.fractionToPoint(activeFraction));\n }\n\n // These static variables are reused on calls to integrateFromStartFraction\n\n private static _gaussFraction: Float64Array;\n private static _gaussWeight: Float64Array;\n private static _gaussMapper: (xA: number, xB: number, arrayX: Float64Array, arrayW: Float64Array) => number;\n /** Initialize class level work arrays. */\n public static initWorkSpace() {\n IntegratedSpiral3d._gaussFraction = new Float64Array(5);\n IntegratedSpiral3d._gaussWeight = new Float64Array(5);\n IntegratedSpiral3d._gaussMapper = (xA, xB, xMapped, wMapped) => Quadrature.setupGauss5(xA, xB, xMapped, wMapped);\n }\n /** Evaluate and sum the gauss quadrature formulas to integrate cos(theta), sin(theta) fractional subset of a reference length.\n * (recall that theta is a nonlinear function of the fraction.)\n * * This is a single interval of gaussian integration.\n * * The fraction is on the full spiral (not in the mapped active interval)\n * @param xyz advancing integrated point.\n * @param fractionA fraction at start of interval\n * @param fractionB fraction at end of interval.\n * @param unitArcLength length of curve for 0 to 1 fractional\n */\n private fullSpiralIncrementalIntegral(xyz: Point3d, fractionA: number, fractionB: number, applyMatrix: boolean) {\n const gaussFraction = IntegratedSpiral3d._gaussFraction;\n const gaussWeight = IntegratedSpiral3d._gaussWeight;\n const numEval = IntegratedSpiral3d._gaussMapper(fractionA, fractionB, gaussFraction, gaussWeight);\n const deltaL = this._arcLength01;\n let w = 0;\n let dx = 0.0;\n let dy = 0.0;\n for (let k = 0; k < numEval; k++) {\n const radians = this.globalFractionToBearingRadians(gaussFraction[k]);\n w = gaussWeight[k] * deltaL;\n dx += w * Math.cos(radians);\n dy += w * Math.sin(radians);\n }\n if (applyMatrix)\n Matrix3d.xyzPlusMatrixTimesXYZ(xyz, this.localToWorld.matrix, { x: dx, y: dy, z: 0.0 }, xyz);\n else\n xyz.addXYZInPlace(dx, dy, 0.0);\n\n }\n /** Recompute strokes */\n public override refreshComputedProperties() {\n this._curvature01 = Segment1d.create(\n TransitionSpiral3d.radiusToCurvature(this.radius01.x0),\n TransitionSpiral3d.radiusToCurvature(this.radius01.x1));\n this._globalStrokes.clear();\n const currentPoint = Point3d.create();\n this._globalStrokes.appendStrokePoint(currentPoint);\n const numInterval = 16;\n\n const fractionStep = 1.0 / numInterval;\n for (let i = 1; i <= numInterval; i++) {\n const fraction0 = (i - 1) * fractionStep;\n const fraction1 = i * fractionStep;\n this.fullSpiralIncrementalIntegral(currentPoint, fraction0, fraction1, false);\n this._globalStrokes.appendStrokePoint(currentPoint);\n }\n this._globalStrokes.tryTransformInPlace(this.localToWorld);\n if (!this.activeFractionInterval.isExact01) {\n if (this._activeStrokes === undefined)\n this._activeStrokes = LineString3d.create();\n this._activeStrokes.clear();\n // finer strokes in the active interval ... same fraction step, but mapped\n // This assumes factionToPoint acts normally within refreshComputedProperties -- that depends on the global strokes we just computed, but not on the active strokes\n for (let i = 0; i <= numInterval; i++) {\n const localFraction = i * fractionStep;\n this._activeStrokes.addPoint(this.fractionToPoint(localFraction));\n }\n }\n }\n /**\n * Create a transition spiral with radius and bearing conditions.\n * @param radius01 radius (inverse curvature) at start and end. (radius of zero means straight line)\n * @param bearing01 bearing angles at start and end. bearings are measured from the x axis, positive clockwise towards y axis\n * @param activeFractionInterval fractional limits of the active portion of the spiral.\n * @param localToWorld placement frame. Fractional coordinate 0 is at the origin.\n */\n public static createRadiusRadiusBearingBearing(radius01: Segment1d, bearing01: AngleSweep, activeFractionInterval: Segment1d, localToWorld: Transform, typeName?: string) {\n const arcLength = TransitionSpiral3d.radiusRadiusSweepRadiansToArcLength(radius01.x0, radius01.x1, bearing01.sweepRadians);\n if (typeName === undefined)\n typeName = \"clothoid\";\n const evaluator = NormalizedTransition.findEvaluator(typeName);\n if (!evaluator)\n return undefined;\n return new IntegratedSpiral3d(typeName, evaluator,\n radius01.clone(),\n bearing01.clone(), activeFractionInterval.clone(), localToWorld.clone(), arcLength,\n new TransitionConditionalProperties(radius01.x0, radius01.x1,\n bearing01.startAngle.clone(), bearing01.endAngle.clone(),\n undefined));\n }\n /**\n * Create a transition spiral.\n * * Inputs must provide exactly 4 of the 5 values `[radius0,radius1,bearing0,bearing1,length`.\n * @param spiralType one of \"clothoid\", \"bloss\", \"biquadratic\", \"cosine\", \"sine\". If undefined, \"clothoid\" is used.\n * @param radius0 radius (or 0 for tangent to line) at start\n * @param radius1 radius (or 0 for tangent to line) at end\n * @param bearing0 bearing, measured CCW from x axis at start.\n * @param bearing1 bearing, measured CCW from x axis at end.\n * @param fractionInterval optional fractional interval for an \"active\" portion of the curve. if omitted, the full [0,1] is used.\n * @param localToWorld placement transform\n */\n public static createFrom4OutOf5(\n spiralType: string | undefined,\n radius0: number | undefined,\n radius1: number | undefined,\n bearing0: Angle | undefined,\n bearing1: Angle | undefined,\n arcLength: number | undefined,\n fractionInterval: undefined | Segment1d,\n localToWorld: Transform): IntegratedSpiral3d | undefined {\n if (spiralType === undefined)\n spiralType = \"clothoid\";\n const evaluator = NormalizedTransition.findEvaluator(spiralType);\n if (!evaluator)\n return undefined;\n const data = new TransitionConditionalProperties(radius0, radius1, bearing0, bearing1, arcLength);\n const data1 = data.clone();\n if (!data.tryResolveAnySingleUnknown())\n return undefined;\n if (fractionInterval === undefined)\n fractionInterval = Segment1d.create(0, 1);\n return new IntegratedSpiral3d(\n spiralType,\n evaluator,\n Segment1d.create(data.radius0, data.radius1),\n AngleSweep.createStartEnd(data.bearing0!, data.bearing1!),\n fractionInterval ? fractionInterval.clone() : Segment1d.create(0, 1),\n localToWorld, data.curveLength!, data1);\n }\n /** Copy all defining data from another spiral. */\n public setFrom(other: IntegratedSpiral3d): IntegratedSpiral3d {\n this.localToWorld.setFrom(other.localToWorld);\n this.radius01.setFrom(other.radius01);\n this._curvature01.setFrom(other._curvature01);\n this.bearing01.setFrom(other.bearing01);\n this.localToWorld.setFrom(other.localToWorld);\n this.activeFractionInterval.setFrom(other.activeFractionInterval);\n this._arcLength01 = other._arcLength01;\n return this;\n }\n /** Deep clone of this spiral */\n public override clone(): IntegratedSpiral3d {\n return new IntegratedSpiral3d(this._spiralType, this._evaluator,\n this.radius01.clone(), this.bearing01.clone(),\n this.activeFractionInterval.clone(), this.localToWorld.clone(), this._arcLength01,\n this._designProperties?.clone());\n }\n\n /** apply `transform` to this spiral's local to world transform. */\n public tryTransformInPlace(transformA: Transform): boolean {\n\n const rigidData = this.applyRigidPartOfTransform(transformA);\n if (rigidData !== undefined) {\n this._curvature01.x0 /= rigidData.scale;\n this._curvature01.x1 /= rigidData.scale;\n this.radius01.x0 *= rigidData.scale;\n this.radius01.x1 *= rigidData.scale;\n this._arcLength01 *= rigidData.scale;\n }\n this.refreshComputedProperties();\n return true;\n }\n\n /** Return the spiral start point. */\n public override startPoint(): Point3d { return this.activeStrokes.startPoint(); }\n /** return the spiral end point. */\n public override endPoint(): Point3d { return this.activeStrokes.endPoint(); }\n /** test if the local to world transform places the spiral xy plane into `plane` */\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\n return plane.isPointInPlane(this.localToWorld.origin as Point3d)\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnX(plane.getNormalRef()))\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnY(plane.getNormalRef()));\n }\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\n public quickLength() { return this.curveLength(); }\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\n public override curveLength() { return this._arcLength01 * (this._activeFractionInterval.absoluteDelta()); }\n /** Return (unsigned) length of the spiral between fractions. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\n public override curveLengthBetweenFractions(fraction0: number, fraction1: number) {\n return this._arcLength01 * (this._activeFractionInterval.absoluteDelta() * Math.abs(fraction1 - fraction0));\n }\n /** Test if `other` is an instance of `TransitionSpiral3d` */\n public isSameGeometryClass(other: any): boolean { return other instanceof TransitionSpiral3d; }\n /** Add strokes from this spiral to `dest`.\n * * Linestrings will usually stroke as just their points.\n * * If maxEdgeLength is given, this will sub-stroke within the linestring -- not what we want.\n */\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void { this.activeStrokes.emitStrokes(dest, options); }\n /** emit stroke fragments to `dest` handler. */\n public emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void {\n const n = this.computeStrokeCountForOptions(options);\n dest.startParentCurvePrimitive(this);\n const activeStrokes = this.activeStrokes;\n const preferPrimary = dest.needPrimaryGeometryForStrokes === undefined ? false : dest.needPrimaryGeometryForStrokes();\n if (!preferPrimary && n <= activeStrokes.numPoints()) {\n this.activeStrokes.emitStrokableParts(dest, options);\n } else {\n dest.announceIntervalForUniformStepStrokes(this, n, 0.0, 1.0);\n }\n dest.endParentCurvePrimitive(this);\n }\n\n /**\n * return the stroke count required for given options.\n * @param options StrokeOptions that determine count\n */\n\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\n let numStroke;\n if (options) {\n const rMin = Math.min(Math.abs(this.radius01.x0), Math.abs(this.radius01.x1));\n numStroke = options.applyTolerancesToArc(rMin, this.bearing01.sweepRadians);\n numStroke = options.applyMaxEdgeLength(numStroke, this.curveLength());\n numStroke = options.applyMinStrokesPerPrimitive(numStroke);\n } else {\n numStroke = StrokeOptions.applyAngleTol(undefined, 4, this.bearing01.sweepRadians);\n }\n return numStroke;\n }\n\n /** Reverse the active interval and active strokes.\n * * Primary defining data remains unchanged !!!\n */\n\n public reverseInPlace(): void {\n this.activeFractionInterval.reverseInPlace();\n if (this._activeStrokes === undefined)\n this._activeStrokes = this._globalStrokes.clone();\n this._activeStrokes.reverseInPlace();\n }\n /** Evaluate curve point with respect to fraction. */\n public fractionToPoint(activeFraction: number, result?: Point3d): Point3d {\n const targetGlobalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\n const numStrokes = this._globalStrokes.packedPoints.length - 1;\n if (activeFraction > 1.0) {\n result = this._globalStrokes.packedPoints.back(result)!;\n const integrationStep = 1.0 / numStrokes;\n let currentGlobalFraction = 1.0;\n let nextGlobalFraction = currentGlobalFraction + integrationStep;\n while (nextGlobalFraction < targetGlobalFraction) {\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);\n currentGlobalFraction = nextGlobalFraction;\n nextGlobalFraction += integrationStep;\n }\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);\n } else if (activeFraction < 0.0) {\n result = this._globalStrokes.packedPoints.front(result)!;\n const integrationStep = 1.0 / numStrokes;\n let currentGlobalFraction = 0.0;\n let nextGlobalFraction = currentGlobalFraction - integrationStep;\n while (nextGlobalFraction > targetGlobalFraction) {\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);\n currentGlobalFraction = nextGlobalFraction;\n nextGlobalFraction -= integrationStep;\n }\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);\n } else {\n const clampedGlobalFraction = Geometry.clampToStartEnd(targetGlobalFraction, 0, 1);\n const index0 = Math.trunc(clampedGlobalFraction * numStrokes); // This indexes the point to the left of the query.\n const globalFraction0 = index0 / numStrokes;\n result = this._globalStrokes.packedPoints.getPoint3dAtUncheckedPointIndex(index0, result);\n // GeometryCoreTestIO.consoleLog(\" fractionToPoint \", activeFraction, this.activeFractionInterval, \"( global integration \" + globalFraction0 + \" to \" + globalFraction + \")\", index0);\n this.fullSpiralIncrementalIntegral(result, globalFraction0, targetGlobalFraction, true);\n\n }\n return result;\n }\n /** Evaluate curve point and derivative with respect to fraction. */\n public fractionToPointAndDerivative(activeFraction: number, result?: Ray3d): Ray3d {\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\n result = result ? result : Ray3d.createZero();\n this.fractionToPoint(activeFraction, result.origin);\n const radians = this.globalFractionToBearingRadians(globalFraction);\n const a = this._arcLength01 * this.activeFractionInterval.signedDelta();\n this.localToWorld.matrix.multiplyXY(a * Math.cos(radians), a * Math.sin(radians), result.direction);\n return result;\n }\n\n /** Return the frenet frame at fractional position. */\n\n public override fractionToFrenetFrame(activeFraction: number, result?: Transform): Transform {\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\n result = result ? result : Transform.createIdentity();\n result.origin.setFrom(this.fractionToPoint(activeFraction));\n Matrix3d.createRigidFromMatrix3d(this.localToWorld.matrix, AxisOrder.XYZ, result.matrix);\n\n const radians = this.globalFractionToBearingRadians(globalFraction);\n const c = Math.cos(radians);\n const s = Math.sin(radians);\n result.matrix.applyGivensColumnOp(0, 1, c, s);\n return result;\n }\n /** Return a plane with\n *\n * * origin at fractional position along the curve\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\n * * vectorV is the second derivative, i.e.derivative of vectorU.\n */\n public fractionToPointAnd2Derivatives(activeFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined {\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\n const origin = this.fractionToPoint(activeFraction);\n const radians = this.globalFractionToBearingRadians(globalFraction);\n const c = Math.cos(radians);\n const s = Math.sin(radians);\n const delta = this.activeFractionInterval.signedDelta();\n const a = delta;\n const b = a * delta;\n const vectorX = this.localToWorld.matrix.multiplyXY(a * c, a * s);\n const vectorY = this.localToWorld.matrix.multiplyXY(-b * s, b * c);\n vectorY.scaleInPlace(this.globalFractionToCurvature(globalFraction));\n return Plane3dByOriginAndVectors.createCapture(origin, vectorX, vectorY, result);\n }\n /** Second step of double dispatch: call `handler.handleTransitionSpiral(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleTransitionSpiral(this);\n }\n\n /** compare various coordinate quantities */\n public override isAlmostEqual(other?: GeometryQuery): boolean {\n if (other instanceof IntegratedSpiral3d) {\n return this.radius01.isAlmostEqual(other.radius01)\n && this.bearing01.isAlmostEqualAllowPeriodShift(other.bearing01)\n && this.localToWorld.isAlmostEqual(other.localToWorld)\n && Geometry.isSameCoordinate(this._arcLength01, other._arcLength01)\n && this.activeFractionInterval.isAlmostEqual(other.activeFractionInterval)\n && this._curvature01.isAlmostEqual(other._curvature01);\n }\n return false;\n }\n}\n// at load time, initialize gauss quadrature workspace\nIntegratedSpiral3d.initWorkSpace();\n"]}
|
|
1
|
+
{"version":3,"file":"IntegratedSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/IntegratedSpiral3d.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6DAA0D;AAC1D,0DAAuD;AACvD,4DAAyD;AACzD,0DAAuD;AACvD,kDAA+C;AAC/C,iEAA8D;AAC9D,uFAAoF;AACpF,0DAAuD;AACvD,sEAA2D;AAC3D,wDAAqD;AAGrD,6CAAqD;AACrD,oDAAiD;AAEjD,kDAA+C;AAC/C,0FAAuF;AAEvF;;;;;;;GAOG;AACH,MAAa,kBAAmB,SAAQ,uCAAkB;IAexD,0EAA0E;IAC1E,IAAW,aAAa,KAAmB,OAAO,IAAI,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;IAMlI,+BAA+B;IAC/B,8HAA8H;IAC9H,YAAoB,UAA8B,EAChD,SAA+B,EAC/B,QAAmB,EACnB,SAAqB,EACr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AK,CAAC,YAAY,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AAjZH,gDAkZC;AACD,sDAAsD;AACtD,kBAAkB,CAAC,aAAa,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { TransitionSpiral3d } from \"./TransitionSpiral3d\";\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\nimport { Transform } from \"../../geometry3d/Transform\";\nimport { LineString3d } from \"../LineString3d\";\nimport { NormalizedTransition } from \"./NormalizedTransition\";\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\nimport { Quadrature } from \"../../numerics/Quadrature\";\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\nimport { Angle } from \"../../geometry3d/Angle\";\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { AxisOrder, Geometry } from \"../../Geometry\";\nimport { StrokeOptions } from \"../StrokeOptions\";\nimport { GeometryHandler, IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { Plane3dByOriginAndVectors } from \"../../geometry3d/Plane3dByOriginAndVectors\";\nimport { GeometryQuery } from \"../GeometryQuery\";\n/**\n * An IntegratedSpiral3d is a curve defined by integrating its curvature.\n * * The first integral of curvature (with respect to distance along the curve) is the bearing angle (in radians)\n * * Integrating (cos(theta), sin(theta)) gives displacement from the start point, and thus the actual curve position.\n * * The curvature functions of interest are all symmetric snap functions in the NormalizedTransition class.\n * * `TransitionConditionalProperties` implements the computations of the interrelationship of radii, bearing, and length.\n * @public\n */\nexport class IntegratedSpiral3d extends TransitionSpiral3d {\n /** String name for schema properties */\n public readonly curvePrimitiveType = \"transitionSpiral\";\n\n /** start and end radii as a Segment1d */\n public radius01: Segment1d;\n /** start and end bearings as an AngleSweep */\n public bearing01: AngleSweep;\n /** stroked approximation of entire spiral. */\n private _globalStrokes: LineString3d;\n /** stroked approximation of active spiral.\n * * Same count as global -- possibly overly fine, but it gives some consistency between same clothoid constructed as partial versus complete.\n * * If no trimming, this points to the same place as the _globalStrokes !!! Don't double transform!!!\n */\n private _activeStrokes?: LineString3d;\n /** Return the internal stroked form of the (possibly partial) spiral */\n public get activeStrokes(): LineString3d { return this._activeStrokes !== undefined ? this._activeStrokes : this._globalStrokes; }\n private _evaluator: NormalizedTransition;\n /** Total curve arc length (computed) */\n private _arcLength01: number;\n /** Curvatures (inverse radii) at start and end */\n private _curvature01: Segment1d;\n /** evaluator for transition */\n // constructor demands all bearing, radius, and length data -- caller determines usual dependency of \"any 4 determine the 5th\"\n private constructor(spiralType: string | undefined,\n evaluator: NormalizedTransition,\n radius01: Segment1d,\n bearing01: AngleSweep,\n activeFractionInterval: Segment1d,\n localToWorld: Transform,\n arcLength: number,\n properties: TransitionConditionalProperties | undefined) {\n super(spiralType, localToWorld, activeFractionInterval, properties);\n this._evaluator = evaluator;\n this.radius01 = radius01;\n this.bearing01 = bearing01;\n this._arcLength01 = arcLength;\n this._globalStrokes = LineString3d.create();\n // initialize for compiler -- but this will be recomputed in refreshComputeProperties ...\n this._curvature01 = Segment1d.create(0, 1);\n this.refreshComputedProperties();\n }\n /** default spiral type name. (clothoid) */\n public static readonly defaultSpiralType = \"clothoid\";\n\n /** use the integrated function to return an angle at fractional position. */\n\n public globalFractionToBearingRadians(fraction: number): number {\n const areaFraction = this._evaluator.fractionToArea(fraction);\n const dx = this._arcLength01;\n return this.bearing01.startRadians + areaFraction * dx * this._curvature01.signedDelta() + fraction * this._curvature01.x0 * dx;\n }\n /** use the integrated function to return an angle at fractional position. */\n public globalFractionToCurvature(fraction: number): number {\n const f = this._evaluator.fractionToCurvatureFraction(fraction);\n return this._curvature01.fractionToPoint(f);\n }\n\n /** Return the bearing at given fraction of the active interval .... */\n\n public fractionToBearingRadians(activeFraction: number): number {\n const fraction = this.activeFractionInterval.fractionToPoint(activeFraction);\n return this.bearing01.startRadians + fraction * this._arcLength01 * (this._curvature01.x0 + 0.5 * fraction * (this._curvature01.x1 - this._curvature01.x0));\n }\n /** Return the curvature at given fraction of the active interval ...\n * * The `undefined` result is to match the abstract class -- it cannot actually occur.\n */\n public override fractionToCurvature(activeFraction: number): number | undefined {\n // BUG? active interval\n return this._curvature01.fractionToPoint(this.activeFractionInterval.fractionToPoint(activeFraction));\n }\n\n // These static variables are reused on calls to integrateFromStartFraction\n\n private static _gaussFraction: Float64Array;\n private static _gaussWeight: Float64Array;\n private static _gaussMapper: (xA: number, xB: number, arrayX: Float64Array, arrayW: Float64Array) => number;\n /** Initialize class level work arrays. */\n public static initWorkSpace() {\n IntegratedSpiral3d._gaussFraction = new Float64Array(5);\n IntegratedSpiral3d._gaussWeight = new Float64Array(5);\n IntegratedSpiral3d._gaussMapper = (xA, xB, xMapped, wMapped) => Quadrature.setupGauss5(xA, xB, xMapped, wMapped);\n }\n /** Evaluate and sum the gauss quadrature formulas to integrate cos(theta), sin(theta) fractional subset of a reference length.\n * (recall that theta is a nonlinear function of the fraction.)\n * * This is a single interval of gaussian integration.\n * * The fraction is on the full spiral (not in the mapped active interval)\n * @param xyz advancing integrated point.\n * @param fractionA fraction at start of interval\n * @param fractionB fraction at end of interval.\n * @param unitArcLength length of curve for 0 to 1 fractional\n */\n private fullSpiralIncrementalIntegral(xyz: Point3d, fractionA: number, fractionB: number, applyMatrix: boolean) {\n const gaussFraction = IntegratedSpiral3d._gaussFraction;\n const gaussWeight = IntegratedSpiral3d._gaussWeight;\n const numEval = IntegratedSpiral3d._gaussMapper(fractionA, fractionB, gaussFraction, gaussWeight);\n const deltaL = this._arcLength01;\n let w = 0;\n let dx = 0.0;\n let dy = 0.0;\n for (let k = 0; k < numEval; k++) {\n const radians = this.globalFractionToBearingRadians(gaussFraction[k]);\n w = gaussWeight[k] * deltaL;\n dx += w * Math.cos(radians);\n dy += w * Math.sin(radians);\n }\n if (applyMatrix)\n Matrix3d.xyzPlusMatrixTimesXYZ(xyz, this.localToWorld.matrix, { x: dx, y: dy, z: 0.0 }, xyz);\n else\n xyz.addXYZInPlace(dx, dy, 0.0);\n\n }\n /** Recompute strokes */\n public override refreshComputedProperties() {\n this._curvature01 = Segment1d.create(\n TransitionSpiral3d.radiusToCurvature(this.radius01.x0),\n TransitionSpiral3d.radiusToCurvature(this.radius01.x1));\n this._globalStrokes.clear();\n const currentPoint = Point3d.create();\n this._globalStrokes.appendStrokePoint(currentPoint);\n const numInterval = 16;\n\n const fractionStep = 1.0 / numInterval;\n for (let i = 1; i <= numInterval; i++) {\n const fraction0 = (i - 1) * fractionStep;\n const fraction1 = i * fractionStep;\n this.fullSpiralIncrementalIntegral(currentPoint, fraction0, fraction1, false);\n this._globalStrokes.appendStrokePoint(currentPoint);\n }\n this._globalStrokes.tryTransformInPlace(this.localToWorld);\n if (!this.activeFractionInterval.isExact01) {\n if (this._activeStrokes === undefined)\n this._activeStrokes = LineString3d.create();\n this._activeStrokes.clear();\n // finer strokes in the active interval ... same fraction step, but mapped\n // This assumes factionToPoint acts normally within refreshComputedProperties -- that depends on the global strokes we just computed, but not on the active strokes\n for (let i = 0; i <= numInterval; i++) {\n const localFraction = i * fractionStep;\n this._activeStrokes.addPoint(this.fractionToPoint(localFraction));\n }\n }\n }\n /**\n * Create a transition spiral with radius and bearing conditions.\n * @param radius01 radius (inverse curvature) at start and end. (radius of zero means straight line)\n * @param bearing01 bearing angles at start and end. bearings are measured from the x axis, positive clockwise towards y axis\n * @param activeFractionInterval fractional limits of the active portion of the spiral.\n * @param localToWorld placement frame. Fractional coordinate 0 is at the origin.\n */\n public static createRadiusRadiusBearingBearing(radius01: Segment1d, bearing01: AngleSweep, activeFractionInterval: Segment1d, localToWorld: Transform, typeName?: string) {\n const arcLength = TransitionSpiral3d.radiusRadiusSweepRadiansToArcLength(radius01.x0, radius01.x1, bearing01.sweepRadians);\n if (typeName === undefined)\n typeName = \"clothoid\";\n const evaluator = NormalizedTransition.findEvaluator(typeName);\n if (!evaluator)\n return undefined;\n return new IntegratedSpiral3d(typeName, evaluator,\n radius01.clone(),\n bearing01.clone(), activeFractionInterval.clone(), localToWorld.clone(), arcLength,\n new TransitionConditionalProperties(radius01.x0, radius01.x1,\n bearing01.startAngle.clone(), bearing01.endAngle.clone(),\n undefined));\n }\n /**\n * Create a transition spiral.\n * * Inputs must provide exactly 4 of the 5 values `[radius0,radius1,bearing0,bearing1,length`.\n * @param spiralType one of \"clothoid\", \"bloss\", \"biquadratic\", \"cosine\", \"sine\". If undefined, \"clothoid\" is used.\n * @param radius0 radius (or 0 for tangent to line) at start\n * @param radius1 radius (or 0 for tangent to line) at end\n * @param bearing0 bearing, measured CCW from x axis at start.\n * @param bearing1 bearing, measured CCW from x axis at end.\n * @param fractionInterval optional fractional interval for an \"active\" portion of the curve. if omitted, the full [0,1] is used.\n * @param localToWorld placement transform\n */\n public static createFrom4OutOf5(\n spiralType: string | undefined,\n radius0: number | undefined,\n radius1: number | undefined,\n bearing0: Angle | undefined,\n bearing1: Angle | undefined,\n arcLength: number | undefined,\n fractionInterval: undefined | Segment1d,\n localToWorld: Transform): IntegratedSpiral3d | undefined {\n if (spiralType === undefined)\n spiralType = \"clothoid\";\n const evaluator = NormalizedTransition.findEvaluator(spiralType);\n if (!evaluator)\n return undefined;\n const data = new TransitionConditionalProperties(radius0, radius1, bearing0, bearing1, arcLength);\n const data1 = data.clone();\n if (!data.tryResolveAnySingleUnknown())\n return undefined;\n if (fractionInterval === undefined)\n fractionInterval = Segment1d.create(0, 1);\n return new IntegratedSpiral3d(\n spiralType,\n evaluator,\n Segment1d.create(data.radius0, data.radius1),\n AngleSweep.createStartEnd(data.bearing0!, data.bearing1!),\n fractionInterval ? fractionInterval.clone() : Segment1d.create(0, 1),\n localToWorld, data.curveLength!, data1);\n }\n /** Copy all defining data from another spiral. */\n public setFrom(other: IntegratedSpiral3d): IntegratedSpiral3d {\n this.localToWorld.setFrom(other.localToWorld);\n this.radius01.setFrom(other.radius01);\n this._curvature01.setFrom(other._curvature01);\n this.bearing01.setFrom(other.bearing01);\n this.localToWorld.setFrom(other.localToWorld);\n this.activeFractionInterval.setFrom(other.activeFractionInterval);\n this._arcLength01 = other._arcLength01;\n return this;\n }\n /** Deep clone of this spiral */\n public override clone(): IntegratedSpiral3d {\n return new IntegratedSpiral3d(this._spiralType, this._evaluator,\n this.radius01.clone(), this.bearing01.clone(),\n this.activeFractionInterval.clone(), this.localToWorld.clone(), this._arcLength01,\n this._designProperties?.clone());\n }\n\n /** apply `transform` to this spiral's local to world transform. */\n public tryTransformInPlace(transformA: Transform): boolean {\n\n const rigidData = this.applyRigidPartOfTransform(transformA);\n if (rigidData !== undefined) {\n this._curvature01.x0 /= rigidData.scale;\n this._curvature01.x1 /= rigidData.scale;\n this.radius01.x0 *= rigidData.scale;\n this.radius01.x1 *= rigidData.scale;\n this._arcLength01 *= rigidData.scale;\n }\n this.refreshComputedProperties();\n return true;\n }\n\n /** Return the spiral start point. */\n public override startPoint(): Point3d { return this.activeStrokes.startPoint(); }\n /** return the spiral end point. */\n public override endPoint(): Point3d { return this.activeStrokes.endPoint(); }\n /** test if the local to world transform places the spiral xy plane into `plane` */\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\n return plane.isPointInPlane(this.localToWorld.origin as Point3d)\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnX(plane.getNormalRef()))\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnY(plane.getNormalRef()));\n }\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\n public quickLength() { return this.curveLength(); }\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\n public override curveLength() { return this._arcLength01 * (this._activeFractionInterval.absoluteDelta()); }\n /** Return (unsigned) length of the spiral between fractions. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\n public override curveLengthBetweenFractions(fraction0: number, fraction1: number) {\n return this._arcLength01 * (this._activeFractionInterval.absoluteDelta() * Math.abs(fraction1 - fraction0));\n }\n /** Test if `other` is an instance of `TransitionSpiral3d` */\n public isSameGeometryClass(other: any): boolean { return other instanceof TransitionSpiral3d; }\n /** Add strokes from this spiral to `dest`.\n * * Linestrings will usually stroke as just their points.\n * * If maxEdgeLength is given, this will sub-stroke within the linestring -- not what we want.\n */\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void { this.activeStrokes.emitStrokes(dest, options); }\n /** emit stroke fragments to `dest` handler. */\n public emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void {\n const n = this.computeStrokeCountForOptions(options);\n dest.startParentCurvePrimitive(this);\n const activeStrokes = this.activeStrokes;\n const preferPrimary = dest.needPrimaryGeometryForStrokes === undefined ? false : dest.needPrimaryGeometryForStrokes();\n if (!preferPrimary && n <= activeStrokes.numPoints()) {\n this.activeStrokes.emitStrokableParts(dest, options);\n } else {\n dest.announceIntervalForUniformStepStrokes(this, n, 0.0, 1.0);\n }\n dest.endParentCurvePrimitive(this);\n }\n\n /**\n * return the stroke count required for given options.\n * @param options StrokeOptions that determine count\n */\n\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\n let numStroke;\n if (options) {\n const rMin = Math.min(Math.abs(this.radius01.x0), Math.abs(this.radius01.x1));\n numStroke = options.applyTolerancesToArc(rMin, this.bearing01.sweepRadians);\n numStroke = options.applyMaxEdgeLength(numStroke, this.curveLength());\n numStroke = options.applyMinStrokesPerPrimitive(numStroke);\n } else {\n numStroke = StrokeOptions.applyAngleTol(undefined, 4, this.bearing01.sweepRadians);\n }\n return numStroke;\n }\n\n /** Reverse the active interval and active strokes.\n * * Primary defining data remains unchanged !!!\n */\n\n public reverseInPlace(): void {\n this.activeFractionInterval.reverseInPlace();\n if (this._activeStrokes === undefined)\n this._activeStrokes = this._globalStrokes.clone();\n this._activeStrokes.reverseInPlace();\n }\n /** Evaluate curve point with respect to fraction. */\n public fractionToPoint(activeFraction: number, result?: Point3d): Point3d {\n const targetGlobalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\n const numStrokes = this._globalStrokes.packedPoints.length - 1;\n if (activeFraction > 1.0) {\n result = this._globalStrokes.packedPoints.back(result)!;\n const integrationStep = 1.0 / numStrokes;\n let currentGlobalFraction = 1.0;\n let nextGlobalFraction = currentGlobalFraction + integrationStep;\n while (nextGlobalFraction < targetGlobalFraction) {\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);\n currentGlobalFraction = nextGlobalFraction;\n nextGlobalFraction += integrationStep;\n }\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);\n } else if (activeFraction < 0.0) {\n result = this._globalStrokes.packedPoints.front(result)!;\n const integrationStep = 1.0 / numStrokes;\n let currentGlobalFraction = 0.0;\n let nextGlobalFraction = currentGlobalFraction - integrationStep;\n while (nextGlobalFraction > targetGlobalFraction) {\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);\n currentGlobalFraction = nextGlobalFraction;\n nextGlobalFraction -= integrationStep;\n }\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);\n } else {\n const clampedGlobalFraction = Geometry.clampToStartEnd(targetGlobalFraction, 0, 1);\n const index0 = Math.trunc(clampedGlobalFraction * numStrokes); // This indexes the point to the left of the query.\n const globalFraction0 = index0 / numStrokes;\n result = this._globalStrokes.packedPoints.getPoint3dAtUncheckedPointIndex(index0, result);\n // GeometryCoreTestIO.consoleLog(\" fractionToPoint \", activeFraction, this.activeFractionInterval, \"( global integration \" + globalFraction0 + \" to \" + globalFraction + \")\", index0);\n this.fullSpiralIncrementalIntegral(result, globalFraction0, targetGlobalFraction, true);\n\n }\n return result;\n }\n /** Evaluate curve point and derivative with respect to fraction. */\n public fractionToPointAndDerivative(activeFraction: number, result?: Ray3d): Ray3d {\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\n result = result ? result : Ray3d.createZero();\n this.fractionToPoint(activeFraction, result.origin);\n const radians = this.globalFractionToBearingRadians(globalFraction);\n const a = this._arcLength01 * this.activeFractionInterval.signedDelta();\n this.localToWorld.matrix.multiplyXY(a * Math.cos(radians), a * Math.sin(radians), result.direction);\n return result;\n }\n\n /** Return the frenet frame at fractional position. */\n\n public override fractionToFrenetFrame(activeFraction: number, result?: Transform): Transform {\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\n result = result ? result : Transform.createIdentity();\n result.origin.setFrom(this.fractionToPoint(activeFraction));\n Matrix3d.createRigidFromMatrix3d(this.localToWorld.matrix, AxisOrder.XYZ, result.matrix);\n\n const radians = this.globalFractionToBearingRadians(globalFraction);\n const c = Math.cos(radians);\n const s = Math.sin(radians);\n result.matrix.applyGivensColumnOp(0, 1, c, s);\n return result;\n }\n /** Return a plane with\n *\n * * origin at fractional position along the curve\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\n * * vectorV is the second derivative, i.e.derivative of vectorU.\n */\n public fractionToPointAnd2Derivatives(activeFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined {\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\n const origin = this.fractionToPoint(activeFraction);\n const radians = this.globalFractionToBearingRadians(globalFraction);\n const c = Math.cos(radians);\n const s = Math.sin(radians);\n const delta = this.activeFractionInterval.signedDelta();\n const a = delta;\n const b = a * delta;\n const vectorX = this.localToWorld.matrix.multiplyXY(a * c, a * s);\n const vectorY = this.localToWorld.matrix.multiplyXY(-b * s, b * c);\n vectorY.scaleInPlace(this.globalFractionToCurvature(globalFraction));\n return Plane3dByOriginAndVectors.createCapture(origin, vectorX, vectorY, result);\n }\n /** Second step of double dispatch: call `handler.handleTransitionSpiral(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleTransitionSpiral(this);\n }\n\n /** compare various coordinate quantities */\n public override isAlmostEqual(other?: GeometryQuery): boolean {\n if (other instanceof IntegratedSpiral3d) {\n return this.radius01.isAlmostEqual(other.radius01)\n && this.bearing01.isAlmostEqualAllowPeriodShift(other.bearing01)\n && this.localToWorld.isAlmostEqual(other.localToWorld)\n && Geometry.isSameCoordinate(this._arcLength01, other._arcLength01)\n && this.activeFractionInterval.isAlmostEqual(other.activeFractionInterval)\n && this._curvature01.isAlmostEqual(other._curvature01);\n }\n return false;\n }\n}\n// at load time, initialize gauss quadrature workspace\nIntegratedSpiral3d.initWorkSpace();\n"]}
|
|
@@ -20,6 +20,22 @@ const Geometry_1 = require("../Geometry");
|
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
22
22
|
class Angle {
|
|
23
|
+
/** maximal accuracy value of pi/12 (15 degrees), in radians */
|
|
24
|
+
static { this.piOver12Radians = 0.26179938779914946; }
|
|
25
|
+
/** maximal accuracy value of pi/4 (45 degrees), in radians */
|
|
26
|
+
static { this.piOver4Radians = 7.853981633974483e-001; }
|
|
27
|
+
/** maximal accuracy value of pi/2 (90 degrees), in radians */
|
|
28
|
+
static { this.piOver2Radians = 1.5707963267948966e+000; }
|
|
29
|
+
/** maximal accuracy value of pi (180 degrees), in radians */
|
|
30
|
+
static { this.piRadians = 3.141592653589793e+000; }
|
|
31
|
+
/** maximal accuracy value of 3*pi/2 (270 degrees), in radians */
|
|
32
|
+
static { this.pi3Over2Radians = 4.71238898038469e+000; }
|
|
33
|
+
/** maximal accuracy value of 2*pi (360 degrees), in radians */
|
|
34
|
+
static { this.pi2Radians = 6.283185307179586e+000; }
|
|
35
|
+
/** scale factor for converting radians to degrees */
|
|
36
|
+
static { this.degreesPerRadian = (45.0 / Angle.piOver4Radians); }
|
|
37
|
+
/** scale factor for converting degrees to radians */
|
|
38
|
+
static { this.radiansPerDegree = (Angle.piOver4Radians / 45.0); }
|
|
23
39
|
constructor(radians = 0, degrees) {
|
|
24
40
|
this._radians = radians;
|
|
25
41
|
this._degrees = degrees;
|
|
@@ -535,20 +551,4 @@ class Angle {
|
|
|
535
551
|
}
|
|
536
552
|
}
|
|
537
553
|
exports.Angle = Angle;
|
|
538
|
-
/** maximal accuracy value of pi/12 (15 degrees), in radians */
|
|
539
|
-
Angle.piOver12Radians = 0.26179938779914946;
|
|
540
|
-
/** maximal accuracy value of pi/4 (45 degrees), in radians */
|
|
541
|
-
Angle.piOver4Radians = 7.853981633974483e-001;
|
|
542
|
-
/** maximal accuracy value of pi/2 (90 degrees), in radians */
|
|
543
|
-
Angle.piOver2Radians = 1.5707963267948966e+000;
|
|
544
|
-
/** maximal accuracy value of pi (180 degrees), in radians */
|
|
545
|
-
Angle.piRadians = 3.141592653589793e+000;
|
|
546
|
-
/** maximal accuracy value of 3*pi/2 (270 degrees), in radians */
|
|
547
|
-
Angle.pi3Over2Radians = 4.71238898038469e+000;
|
|
548
|
-
/** maximal accuracy value of 2*pi (360 degrees), in radians */
|
|
549
|
-
Angle.pi2Radians = 6.283185307179586e+000;
|
|
550
|
-
/** scale factor for converting radians to degrees */
|
|
551
|
-
Angle.degreesPerRadian = (45.0 / Angle.piOver4Radians);
|
|
552
|
-
/** scale factor for converting degrees to radians */
|
|
553
|
-
Angle.radiansPerDegree = (Angle.piOver4Radians / 45.0);
|
|
554
554
|
//# sourceMappingURL=Angle.js.map
|