@itwin/core-geometry 3.1.0-dev.8 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +75 -3
- package/lib/cjs/bspline/BSplineCurve.d.ts +8 -0
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +14 -0
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.d.ts +8 -0
- package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js +16 -1
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +6 -0
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +31 -0
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +8 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +22 -2
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.js +3 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +7 -3
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +30 -15
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +23 -9
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +18 -0
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +6 -0
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +14 -0
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +7 -0
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +20 -0
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.d.ts +6 -2
- package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js +5 -0
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +11 -0
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js +26 -17
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +15 -16
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +14 -16
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js +3 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts +6 -0
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js +20 -0
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.d.ts +36 -0
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js +73 -0
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -0
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +48 -24
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +113 -112
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +33 -7
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +8 -0
- package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js +14 -0
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +4 -4
- package/lib/cjs/geometry3d/Matrix3d.js +4 -4
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.js +21 -8
- package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.d.ts +1 -1
- package/lib/cjs/numerics/ClusterableArray.d.ts.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.js +2 -2
- package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +15 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +17 -11
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts +22 -3
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +97 -1
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +8 -0
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +14 -0
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.d.ts +8 -0
- package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js +16 -1
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +6 -0
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +31 -0
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +8 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +22 -2
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXY.js +3 -1
- package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +7 -3
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +30 -15
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +23 -9
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +18 -0
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +6 -0
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +15 -1
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +7 -0
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +20 -0
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.d.ts +6 -2
- package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/esm/curve/ProxyCurve.js +5 -0
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts +11 -0
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js +26 -17
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +15 -16
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +15 -17
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js +3 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts +6 -0
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js +20 -0
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.d.ts +36 -0
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js +69 -0
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -0
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +48 -24
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +111 -111
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js +33 -7
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +8 -0
- package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js +14 -0
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +4 -4
- package/lib/esm/geometry3d/Matrix3d.js +4 -4
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.js +21 -8
- package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
- package/lib/esm/numerics/ClusterableArray.d.ts +1 -1
- package/lib/esm/numerics/ClusterableArray.d.ts.map +1 -1
- package/lib/esm/numerics/ClusterableArray.js +2 -2
- package/lib/esm/numerics/ClusterableArray.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +15 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +17 -11
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts +22 -3
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +95 -0
- package/lib/esm/topology/Merging.js.map +1 -1
- package/package.json +7 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolygonOffsetContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAE1C,4DAAyD;AACzD,+BAA+B;AAC/B,sEAAqE;AACrE,kDAA+C;AAC/C,oCAAiC;AAEjC,8CAA2C;AAC3C,gEAAyF;AACzF,sDAAmD;AACnD,oDAAiD;AACjD,kDAA+C;AAC/C,kCAA+B;AAC/B,kCAA+B;AAC/B,4CAAyC;AAEzC;;;GAGG;AACH,IAAK,SAOJ;AAPD,WAAK,SAAS;IACZ,+CAAW,CAA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AC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\r\n/* eslint-disable no-console */\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { CurveCollection } from \"../CurveCollection\";\r\nimport { CurveCurve } from \"../CurveCurve\";\r\nimport { CurveCurveApproachType, CurveLocationDetailPair } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { Loop } from \"../Loop\";\r\nimport { Path } from \"../Path\";\r\nimport { RegionOps } from \"../RegionOps\";\r\n\r\n/**\r\n * Classification of contortions at a joint.\r\n * @internal\r\n */\r\nenum JointMode {\r\n Unknown = 0,\r\n Cap = 1,\r\n Extend = 2,\r\n Trim = -1,\r\n JustGeometry = 3,\r\n Gap = 4,\r\n}\r\n\r\n/**\r\n * * control parameters for joint construction.\r\n * * Decision order is:\r\n * * if turn angle is greater than minArcDegrees, make an arc.\r\n * * if turn angle is less than or equal maxChamferTurnDegrees, extend curves along tangent to single intersection point.\r\n * * if turn angle is greater than maxChamferTurnDegrees, construct multiple lines that are tangent to the turn circle \"from the outside\",\r\n * with each equal turn less than maxChamferTurnDegrees.\r\n * * otherwise make single edge.\r\n * @public\r\n */\r\nexport class JointOptions {\r\n /** smallest arc to construct.\r\n * * If this control angle is large, arcs are never created.\r\n */\r\n public minArcDegrees = 180.0;\r\n public maxChamferTurnDegrees = 90;\r\n public leftOffsetDistance: number = 0;\r\n /** Construct JointOptions.\r\n * * leftOffsetDistance is required\r\n * * minArcDegrees and maxChamferDegrees are optional.\r\n */\r\n constructor(leftOffsetDistance: number, minArcDegrees = 180, maxChamferDegrees = 90) {\r\n this.leftOffsetDistance = leftOffsetDistance;\r\n this.minArcDegrees = minArcDegrees;\r\n this.maxChamferTurnDegrees = maxChamferDegrees;\r\n }\r\n /**\r\n * Parse a number of JointOptions up to JointOptions:\r\n * * If leftOffsetDistanceOptions is a number, create a JointOptions with default arc and chamfer values.\r\n * * If leftOffsetDistanceOrOptions is a JointOptions, return it unchanged.\r\n * @param leftOffsetDistanceOrOptions\r\n */\r\n public static create(leftOffsetDistanceOrOptions: number | JointOptions): JointOptions {\r\n if (leftOffsetDistanceOrOptions instanceof JointOptions)\r\n return leftOffsetDistanceOrOptions;\r\n // if (Number.isFinite(leftOffsetDistanceOrOptions))\r\n return new JointOptions(leftOffsetDistanceOrOptions);\r\n }\r\n /** return true if the options indicate this amount of turn should be handled with an arc. */\r\n public needArc(theta: Angle): boolean {\r\n return Math.abs(theta.degrees) >= this.minArcDegrees;\r\n }\r\n /** Test if turn by theta should be output as single point. */\r\n public numChamferPoints(theta: Angle): number {\r\n const degrees = Math.abs(theta.degrees);\r\n const stepDegrees = Geometry.clamp(this.maxChamferTurnDegrees, 10, 120);\r\n if (degrees <= stepDegrees)\r\n return 1;\r\n return Math.ceil(degrees / stepDegrees);\r\n }\r\n}\r\n/**\r\n * Description of geometry around a joint.\r\n * @internal\r\n */\r\nclass Joint {\r\n /** Enumeration of how the joint is constructed */\r\n public flexure: JointMode;\r\n\r\n /** curve before the joint */\r\n public curve0?: CurvePrimitive;\r\n /** fractional position on curve0 (may be a trim or extension) */\r\n public fraction0?: number;\r\n /** curve after the joint (may be a trim or extension) */\r\n public curve1?: CurvePrimitive;\r\n /** fractional position on curve1 */\r\n public fraction1?: number;\r\n /** curve to be added within the joint */\r\n public jointCurve?: CurvePrimitive;\r\n /** common point on the original curves */\r\n public swingPoint?: Point3d;\r\n /** pointer to next joint */\r\n public nextJoint?: Joint;\r\n /** pointer to previous joint */\r\n public previousJoint?: Joint;\r\n // capture references to all data . . .\r\n public constructor(curve0: CurvePrimitive | undefined, curve1: CurvePrimitive | undefined, swingPoint: Point3d | undefined) {\r\n this.curve0 = curve0;\r\n this.curve1 = curve1;\r\n this.swingPoint = swingPoint;\r\n this.flexure = JointMode.Unknown;\r\n }\r\n /** try to construct an arc transition from ray0 to ray1 with given center. */\r\n public static constructArc(ray0: Ray3d, center: Point3d | undefined, ray1: Ray3d): Arc3d | undefined {\r\n if (center !== undefined && Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {\r\n const angle = ray0.direction.angleToXY(ray1.direction);\r\n const vector0 = Vector3d.createStartEnd(center, ray0.origin);\r\n const vector90 = vector0.rotate90CCWXY();\r\n return Arc3d.create(center, vector0, vector90, AngleSweep.createStartEndRadians(0.0, angle.radians));\r\n }\r\n return undefined;\r\n }\r\n /** Extract a json object of {curve0:data, fraction0:data, curve1:data, fraction1:data} */\r\n public shallowExtract(): any {\r\n return { curve0: this.curve0, curve1: this.curve1, fraction0: this.fraction0, fraction1: this.fraction1 };\r\n }\r\n /** Establish the nextJoint and previousJoint links from joint0 to joint1. */\r\n public static link(joint0: Joint, joint1: Joint | undefined) {\r\n joint0.nextJoint = joint1;\r\n if (joint1)\r\n joint1.previousJoint = joint0;\r\n if (joint0.curve1 && joint1 && !joint1.curve0)\r\n joint1.curve0 = joint0.curve1;\r\n else if (!joint0.curve1 && joint1 && joint1.curve0)\r\n joint0.curve1 = joint1.curve0;\r\n }\r\n /**\r\n * * If nextJoint and nextJoint.fraction0 are defined, return them.\r\n * * Otherwise return defaultValue\r\n */\r\n public nextJointFraction0(defaultValue: number): number {\r\n if (this.nextJoint && this.nextJoint.fraction0 !== undefined)\r\n return this.nextJoint.fraction0;\r\n return defaultValue;\r\n }\r\n\r\n private static addStrokes(destination: LineString3d, curve?: CurvePrimitive) {\r\n if (curve) {\r\n curve.emitStrokes(destination);\r\n }\r\n }\r\n\r\n private static addPoint(destination: LineString3d, point: Point3d) {\r\n if (destination.packedPoints.length > 0) {\r\n const pointA = destination.endPoint();\r\n if (!pointA.isAlmostEqual(point))\r\n destination.packedPoints.push(point);\r\n }\r\n }\r\n\r\n public static collectStrokesFromChain(start: Joint, destination: LineString3d, maxTest: number = 100) {\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(start, (joint: Joint) => {\r\n this.addStrokes(destination, joint.jointCurve);\r\n\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone() as CurvePrimitive;\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB);\r\n if (curve1) {\r\n if (!joint.jointCurve) {\r\n this.addPoint(destination, curve1.startPoint());\r\n }\r\n }\r\n this.addStrokes(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n }, maxTest);\r\n }\r\n\r\n private static collectPrimitive(destination: CurvePrimitive[], primitive?: CurvePrimitive) {\r\n if (primitive) {\r\n if (destination.length > 0) {\r\n const pointA = destination[destination.length - 1].endPoint();\r\n const pointB = primitive.startPoint();\r\n if (!pointA.isAlmostEqual(pointB)) {\r\n destination.push(LineSegment3d.create(pointA, pointB));\r\n }\r\n }\r\n destination.push(primitive);\r\n }\r\n }\r\n private static adjustJointToPrimitives(joint: Joint) {\r\n const ls = joint.jointCurve;\r\n if (ls instanceof LineString3d) {\r\n if (joint.curve0) {\r\n const curvePoint = joint.curve0.endPoint();\r\n const jointPoint0 = ls.startPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint0))\r\n ls.packedPoints.setAtCheckedPointIndex(0, curvePoint);\r\n }\r\n if (joint.curve1) {\r\n const curvePoint = joint.curve1.startPoint();\r\n const jointPoint1 = ls.endPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint1))\r\n ls.packedPoints.setAtCheckedPointIndex(ls.packedPoints.length - 1, curvePoint);\r\n }\r\n }\r\n }\r\n public static collectCurvesFromChain(start: Joint | undefined, destination: CurvePrimitive[], maxTest: number = 100) {\r\n if (start === undefined)\r\n return;\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(start, (joint: Joint) => {\r\n this.adjustJointToPrimitives(joint);\r\n this.collectPrimitive(destination, joint.jointCurve);\r\n\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone() as CurvePrimitive;\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB);\r\n this.collectPrimitive(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n }, maxTest);\r\n }\r\n\r\n /** Execute `joint.annotateJointMode()` at all joints on the chain. */\r\n public static annotateChain(start: Joint | undefined, options: JointOptions, maxTest: number = 100) {\r\n if (start)\r\n Joint.visitJointsOnChain(start, (joint: Joint) => { joint.annotateJointMode(options); return true; }, maxTest);\r\n }\r\n\r\n /**\r\n * Visit joints on a chain.\r\n * * terminate on `false` return from `callback`\r\n * @param start first (and, for cyclic chain, final) Joint\r\n * @param callback function to call with each Joint as a single parameter.\r\n */\r\n public static visitJointsOnChain(start: Joint, callback: (joint: Joint) => boolean, maxTest: number = 100): boolean {\r\n let joint: Joint | undefined = start;\r\n if (joint) {\r\n let numTest = 0;\r\n while (joint !== undefined) {\r\n if (numTest++ >= maxTest + 5)\r\n return true;\r\n if (!callback(joint)) return false;\r\n joint = joint.nextJoint;\r\n if (joint === start)\r\n break;\r\n }\r\n }\r\n return true;\r\n }\r\n private annotateExtension(options: JointOptions) {\r\n if (this.curve0 && this.curve1) {\r\n const ray0 = this.curve0.fractionToPointAndDerivative(1.0); // And we know that is full length ray !\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0); // ditto\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1);\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {\r\n this.flexure = JointMode.Extend;\r\n const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef());\r\n if (options.needArc(theta)) {\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc) {\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.jointCurve = arc;\r\n return;\r\n }\r\n }\r\n const numChamferPoints = options.numChamferPoints(theta);\r\n if (numChamferPoints <= 1) {\r\n this.jointCurve = LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);\r\n return;\r\n }\r\n\r\n if (numChamferPoints > 1) {\r\n // A nontrivial linestring ...\r\n const radians0 = theta.radians;\r\n const numHalfStep = 2.0 * numChamferPoints;\r\n const halfStepRadians = radians0 / numHalfStep;\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc !== undefined) {\r\n const radialFraction = 1 / Math.cos(halfStepRadians);\r\n const jointCurve = LineString3d.create();\r\n this.jointCurve = jointCurve;\r\n jointCurve.addPoint(ray0.origin); // possibly extend segment or line string\r\n\r\n for (let i = 0; i < numChamferPoints; i++) {\r\n const arcFraction = (1 + 2 * i) / numHalfStep;\r\n jointCurve.addPoint(arc.fractionAndRadialFractionToPoint(arcFraction, radialFraction));\r\n }\r\n jointCurve.addPoint(ray1.origin); // possibly extend segment or line string.\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n // desperation appears ...\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n // Select the index at which summed fraction difference is smallest.\r\n private selectIntersectionIndexByFraction(fractionA: number, fractionB: number, intersections: CurveLocationDetailPair[]): number {\r\n let index = -1;\r\n let aMin = Number.MAX_VALUE;\r\n for (let i = 0; i < intersections.length; i++) {\r\n const a = Math.abs(intersections[i].detailA.fraction - fractionA) + Math.abs(intersections[i].detailB.fraction - fractionB);\r\n if (a < aMin) {\r\n aMin = a;\r\n index = i;\r\n }\r\n }\r\n return index;\r\n }\r\n\r\n /**\r\n * Examine the adjacent geometry\r\n * * set JointMode: one of Cap Extend, or Trim\r\n * * set fraction0 and fraction1 of intersection of curve0 and curve1\r\n * * this REFERENCES curve0, curve1, fraction0, fraction1\r\n * * this does not reference nextJoint and previousJoint\r\n */\r\n public annotateJointMode(options: JointOptions) {\r\n if (this.curve0 && !this.curve1) {\r\n this.flexure = JointMode.Cap;\r\n this.fraction0 = 1.0;\r\n } else if (this.curve1 && !this.curve0) {\r\n this.flexure = JointMode.Cap;\r\n this.fraction1 = 0.0;\r\n } else if (this.curve0 && this.curve1) {\r\n const ray0 = this.curve0.fractionToPointAndDerivative(0.0); // And we know that is full length ray !\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0); // ditto\r\n if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) {\r\n // check for direct intersection -- occurs on offset of colinear base segments.\r\n if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) {\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Trim;\r\n } else {\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1);\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n this.fraction0 = intersection.detailA.fraction;\r\n this.fraction1 = intersection.detailB.fraction;\r\n if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) {\r\n this.annotateExtension(options);\r\n } else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) {\r\n this.flexure = JointMode.Trim;\r\n } else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) {\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n }\r\n } else {\r\n // generic pair of curves ...\r\n const intersections = CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);\r\n const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);\r\n if (intersectionIndex >= 0) {\r\n this.flexure = JointMode.Trim;\r\n this.fraction0 = intersections[intersectionIndex].detailA.fraction;\r\n this.fraction1 = intersections[intersectionIndex].detailB.fraction;\r\n } else {\r\n this.annotateExtension(options);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * * Examine the primitive trim fractions between each pair of joints.\r\n * * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at surrounding primitives\r\n * @param start\r\n */\r\n public static removeDegeneratePrimitives(start: Joint, options: JointOptions, maxTest: number): { newStart: Joint, numJointRemoved: number } {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n console.log(\"\\nENTER removeDegenerates\");\r\n */\r\n let jointA: Joint | undefined = start;\r\n let numRemoved = 0;\r\n const maxRemove = 1;\r\n let numTest = 0;\r\n if (jointA) {\r\n while (jointA !== undefined && numTest++ < maxTest) {\r\n const jointB = jointA.nextJoint;\r\n if (jointA\r\n && jointB\r\n && jointA.previousJoint\r\n && jointB.nextJoint\r\n && jointA.fraction1 !== undefined\r\n && jointB.fraction0 !== undefined) {\r\n const f0 = jointA.fraction1;\r\n const f1 = jointB.fraction0;\r\n const g0 = jointB.fraction1;\r\n const g1 = jointB.nextJoint.fraction0;\r\n // f0 and f1 are fractions on the single primitive between these joints.\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n console.log(\"joint candidate\");\r\n console.log(prettyPrint(jointA.shallowExtract()));\r\n console.log(prettyPrint(jointB.shallowExtract()));\r\n console.log(\"FRACTIONS \", { fA1: f0, fB0: f1 });\r\n }\r\n */\r\n const eliminateF = f0 >= f1 || f0 > 1.0;\r\n const eliminateG = (g0 !== undefined && g0 > 1.0)\r\n || (g0 !== undefined && g1 !== undefined && g0 >= g1);\r\n if (eliminateF && eliminateG) {\r\n const jointC = jointB.nextJoint;\r\n const newJoint: Joint = new Joint(jointA.curve0, jointC.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointC.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n if (newJoint.nextJoint)\r\n newJoint.nextJoint.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n console.log(\" NEW DOUBLE CUT\");\r\n console.log(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n } else if (eliminateF) {\r\n const newJoint: Joint = new Joint(jointA.curve0, jointB.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointB.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n newJoint.nextJoint!.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n console.log(\" NEW JOINT\");\r\n console.log(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n numRemoved++;\r\n if (jointA === start)\r\n start = newJoint;\r\n jointA = newJoint;\r\n if (numRemoved >= maxRemove) {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n console.log(\" EXIT removeDegenerates at maxRemove\\n\");\r\n */\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n }\r\n }\r\n jointA = jointA.nextJoint;\r\n if (jointA === start)\r\n break;\r\n }\r\n }\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n}\r\n/**\r\n * Context for building a wire offset.\r\n * @internal\r\n */\r\nexport class PolygonWireOffsetContext {\r\n /** construct a context. */\r\n public constructor() {\r\n }\r\n private static _unitAlong = Vector3d.create();\r\n private static _unitPerp = Vector3d.create();\r\n private static _offsetA = Point3d.create();\r\n private static _offsetB = Point3d.create();\r\n\r\n // Construct a single offset from base points\r\n private static createOffsetSegment(basePointA: Point3d, basePointB: Point3d, distance: number): CurvePrimitive | undefined {\r\n Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);\r\n if (this._unitAlong.normalizeInPlace()) {\r\n this._unitAlong.rotate90CCWXY(this._unitPerp);\r\n const segment = LineSegment3d.create(\r\n basePointA.plusScaled(this._unitPerp, distance, this._offsetA),\r\n basePointB.plusScaled(this._unitPerp, distance, this._offsetB));\r\n CurveChainWireOffsetContext.applyBasePoints(segment, basePointA.clone(), basePointB.clone());\r\n return segment;\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Construct curves that are offset from a polygon.\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will not detect self intersection with far-away edges.\r\n * @param points\r\n * @param wrap\r\n * @param offsetDistance\r\n */\r\n public constructPolygonWireXYOffset(points: Point3d[], wrap: boolean, leftOffsetDistanceOrOptions: number | JointOptions): CurveCollection | undefined {\r\n const options = JointOptions.create(leftOffsetDistanceOrOptions);\r\n const numPoints = points.length;\r\n let fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[0], points[1], options.leftOffsetDistance);\r\n let joint0 = new Joint(undefined, fragment0, points[0]);\r\n let newJoint;\r\n let previousJoint = joint0;\r\n for (let i = 1; i + 1 < numPoints; i++) {\r\n const fragment1 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance);\r\n newJoint = new Joint(fragment0, fragment1, points[i]);\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n if (wrap)\r\n Joint.link(previousJoint, joint0);\r\n else {\r\n newJoint = new Joint(fragment0, undefined, points[numPoints - 1]);\r\n Joint.link(previousJoint, newJoint);\r\n }\r\n Joint.annotateChain(joint0, options, numPoints);\r\n for (let pass = 0; pass++ < 5;) {\r\n const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);\r\n joint0 = state.newStart;\r\n if (state.numJointRemoved === 0)\r\n break;\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n console.log(\" POST REMOVE DEGENERATES \" + state.numJointRemoved);\r\n Joint.visitJointsOnChain(joint0, (joint: Joint) => { console.log(prettyPrint(joint.shallowExtract())); return true; });\r\n }\r\n */\r\n }\r\n\r\n // Joint.collectPrimitivesFromChain(joint0, result, numPoints);\r\n const chain = LineString3d.create();\r\n Joint.collectStrokesFromChain(joint0, chain, numPoints);\r\n const n = chain.packedPoints.length;\r\n if (n > 1) {\r\n if (chain.packedPoints.front()!.isAlmostEqual(chain.packedPoints.back()!))\r\n return Loop.create(chain);\r\n else\r\n return Path.create(chain);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Context for building a wire offset from a Path or Loop of CurvePrimitives\r\n * @internal\r\n */\r\nexport class CurveChainWireOffsetContext {\r\n /** construct a context. */\r\n public constructor() {\r\n }\r\n\r\n private static _unitAlong = Vector3d.create();\r\n private static _unitPerp = Vector3d.create();\r\n private static _offsetA = Point3d.create();\r\n private static _offsetB = Point3d.create();\r\n\r\n // Construct a single offset from base points\r\n private static createOffsetSegment(basePointA: Point3d, basePointB: Point3d, distanceLeft: number): CurvePrimitive | undefined {\r\n Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);\r\n if (this._unitAlong.normalizeInPlace()) {\r\n this._unitAlong.rotate90CCWXY(this._unitPerp);\r\n return LineSegment3d.create(\r\n basePointA.plusScaled(this._unitPerp, distanceLeft, this._offsetA),\r\n basePointB.plusScaled(this._unitPerp, distanceLeft, this._offsetB));\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.\r\n * * return cp\r\n * @param cp primitive to annotate\r\n * @param startPoint optional start point\r\n * @param endPoint optional end point\r\n */\r\n public static applyBasePoints(cp: CurvePrimitive | undefined, startPoint: Point3d | undefined, endPoint: Point3d | undefined): CurvePrimitive | undefined {\r\n if (cp !== undefined) {\r\n if (startPoint !== undefined)\r\n (cp as any).baseCurveStart = startPoint;\r\n if (endPoint !== undefined)\r\n (cp as any).baseCurveEnd = endPoint;\r\n }\r\n return cp;\r\n }\r\n /**\r\n * Create the offset of a single primitive.\r\n * * each primitive may be labeled (as an `any` object) with start or end point of base curve:\r\n * * `(primitive as any).baseCurveStart: Point3d`\r\n * * `(primitive as any).baseCurveEnd: Point3d`\r\n * @param g primitive to offset\r\n * @param distanceLeft\r\n */\r\n public static createSingleOffsetPrimitiveXY(g: CurvePrimitive, distanceLeft: number): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const point0 = g.fractionToPoint(0.0);\r\n const point1 = g.fractionToPoint(1.0);\r\n if (g instanceof LineSegment3d) {\r\n return this.applyBasePoints(this.createOffsetSegment(point0, point1, distanceLeft), point0, point1);\r\n } else if (g instanceof Arc3d) {\r\n const g1 = g.cloneAtZ();\r\n if (g1.isCircular) {\r\n const sign = g1.sweep.sweepRadians * g1.matrixRef.coffs[8] >= 0.0 ? 1.0 : -1.0;\r\n const r = g1.matrixRef.columnXMagnitude();\r\n const r1 = r - sign * distanceLeft;\r\n if (!Geometry.isSmallMetricDistance(r1) && r * r1 > 0.0) {\r\n const factor = r1 / r;\r\n const matrix = g1.matrixClone();\r\n matrix.scaleColumnsInPlace(factor, factor, 1.0);\r\n return this.applyBasePoints(Arc3d.createRefs(g1.center.clone(), matrix, g1.sweep.clone()), g.startPoint(), g.endPoint());\r\n }\r\n }\r\n } else if (g instanceof LineString3d) {\r\n const n = g.numPoints();\r\n if (n > 1) {\r\n const offsets = [];\r\n const pointA = Point3d.create();\r\n const pointB = Point3d.create();\r\n g.packedPoints.getPoint3dAtUncheckedPointIndex(0, pointA);\r\n for (let i = 1; i < n; i++) {\r\n g.packedPoints.getPoint3dAtUncheckedPointIndex(i, pointB);\r\n const g1 = this.applyBasePoints(this.createOffsetSegment(pointA, pointB, distanceLeft), pointA.clone(), pointB.clone());\r\n if (g1 !== undefined)\r\n offsets.push(g1);\r\n pointA.setFromPoint3d(pointB);\r\n }\r\n return offsets;\r\n }\r\n\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Construct curves that are offset from a Path or Loop\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will not detect self intersection among widely separated edges.\r\n * * Offset distance is defined as positive to the left.\r\n * * If offsetDistanceOrOptions is given as a number, default options are applied.\r\n * * When the offset needs to do an \"outside\" turn, the first applicable construction is applied:\r\n * * If the turn is larger than `options.minArcDegrees`, a circular arc is constructed.\r\n * * if the turn is larger than `options.maxChamferDegrees`, the turn is constructed as a sequence of straight lines that are\r\n * * outside the arc\r\n * * have uniform turn angle less than `options.maxChamferDegrees`\r\n * * each line segment (except first and last) touches the arc at its midpoint.\r\n * * Otherwise the prior and successor curves are extended to simple intersection.\r\n * @param curves input curves\r\n * @param offsetDistanceOrOptions offset controls.\r\n */\r\n private static constructCurveXYOffsetGo(curves: Path | Loop, options: JointOptions): CurveCollection | undefined {\r\n const wrap = curves instanceof Loop;\r\n if (options === undefined)\r\n return undefined;\r\n\r\n const simpleOffsets: CurvePrimitive[] = [];\r\n // setup pass: get simple offsets of each primitive\r\n for (const c of curves.children) {\r\n const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, options.leftOffsetDistance);\r\n if (c1 === undefined) {\r\n // bad .. maybe arc to inside?\r\n } else if (c1 instanceof CurvePrimitive)\r\n simpleOffsets.push(c1);\r\n else if (Array.isArray(c1)) {\r\n for (const c2 of c1) {\r\n if (c2 instanceof CurvePrimitive)\r\n simpleOffsets.push(c2);\r\n }\r\n }\r\n }\r\n let fragment0;\r\n let newJoint;\r\n let previousJoint;\r\n let joint0;\r\n for (const fragment1 of simpleOffsets) {\r\n if (fragment1) {\r\n newJoint = new Joint(fragment0, fragment1, fragment1.fractionToPoint(0.0));\r\n if (newJoint !== undefined)\r\n if (joint0 === undefined)\r\n joint0 = newJoint;\r\n if (previousJoint)\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n }\r\n if (joint0 && previousJoint && curves instanceof Loop)\r\n Joint.link(previousJoint, joint0);\r\n\r\n const numOffset = simpleOffsets.length;\r\n Joint.annotateChain(joint0, options, numOffset);\r\n\r\n const outputCurves: CurvePrimitive[] = [];\r\n Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);\r\n return RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);\r\n }\r\n /**\r\n * Construct offset curves as viewed in xy.\r\n * @param curves base curves.\r\n * @param offsetDistanceOrOptions distance (positive left, negative right) or options.\r\n */\r\n public static constructCurveXYOffset(curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions): CurveCollection | undefined {\r\n const options = JointOptions.create(offsetDistanceOrOptions);\r\n return this.constructCurveXYOffsetGo(curves, options);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"PolygonOffsetContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAE1C,4DAAyD;AACzD,sEAAqE;AACrE,kDAA+C;AAC/C,oCAAiC;AAEjC,8CAA2C;AAC3C,gEAAyF;AACzF,sDAAmD;AACnD,oDAAiD;AACjD,kDAA+C;AAC/C,kCAA+B;AAC/B,kCAA+B;AAC/B,4CAAyC;AACzC,oDAAiD;AAEjD;;;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;;;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,GAAG,CAAC,CAAC,CAAC;gBAC3E,IAAI,QAAQ,KAAK,SAAS;oBACxB,IAAI,MAAM,KAAK,SAAS;wBACtB,MAAM,GAAG,QAAQ,CAAC;gBACtB,IAAI,aAAa;oBACf,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;gBACtC,aAAa,GAAG,QAAQ,CAAC;gBACzB,SAAS,GAAG,SAAS,CAAC;aACvB;SACF;QACD,IAAI,MAAM,IAAI,aAAa,IAAI,MAAM,YAAY,WAAI;YACnD,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAEpC,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC;QACvC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QAEnE,MAAM,YAAY,GAAqB,EAAE,CAAC;QAC1C,KAAK,CAAC,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAC9D,OAAO,qBAAS,CAAC,2BAA2B,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;CACF;AAtGD,kEAsGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { CurveCollection } from \"../CurveCollection\";\r\nimport { CurveCurve } from \"../CurveCurve\";\r\nimport { CurveCurveApproachType, CurveLocationDetailPair } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { Loop } from \"../Loop\";\r\nimport { Path } from \"../Path\";\r\nimport { RegionOps } from \"../RegionOps\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\n\r\n/**\r\n * Classification of contortions at a joint.\r\n * @internal\r\n */\r\nenum JointMode {\r\n Unknown = 0,\r\n Cap = 1,\r\n Extend = 2,\r\n Trim = -1,\r\n JustGeometry = 3,\r\n Gap = 4,\r\n}\r\n\r\n/**\r\n * * Control parameters for joint construction.\r\n * * Decision order is:\r\n * * if turn angle is greater than minArcDegrees, make an arc.\r\n * * if turn angle is less than or equal maxChamferTurnDegrees, extend curves along tangent to single intersection point.\r\n * * if turn angle is greater than maxChamferTurnDegrees, construct multiple lines that are tangent to the turn circle \"from the outside\",\r\n * with each equal turn less than maxChamferTurnDegrees.\r\n * * otherwise make single edge.\r\n * @public\r\n */\r\nexport class JointOptions {\r\n /** smallest arc to construct.\r\n * * If this control angle is large, arcs are never created.\r\n */\r\n public minArcDegrees = 180.0;\r\n public maxChamferTurnDegrees = 90;\r\n /** Offset distance, positive to left of base curve. */\r\n public leftOffsetDistance: number = 0;\r\n /** Whether to offset elliptical arcs as elliptical arcs (true) or as B-spline curves (false, default). */\r\n public preserveEllipticalArcs = false;\r\n\r\n /** Construct JointOptions.\r\n * * leftOffsetDistance is required\r\n * * minArcDegrees and maxChamferDegrees are optional.\r\n */\r\n constructor(leftOffsetDistance: number, minArcDegrees = 180, maxChamferDegrees = 90, preserveEllipticalArcs = false) {\r\n this.leftOffsetDistance = leftOffsetDistance;\r\n this.minArcDegrees = minArcDegrees;\r\n this.maxChamferTurnDegrees = maxChamferDegrees;\r\n this.preserveEllipticalArcs = preserveEllipticalArcs;\r\n }\r\n\r\n /** Return a deep clone. */\r\n public clone(): JointOptions {\r\n return new JointOptions(this.leftOffsetDistance, this.minArcDegrees, this.maxChamferTurnDegrees, this.preserveEllipticalArcs);\r\n }\r\n\r\n /** Copy values of input options */\r\n public setFrom(other: JointOptions) {\r\n this.leftOffsetDistance = other.leftOffsetDistance;\r\n this.minArcDegrees = other.minArcDegrees;\r\n this.maxChamferTurnDegrees = other.maxChamferTurnDegrees;\r\n this.preserveEllipticalArcs = other.preserveEllipticalArcs;\r\n }\r\n\r\n /**\r\n * Parse a number or JointOptions up to JointOptions:\r\n * * If leftOffsetDistanceOptions is a number, create a JointOptions with other options set to default values.\r\n * * If leftOffsetDistanceOrOptions is a JointOptions, return it unchanged.\r\n * @param leftOffsetDistanceOrOptions\r\n */\r\n public static create(leftOffsetDistanceOrOptions: number | JointOptions): JointOptions {\r\n if (leftOffsetDistanceOrOptions instanceof JointOptions)\r\n return leftOffsetDistanceOrOptions;\r\n // if (Number.isFinite(leftOffsetDistanceOrOptions))\r\n return new JointOptions(leftOffsetDistanceOrOptions);\r\n }\r\n /** return true if the options indicate this amount of turn should be handled with an arc. */\r\n public needArc(theta: Angle): boolean {\r\n return Math.abs(theta.degrees) >= this.minArcDegrees;\r\n }\r\n /** Test if turn by theta should be output as single point. */\r\n public numChamferPoints(theta: Angle): number {\r\n const degrees = Math.abs(theta.degrees);\r\n const stepDegrees = Geometry.clamp(this.maxChamferTurnDegrees, 10, 120);\r\n if (degrees <= stepDegrees)\r\n return 1;\r\n return Math.ceil(degrees / stepDegrees);\r\n }\r\n}\r\n\r\n/**\r\n * Options for offsetting a curve.\r\n * @public\r\n */\r\nexport class OffsetOptions {\r\n /** Options for offsetting and joining CurvePrimitives */\r\n public jointOptions: JointOptions;\r\n /** Options for generating a B-spline curve offset */\r\n public strokeOptions: StrokeOptions;\r\n\r\n /** Options that are provided are captured. */\r\n constructor(offsetDistanceOrOptions: number | JointOptions, strokeOptions?: StrokeOptions) {\r\n this.jointOptions = JointOptions.create(offsetDistanceOrOptions);\r\n this.strokeOptions = (strokeOptions !== undefined) ? strokeOptions : StrokeOptions.createForCurves();\r\n }\r\n\r\n public get minArcDegrees(): number { return this.jointOptions.minArcDegrees; }\r\n public set minArcDegrees(value: number) { this.jointOptions.minArcDegrees = value; }\r\n public get maxChamferTurnDegrees(): number { return this.jointOptions.maxChamferTurnDegrees; }\r\n public set maxChamferTurnDegrees(value: number) { this.jointOptions.maxChamferTurnDegrees = value; }\r\n public get leftOffsetDistance(): number { return this.jointOptions.leftOffsetDistance; }\r\n public set leftOffsetDistance(value: number) { this.jointOptions.leftOffsetDistance = value; }\r\n public get preserveEllipticalArcs(): boolean { return this.jointOptions.preserveEllipticalArcs; }\r\n public set preserveEllipticalArcs(value: boolean) { this.jointOptions.preserveEllipticalArcs = value; }\r\n\r\n /** Convert variant input into OffsetOptions.\r\n * * If a JointOptions is provided, it is captured.\r\n * * If an OffsetOptions is provided, a reference to it is returned. */\r\n public static create(offsetDistanceOrOptions: number | JointOptions | OffsetOptions): OffsetOptions {\r\n if (offsetDistanceOrOptions instanceof OffsetOptions)\r\n return offsetDistanceOrOptions;\r\n return new OffsetOptions(offsetDistanceOrOptions);\r\n }\r\n\r\n /** Convert variant input into offset distance */\r\n public static getOffsetDistance(offsetDistanceOrOptions: number | JointOptions | OffsetOptions): number {\r\n if (typeof offsetDistanceOrOptions === \"number\")\r\n return offsetDistanceOrOptions;\r\n return offsetDistanceOrOptions.leftOffsetDistance;\r\n }\r\n\r\n /** Return a deep clone. */\r\n public clone(): OffsetOptions {\r\n return new OffsetOptions(this.jointOptions.clone(), this.strokeOptions.clone());\r\n }\r\n}\r\n\r\n/**\r\n * Description of geometry around a joint.\r\n * @internal\r\n */\r\nclass Joint {\r\n /** Enumeration of how the joint is constructed */\r\n public flexure: JointMode;\r\n /** curve before the joint */\r\n public curve0?: CurvePrimitive;\r\n /** fractional position on curve0 (may be a trim or extension) */\r\n public fraction0?: number;\r\n /** curve after the joint (may be a trim or extension) */\r\n public curve1?: CurvePrimitive;\r\n /** fractional position on curve1 */\r\n public fraction1?: number;\r\n /** curve to be added within the joint */\r\n public jointCurve?: CurvePrimitive;\r\n /** common point on the original curves */\r\n public swingPoint?: Point3d;\r\n /** pointer to next joint */\r\n public nextJoint?: Joint;\r\n /** pointer to previous joint */\r\n public previousJoint?: Joint;\r\n // capture references to all data . . .\r\n public constructor(curve0: CurvePrimitive | undefined, curve1: CurvePrimitive | undefined, swingPoint: Point3d | undefined) {\r\n this.curve0 = curve0;\r\n this.curve1 = curve1;\r\n this.swingPoint = swingPoint;\r\n this.flexure = JointMode.Unknown;\r\n }\r\n /** try to construct an arc transition from ray0 to ray1 with given center. */\r\n public static constructArc(ray0: Ray3d, center: Point3d | undefined, ray1: Ray3d): Arc3d | undefined {\r\n if (center !== undefined && Geometry.isSameCoordinate(ray0.origin.distance(center), ray1.origin.distance(center))) {\r\n const angle = ray0.direction.angleToXY(ray1.direction);\r\n const vector0 = Vector3d.createStartEnd(center, ray0.origin);\r\n const vector90 = vector0.rotate90CCWXY();\r\n return Arc3d.create(center, vector0, vector90, AngleSweep.createStartEndRadians(0.0, angle.radians));\r\n }\r\n return undefined;\r\n }\r\n /** Extract a json object of {curve0:data, fraction0:data, curve1:data, fraction1:data} */\r\n public shallowExtract(): any {\r\n return { curve0: this.curve0, curve1: this.curve1, fraction0: this.fraction0, fraction1: this.fraction1 };\r\n }\r\n /** Establish the nextJoint and previousJoint links from joint0 to joint1. */\r\n public static link(joint0: Joint, joint1: Joint | undefined) {\r\n joint0.nextJoint = joint1;\r\n if (joint1)\r\n joint1.previousJoint = joint0;\r\n if (joint0.curve1 && joint1 && !joint1.curve0)\r\n joint1.curve0 = joint0.curve1;\r\n else if (!joint0.curve1 && joint1 && joint1.curve0)\r\n joint0.curve1 = joint1.curve0;\r\n }\r\n /**\r\n * * If nextJoint and nextJoint.fraction0 are defined, return them.\r\n * * Otherwise return defaultValue\r\n */\r\n public nextJointFraction0(defaultValue: number): number {\r\n if (this.nextJoint && this.nextJoint.fraction0 !== undefined)\r\n return this.nextJoint.fraction0;\r\n return defaultValue;\r\n }\r\n\r\n private static addStrokes(destination: LineString3d, curve?: CurvePrimitive) {\r\n if (curve) {\r\n curve.emitStrokes(destination);\r\n }\r\n }\r\n\r\n private static addPoint(destination: LineString3d, point: Point3d) {\r\n if (destination.packedPoints.length > 0) {\r\n const pointA = destination.endPoint();\r\n if (!pointA.isAlmostEqual(point))\r\n destination.packedPoints.push(point);\r\n }\r\n }\r\n\r\n public static collectStrokesFromChain(start: Joint, destination: LineString3d, maxTest: number = 100) {\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(start, (joint: Joint) => {\r\n this.addStrokes(destination, joint.jointCurve);\r\n\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone() as CurvePrimitive;\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB);\r\n if (curve1) {\r\n if (!joint.jointCurve) {\r\n this.addPoint(destination, curve1.startPoint());\r\n }\r\n }\r\n this.addStrokes(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n }, maxTest);\r\n }\r\n\r\n private static collectPrimitive(destination: CurvePrimitive[], primitive?: CurvePrimitive) {\r\n if (primitive) {\r\n if (destination.length > 0) {\r\n const pointA = destination[destination.length - 1].endPoint();\r\n const pointB = primitive.startPoint();\r\n if (!pointA.isAlmostEqual(pointB)) {\r\n destination.push(LineSegment3d.create(pointA, pointB));\r\n }\r\n }\r\n destination.push(primitive);\r\n }\r\n }\r\n\r\n private static adjustJointToPrimitives(joint: Joint) {\r\n const ls = joint.jointCurve;\r\n if (ls instanceof LineString3d) {\r\n if (joint.curve0) {\r\n const curvePoint = joint.curve0.endPoint();\r\n const jointPoint0 = ls.startPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint0))\r\n ls.packedPoints.setAtCheckedPointIndex(0, curvePoint);\r\n }\r\n if (joint.curve1) {\r\n const curvePoint = joint.curve1.startPoint();\r\n const jointPoint1 = ls.endPoint();\r\n if (!curvePoint.isAlmostEqual(jointPoint1))\r\n ls.packedPoints.setAtCheckedPointIndex(ls.packedPoints.length - 1, curvePoint);\r\n }\r\n }\r\n }\r\n\r\n public static collectCurvesFromChain(start: Joint | undefined, destination: CurvePrimitive[], maxTest: number = 100) {\r\n if (start === undefined)\r\n return;\r\n let numOut = -2 * maxTest; // allow extra things to happen\r\n Joint.visitJointsOnChain(start, (joint: Joint) => {\r\n this.adjustJointToPrimitives(joint);\r\n this.collectPrimitive(destination, joint.jointCurve);\r\n\r\n if (joint.curve1 && joint.fraction1 !== undefined) {\r\n const fA = joint.fraction1;\r\n const fB = joint.nextJointFraction0(1.0);\r\n let curve1;\r\n if (fA === 0.0 && fB === 1.0)\r\n curve1 = joint.curve1.clone() as CurvePrimitive;\r\n else if (fA < fB)\r\n curve1 = joint.curve1.clonePartialCurve(fA, fB);\r\n this.collectPrimitive(destination, curve1);\r\n }\r\n return numOut++ < maxTest;\r\n }, maxTest);\r\n }\r\n\r\n /** Execute `joint.annotateJointMode()` at all joints on the chain. */\r\n public static annotateChain(start: Joint | undefined, options: JointOptions, maxTest: number = 100) {\r\n if (start)\r\n Joint.visitJointsOnChain(start, (joint: Joint) => { joint.annotateJointMode(options); return true; }, maxTest);\r\n }\r\n\r\n /**\r\n * Visit joints on a chain.\r\n * * terminate on `false` return from `callback`\r\n * @param start first (and, for cyclic chain, final) Joint\r\n * @param callback function to call with each Joint as a single parameter.\r\n */\r\n public static visitJointsOnChain(start: Joint, callback: (joint: Joint) => boolean, maxTest: number = 100): boolean {\r\n let joint: Joint | undefined = start;\r\n if (joint) {\r\n let numTest = 0;\r\n while (joint !== undefined) {\r\n if (numTest++ >= maxTest + 5)\r\n return true;\r\n if (!callback(joint)) return false;\r\n joint = joint.nextJoint;\r\n if (joint === start)\r\n break;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n /** NOTE: no assumption on type of curve0, curve1 */\r\n private annotateExtension(options: JointOptions) {\r\n if (this.curve0 && this.curve1) {\r\n const ray0 = this.curve0.fractionToPointAndDerivative(1.0);\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0);\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1);\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Extend;\r\n const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef());\r\n if (options.needArc(theta)) {\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc) {\r\n this.jointCurve = arc;\r\n return;\r\n }\r\n }\r\n const numChamferPoints = options.numChamferPoints(theta);\r\n if (numChamferPoints <= 1) {\r\n this.jointCurve = LineString3d.create(ray0.origin, intersection.detailA.point, ray1.origin);\r\n return;\r\n }\r\n if (numChamferPoints > 1) {\r\n // A nontrivial linestring ...\r\n const radians0 = theta.radians;\r\n const numHalfStep = 2.0 * numChamferPoints;\r\n const halfStepRadians = radians0 / numHalfStep;\r\n const arc = Joint.constructArc(ray0, (this.curve0 as any).baseCurveEnd, ray1);\r\n if (arc !== undefined) {\r\n const radialFraction = 1 / Math.cos(halfStepRadians);\r\n const jointCurve = LineString3d.create();\r\n this.jointCurve = jointCurve;\r\n jointCurve.addPoint(ray0.origin); // possibly extend segment or line string\r\n\r\n for (let i = 0; i < numChamferPoints; i++) {\r\n const arcFraction = (1 + 2 * i) / numHalfStep;\r\n jointCurve.addPoint(arc.fractionAndRadialFractionToPoint(arcFraction, radialFraction));\r\n }\r\n jointCurve.addPoint(ray1.origin); // possibly extend segment or line string.\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n // desperation appears ...\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n\r\n // Select the index at which summed fraction difference is smallest.\r\n private selectIntersectionIndexByFraction(fractionA: number, fractionB: number, intersections: CurveLocationDetailPair[]): number {\r\n let index = -1;\r\n let aMin = Number.MAX_VALUE;\r\n for (let i = 0; i < intersections.length; i++) {\r\n const a = Math.abs(intersections[i].detailA.fraction - fractionA) + Math.abs(intersections[i].detailB.fraction - fractionB);\r\n if (a < aMin) {\r\n aMin = a;\r\n index = i;\r\n }\r\n }\r\n return index;\r\n }\r\n\r\n /**\r\n * Examine the adjacent geometry\r\n * * set JointMode: one of Cap Extend, or Trim\r\n * * set fraction0 and fraction1 of intersection of curve0 and curve1\r\n * * this REFERENCES curve0, curve1, fraction0, fraction1\r\n * * this does not reference nextJoint and previousJoint\r\n */\r\n public annotateJointMode(options: JointOptions) {\r\n if (this.curve0 && !this.curve1) {\r\n this.flexure = JointMode.Cap;\r\n this.fraction0 = 1.0;\r\n } else if (this.curve1 && !this.curve0) {\r\n this.flexure = JointMode.Cap;\r\n this.fraction1 = 0.0;\r\n } else if (this.curve0 && this.curve1) {\r\n // check for direct intersection -- occurs on offset of colinear base segments, and closed primitives\r\n if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) {\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n this.flexure = JointMode.Trim;\r\n } else if (this.curve0 instanceof LineSegment3d && this.curve1 instanceof LineSegment3d) {\r\n const ray0 = this.curve0.fractionToPointAndDerivative(0.0); // And we know that is full length ray !\r\n const ray1 = this.curve1.fractionToPointAndDerivative(0.0); // ditto\r\n const intersection = Ray3d.closestApproachRay3dRay3d(ray0, ray1);\r\n if (intersection.approachType === CurveCurveApproachType.Intersection) {\r\n this.fraction0 = intersection.detailA.fraction;\r\n this.fraction1 = intersection.detailB.fraction;\r\n if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) {\r\n this.annotateExtension(options);\r\n } else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) {\r\n this.flexure = JointMode.Trim;\r\n } else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) {\r\n this.flexure = JointMode.Gap;\r\n this.jointCurve = LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));\r\n this.fraction0 = 1.0;\r\n this.fraction1 = 0.0;\r\n }\r\n }\r\n } else { // generic pair of curves ...\r\n const intersections = CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);\r\n const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);\r\n if (intersectionIndex >= 0) {\r\n this.flexure = JointMode.Trim;\r\n this.fraction0 = intersections[intersectionIndex].detailA.fraction;\r\n this.fraction1 = intersections[intersectionIndex].detailB.fraction;\r\n } else {\r\n this.annotateExtension(options);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * * Examine the primitive trim fractions between each pair of joints.\r\n * * If trim fractions indicate the primitive must disappear, replace the joint pair by a new joint pointing at surrounding primitives\r\n * @param start\r\n */\r\n public static removeDegeneratePrimitives(start: Joint, options: JointOptions, maxTest: number): { newStart: Joint, numJointRemoved: number } {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n console.log(\"\\nENTER removeDegenerates\");\r\n */\r\n let jointA: Joint | undefined = start;\r\n let numRemoved = 0;\r\n const maxRemove = 1;\r\n let numTest = 0;\r\n if (jointA) {\r\n while (jointA !== undefined && numTest++ < maxTest) {\r\n const jointB = jointA.nextJoint;\r\n if (jointA\r\n && jointB\r\n && jointA.previousJoint\r\n && jointB.nextJoint\r\n && jointA.fraction1 !== undefined\r\n && jointB.fraction0 !== undefined) {\r\n const f0 = jointA.fraction1;\r\n const f1 = jointB.fraction0;\r\n const g0 = jointB.fraction1;\r\n const g1 = jointB.nextJoint.fraction0;\r\n // f0 and f1 are fractions on the single primitive between these joints.\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n console.log(\"joint candidate\");\r\n console.log(prettyPrint(jointA.shallowExtract()));\r\n console.log(prettyPrint(jointB.shallowExtract()));\r\n console.log(\"FRACTIONS \", { fA1: f0, fB0: f1 });\r\n }\r\n */\r\n const eliminateF = f0 >= f1 || f0 > 1.0;\r\n const eliminateG = (g0 !== undefined && g0 > 1.0)\r\n || (g0 !== undefined && g1 !== undefined && g0 >= g1);\r\n if (eliminateF && eliminateG) {\r\n const jointC = jointB.nextJoint;\r\n const newJoint: Joint = new Joint(jointA.curve0, jointC.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointC.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n if (newJoint.nextJoint)\r\n newJoint.nextJoint.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n console.log(\" NEW DOUBLE CUT\");\r\n console.log(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n } else if (eliminateF) {\r\n const newJoint: Joint = new Joint(jointA.curve0, jointB.curve1, undefined);\r\n Joint.link(jointA.previousJoint, newJoint);\r\n Joint.link(newJoint, jointB.nextJoint);\r\n newJoint.annotateJointMode(options);\r\n newJoint.previousJoint!.annotateJointMode(options);\r\n newJoint.nextJoint!.annotateJointMode(options);\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n console.log(\" NEW JOINT\");\r\n console.log(prettyPrint(newJoint.shallowExtract()));\r\n }\r\n */\r\n numRemoved++;\r\n if (jointA === start)\r\n start = newJoint;\r\n jointA = newJoint;\r\n if (numRemoved >= maxRemove) {\r\n /*\r\n if (Checker.noisy.PolygonOffset)\r\n console.log(\" EXIT removeDegenerates at maxRemove\\n\");\r\n */\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n }\r\n }\r\n jointA = jointA.nextJoint;\r\n if (jointA === start)\r\n break;\r\n }\r\n }\r\n return { newStart: start, numJointRemoved: numRemoved };\r\n }\r\n}\r\n/**\r\n * Context for building a wire offset.\r\n * @internal\r\n */\r\nexport class PolygonWireOffsetContext {\r\n /** construct a context. */\r\n public constructor() {\r\n }\r\n private static _unitAlong = Vector3d.create();\r\n private static _unitPerp = Vector3d.create();\r\n private static _offsetA = Point3d.create();\r\n private static _offsetB = Point3d.create();\r\n\r\n // Construct a single offset from base points\r\n private static createOffsetSegment(basePointA: Point3d, basePointB: Point3d, distance: number): CurvePrimitive | undefined {\r\n Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);\r\n if (this._unitAlong.normalizeInPlace()) {\r\n this._unitAlong.rotate90CCWXY(this._unitPerp);\r\n const segment = LineSegment3d.create(\r\n basePointA.plusScaled(this._unitPerp, distance, this._offsetA),\r\n basePointB.plusScaled(this._unitPerp, distance, this._offsetB));\r\n CurveChainWireOffsetContext.applyBasePoints(segment, basePointA.clone(), basePointB.clone());\r\n return segment;\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Construct curves that are offset from a polygon.\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will not detect self intersection with far-away edges.\r\n * @param points\r\n * @param wrap\r\n * @param offsetDistance\r\n */\r\n public constructPolygonWireXYOffset(points: Point3d[], wrap: boolean, leftOffsetDistanceOrOptions: number | JointOptions): CurveCollection | undefined {\r\n const options = JointOptions.create(leftOffsetDistanceOrOptions);\r\n const numPoints = points.length;\r\n let fragment0 = PolygonWireOffsetContext.createOffsetSegment(points[0], points[1], options.leftOffsetDistance);\r\n let joint0 = new Joint(undefined, fragment0, points[0]);\r\n let newJoint;\r\n let previousJoint = joint0;\r\n for (let i = 1; i + 1 < numPoints; i++) {\r\n const fragment1 = PolygonWireOffsetContext.createOffsetSegment(points[i], points[i + 1], options.leftOffsetDistance);\r\n newJoint = new Joint(fragment0, fragment1, points[i]);\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n if (wrap)\r\n Joint.link(previousJoint, joint0);\r\n else {\r\n newJoint = new Joint(fragment0, undefined, points[numPoints - 1]);\r\n Joint.link(previousJoint, newJoint);\r\n }\r\n Joint.annotateChain(joint0, options, numPoints);\r\n for (let pass = 0; pass++ < 5;) {\r\n const state = Joint.removeDegeneratePrimitives(joint0, options, numPoints);\r\n joint0 = state.newStart;\r\n if (state.numJointRemoved === 0)\r\n break;\r\n /*\r\n if (Checker.noisy.PolygonOffset) {\r\n console.log(\" POST REMOVE DEGENERATES \" + state.numJointRemoved);\r\n Joint.visitJointsOnChain(joint0, (joint: Joint) => { console.log(prettyPrint(joint.shallowExtract())); return true; });\r\n }\r\n */\r\n }\r\n\r\n // Joint.collectPrimitivesFromChain(joint0, result, numPoints);\r\n const chain = LineString3d.create();\r\n Joint.collectStrokesFromChain(joint0, chain, numPoints);\r\n const n = chain.packedPoints.length;\r\n if (n > 1) {\r\n if (chain.packedPoints.front()!.isAlmostEqual(chain.packedPoints.back()!))\r\n return Loop.create(chain);\r\n else\r\n return Path.create(chain);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Context for building a wire offset from a Path or Loop of CurvePrimitives\r\n * @internal\r\n */\r\nexport class CurveChainWireOffsetContext {\r\n /** construct a context. */\r\n public constructor() {\r\n }\r\n /**\r\n * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.\r\n * * return cp\r\n * @param cp primitive to annotate\r\n * @param startPoint optional start point\r\n * @param endPoint optional end point\r\n */\r\n public static applyBasePoints(cp: CurvePrimitive | undefined, startPoint: Point3d | undefined, endPoint: Point3d | undefined): CurvePrimitive | undefined {\r\n if (cp !== undefined) {\r\n if (startPoint !== undefined)\r\n (cp as any).baseCurveStart = startPoint;\r\n if (endPoint !== undefined)\r\n (cp as any).baseCurveEnd = endPoint;\r\n }\r\n return cp;\r\n }\r\n /**\r\n * Create the offset of a single primitive.\r\n * * each primitive may be labeled (as an `any` object) with start or end point of base curve:\r\n * * `(primitive as any).baseCurveStart: Point3d`\r\n * * `(primitive as any).baseCurveEnd: Point3d`\r\n * @param g primitive to offset\r\n * @param offsetDistanceOrOptions offset distance (positive to left of g), or options object\r\n */\r\n public static createSingleOffsetPrimitiveXY(g: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const offset = g.constructOffsetXY(offsetDistanceOrOptions);\r\n if (offset === undefined)\r\n return undefined;\r\n // decorate each offset with its base curve's endpoints\r\n if (Array.isArray(offset)) {\r\n const basePrims = g.collectCurvePrimitives(undefined, true, true);\r\n if (basePrims.length !== offset.length)\r\n return undefined; // unexpected aggregate curve type!\r\n for (let i = 0; i < basePrims.length; ++i)\r\n this.applyBasePoints(offset[i], basePrims[i].startPoint(), basePrims[i].endPoint());\r\n return offset;\r\n }\r\n return this.applyBasePoints(offset, g.startPoint(), g.endPoint());\r\n }\r\n\r\n /**\r\n * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).\r\n * * The construction will remove \"some\" local effects of features smaller than the offset distance, but will not detect self intersection among widely separated edges.\r\n * * If offsetDistance is given as a number, default OffsetOptions are applied.\r\n * * When the offset needs to do an \"outside\" turn, the first applicable construction is applied:\r\n * * If the turn is larger than `options.minArcDegrees`, a circular arc is constructed.\r\n * * If the turn is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to single intersection point.\r\n * * If the turn is larger than `options.maxChamferDegrees`, the turn is constructed as a sequence of straight lines that are:\r\n * * outside the arc\r\n * * have uniform turn angle less than `options.maxChamferDegrees`\r\n * * each line segment (except first and last) touches the arc at its midpoint.\r\n * @param curves base curves.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.\r\n */\r\n public static constructCurveXYOffset(curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions): CurveCollection | undefined {\r\n const wrap = curves instanceof Loop;\r\n const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);\r\n const simpleOffsets: CurvePrimitive[] = [];\r\n // setup pass: get simple offsets of each primitive\r\n for (const c of curves.children) {\r\n const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);\r\n if (c1 === undefined) {\r\n // bad .. maybe arc to inside?\r\n } else if (c1 instanceof CurvePrimitive)\r\n simpleOffsets.push(c1);\r\n else if (Array.isArray(c1)) {\r\n for (const c2 of c1) {\r\n if (c2 instanceof CurvePrimitive)\r\n simpleOffsets.push(c2);\r\n }\r\n }\r\n }\r\n let fragment0;\r\n let newJoint;\r\n let previousJoint;\r\n let joint0;\r\n for (const fragment1 of simpleOffsets) {\r\n if (fragment1) {\r\n newJoint = new Joint(fragment0, fragment1, fragment1.fractionToPoint(0.0));\r\n if (newJoint !== undefined)\r\n if (joint0 === undefined)\r\n joint0 = newJoint;\r\n if (previousJoint)\r\n Joint.link(previousJoint, newJoint);\r\n previousJoint = newJoint;\r\n fragment0 = fragment1;\r\n }\r\n }\r\n if (joint0 && previousJoint && curves instanceof Loop)\r\n Joint.link(previousJoint, joint0);\r\n\r\n const numOffset = simpleOffsets.length;\r\n Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);\r\n\r\n const outputCurves: CurvePrimitive[] = [];\r\n Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);\r\n return RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegratedSpiral3d.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/IntegratedSpiral3d.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI/C,OAAO,EAAE,OAAO,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AAE,SAAS,EAAE,MAAM;IAGhF,6DAA6D;IACtD,mBAAmB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;IAC/C;;;OAGG;IACI,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI;IACrE,+CAA+C;IACxC,kBAAkB,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI;IAa9E;;;OAGG;IAEI,4BAA4B,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM;IAapE;;OAEG;IAEI,cAAc,IAAI,IAAI;IAM7B,qDAAqD;IAC9C,eAAe,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAoCzE,oEAAoE;IAC7D,4BAA4B,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK;IAUlF,sDAAsD;IAEtC,qBAAqB,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS;IAY5F;;;;;OAKG;IACI,8BAA8B,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,yBAAyB,GAAG,yBAAyB,GAAG,SAAS;IAcxI,mFAAmF;IAC5E,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;IAG/D,oDAAoD;IAC7C,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI;IAGvE,4CAA4C;IAC5B,aAAa,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,OAAO;CAY9D"}
|
|
@@ -284,14 +284,40 @@ class IntegratedSpiral3d extends TransitionSpiral3d_1.TransitionSpiral3d {
|
|
|
284
284
|
}
|
|
285
285
|
/** Evaluate curve point with respect to fraction. */
|
|
286
286
|
fractionToPoint(activeFraction, result) {
|
|
287
|
-
|
|
288
|
-
globalFraction = Geometry_1.Geometry.clampToStartEnd(globalFraction, 0, 1);
|
|
287
|
+
const targetGlobalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);
|
|
289
288
|
const numStrokes = this._globalStrokes.packedPoints.length - 1;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
289
|
+
if (activeFraction > 1.0) {
|
|
290
|
+
result = this._globalStrokes.packedPoints.back(result);
|
|
291
|
+
const integrationStep = 1.0 / numStrokes;
|
|
292
|
+
let currentGlobalFraction = 1.0;
|
|
293
|
+
let nextGlobalFraction = currentGlobalFraction + integrationStep;
|
|
294
|
+
while (nextGlobalFraction < targetGlobalFraction) {
|
|
295
|
+
this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);
|
|
296
|
+
currentGlobalFraction = nextGlobalFraction;
|
|
297
|
+
nextGlobalFraction += integrationStep;
|
|
298
|
+
}
|
|
299
|
+
this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);
|
|
300
|
+
}
|
|
301
|
+
else if (activeFraction < 0.0) {
|
|
302
|
+
result = this._globalStrokes.packedPoints.front(result);
|
|
303
|
+
const integrationStep = 1.0 / numStrokes;
|
|
304
|
+
let currentGlobalFraction = 0.0;
|
|
305
|
+
let nextGlobalFraction = currentGlobalFraction - integrationStep;
|
|
306
|
+
while (nextGlobalFraction > targetGlobalFraction) {
|
|
307
|
+
this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);
|
|
308
|
+
currentGlobalFraction = nextGlobalFraction;
|
|
309
|
+
nextGlobalFraction -= integrationStep;
|
|
310
|
+
}
|
|
311
|
+
this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
const clampedGlobalFraction = Geometry_1.Geometry.clampToStartEnd(targetGlobalFraction, 0, 1);
|
|
315
|
+
const index0 = Math.trunc(clampedGlobalFraction * numStrokes); // This indexes the point to the left of the query.
|
|
316
|
+
const globalFraction0 = index0 / numStrokes;
|
|
317
|
+
result = this._globalStrokes.packedPoints.getPoint3dAtUncheckedPointIndex(index0, result);
|
|
318
|
+
// console.log(" fractionToPoint ", activeFraction, this.activeFractionInterval, "( global integration " + globalFraction0 + " to " + globalFraction + ")", index0);
|
|
319
|
+
this.fullSpiralIncrementalIntegral(result, globalFraction0, targetGlobalFraction, true);
|
|
320
|
+
}
|
|
295
321
|
return result;
|
|
296
322
|
}
|
|
297
323
|
/** Evaluate curve point and derivative with respect to fraction. */
|
|
@@ -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;AAGvF;;;;;;;GAOG;AACH,MAAa,kBAAmB,SAAQ,uCAAkB;IAsBxD,+BAA+B;IAC/B,8HAA8H;IAC9H,YAAoB,UAA8B,EAChD,SAA+B,EAC/B,QAAmB,EACnB,SAAqB,EACrB,sBAAiC,EACjC,YAAuB,EACvB,SAAiB,EACjB,UAAuD;QACvD,KAAK,CAAC,UAAU,EAAE,YAAY,EAAE,sBAAsB,EAAE,UAAU,CAAC,CAAC;QA/BtE,wCAAwC;QACxB,uBAAkB,GAAG,kBAAkB,CAAC;QA+BtD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;QA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AA6B,CAAC,KAAK,CAAC,SAAS,CAAC;mBAC7D,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC;mBACnD,mBAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC;mBAChE,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,KAAK,CAAC,sBAAsB,CAAC;mBACvE,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;SAC1D;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AA1YH,gDA4YC;AAlWC,2CAA2C;AACpB,oCAAiB,GAAG,UAAU,CAAC;AAkWxD,sDAAsD;AACtD,kBAAkB,CAAC,aAAa,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { TransitionSpiral3d } from \"./TransitionSpiral3d\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { NormalizedTransition } from \"./NormalizedTransition\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\nimport { Quadrature } from \"../../numerics/Quadrature\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { AxisOrder, Geometry } from \"../../Geometry\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Plane3dByOriginAndVectors } from \"../../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Range3d } from \"../../geometry3d/Range\";\r\nimport { GeometryQuery } from \"../GeometryQuery\";\r\n/**\r\n * An IntegratedSpiral3d is a curve defined by integrating its curvature.\r\n * * The first integral of curvature (with respect to distance along the curve) is the bearing angle (in radians)\r\n * * Integrating (cos(theta), sin(theta)) gives displacement from the start point, and thus the actual curve position.\r\n * * The curvature functions of interest are all symmetric snap functions in the NormalizedTransition class.\r\n * * `TransitionConditionalProperties` implements the computations of the interrelationship of radii, bearing, and length.\r\n * @public\r\n */\r\nexport class IntegratedSpiral3d extends TransitionSpiral3d {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"transitionSpiral\";\r\n\r\n /** start and end radii as a Segment1d */\r\n public radius01: Segment1d;\r\n /** start and end bearings as an AngleSweep */\r\n public bearing01: AngleSweep;\r\n /** stroked approximation of entire spiral. */\r\n private _globalStrokes: LineString3d;\r\n /** stroked approximation of active spiral.\r\n * * Same count as global -- possibly overly fine, but it gives some consistency between same clothoid constructed as partial versus complete.\r\n * * If no trimming, this points to the same place as the _globalStrokes !!! Don't double transform!!!\r\n */\r\n private _activeStrokes?: LineString3d;\r\n /** Return the internal stroked form of the (possibly partial) spiral */\r\n public get activeStrokes(): LineString3d { return this._activeStrokes !== undefined ? this._activeStrokes : this._globalStrokes; }\r\n private _evaluator: NormalizedTransition;\r\n /** Total curve arc length (computed) */\r\n private _arcLength01: number;\r\n /** Curvatures (inverse radii) at start and end */\r\n private _curvature01: Segment1d;\r\n /** evaluator for transition */\r\n // constructor demands all bearing, radius, and length data -- caller determines usual dependency of \"any 4 determine the 5th\"\r\n private constructor(spiralType: string | undefined,\r\n evaluator: NormalizedTransition,\r\n radius01: Segment1d,\r\n bearing01: AngleSweep,\r\n activeFractionInterval: Segment1d,\r\n localToWorld: Transform,\r\n arcLength: number,\r\n properties: TransitionConditionalProperties | undefined) {\r\n super(spiralType, localToWorld, activeFractionInterval, properties);\r\n this._evaluator = evaluator;\r\n this.radius01 = radius01;\r\n this.bearing01 = bearing01;\r\n this._arcLength01 = arcLength;\r\n this._globalStrokes = LineString3d.create();\r\n // initialize for compiler -- but this will be recomputed in refreshComputeProperties ...\r\n this._curvature01 = Segment1d.create(0, 1);\r\n this.refreshComputedProperties();\r\n }\r\n /** default spiral type name. (clothoid) */\r\n public static readonly defaultSpiralType = \"clothoid\";\r\n\r\n /** use the integrated function to return an angle at fractional position. */\r\n\r\n public globalFractionToBearingRadians(fraction: number): number {\r\n const areaFraction = this._evaluator.fractionToArea(fraction);\r\n const dx = this._arcLength01;\r\n return this.bearing01.startRadians + areaFraction * dx * this._curvature01.signedDelta() + fraction * this._curvature01.x0 * dx;\r\n }\r\n /** use the integrated function to return an angle at fractional position. */\r\n public globalFractionToCurvature(fraction: number): number {\r\n const f = this._evaluator.fractionToCurvatureFraction(fraction);\r\n return this._curvature01.fractionToPoint(f);\r\n }\r\n\r\n /** Return the bearing at given fraction of the active interval .... */\r\n\r\n public fractionToBearingRadians(activeFraction: number): number {\r\n const fraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n return this.bearing01.startRadians + fraction * this._arcLength01 * (this._curvature01.x0 + 0.5 * fraction * (this._curvature01.x1 - this._curvature01.x0));\r\n }\r\n /** Return the curvature at given fraction of the active interval ...\r\n * * The `undefined` result is to match the abstract class -- it cannot actually occur.\r\n */\r\n public override fractionToCurvature(activeFraction: number): number | undefined {\r\n // BUG? active interval\r\n return this._curvature01.fractionToPoint(this.activeFractionInterval.fractionToPoint(activeFraction));\r\n }\r\n\r\n // These static variables are reused on calls to integrateFromStartFraction\r\n\r\n private static _gaussFraction: Float64Array;\r\n private static _gaussWeight: Float64Array;\r\n private static _gaussMapper: (xA: number, xB: number, arrayX: Float64Array, arrayW: Float64Array) => number;\r\n /** Initialize class level work arrays. */\r\n public static initWorkSpace() {\r\n IntegratedSpiral3d._gaussFraction = new Float64Array(5);\r\n IntegratedSpiral3d._gaussWeight = new Float64Array(5);\r\n IntegratedSpiral3d._gaussMapper = Quadrature.setupGauss5;\r\n }\r\n /** Evaluate and sum the gauss quadrature formulas to integrate cos(theta), sin(theta) fractional subset of a reference length.\r\n * (recall that theta is a nonlinear function of the fraction.)\r\n * * This is a single interval of gaussian integration.\r\n * * The fraction is on the full spiral (not in the mapped active interval)\r\n * @param xyz advancing integrated point.\r\n * @param fractionA fraction at start of interval\r\n * @param fractionB fraction at end of interval.\r\n * @param unitArcLength length of curve for 0 to 1 fractional\r\n */\r\n private fullSpiralIncrementalIntegral(xyz: Point3d, fractionA: number, fractionB: number, applyMatrix: boolean) {\r\n const gaussFraction = IntegratedSpiral3d._gaussFraction;\r\n const gaussWeight = IntegratedSpiral3d._gaussWeight;\r\n const numEval = IntegratedSpiral3d._gaussMapper(fractionA, fractionB, gaussFraction, gaussWeight);\r\n const deltaL = this._arcLength01;\r\n let w = 0;\r\n let dx = 0.0;\r\n let dy = 0.0;\r\n for (let k = 0; k < numEval; k++) {\r\n const radians = this.globalFractionToBearingRadians(gaussFraction[k]);\r\n w = gaussWeight[k] * deltaL;\r\n dx += w * Math.cos(radians);\r\n dy += w * Math.sin(radians);\r\n }\r\n if (applyMatrix)\r\n Matrix3d.xyzPlusMatrixTimesXYZ(xyz, this.localToWorld.matrix, { x: dx, y: dy, z: 0.0 }, xyz);\r\n else\r\n xyz.addXYZInPlace(dx, dy, 0.0);\r\n\r\n }\r\n /** Recompute strokes */\r\n public refreshComputedProperties() {\r\n this._curvature01 = Segment1d.create(\r\n TransitionSpiral3d.radiusToCurvature(this.radius01.x0),\r\n TransitionSpiral3d.radiusToCurvature(this.radius01.x1));\r\n this._globalStrokes.clear();\r\n const currentPoint = Point3d.create();\r\n this._globalStrokes.appendStrokePoint(currentPoint);\r\n const numInterval = 16;\r\n\r\n const fractionStep = 1.0 / numInterval;\r\n for (let i = 1; i <= numInterval; i++) {\r\n const fraction0 = (i - 1) * fractionStep;\r\n const fraction1 = i * fractionStep;\r\n this.fullSpiralIncrementalIntegral(currentPoint, fraction0, fraction1, false);\r\n this._globalStrokes.appendStrokePoint(currentPoint);\r\n }\r\n this._globalStrokes.tryTransformInPlace(this.localToWorld);\r\n if (!this.activeFractionInterval.isExact01) {\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = LineString3d.create();\r\n this._activeStrokes.clear();\r\n // finer strokes in the active interval ... same fraction step, but mapped\r\n // This assumes factionToPoint acts normally within refreshComputedProperties -- that depends on the global strokes we just computed, but not on the active strokes\r\n for (let i = 0; i <= numInterval; i++) {\r\n const localFraction = i * fractionStep;\r\n this._activeStrokes.addPoint(this.fractionToPoint(localFraction));\r\n }\r\n }\r\n }\r\n /**\r\n * Create a transition spiral with radius and bearing conditions.\r\n * @param radius01 radius (inverse curvature) at start and end. (radius of zero means straight line)\r\n * @param bearing01 bearing angles at start and end. bearings are measured from the x axis, positive clockwise towards y axis\r\n * @param activeFractionInterval fractional limits of the active portion of the spiral.\r\n * @param localToWorld placement frame. Fractional coordinate 0 is at the origin.\r\n */\r\n public static createRadiusRadiusBearingBearing(radius01: Segment1d, bearing01: AngleSweep, activeFractionInterval: Segment1d, localToWorld: Transform, typeName?: string) {\r\n const arcLength = TransitionSpiral3d.radiusRadiusSweepRadiansToArcLength(radius01.x0, radius01.x1, bearing01.sweepRadians);\r\n if (typeName === undefined)\r\n typeName = \"clothoid\";\r\n const evaluator = NormalizedTransition.findEvaluator(typeName);\r\n if (!evaluator)\r\n return undefined;\r\n return new IntegratedSpiral3d(typeName, evaluator,\r\n radius01.clone(),\r\n bearing01.clone(), activeFractionInterval.clone(), localToWorld.clone(), arcLength,\r\n new TransitionConditionalProperties(radius01.x0, radius01.x1,\r\n bearing01.startAngle.clone(), bearing01.endAngle.clone(),\r\n undefined));\r\n }\r\n /**\r\n * Create a transition spiral.\r\n * * Inputs must provide exactly 4 of the 5 values `[radius0,radius1,bearing0,bearing1,length`.\r\n * @param spiralType one of \"clothoid\", \"bloss\", \"biquadratic\", \"cosine\", \"sine\". If undefined, \"clothoid\" is used.\r\n * @param radius0 radius (or 0 for tangent to line) at start\r\n * @param radius1 radius (or 0 for tangent to line) at end\r\n * @param bearing0 bearing, measured CCW from x axis at start.\r\n * @param bearing1 bearing, measured CCW from x axis at end.\r\n * @param fractionInterval optional fractional interval for an \"active\" portion of the curve. if omitted, the full [0,1] is used.\r\n * @param localToWorld placement transform\r\n */\r\n public static createFrom4OutOf5(\r\n spiralType: string | undefined,\r\n radius0: number | undefined,\r\n radius1: number | undefined,\r\n bearing0: Angle | undefined,\r\n bearing1: Angle | undefined,\r\n arcLength: number | undefined,\r\n fractionInterval: undefined | Segment1d,\r\n localToWorld: Transform): IntegratedSpiral3d | undefined {\r\n if (spiralType === undefined)\r\n spiralType = \"clothoid\";\r\n const evaluator = NormalizedTransition.findEvaluator(spiralType);\r\n if (!evaluator)\r\n return undefined;\r\n const data = new TransitionConditionalProperties(radius0, radius1, bearing0, bearing1, arcLength);\r\n const data1 = data.clone();\r\n if (!data.tryResolveAnySingleUnknown())\r\n return undefined;\r\n if (fractionInterval === undefined)\r\n fractionInterval = Segment1d.create(0, 1);\r\n return new IntegratedSpiral3d(\r\n spiralType,\r\n evaluator,\r\n Segment1d.create(data.radius0, data.radius1),\r\n AngleSweep.createStartEnd(data.bearing0!, data.bearing1!),\r\n fractionInterval ? fractionInterval.clone() : Segment1d.create(0, 1),\r\n localToWorld, data.curveLength!, data1);\r\n }\r\n /** Copy all defining data from another spiral. */\r\n public setFrom(other: IntegratedSpiral3d): IntegratedSpiral3d {\r\n this.localToWorld.setFrom(other.localToWorld);\r\n this.radius01.setFrom(other.radius01);\r\n this._curvature01.setFrom(other._curvature01);\r\n this.bearing01.setFrom(other.bearing01);\r\n this.localToWorld.setFrom(other.localToWorld);\r\n this.activeFractionInterval.setFrom(other.activeFractionInterval);\r\n this._arcLength01 = other._arcLength01;\r\n return this;\r\n }\r\n /** Deep clone of this spiral */\r\n public clone(): IntegratedSpiral3d {\r\n return new IntegratedSpiral3d(this._spiralType, this._evaluator,\r\n this.radius01.clone(), this.bearing01.clone(),\r\n this.activeFractionInterval.clone(), this.localToWorld.clone(), this._arcLength01,\r\n this._designProperties?.clone());\r\n }\r\n\r\n /** Return (if possible) a spiral which is a portion of this curve. */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): IntegratedSpiral3d | undefined {\r\n const spiralB = this.clone();\r\n const globalFractionA = this._activeFractionInterval.fractionToPoint(fractionA);\r\n const globalFractionB = this._activeFractionInterval.fractionToPoint(fractionB);\r\n spiralB._activeFractionInterval.set(globalFractionA, globalFractionB);\r\n spiralB.refreshComputedProperties();\r\n return spiralB;\r\n }\r\n\r\n /** apply `transform` to this spiral's local to world transform. */\r\n public tryTransformInPlace(transformA: Transform): boolean {\r\n\r\n const rigidData = this.applyRigidPartOfTransform(transformA);\r\n if (rigidData !== undefined) {\r\n this._curvature01.x0 /= rigidData.scale;\r\n this._curvature01.x1 /= rigidData.scale;\r\n this.radius01.x0 *= rigidData.scale;\r\n this.radius01.x1 *= rigidData.scale;\r\n this._arcLength01 *= rigidData.scale;\r\n }\r\n this.refreshComputedProperties();\r\n return true;\r\n }\r\n /** Clone with a transform applied */\r\n public cloneTransformed(transform: Transform): TransitionSpiral3d {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform); // ok, we're confident it will always work.\r\n return result;\r\n }\r\n /** Return the spiral start point. */\r\n public override startPoint(): Point3d { return this.activeStrokes.startPoint(); }\r\n /** return the spiral end point. */\r\n public override endPoint(): Point3d { return this.activeStrokes.endPoint(); }\r\n /** test if the local to world transform places the spiral xy plane into `plane` */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return plane.isPointInPlane(this.localToWorld.origin as Point3d)\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnX(plane.getNormalRef()))\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnY(plane.getNormalRef()));\r\n }\r\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public quickLength() { return this.curveLength(); }\r\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public override curveLength() { return this._arcLength01 * (this._activeFractionInterval.absoluteDelta()); }\r\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. */\r\n public override curveLengthBetweenFractions(fraction0: number, fraction1: number) {\r\n return this._arcLength01 * (this._activeFractionInterval.absoluteDelta() * Math.abs(fraction1 - fraction0));\r\n }\r\n /** Test if `other` is an instance of `TransitionSpiral3d` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof TransitionSpiral3d; }\r\n /** Add strokes from this spiral to `dest`.\r\n * * Linestrings will usually stroke as just their points.\r\n * * If maxEdgeLength is given, this will sub-stroke within the linestring -- not what we want.\r\n */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void { this.activeStrokes.emitStrokes(dest, options); }\r\n /** emit stroke fragments to `dest` handler. */\r\n public emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void {\r\n const n = this.computeStrokeCountForOptions(options);\r\n dest.startParentCurvePrimitive(this);\r\n const activeStrokes = this.activeStrokes;\r\n const preferPrimary = dest.needPrimaryGeometryForStrokes === undefined ? false : dest.needPrimaryGeometryForStrokes();\r\n if (!preferPrimary && n <= activeStrokes.numPoints()) {\r\n this.activeStrokes.emitStrokableParts(dest, options);\r\n } else {\r\n dest.announceIntervalForUniformStepStrokes(this, n, 0.0, 1.0);\r\n }\r\n dest.endParentCurvePrimitive(this);\r\n }\r\n\r\n /**\r\n * return the stroke count required for given options.\r\n * @param options StrokeOptions that determine count\r\n */\r\n\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n let numStroke;\r\n if (options) {\r\n const rMin = Math.min(Math.abs(this.radius01.x0), Math.abs(this.radius01.x1));\r\n numStroke = options.applyTolerancesToArc(rMin, this.bearing01.sweepRadians);\r\n numStroke = options.applyMaxEdgeLength(numStroke, this.curveLength());\r\n numStroke = options.applyMinStrokesPerPrimitive(numStroke);\r\n } else {\r\n numStroke = StrokeOptions.applyAngleTol(undefined, 4, this.bearing01.sweepRadians);\r\n }\r\n return numStroke;\r\n }\r\n\r\n /** Reverse the active interval and active strokes.\r\n * * Primary defining data remains unchanged !!!\r\n */\r\n\r\n public reverseInPlace(): void {\r\n this.activeFractionInterval.reverseInPlace();\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = this._globalStrokes.clone();\r\n this._activeStrokes.reverseInPlace();\r\n }\r\n /** Evaluate curve point with respect to fraction. */\r\n public fractionToPoint(activeFraction: number, result?: Point3d): Point3d {\r\n let globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n globalFraction = Geometry.clampToStartEnd(globalFraction, 0, 1);\r\n const numStrokes = this._globalStrokes.packedPoints.length - 1;\r\n const index0 = Math.trunc(globalFraction * numStrokes); // This indexes the point to the left of the query.\r\n const globalFraction0 = index0 / numStrokes;\r\n result = this._globalStrokes.packedPoints.getPoint3dAtUncheckedPointIndex(index0, result);\r\n // console.log(\" fractionToPoint \", activeFraction, this.activeFractionInterval, \"( global integration \" + globalFraction0 + \" to \" + globalFraction + \")\", index0);\r\n this.fullSpiralIncrementalIntegral(result, globalFraction0, globalFraction, true);\r\n return result;\r\n }\r\n /** Evaluate curve point and derivative with respect to fraction. */\r\n public fractionToPointAndDerivative(activeFraction: number, result?: Ray3d): Ray3d {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n result = result ? result : Ray3d.createZero();\r\n this.fractionToPoint(activeFraction, result.origin);\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const a = this._arcLength01 * this.activeFractionInterval.signedDelta();\r\n this.localToWorld.matrix.multiplyXY(a * Math.cos(radians), a * Math.sin(radians), result.direction);\r\n return result;\r\n }\r\n\r\n /** Return the frenet frame at fractional position. */\r\n\r\n public override fractionToFrenetFrame(activeFraction: number, result?: Transform): Transform {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n result = result ? result : Transform.createIdentity();\r\n result.origin.setFrom(this.fractionToPoint(activeFraction));\r\n Matrix3d.createRigidFromMatrix3d(this.localToWorld.matrix, AxisOrder.XYZ, result.matrix);\r\n\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const c = Math.cos(radians);\r\n const s = Math.sin(radians);\r\n result.matrix.applyGivensColumnOp(0, 1, c, s);\r\n return result;\r\n }\r\n /** Return a plane with\r\n *\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n public fractionToPointAnd2Derivatives(activeFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n const origin = this.fractionToPoint(activeFraction);\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const c = Math.cos(radians);\r\n const s = Math.sin(radians);\r\n const delta = this.activeFractionInterval.signedDelta();\r\n const a = delta;\r\n const b = a * delta;\r\n const vectorX = this.localToWorld.matrix.multiplyXY(a * c, a * s);\r\n const vectorY = this.localToWorld.matrix.multiplyXY(-b * s, b * c);\r\n vectorY.scaleInPlace(this.globalFractionToCurvature(globalFraction));\r\n return Plane3dByOriginAndVectors.createCapture(origin, vectorX, vectorY, result);\r\n }\r\n /** Second step of double dispatch: call `handler.handleTransitionSpiral(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleTransitionSpiral(this);\r\n }\r\n /** extend the range by the strokes of the spiral */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n this.activeStrokes.extendRange(rangeToExtend, transform);\r\n }\r\n /** compare various coordinate quantities */\r\n public override isAlmostEqual(other?: GeometryQuery): boolean {\r\n if (other instanceof IntegratedSpiral3d) {\r\n return this.radius01.isAlmostEqual(other.radius01)\r\n && this.bearing01.isAlmostEqualAllowPeriodShift(other.bearing01)\r\n && this.localToWorld.isAlmostEqual(other.localToWorld)\r\n && Geometry.isSameCoordinate(this._arcLength01, other._arcLength01)\r\n && this.activeFractionInterval.isAlmostEqual(other.activeFractionInterval)\r\n && this._curvature01.isAlmostEqual(other._curvature01);\r\n }\r\n return false;\r\n }\r\n\r\n}\r\n// at load time, initialize gauss quadrature workspace\r\nIntegratedSpiral3d.initWorkSpace();\r\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;AAGvF;;;;;;;GAOG;AACH,MAAa,kBAAmB,SAAQ,uCAAkB;IAsBxD,+BAA+B;IAC/B,8HAA8H;IAC9H,YAAoB,UAA8B,EAChD,SAA+B,EAC/B,QAAmB,EACnB,SAAqB,EACrB,sBAAiC,EACjC,YAAuB,EACvB,SAAiB,EACjB,UAAuD;QACvD,KAAK,CAAC,UAAU,EAAE,YAAY,EAAE,sBAAsB,EAAE,UAAU,CAAC,CAAC;QA/BtE,wCAAwC;QACxB,uBAAkB,GAAG,kBAAkB,CAAC;QA+BtD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;QAC9B,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AAa,CAAC,KAAK,CAAC,YAAY,CAAC;mBACnD,mBAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC;mBAChE,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,KAAK,CAAC,sBAAsB,CAAC;mBACvE,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;SAC1D;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AAnaH,gDAqaC;AA3XC,2CAA2C;AACpB,oCAAiB,GAAG,UAAU,CAAC;AA2XxD,sDAAsD;AACtD,kBAAkB,CAAC,aAAa,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { TransitionSpiral3d } from \"./TransitionSpiral3d\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { NormalizedTransition } from \"./NormalizedTransition\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\nimport { Quadrature } from \"../../numerics/Quadrature\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { AxisOrder, Geometry } from \"../../Geometry\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Plane3dByOriginAndVectors } from \"../../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Range3d } from \"../../geometry3d/Range\";\r\nimport { GeometryQuery } from \"../GeometryQuery\";\r\n/**\r\n * An IntegratedSpiral3d is a curve defined by integrating its curvature.\r\n * * The first integral of curvature (with respect to distance along the curve) is the bearing angle (in radians)\r\n * * Integrating (cos(theta), sin(theta)) gives displacement from the start point, and thus the actual curve position.\r\n * * The curvature functions of interest are all symmetric snap functions in the NormalizedTransition class.\r\n * * `TransitionConditionalProperties` implements the computations of the interrelationship of radii, bearing, and length.\r\n * @public\r\n */\r\nexport class IntegratedSpiral3d extends TransitionSpiral3d {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"transitionSpiral\";\r\n\r\n /** start and end radii as a Segment1d */\r\n public radius01: Segment1d;\r\n /** start and end bearings as an AngleSweep */\r\n public bearing01: AngleSweep;\r\n /** stroked approximation of entire spiral. */\r\n private _globalStrokes: LineString3d;\r\n /** stroked approximation of active spiral.\r\n * * Same count as global -- possibly overly fine, but it gives some consistency between same clothoid constructed as partial versus complete.\r\n * * If no trimming, this points to the same place as the _globalStrokes !!! Don't double transform!!!\r\n */\r\n private _activeStrokes?: LineString3d;\r\n /** Return the internal stroked form of the (possibly partial) spiral */\r\n public get activeStrokes(): LineString3d { return this._activeStrokes !== undefined ? this._activeStrokes : this._globalStrokes; }\r\n private _evaluator: NormalizedTransition;\r\n /** Total curve arc length (computed) */\r\n private _arcLength01: number;\r\n /** Curvatures (inverse radii) at start and end */\r\n private _curvature01: Segment1d;\r\n /** evaluator for transition */\r\n // constructor demands all bearing, radius, and length data -- caller determines usual dependency of \"any 4 determine the 5th\"\r\n private constructor(spiralType: string | undefined,\r\n evaluator: NormalizedTransition,\r\n radius01: Segment1d,\r\n bearing01: AngleSweep,\r\n activeFractionInterval: Segment1d,\r\n localToWorld: Transform,\r\n arcLength: number,\r\n properties: TransitionConditionalProperties | undefined) {\r\n super(spiralType, localToWorld, activeFractionInterval, properties);\r\n this._evaluator = evaluator;\r\n this.radius01 = radius01;\r\n this.bearing01 = bearing01;\r\n this._arcLength01 = arcLength;\r\n this._globalStrokes = LineString3d.create();\r\n // initialize for compiler -- but this will be recomputed in refreshComputeProperties ...\r\n this._curvature01 = Segment1d.create(0, 1);\r\n this.refreshComputedProperties();\r\n }\r\n /** default spiral type name. (clothoid) */\r\n public static readonly defaultSpiralType = \"clothoid\";\r\n\r\n /** use the integrated function to return an angle at fractional position. */\r\n\r\n public globalFractionToBearingRadians(fraction: number): number {\r\n const areaFraction = this._evaluator.fractionToArea(fraction);\r\n const dx = this._arcLength01;\r\n return this.bearing01.startRadians + areaFraction * dx * this._curvature01.signedDelta() + fraction * this._curvature01.x0 * dx;\r\n }\r\n /** use the integrated function to return an angle at fractional position. */\r\n public globalFractionToCurvature(fraction: number): number {\r\n const f = this._evaluator.fractionToCurvatureFraction(fraction);\r\n return this._curvature01.fractionToPoint(f);\r\n }\r\n\r\n /** Return the bearing at given fraction of the active interval .... */\r\n\r\n public fractionToBearingRadians(activeFraction: number): number {\r\n const fraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n return this.bearing01.startRadians + fraction * this._arcLength01 * (this._curvature01.x0 + 0.5 * fraction * (this._curvature01.x1 - this._curvature01.x0));\r\n }\r\n /** Return the curvature at given fraction of the active interval ...\r\n * * The `undefined` result is to match the abstract class -- it cannot actually occur.\r\n */\r\n public override fractionToCurvature(activeFraction: number): number | undefined {\r\n // BUG? active interval\r\n return this._curvature01.fractionToPoint(this.activeFractionInterval.fractionToPoint(activeFraction));\r\n }\r\n\r\n // These static variables are reused on calls to integrateFromStartFraction\r\n\r\n private static _gaussFraction: Float64Array;\r\n private static _gaussWeight: Float64Array;\r\n private static _gaussMapper: (xA: number, xB: number, arrayX: Float64Array, arrayW: Float64Array) => number;\r\n /** Initialize class level work arrays. */\r\n public static initWorkSpace() {\r\n IntegratedSpiral3d._gaussFraction = new Float64Array(5);\r\n IntegratedSpiral3d._gaussWeight = new Float64Array(5);\r\n IntegratedSpiral3d._gaussMapper = Quadrature.setupGauss5;\r\n }\r\n /** Evaluate and sum the gauss quadrature formulas to integrate cos(theta), sin(theta) fractional subset of a reference length.\r\n * (recall that theta is a nonlinear function of the fraction.)\r\n * * This is a single interval of gaussian integration.\r\n * * The fraction is on the full spiral (not in the mapped active interval)\r\n * @param xyz advancing integrated point.\r\n * @param fractionA fraction at start of interval\r\n * @param fractionB fraction at end of interval.\r\n * @param unitArcLength length of curve for 0 to 1 fractional\r\n */\r\n private fullSpiralIncrementalIntegral(xyz: Point3d, fractionA: number, fractionB: number, applyMatrix: boolean) {\r\n const gaussFraction = IntegratedSpiral3d._gaussFraction;\r\n const gaussWeight = IntegratedSpiral3d._gaussWeight;\r\n const numEval = IntegratedSpiral3d._gaussMapper(fractionA, fractionB, gaussFraction, gaussWeight);\r\n const deltaL = this._arcLength01;\r\n let w = 0;\r\n let dx = 0.0;\r\n let dy = 0.0;\r\n for (let k = 0; k < numEval; k++) {\r\n const radians = this.globalFractionToBearingRadians(gaussFraction[k]);\r\n w = gaussWeight[k] * deltaL;\r\n dx += w * Math.cos(radians);\r\n dy += w * Math.sin(radians);\r\n }\r\n if (applyMatrix)\r\n Matrix3d.xyzPlusMatrixTimesXYZ(xyz, this.localToWorld.matrix, { x: dx, y: dy, z: 0.0 }, xyz);\r\n else\r\n xyz.addXYZInPlace(dx, dy, 0.0);\r\n\r\n }\r\n /** Recompute strokes */\r\n public refreshComputedProperties() {\r\n this._curvature01 = Segment1d.create(\r\n TransitionSpiral3d.radiusToCurvature(this.radius01.x0),\r\n TransitionSpiral3d.radiusToCurvature(this.radius01.x1));\r\n this._globalStrokes.clear();\r\n const currentPoint = Point3d.create();\r\n this._globalStrokes.appendStrokePoint(currentPoint);\r\n const numInterval = 16;\r\n\r\n const fractionStep = 1.0 / numInterval;\r\n for (let i = 1; i <= numInterval; i++) {\r\n const fraction0 = (i - 1) * fractionStep;\r\n const fraction1 = i * fractionStep;\r\n this.fullSpiralIncrementalIntegral(currentPoint, fraction0, fraction1, false);\r\n this._globalStrokes.appendStrokePoint(currentPoint);\r\n }\r\n this._globalStrokes.tryTransformInPlace(this.localToWorld);\r\n if (!this.activeFractionInterval.isExact01) {\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = LineString3d.create();\r\n this._activeStrokes.clear();\r\n // finer strokes in the active interval ... same fraction step, but mapped\r\n // This assumes factionToPoint acts normally within refreshComputedProperties -- that depends on the global strokes we just computed, but not on the active strokes\r\n for (let i = 0; i <= numInterval; i++) {\r\n const localFraction = i * fractionStep;\r\n this._activeStrokes.addPoint(this.fractionToPoint(localFraction));\r\n }\r\n }\r\n }\r\n /**\r\n * Create a transition spiral with radius and bearing conditions.\r\n * @param radius01 radius (inverse curvature) at start and end. (radius of zero means straight line)\r\n * @param bearing01 bearing angles at start and end. bearings are measured from the x axis, positive clockwise towards y axis\r\n * @param activeFractionInterval fractional limits of the active portion of the spiral.\r\n * @param localToWorld placement frame. Fractional coordinate 0 is at the origin.\r\n */\r\n public static createRadiusRadiusBearingBearing(radius01: Segment1d, bearing01: AngleSweep, activeFractionInterval: Segment1d, localToWorld: Transform, typeName?: string) {\r\n const arcLength = TransitionSpiral3d.radiusRadiusSweepRadiansToArcLength(radius01.x0, radius01.x1, bearing01.sweepRadians);\r\n if (typeName === undefined)\r\n typeName = \"clothoid\";\r\n const evaluator = NormalizedTransition.findEvaluator(typeName);\r\n if (!evaluator)\r\n return undefined;\r\n return new IntegratedSpiral3d(typeName, evaluator,\r\n radius01.clone(),\r\n bearing01.clone(), activeFractionInterval.clone(), localToWorld.clone(), arcLength,\r\n new TransitionConditionalProperties(radius01.x0, radius01.x1,\r\n bearing01.startAngle.clone(), bearing01.endAngle.clone(),\r\n undefined));\r\n }\r\n /**\r\n * Create a transition spiral.\r\n * * Inputs must provide exactly 4 of the 5 values `[radius0,radius1,bearing0,bearing1,length`.\r\n * @param spiralType one of \"clothoid\", \"bloss\", \"biquadratic\", \"cosine\", \"sine\". If undefined, \"clothoid\" is used.\r\n * @param radius0 radius (or 0 for tangent to line) at start\r\n * @param radius1 radius (or 0 for tangent to line) at end\r\n * @param bearing0 bearing, measured CCW from x axis at start.\r\n * @param bearing1 bearing, measured CCW from x axis at end.\r\n * @param fractionInterval optional fractional interval for an \"active\" portion of the curve. if omitted, the full [0,1] is used.\r\n * @param localToWorld placement transform\r\n */\r\n public static createFrom4OutOf5(\r\n spiralType: string | undefined,\r\n radius0: number | undefined,\r\n radius1: number | undefined,\r\n bearing0: Angle | undefined,\r\n bearing1: Angle | undefined,\r\n arcLength: number | undefined,\r\n fractionInterval: undefined | Segment1d,\r\n localToWorld: Transform): IntegratedSpiral3d | undefined {\r\n if (spiralType === undefined)\r\n spiralType = \"clothoid\";\r\n const evaluator = NormalizedTransition.findEvaluator(spiralType);\r\n if (!evaluator)\r\n return undefined;\r\n const data = new TransitionConditionalProperties(radius0, radius1, bearing0, bearing1, arcLength);\r\n const data1 = data.clone();\r\n if (!data.tryResolveAnySingleUnknown())\r\n return undefined;\r\n if (fractionInterval === undefined)\r\n fractionInterval = Segment1d.create(0, 1);\r\n return new IntegratedSpiral3d(\r\n spiralType,\r\n evaluator,\r\n Segment1d.create(data.radius0, data.radius1),\r\n AngleSweep.createStartEnd(data.bearing0!, data.bearing1!),\r\n fractionInterval ? fractionInterval.clone() : Segment1d.create(0, 1),\r\n localToWorld, data.curveLength!, data1);\r\n }\r\n /** Copy all defining data from another spiral. */\r\n public setFrom(other: IntegratedSpiral3d): IntegratedSpiral3d {\r\n this.localToWorld.setFrom(other.localToWorld);\r\n this.radius01.setFrom(other.radius01);\r\n this._curvature01.setFrom(other._curvature01);\r\n this.bearing01.setFrom(other.bearing01);\r\n this.localToWorld.setFrom(other.localToWorld);\r\n this.activeFractionInterval.setFrom(other.activeFractionInterval);\r\n this._arcLength01 = other._arcLength01;\r\n return this;\r\n }\r\n /** Deep clone of this spiral */\r\n public clone(): IntegratedSpiral3d {\r\n return new IntegratedSpiral3d(this._spiralType, this._evaluator,\r\n this.radius01.clone(), this.bearing01.clone(),\r\n this.activeFractionInterval.clone(), this.localToWorld.clone(), this._arcLength01,\r\n this._designProperties?.clone());\r\n }\r\n\r\n /** Return (if possible) a spiral which is a portion of this curve. */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): IntegratedSpiral3d | undefined {\r\n const spiralB = this.clone();\r\n const globalFractionA = this._activeFractionInterval.fractionToPoint(fractionA);\r\n const globalFractionB = this._activeFractionInterval.fractionToPoint(fractionB);\r\n spiralB._activeFractionInterval.set(globalFractionA, globalFractionB);\r\n spiralB.refreshComputedProperties();\r\n return spiralB;\r\n }\r\n\r\n /** apply `transform` to this spiral's local to world transform. */\r\n public tryTransformInPlace(transformA: Transform): boolean {\r\n\r\n const rigidData = this.applyRigidPartOfTransform(transformA);\r\n if (rigidData !== undefined) {\r\n this._curvature01.x0 /= rigidData.scale;\r\n this._curvature01.x1 /= rigidData.scale;\r\n this.radius01.x0 *= rigidData.scale;\r\n this.radius01.x1 *= rigidData.scale;\r\n this._arcLength01 *= rigidData.scale;\r\n }\r\n this.refreshComputedProperties();\r\n return true;\r\n }\r\n /** Clone with a transform applied */\r\n public cloneTransformed(transform: Transform): TransitionSpiral3d {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform); // ok, we're confident it will always work.\r\n return result;\r\n }\r\n /** Return the spiral start point. */\r\n public override startPoint(): Point3d { return this.activeStrokes.startPoint(); }\r\n /** return the spiral end point. */\r\n public override endPoint(): Point3d { return this.activeStrokes.endPoint(); }\r\n /** test if the local to world transform places the spiral xy plane into `plane` */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return plane.isPointInPlane(this.localToWorld.origin as Point3d)\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnX(plane.getNormalRef()))\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnY(plane.getNormalRef()));\r\n }\r\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public quickLength() { return this.curveLength(); }\r\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public override curveLength() { return this._arcLength01 * (this._activeFractionInterval.absoluteDelta()); }\r\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. */\r\n public override curveLengthBetweenFractions(fraction0: number, fraction1: number) {\r\n return this._arcLength01 * (this._activeFractionInterval.absoluteDelta() * Math.abs(fraction1 - fraction0));\r\n }\r\n /** Test if `other` is an instance of `TransitionSpiral3d` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof TransitionSpiral3d; }\r\n /** Add strokes from this spiral to `dest`.\r\n * * Linestrings will usually stroke as just their points.\r\n * * If maxEdgeLength is given, this will sub-stroke within the linestring -- not what we want.\r\n */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void { this.activeStrokes.emitStrokes(dest, options); }\r\n /** emit stroke fragments to `dest` handler. */\r\n public emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void {\r\n const n = this.computeStrokeCountForOptions(options);\r\n dest.startParentCurvePrimitive(this);\r\n const activeStrokes = this.activeStrokes;\r\n const preferPrimary = dest.needPrimaryGeometryForStrokes === undefined ? false : dest.needPrimaryGeometryForStrokes();\r\n if (!preferPrimary && n <= activeStrokes.numPoints()) {\r\n this.activeStrokes.emitStrokableParts(dest, options);\r\n } else {\r\n dest.announceIntervalForUniformStepStrokes(this, n, 0.0, 1.0);\r\n }\r\n dest.endParentCurvePrimitive(this);\r\n }\r\n\r\n /**\r\n * return the stroke count required for given options.\r\n * @param options StrokeOptions that determine count\r\n */\r\n\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n let numStroke;\r\n if (options) {\r\n const rMin = Math.min(Math.abs(this.radius01.x0), Math.abs(this.radius01.x1));\r\n numStroke = options.applyTolerancesToArc(rMin, this.bearing01.sweepRadians);\r\n numStroke = options.applyMaxEdgeLength(numStroke, this.curveLength());\r\n numStroke = options.applyMinStrokesPerPrimitive(numStroke);\r\n } else {\r\n numStroke = StrokeOptions.applyAngleTol(undefined, 4, this.bearing01.sweepRadians);\r\n }\r\n return numStroke;\r\n }\r\n\r\n /** Reverse the active interval and active strokes.\r\n * * Primary defining data remains unchanged !!!\r\n */\r\n\r\n public reverseInPlace(): void {\r\n this.activeFractionInterval.reverseInPlace();\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = this._globalStrokes.clone();\r\n this._activeStrokes.reverseInPlace();\r\n }\r\n /** Evaluate curve point with respect to fraction. */\r\n public fractionToPoint(activeFraction: number, result?: Point3d): Point3d {\r\n const targetGlobalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n const numStrokes = this._globalStrokes.packedPoints.length - 1;\r\n if (activeFraction > 1.0) {\r\n result = this._globalStrokes.packedPoints.back(result)!;\r\n const integrationStep = 1.0 / numStrokes;\r\n let currentGlobalFraction = 1.0;\r\n let nextGlobalFraction = currentGlobalFraction + integrationStep;\r\n while (nextGlobalFraction < targetGlobalFraction) {\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);\r\n currentGlobalFraction = nextGlobalFraction;\r\n nextGlobalFraction += integrationStep;\r\n }\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);\r\n } else if (activeFraction < 0.0) {\r\n result = this._globalStrokes.packedPoints.front(result)!;\r\n const integrationStep = 1.0 / numStrokes;\r\n let currentGlobalFraction = 0.0;\r\n let nextGlobalFraction = currentGlobalFraction - integrationStep;\r\n while (nextGlobalFraction > targetGlobalFraction) {\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);\r\n currentGlobalFraction = nextGlobalFraction;\r\n nextGlobalFraction -= integrationStep;\r\n }\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);\r\n } else {\r\n const clampedGlobalFraction = Geometry.clampToStartEnd(targetGlobalFraction, 0, 1);\r\n const index0 = Math.trunc(clampedGlobalFraction * numStrokes); // This indexes the point to the left of the query.\r\n const globalFraction0 = index0 / numStrokes;\r\n result = this._globalStrokes.packedPoints.getPoint3dAtUncheckedPointIndex(index0, result);\r\n // console.log(\" fractionToPoint \", activeFraction, this.activeFractionInterval, \"( global integration \" + globalFraction0 + \" to \" + globalFraction + \")\", index0);\r\n this.fullSpiralIncrementalIntegral(result, globalFraction0, targetGlobalFraction, true);\r\n\r\n }\r\n return result;\r\n }\r\n /** Evaluate curve point and derivative with respect to fraction. */\r\n public fractionToPointAndDerivative(activeFraction: number, result?: Ray3d): Ray3d {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n result = result ? result : Ray3d.createZero();\r\n this.fractionToPoint(activeFraction, result.origin);\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const a = this._arcLength01 * this.activeFractionInterval.signedDelta();\r\n this.localToWorld.matrix.multiplyXY(a * Math.cos(radians), a * Math.sin(radians), result.direction);\r\n return result;\r\n }\r\n\r\n /** Return the frenet frame at fractional position. */\r\n\r\n public override fractionToFrenetFrame(activeFraction: number, result?: Transform): Transform {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n result = result ? result : Transform.createIdentity();\r\n result.origin.setFrom(this.fractionToPoint(activeFraction));\r\n Matrix3d.createRigidFromMatrix3d(this.localToWorld.matrix, AxisOrder.XYZ, result.matrix);\r\n\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const c = Math.cos(radians);\r\n const s = Math.sin(radians);\r\n result.matrix.applyGivensColumnOp(0, 1, c, s);\r\n return result;\r\n }\r\n /** Return a plane with\r\n *\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n public fractionToPointAnd2Derivatives(activeFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n const origin = this.fractionToPoint(activeFraction);\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const c = Math.cos(radians);\r\n const s = Math.sin(radians);\r\n const delta = this.activeFractionInterval.signedDelta();\r\n const a = delta;\r\n const b = a * delta;\r\n const vectorX = this.localToWorld.matrix.multiplyXY(a * c, a * s);\r\n const vectorY = this.localToWorld.matrix.multiplyXY(-b * s, b * c);\r\n vectorY.scaleInPlace(this.globalFractionToCurvature(globalFraction));\r\n return Plane3dByOriginAndVectors.createCapture(origin, vectorX, vectorY, result);\r\n }\r\n /** Second step of double dispatch: call `handler.handleTransitionSpiral(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleTransitionSpiral(this);\r\n }\r\n /** extend the range by the strokes of the spiral */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n this.activeStrokes.extendRange(rangeToExtend, transform);\r\n }\r\n /** compare various coordinate quantities */\r\n public override isAlmostEqual(other?: GeometryQuery): boolean {\r\n if (other instanceof IntegratedSpiral3d) {\r\n return this.radius01.isAlmostEqual(other.radius01)\r\n && this.bearing01.isAlmostEqualAllowPeriodShift(other.bearing01)\r\n && this.localToWorld.isAlmostEqual(other.localToWorld)\r\n && Geometry.isSameCoordinate(this._arcLength01, other._arcLength01)\r\n && this.activeFractionInterval.isAlmostEqual(other.activeFractionInterval)\r\n && this._curvature01.isAlmostEqual(other._curvature01);\r\n }\r\n return false;\r\n }\r\n\r\n}\r\n// at load time, initialize gauss quadrature workspace\r\nIntegratedSpiral3d.initWorkSpace();\r\n"]}
|
|
@@ -7,6 +7,7 @@ import { Segment1d } from "../../geometry3d/Segment1d";
|
|
|
7
7
|
import { Transform } from "../../geometry3d/Transform";
|
|
8
8
|
import { TransitionConditionalProperties } from "./TransitionConditionalProperties";
|
|
9
9
|
import { LineString3d } from "../LineString3d";
|
|
10
|
+
import { OffsetOptions } from "../internalContexts/PolygonOffsetContext";
|
|
10
11
|
/**
|
|
11
12
|
* This is the set of valid type names for "integrated" spirals
|
|
12
13
|
* * Behavior is expressed by a `NormalizedTransition` snap function.
|
|
@@ -97,5 +98,12 @@ export declare abstract class TransitionSpiral3d extends CurvePrimitive {
|
|
|
97
98
|
rigidAxes: Matrix3d;
|
|
98
99
|
scale: number;
|
|
99
100
|
} | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).
|
|
103
|
+
* * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset
|
|
104
|
+
* for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.
|
|
105
|
+
* @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object
|
|
106
|
+
*/
|
|
107
|
+
constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined;
|
|
100
108
|
}
|
|
101
109
|
//# sourceMappingURL=TransitionSpiral3d.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransitionSpiral3d.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionSpiral3d.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEpF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"TransitionSpiral3d.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionSpiral3d.ts"],"names":[],"mappings":"A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AAc,EAAE,GAAG,SAAS;CAMlI"}
|
|
@@ -12,6 +12,8 @@ const CurvePrimitive_1 = require("../CurvePrimitive");
|
|
|
12
12
|
const Segment1d_1 = require("../../geometry3d/Segment1d");
|
|
13
13
|
const Transform_1 = require("../../geometry3d/Transform");
|
|
14
14
|
const Geometry_1 = require("../../Geometry");
|
|
15
|
+
const CurveOffsetXYHandler_1 = require("../internalContexts/CurveOffsetXYHandler");
|
|
16
|
+
const PolygonOffsetContext_1 = require("../internalContexts/PolygonOffsetContext");
|
|
15
17
|
/**
|
|
16
18
|
* TransitionSpiral3d is a base class for multiple variants of spirals.
|
|
17
19
|
* * The menagerie of spiral types have 2 broad categories:
|
|
@@ -105,6 +107,18 @@ class TransitionSpiral3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
105
107
|
}
|
|
106
108
|
return undefined;
|
|
107
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).
|
|
112
|
+
* * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset
|
|
113
|
+
* for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.
|
|
114
|
+
* @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object
|
|
115
|
+
*/
|
|
116
|
+
constructOffsetXY(offsetDistanceOrOptions) {
|
|
117
|
+
const options = PolygonOffsetContext_1.OffsetOptions.create(offsetDistanceOrOptions);
|
|
118
|
+
const handler = new CurveOffsetXYHandler_1.CurveOffsetXYHandler(this, options.leftOffsetDistance);
|
|
119
|
+
this.emitStrokableParts(handler, options.strokeOptions);
|
|
120
|
+
return handler.claimResult();
|
|
121
|
+
}
|
|
108
122
|
}
|
|
109
123
|
exports.TransitionSpiral3d = TransitionSpiral3d;
|
|
110
124
|
//# sourceMappingURL=TransitionSpiral3d.js.map
|