@itwin/core-geometry 3.1.0-dev.27 → 3.1.0-dev.28
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 +38 -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 +14 -0
- 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/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/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/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/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 +14 -0
- 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/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/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/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/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 +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolygonOffsetContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6CAA0C;AAE1C,4DAAyD;AACzD,+BAA+B;AAC/B,sEAAqE;AACrE,kDAA+C;AAC/C,oCAAiC;AAEjC,8CAA2C;AAC3C,gEAAyF;AACzF,sDAAmD;AACnD,oDAA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BAAQ,CAAC,MAAM,EAAE,CAAC;AAC9B,oCAAQ,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC;AAC5B,oCAAQ,GAAG,yBAAO,CAAC,MAAM,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 { 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,uC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,SAAS,IAAI,aAAa,EAAE;YACrC,IAAI,SAAS,EAAE;gBACb,QAAQ,GAAG,IAAI,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC3E,IAAI,QAAQ,KAAK,SAAS;oBACxB,IAAI,MAAM,KAAK,SAAS;wBACtB,MAAM,GAAG,QAAQ,CAAC;gBACtB,IAAI,aAAa;oBACf,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;gBACtC,aAAa,GAAG,QAAQ,CAAC;gBACzB,SAAS,GAAG,SAAS,CAAC;aACvB;SACF;QACD,IAAI,MAAM,IAAI,aAAa,IAAI,MAAM,YAAY,WAAI;YACnD,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;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"]}
|
|
@@ -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":"AAKA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,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|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransitionSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionSpiral3d.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAAm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C,kCAAkC,CAAC,OAAe,EAAE,SAAiB,EAAE,YAAoB;QACvG,OAAO,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,GAAG,GAAG,YAAY,GAAG,SAAS,CAAC,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;IAChI,CAAC;IACD,iFAAiF;IACjF,IAAW,gBAAgB,KAAkD,OAAO,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC7G;;;;;OAKG;IACO,yBAAyB,CAAC,UAAqB;QACvD,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,0BAA0B,EAAE,CAAC;QACjE,IAAI,SAAS,KAAK,SAAS,EAAE;YAC3B,6BAA6B;YAC7B,8DAA8D;YAC9D,MAAM,WAAW,GAAG,UAAU,CAAC,0BAA0B,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC7E,gDAAgD;YAChD,MAAM,OAAO,GAAG,SAAS,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YACnF,IAAI,CAAC,aAAa,GAAG,qBAAS,CAAC,qBAAqB,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAClF,IAAI,IAAI,CAAC,gBAAgB;gBACvB,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAE1D,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AArGD,gDAqGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { LineString3d } from \"../LineString3d\";\r\n/**\r\n * This is the set of valid type names for \"integrated\" spirals\r\n * * Behavior is expressed by a `NormalizedTransition` snap function.\r\n * * The snap function varies smoothly from f(0)=0 to f(1)=1\r\n * * The various snap functions are:\r\n * * clothoid: linear\r\n * * biquadratic: 2 quadratics pieced together, joining with 1st derivative continuity at f(0.) = 0.5, with zero slope f'(0)=0 and f'(1)= 0\r\n * * bloss: A single cubic with zero slope at 0 and 1\r\n * * cosine: half of a cosine wave, centered around 0.5\r\n * * sine: full period of a sine wave added to the line f(u)=u\r\n * *\r\n * @public\r\n */\r\nexport type IntegratedSpiralTypeName = \"clothoid\" | \"bloss\" | \"biquadratic\" | \"cosine\" | \"sine\";\r\n\r\n/**\r\n * This is the set of valid type names for \"direct\" spirals.\r\n * \"Direct\" spirals can evaluate fractionToPoint by direct equations, i.e. not requiring the numeric integrations in \"Integrated\" spiral types.\r\n * @public\r\n */\r\nexport type DirectSpiralTypeName =\r\n \"JapaneseCubic\" // 1 term from each of the X,Y clothoid series expansions: y = x^3 / (6RL)\r\n | \"Arema\" // 2 terms from each of the X,Y clothoid series expansions. Identical to ChineseCubic!\r\n | \"ChineseCubic\" // Identical to Arema!\r\n | \"HalfCosine\" // high continuity cosine variation from quadratic.\r\n | \"AustralianRailCorp\" // cubic with high accuracy distance series\r\n | \"WesternAustralian\" // simple cubic -- 2 terms of x series, 1 term of y series.\r\n | \"Czech\" // simple cubic with two term distance approximation\r\n | \"MXCubicAlongArc\" // x obtained from fractional distance via 2-terms from series, y = x^3/ (6RL)\r\n | \"Polish\"\r\n | \"Italian\"\r\n ;\r\n\r\n/**\r\n * TransitionSpiral3d is a base class for multiple variants of spirals.\r\n * * The menagerie of spiral types have 2 broad categories:\r\n * * IntegratedSpiral3d -- a spiral whose direct function for curvature versus distance must be integrated to determine x,y\r\n * * The IntegratedSpiral3d types are enumerated in `IntegratedSpiralTypes`\r\n * * DirectSpiral3d -- a spiral implemented with direct calculation of x,y from fractional position along the spiral.\r\n * * The direct spiral types are enumerated in the `DirectSpiralType`\r\n * * The method set for CurvePrimitive support includes a `handleTransitionSpiral(g: TransitionSpiral3d)` which receives all the spiral types.\r\n * * The spiral class may impose expectations that its inflection is at the origin, with tangent along the x axis.\r\n * * This is generally necessary for direct spirals.\r\n * * This is not necessary for integrated spirals.\r\n * @public\r\n */\r\nexport abstract class TransitionSpiral3d extends CurvePrimitive {\r\n /** string name of spiral type */\r\n protected _spiralType: string;\r\n /** Original defining properties. */\r\n protected _designProperties: TransitionConditionalProperties | undefined;\r\n\r\n /** Fractional interval for the \"active\" part of a containing spiral.\r\n * (The radius, angle, and length conditions define a complete spiral, and some portion of it is \"active\")\r\n */\r\n protected _activeFractionInterval: Segment1d;\r\n /** Return (reference to) the active portion of the reference spiral. */\r\n public get activeFractionInterval(): Segment1d { return this._activeFractionInterval; }\r\n /** strokes in the active portion */\r\n public abstract get activeStrokes(): LineString3d;\r\n /** Placement transform */\r\n protected _localToWorld: Transform;\r\n /** (reference to) placement transform. */\r\n public get localToWorld(): Transform { return this._localToWorld; }\r\n\r\n protected constructor(spiralType: string | undefined, localToWorld: Transform, activeFractionInterval: Segment1d | undefined, designProperties: TransitionConditionalProperties | undefined) {\r\n super();\r\n this._spiralType = spiralType ? spiralType : \"unknownSpiralType\";\r\n this._designProperties = designProperties;\r\n this._localToWorld = localToWorld;\r\n this._activeFractionInterval = activeFractionInterval ? activeFractionInterval : Segment1d.create(0, 1);\r\n }\r\n\r\n public get spiralType(): string { return this._spiralType; }\r\n /** Return 1/r with convention that if true zero is given as radius it represents infinite radius (0 curvature, straight line) */\r\n public static radiusToCurvature(radius: number): number { return (radius === 0.0) ? 0.0 : 1.0 / radius; }\r\n\r\n /** Return 1/k with convention that if near-zero is given as curvature, its infinite radius is returned as 0 */\r\n public static curvatureToRadius(curvature: number): number {\r\n if (Math.abs(curvature) < Geometry.smallAngleRadians)\r\n return 0.0;\r\n return 1.0 / curvature;\r\n }\r\n\r\n /** Return the average of the start and end curvatures. */\r\n public static averageCurvature(radiusLimits: Segment1d): number {\r\n return 0.5 * (TransitionSpiral3d.radiusToCurvature(radiusLimits.x0) + TransitionSpiral3d.radiusToCurvature(radiusLimits.x1));\r\n }\r\n /**\r\n * Given two radii (or zeros for 0 curvature) return the average curvature\r\n * @param r0 start radius, or 0 for line\r\n * @param r1 end radius, or 0 for line\r\n */\r\n public static averageCurvatureR0R1(r0: number, r1: number): number {\r\n return 0.5 * (TransitionSpiral3d.radiusToCurvature(r0) + TransitionSpiral3d.radiusToCurvature(r1));\r\n }\r\n /**\r\n * Given two radii (or zeros for 0 curvature) return the average curvature\r\n * @param r0 start radius, or 0 for line\r\n * @param r1 end radius, or 0 for line\r\n */\r\n public static interpolateCurvatureR0R1(r0: number, fraction: number, r1: number): number {\r\n return Geometry.interpolate(TransitionSpiral3d.radiusToCurvature(r0), fraction, TransitionSpiral3d.radiusToCurvature(r1));\r\n }\r\n\r\n /** Return the arc length of a transition spiral with given sweep and radius pair. */\r\n public static radiusRadiusSweepRadiansToArcLength(radius0: number, radius1: number, sweepRadians: number): number {\r\n return Math.abs(sweepRadians / TransitionSpiral3d.averageCurvatureR0R1(radius0, radius1));\r\n }\r\n\r\n /** Return the turn angle for spiral of given length between two radii */\r\n public static radiusRadiusLengthToSweepRadians(radius0: number, radius1: number, arcLength: number): number {\r\n return TransitionSpiral3d.averageCurvatureR0R1(radius0, radius1) * arcLength;\r\n }\r\n\r\n /** Return the end radius for spiral of given start radius, length, and turn angle. */\r\n public static radius0LengthSweepRadiansToRadius1(radius0: number, arcLength: number, sweepRadians: number) {\r\n return TransitionSpiral3d.curvatureToRadius((2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius0));\r\n }\r\n /** Return the start radius for spiral of given end radius, length, and turn angle. */\r\n public static radius1LengthSweepRadiansToRadius0(radius1: number, arcLength: number, sweepRadians: number) {\r\n return TransitionSpiral3d.curvatureToRadius((2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius1));\r\n }\r\n /** Return the original defining properties (if any) saved by the constructor. */\r\n public get designProperties(): TransitionConditionalProperties | undefined { return this._designProperties; }\r\n /**\r\n * * If transformA is rigid with uniform scale, apply the rigid part of transformA to the localToWorld transform and return the scale and rigid separation.\r\n * * If not rigid, do nothing and return undefined.\r\n * * Also apply the scale factor to the designProperties.\r\n * @param transformA\r\n */\r\n protected applyRigidPartOfTransform(transformA: Transform): { rigidAxes: Matrix3d, scale: number } | undefined {\r\n const rigidData = transformA.matrix.factorRigidWithSignedScale();\r\n if (rigidData !== undefined) {\r\n // [sQ a][R b] = [sQ*R sQb+a]\r\n // but we save it as [Q*R sQb+a] with spiral data scaled by s.\r\n const transformC0 = transformA.multiplyTransformTransform(this.localToWorld);\r\n // BUT pull the scale part out of the matrix ...\r\n const matrixC = rigidData.rigidAxes.multiplyMatrixMatrix(this.localToWorld.matrix);\r\n this._localToWorld = Transform.createOriginAndMatrix(transformC0.origin, matrixC);\r\n if (this.designProperties)\r\n this.designProperties.applyScaleFactor(rigidData.scale);\r\n\r\n return rigidData;\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"TransitionSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionSpiral3d.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAAmD;AAEnD,0DAAuD;AACvD,0DAAuD;AAEvD,6CAA0C;AAE1C,mFAAgF;AAChF,mFAAyE;AAkCzE;;;;;;;;;;;;GAYG;AACH,MAAsB,kBAAmB,SAAQ,+BAAc;IAmB7D,YAAsB,UAA8B,EAAE,YAAuB,EAAE,sBAA6C,EAAE,gBAA6D;QACzL,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,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IACjF,IAAW,gBAAgB,KAAkD,OAAO,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC7G;;;;;OAKG;IACO,yBAAyB,CAAC,UAAqB;QACvD,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,0BAA0B,EAAE,CAAC;QACjE,IAAI,SAAS,KAAK,SAAS,EAAE;YAC3B,6BAA6B;YAC7B,8DAA8D;YAC9D,MAAM,WAAW,GAAG,UAAU,CAAC,0BAA0B,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC7E,gDAAgD;YAChD,MAAM,OAAO,GAAG,SAAS,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YACnF,IAAI,CAAC,aAAa,GAAG,qBAAS,CAAC,qBAAqB,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAClF,IAAI,IAAI,CAAC,gBAAgB;gBACvB,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAE1D,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACa,iBAAiB,CAAC,uBAA+C;QAC/E,MAAM,OAAO,GAAG,oCAAa,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,2CAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC3E,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QACxD,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;IAC/B,CAAC;CACF;AAlHD,gDAkHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { CurveOffsetXYHandler } from \"../internalContexts/CurveOffsetXYHandler\";\r\nimport { OffsetOptions } from \"../internalContexts/PolygonOffsetContext\";\r\n/**\r\n * This is the set of valid type names for \"integrated\" spirals\r\n * * Behavior is expressed by a `NormalizedTransition` snap function.\r\n * * The snap function varies smoothly from f(0)=0 to f(1)=1\r\n * * The various snap functions are:\r\n * * clothoid: linear\r\n * * biquadratic: 2 quadratics pieced together, joining with 1st derivative continuity at f(0.) = 0.5, with zero slope f'(0)=0 and f'(1)= 0\r\n * * bloss: A single cubic with zero slope at 0 and 1\r\n * * cosine: half of a cosine wave, centered around 0.5\r\n * * sine: full period of a sine wave added to the line f(u)=u\r\n * *\r\n * @public\r\n */\r\nexport type IntegratedSpiralTypeName = \"clothoid\" | \"bloss\" | \"biquadratic\" | \"cosine\" | \"sine\";\r\n\r\n/**\r\n * This is the set of valid type names for \"direct\" spirals.\r\n * \"Direct\" spirals can evaluate fractionToPoint by direct equations, i.e. not requiring the numeric integrations in \"Integrated\" spiral types.\r\n * @public\r\n */\r\nexport type DirectSpiralTypeName =\r\n \"JapaneseCubic\" // 1 term from each of the X,Y clothoid series expansions: y = x^3 / (6RL)\r\n | \"Arema\" // 2 terms from each of the X,Y clothoid series expansions. Identical to ChineseCubic!\r\n | \"ChineseCubic\" // Identical to Arema!\r\n | \"HalfCosine\" // high continuity cosine variation from quadratic.\r\n | \"AustralianRailCorp\" // cubic with high accuracy distance series\r\n | \"WesternAustralian\" // simple cubic -- 2 terms of x series, 1 term of y series.\r\n | \"Czech\" // simple cubic with two term distance approximation\r\n | \"MXCubicAlongArc\" // x obtained from fractional distance via 2-terms from series, y = x^3/ (6RL)\r\n | \"Polish\"\r\n | \"Italian\"\r\n ;\r\n\r\n/**\r\n * TransitionSpiral3d is a base class for multiple variants of spirals.\r\n * * The menagerie of spiral types have 2 broad categories:\r\n * * IntegratedSpiral3d -- a spiral whose direct function for curvature versus distance must be integrated to determine x,y\r\n * * The IntegratedSpiral3d types are enumerated in `IntegratedSpiralTypes`\r\n * * DirectSpiral3d -- a spiral implemented with direct calculation of x,y from fractional position along the spiral.\r\n * * The direct spiral types are enumerated in the `DirectSpiralType`\r\n * * The method set for CurvePrimitive support includes a `handleTransitionSpiral(g: TransitionSpiral3d)` which receives all the spiral types.\r\n * * The spiral class may impose expectations that its inflection is at the origin, with tangent along the x axis.\r\n * * This is generally necessary for direct spirals.\r\n * * This is not necessary for integrated spirals.\r\n * @public\r\n */\r\nexport abstract class TransitionSpiral3d extends CurvePrimitive {\r\n /** string name of spiral type */\r\n protected _spiralType: string;\r\n /** Original defining properties. */\r\n protected _designProperties: TransitionConditionalProperties | undefined;\r\n\r\n /** Fractional interval for the \"active\" part of a containing spiral.\r\n * (The radius, angle, and length conditions define a complete spiral, and some portion of it is \"active\")\r\n */\r\n protected _activeFractionInterval: Segment1d;\r\n /** Return (reference to) the active portion of the reference spiral. */\r\n public get activeFractionInterval(): Segment1d { return this._activeFractionInterval; }\r\n /** strokes in the active portion */\r\n public abstract get activeStrokes(): LineString3d;\r\n /** Placement transform */\r\n protected _localToWorld: Transform;\r\n /** (reference to) placement transform. */\r\n public get localToWorld(): Transform { return this._localToWorld; }\r\n\r\n protected constructor(spiralType: string | undefined, localToWorld: Transform, activeFractionInterval: Segment1d | undefined, designProperties: TransitionConditionalProperties | undefined) {\r\n super();\r\n this._spiralType = spiralType ? spiralType : \"unknownSpiralType\";\r\n this._designProperties = designProperties;\r\n this._localToWorld = localToWorld;\r\n this._activeFractionInterval = activeFractionInterval ? activeFractionInterval : Segment1d.create(0, 1);\r\n }\r\n\r\n public get spiralType(): string { return this._spiralType; }\r\n /** Return 1/r with convention that if true zero is given as radius it represents infinite radius (0 curvature, straight line) */\r\n public static radiusToCurvature(radius: number): number { return (radius === 0.0) ? 0.0 : 1.0 / radius; }\r\n\r\n /** Return 1/k with convention that if near-zero is given as curvature, its infinite radius is returned as 0 */\r\n public static curvatureToRadius(curvature: number): number {\r\n if (Math.abs(curvature) < Geometry.smallAngleRadians)\r\n return 0.0;\r\n return 1.0 / curvature;\r\n }\r\n\r\n /** Return the average of the start and end curvatures. */\r\n public static averageCurvature(radiusLimits: Segment1d): number {\r\n return 0.5 * (TransitionSpiral3d.radiusToCurvature(radiusLimits.x0) + TransitionSpiral3d.radiusToCurvature(radiusLimits.x1));\r\n }\r\n /**\r\n * Given two radii (or zeros for 0 curvature) return the average curvature\r\n * @param r0 start radius, or 0 for line\r\n * @param r1 end radius, or 0 for line\r\n */\r\n public static averageCurvatureR0R1(r0: number, r1: number): number {\r\n return 0.5 * (TransitionSpiral3d.radiusToCurvature(r0) + TransitionSpiral3d.radiusToCurvature(r1));\r\n }\r\n /**\r\n * Given two radii (or zeros for 0 curvature) return the average curvature\r\n * @param r0 start radius, or 0 for line\r\n * @param r1 end radius, or 0 for line\r\n */\r\n public static interpolateCurvatureR0R1(r0: number, fraction: number, r1: number): number {\r\n return Geometry.interpolate(TransitionSpiral3d.radiusToCurvature(r0), fraction, TransitionSpiral3d.radiusToCurvature(r1));\r\n }\r\n\r\n /** Return the arc length of a transition spiral with given sweep and radius pair. */\r\n public static radiusRadiusSweepRadiansToArcLength(radius0: number, radius1: number, sweepRadians: number): number {\r\n return Math.abs(sweepRadians / TransitionSpiral3d.averageCurvatureR0R1(radius0, radius1));\r\n }\r\n\r\n /** Return the turn angle for spiral of given length between two radii */\r\n public static radiusRadiusLengthToSweepRadians(radius0: number, radius1: number, arcLength: number): number {\r\n return TransitionSpiral3d.averageCurvatureR0R1(radius0, radius1) * arcLength;\r\n }\r\n\r\n /** Return the end radius for spiral of given start radius, length, and turn angle. */\r\n public static radius0LengthSweepRadiansToRadius1(radius0: number, arcLength: number, sweepRadians: number) {\r\n return TransitionSpiral3d.curvatureToRadius((2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius0));\r\n }\r\n /** Return the start radius for spiral of given end radius, length, and turn angle. */\r\n public static radius1LengthSweepRadiansToRadius0(radius1: number, arcLength: number, sweepRadians: number) {\r\n return TransitionSpiral3d.curvatureToRadius((2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius1));\r\n }\r\n /** Return the original defining properties (if any) saved by the constructor. */\r\n public get designProperties(): TransitionConditionalProperties | undefined { return this._designProperties; }\r\n /**\r\n * * If transformA is rigid with uniform scale, apply the rigid part of transformA to the localToWorld transform and return the scale and rigid separation.\r\n * * If not rigid, do nothing and return undefined.\r\n * * Also apply the scale factor to the designProperties.\r\n * @param transformA\r\n */\r\n protected applyRigidPartOfTransform(transformA: Transform): { rigidAxes: Matrix3d, scale: number } | undefined {\r\n const rigidData = transformA.matrix.factorRigidWithSignedScale();\r\n if (rigidData !== undefined) {\r\n // [sQ a][R b] = [sQ*R sQb+a]\r\n // but we save it as [Q*R sQb+a] with spiral data scaled by s.\r\n const transformC0 = transformA.multiplyTransformTransform(this.localToWorld);\r\n // BUT pull the scale part out of the matrix ...\r\n const matrixC = rigidData.rigidAxes.multiplyMatrixMatrix(this.localToWorld.matrix);\r\n this._localToWorld = Transform.createOriginAndMatrix(transformC0.origin, matrixC);\r\n if (this.designProperties)\r\n this.designProperties.applyScaleFactor(rigidData.scale);\r\n\r\n return rigidData;\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset\r\n * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object\r\n */\r\n public override constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const options = OffsetOptions.create(offsetDistanceOrOptions);\r\n const handler = new CurveOffsetXYHandler(this, options.leftOffsetDistance);\r\n this.emitStrokableParts(handler, options.strokeOptions);\r\n return handler.claimResult();\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Matrix4d.d.ts","sourceRoot":"","sources":["../../../src/geometry4d/Matrix4d.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAY,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAElD;;;GAGG;AACH,oBAAY,aAAa,GAAG,YAAY,EAAE,CAAC;AAE3C;;;;;;;;;;;;;;GAcG;AACH,qBAAa,QAAS,YAAW,eAAe;IAC9C,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO;IACP,uCAAuC;IAChC,OAAO,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAIrC,2BAA2B;IACpB,KAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ;IASzC,mCAAmC;IAC5B,OAAO,IAAI,IAAI;IAItB,uBAAuB;IAChB,WAAW,IAAI,IAAI;IAK1B,OAAO,CAAC,MAAM,CAAC,MAAM;IAMrB,uBAAuB;IAChB,UAAU,CAAC,GAAG,GAAE,MAAgB,GAAG,OAAO;IAMjD,2CAA2C;WAC7B,UAAU,CAAC,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C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM;IAyBrF;;;;;;;;;;;OAWG;IACI,6BAA6B,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAiCzG;;;;;;;;;;;OAWG;IACI,kCAAkC,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;CAiC7E"}
|
|
@@ -548,18 +548,31 @@ class Matrix4d {
|
|
|
548
548
|
* @returns undefined if dividing by the determinant looks unsafe.
|
|
549
549
|
*/
|
|
550
550
|
createInverse(result) {
|
|
551
|
-
|
|
551
|
+
// dividing each column by its maxAbs is more robust than dividing them by this.maxAbs()
|
|
552
|
+
let maxAbs0 = this.columnX().maxAbs();
|
|
552
553
|
if (maxAbs0 === 0.0)
|
|
553
554
|
return undefined;
|
|
554
|
-
const
|
|
555
|
+
const divMaxAbsA = 1.0 / maxAbs0;
|
|
556
|
+
maxAbs0 = this.columnY().maxAbs();
|
|
557
|
+
if (maxAbs0 === 0.0)
|
|
558
|
+
return undefined;
|
|
559
|
+
const divMaxAbsB = 1.0 / maxAbs0;
|
|
560
|
+
maxAbs0 = this.columnZ().maxAbs();
|
|
561
|
+
if (maxAbs0 === 0.0)
|
|
562
|
+
return undefined;
|
|
563
|
+
const divMaxAbsC = 1.0 / maxAbs0;
|
|
564
|
+
maxAbs0 = this.columnW().maxAbs();
|
|
565
|
+
if (maxAbs0 === 0.0)
|
|
566
|
+
return undefined;
|
|
567
|
+
const divMaxAbsD = 1.0 / maxAbs0;
|
|
555
568
|
const columnA = this.columnX();
|
|
556
569
|
const columnB = this.columnY();
|
|
557
570
|
const columnC = this.columnZ();
|
|
558
571
|
const columnD = this.columnW();
|
|
559
|
-
columnA.scale(
|
|
560
|
-
columnB.scale(
|
|
561
|
-
columnC.scale(
|
|
562
|
-
columnD.scale(
|
|
572
|
+
columnA.scale(divMaxAbsA, columnA);
|
|
573
|
+
columnB.scale(divMaxAbsB, columnB);
|
|
574
|
+
columnC.scale(divMaxAbsC, columnC);
|
|
575
|
+
columnD.scale(divMaxAbsD, columnD);
|
|
563
576
|
const rowBCD = Point4d_1.Point4d.perpendicularPoint4dPlane(columnB, columnC, columnD);
|
|
564
577
|
const rowCDA = Point4d_1.Point4d.perpendicularPoint4dPlane(columnA, columnD, columnC); // order for negation !
|
|
565
578
|
const rowDAB = Point4d_1.Point4d.perpendicularPoint4dPlane(columnD, columnA, columnB);
|
|
@@ -582,8 +595,8 @@ class Matrix4d {
|
|
|
582
595
|
&& determinantA * determinantD > 0.0) {
|
|
583
596
|
const divisionTest = Geometry_1.Geometry.conditionalDivideCoordinate(maxAbs1, determinantA);
|
|
584
597
|
if (divisionTest !== undefined) {
|
|
585
|
-
const
|
|
586
|
-
result.scaleRowsInPlace(
|
|
598
|
+
const divDet = 1.0 / determinantA;
|
|
599
|
+
result.scaleRowsInPlace(divMaxAbsA * divDet, divMaxAbsB * divDet, divMaxAbsC * divDet, divMaxAbsD * divDet);
|
|
587
600
|
return result;
|
|
588
601
|
}
|
|
589
602
|
}
|