@itwin/core-geometry 4.7.0-dev.0 → 4.7.0-dev.11
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 +11 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +7 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +20 -4
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts +2 -0
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +4 -0
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +3 -3
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +4 -3
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts +7 -0
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +19 -0
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/polyface/AuxData.d.ts +18 -10
- package/lib/cjs/polyface/AuxData.d.ts.map +1 -1
- package/lib/cjs/polyface/AuxData.js +24 -12
- package/lib/cjs/polyface/AuxData.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +2 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +2 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +10 -2
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +29 -17
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +10 -9
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +17 -2
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +321 -270
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +405 -351
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.d.ts +18 -20
- package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js +119 -84
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.d.ts +1 -1
- package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js +10 -15
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +52 -7
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +26 -78
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.d.ts +17 -0
- package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.js +85 -0
- package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
- package/lib/cjs/solid/Sphere.d.ts +1 -0
- package/lib/cjs/solid/Sphere.d.ts.map +1 -1
- package/lib/cjs/solid/Sphere.js +4 -2
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +7 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +20 -4
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.d.ts +2 -0
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +4 -0
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +3 -3
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +4 -3
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts +7 -0
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +19 -0
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/polyface/AuxData.d.ts +18 -10
- package/lib/esm/polyface/AuxData.d.ts.map +1 -1
- package/lib/esm/polyface/AuxData.js +24 -12
- package/lib/esm/polyface/AuxData.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +2 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js +2 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +10 -2
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +29 -17
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +10 -9
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +17 -2
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +321 -270
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +405 -351
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.d.ts +18 -20
- package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBReader.js +119 -84
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.d.ts +1 -1
- package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js +10 -15
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +52 -7
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +26 -78
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.d.ts +17 -0
- package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.js +85 -0
- package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
- package/lib/esm/solid/Sphere.d.ts +1 -0
- package/lib/esm/solid/Sphere.d.ts.map +1 -1
- package/lib/esm/solid/Sphere.js +4 -2
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/package.json +5 -5
|
@@ -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,CAAC,MAAM,EAAE,CAAC;AACnC,oCAAa,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC;AACjC,oCAAa,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC;AACjC,oCAAa,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC;AACjC,oCAAa,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { BSplineCurve3d, BSplineCurve3dBase } from \"../../bspline/BSplineCurve\";\nimport { BSplineCurve3dH } from \"../../bspline/BSplineCurve3dH\";\nimport { Geometry } from \"../../Geometry\";\nimport { RecurseToCurvesGeometryHandler } from \"../../geometry3d/GeometryHandler\";\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { Vector2d } from \"../../geometry3d/Point2dVector2d\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { SmallSystem, TrigPolynomial } from \"../../numerics/Polynomials\";\nimport { Arc3d } from \"../Arc3d\";\nimport { CurveChainWithDistanceIndex } from \"../CurveChainWithDistanceIndex\";\nimport { CurveCollection } from \"../CurveCollection\";\nimport { CurveIntervalRole, CurveLocationDetail, CurveLocationDetailPair } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { AnyCurve } from \"../CurveTypes\";\nimport { LineSegment3d } from \"../LineSegment3d\";\nimport { LineString3d } from \"../LineString3d\";\n\n// cspell:word XYRR\n\n/**\n * Handler class for XYZ intersections between _geometryB and another geometry.\n * * Instances are initialized and called from CurveCurve.\n * * geometryB is saved for later reference.\n * @internal\n */\nexport class CurveCurveIntersectXYZ extends RecurseToCurvesGeometryHandler {\n private _extendA: boolean;\n private _geometryB: AnyCurve;\n private _extendB: boolean;\n private _results: CurveLocationDetailPair[];\n private static _workVector2dA = Vector2d.create();\n private static _workPointAA0 = Point3d.create();\n private static _workPointAA1 = Point3d.create();\n private static _workPointBB0 = Point3d.create();\n private static _workPointBB1 = Point3d.create();\n /**\n * @param extendA flag to enable using extension of the other geometry.\n * @param geometryB second curve for intersection. Saved for reference by specific handler methods.\n * @param extendB flag for extension of geometryB.\n */\n public constructor(extendA: boolean, geometryB: AnyCurve, extendB: boolean) {\n super();\n this._extendA = extendA;\n this._geometryB = geometryB;\n this._extendB = extendB;\n this._results = [];\n }\n /** Reset the geometry, leaving all other parts unchanged (and preserving accumulated intersections). */\n public resetGeometry(geometryB: AnyCurve): void {\n this._geometryB = geometryB;\n }\n /**\n * Return the results structure for the intersection calculation, structured as an array of CurveLocationDetailPair.\n * @param reinitialize if true, a new results structure is created for use by later calls.\n */\n public grabPairedResults(reinitialize: boolean = false): CurveLocationDetailPair[] {\n const result = this._results;\n if (reinitialize)\n this._results = [];\n return result;\n }\n private acceptFraction(extend0: boolean, fraction: number, extend1: boolean) {\n if (!extend0 && fraction < 0.0)\n return false;\n if (!extend1 && fraction > 1.0)\n return false;\n return true;\n }\n /**\n * Compute intersection of two line segments.\n * Filter by extension rules.\n * Reject if evaluated points do not match coordinates (e.g. close approach point).\n * Record with fraction mapping.\n */\n private recordPointWithLocalFractions(\n localFractionA: number,\n cpA: CurvePrimitive,\n fractionA0: number,\n fractionA1: number,\n localFractionB: number,\n cpB: CurvePrimitive,\n fractionB0: number,\n fractionB1: number,\n reversed: boolean,\n ): void {\n const globalFractionA = Geometry.interpolate(fractionA0, localFractionA, fractionA1);\n const globalFractionB = Geometry.interpolate(fractionB0, localFractionB, fractionB1);\n // ignore duplicate of most recent point\n const numPrevious = this._results.length;\n if (numPrevious > 0) {\n const oldDetailA = this._results[numPrevious - 1].detailA;\n const oldDetailB = this._results[numPrevious - 1].detailB;\n if (reversed) {\n if (oldDetailB.isSameCurveAndFraction({ curve: cpA, fraction: globalFractionA }) &&\n oldDetailA.isSameCurveAndFraction({ curve: cpB, fraction: globalFractionB }))\n return;\n } else {\n if (oldDetailA.isSameCurveAndFraction({ curve: cpA, fraction: globalFractionA }) &&\n oldDetailB.isSameCurveAndFraction({ curve: cpB, fraction: globalFractionB }))\n return;\n }\n }\n const pointA = cpA.fractionToPoint(globalFractionA);\n const pointB = cpB.fractionToPoint(globalFractionB);\n if (!pointA.isAlmostEqualMetric(pointB))\n return;\n const detailA = CurveLocationDetail.createCurveFractionPoint(cpA, globalFractionA, pointA);\n detailA.setIntervalRole(CurveIntervalRole.isolated);\n const detailB = CurveLocationDetail.createCurveFractionPoint(cpB, globalFractionB, pointB);\n detailB.setIntervalRole(CurveIntervalRole.isolated);\n if (reversed) {\n const pair = new CurveLocationDetailPair(detailB, detailA);\n this._results.push(pair);\n } else {\n const pair = new CurveLocationDetailPair(detailA, detailB);\n this._results.push(pair);\n }\n }\n /**\n * Compute intersection of two line segments.\n * Filter by extension rules.\n * Record with fraction mapping.\n */\n private computeSegmentSegment3D(\n cpA: CurvePrimitive,\n extendA0: boolean,\n pointA0: Point3d,\n fractionA0: number,\n pointA1: Point3d,\n fractionA1: number,\n extendA1: boolean,\n cpB: CurvePrimitive,\n extendB0: boolean,\n pointB0: Point3d,\n fractionB0: number,\n pointB1: Point3d,\n fractionB1: number,\n extendB1: boolean,\n reversed: boolean,\n ): void {\n const uv = CurveCurveIntersectXYZ._workVector2dA;\n if (SmallSystem.lineSegment3dClosestApproachUnbounded(pointA0, pointA1, pointB0, pointB1, uv) &&\n this.acceptFraction(extendA0, uv.x, extendA1) && this.acceptFraction(extendB0, uv.y, extendB1)) {\n this.recordPointWithLocalFractions(uv.x, cpA, fractionA0, fractionA1, uv.y, cpB, fractionB0, fractionB1, reversed);\n }\n }\n // Caller accesses data from a line segment and passes to here.\n // The line segment in question might be (a) a full line segment or (b) a fragment within a linestring.\n // The fraction and extend parameters allow all combinations to be passed in.\n // This method applies transform.\n private dispatchSegmentSegment(\n cpA: CurvePrimitive,\n extendA0: boolean,\n pointA0: Point3d,\n fractionA0: number,\n pointA1: Point3d,\n fractionA1: number,\n extendA1: boolean,\n cpB: CurvePrimitive,\n extendB0: boolean,\n pointB0: Point3d,\n fractionB0: number,\n pointB1: Point3d,\n fractionB1: number,\n extendB1: boolean,\n reversed: boolean,\n ): void {\n this.computeSegmentSegment3D(\n cpA, extendA0, pointA0, fractionA0, pointA1, fractionA1, extendA1,\n cpB, extendB0, pointB0, fractionB0, pointB1, fractionB1, extendB1,\n reversed,\n );\n }\n /**\n * Create a plane whose normal is the \"better\" cross product: `vectorA.crossProduct(vectorB)` or\n * `vectorA.crossProduct(vectorC)`\n * * The heuristic for \"better\" is:\n * * first choice is cross product with `vectorB`, if `vectorA` and `vectorB` are sufficiently far from parallel\n * (or anti-parallel).\n * * otherwise use vectorC\n * @param origin plane origin\n * @param vectorA vector which must be in the plane.\n * @param cosineValue largest cosine of the angle theta between vectorA and vectorB to prefer their cross product, e.g.\n * passing 0.94 ~ cos(20deg) will switch to using vectorC in the cross product if theta < ~20deg or theta > ~160deg.\n * @param vectorB first candidate for additional in-plane vector\n * @param vectorC second candidate for additional in-plane vector\n */\n public createPlaneWithPreferredPerpendicular(\n origin: Point3d, vectorA: Vector3d, cosineValue: number, vectorB: Vector3d, vectorC: Vector3d,\n ): Plane3dByOriginAndUnitNormal | undefined {\n cosineValue = Geometry.restrictToInterval(Math.abs(cosineValue), 0.0, 1.0 - Geometry.smallFraction);\n const dotAA = vectorA.magnitudeSquared();\n const dotBB = vectorB.magnitudeSquared();\n const dotAB = Math.abs(vectorA.dotProduct(vectorB));\n const cross = vectorA.unitCrossProduct(\n dotAB * dotAB <= cosineValue * cosineValue * dotAA * dotBB ? vectorB : vectorC,\n );\n if (cross)\n return Plane3dByOriginAndUnitNormal.create(origin, cross);\n return undefined;\n }\n // Caller accesses data from a linestring or segment and passes it here.\n // The line in question might be (a) a full line segment or (b) a fragment within a linestring.\n // The fraction and extend parameters allow all combinations to be passed in.\n private dispatchSegmentArc(\n cpA: CurvePrimitive,\n extendA0: boolean,\n pointA0: Point3d,\n fractionA0: number,\n pointA1: Point3d,\n fractionA1: number,\n extendA1: boolean,\n arc: Arc3d,\n extendB0: boolean,\n extendB1: boolean,\n reversed: boolean,\n ): void {\n const lineVector = Vector3d.createStartEnd(pointA0, pointA1);\n const cosValue = 0.94; // cosine of 20 degrees\n const plane = this.createPlaneWithPreferredPerpendicular(\n pointA0, lineVector, cosValue, arc.perpendicularVector, arc.vector0,\n );\n if (plane !== undefined) {\n const candidates: CurveLocationDetail[] = [];\n arc.appendPlaneIntersectionPoints(plane, candidates);\n let lineFraction;\n let linePoint: Point3d | undefined;\n for (const c of candidates) {\n if (this.acceptFraction(extendB0, c.fraction, extendB1)) {\n lineFraction = SmallSystem.lineSegment3dClosestPointUnbounded(pointA0, pointA1, c.point);\n if (lineFraction !== undefined) {\n linePoint = pointA0.interpolate(lineFraction, pointA1, linePoint);\n if (linePoint.isAlmostEqualMetric(c.point)\n && this.acceptFraction(extendA0, lineFraction, extendA1)) {\n this.recordPointWithLocalFractions(\n lineFraction, cpA, fractionA0, fractionA1, c.fraction, arc, 0, 1, reversed,\n );\n }\n }\n }\n }\n }\n }\n // Caller promises arcs are coplanar.\n // Passes \"other\" as {center, vector0, vector90} in local xy space of cpA\n // Solves the arc-arc equations for that local ellipse with unit circle.\n // Solution fractions map directly to original arcs.\n private dispatchArcArcInPlane(\n cpA: Arc3d, extendA: boolean, cpB: Arc3d, extendB: boolean, reversed: boolean,\n ): void {\n const otherVectors = cpA.otherArcAsLocalVectors(cpB);\n if (otherVectors !== undefined) {\n const ellipseRadians: number[] = [];\n const circleRadians: number[] = [];\n TrigPolynomial.solveUnitCircleHomogeneousEllipseIntersection(\n otherVectors.center.x, otherVectors.center.y, 1.0,\n otherVectors.vector0.x, otherVectors.vector0.y, 0.0,\n otherVectors.vector90.x, otherVectors.vector90.y, 0.0,\n ellipseRadians, circleRadians,\n );\n for (let i = 0; i < ellipseRadians.length; i++) {\n const fractionA = cpA.sweep.radiansToSignedPeriodicFraction(circleRadians[i]);\n const fractionB = cpB.sweep.radiansToSignedPeriodicFraction(ellipseRadians[i]);\n // hm .. do we really need to check the fractions? We know they are internal to the beziers\n if (this.acceptFraction(extendA, fractionA, extendA) && this.acceptFraction(extendB, fractionB, extendB)) {\n this.recordPointWithLocalFractions(fractionA, cpA, 0, 1, fractionB, cpB, 0, 1, reversed);\n }\n }\n }\n }\n // Caller accesses data from two arcs.\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\".\n // Solves the arc-arc equations.\n private dispatchArcArc(\n cpA: Arc3d, extendA: boolean, cpB: Arc3d, extendB: boolean, reversed: boolean,\n ): void {\n // If arcs are in different planes:\n // 1) Intersect each plane with the other arc (quadratic)\n // 2) accept points that appear in both intersection sets.\n // If arcs are in parallel planes -- no intersections.\n // If arcs are in the same plane -- xy intersection in that plane.\n const planeA = Plane3dByOriginAndUnitNormal.create(cpA.center, cpA.perpendicularVector);\n const planeB = Plane3dByOriginAndUnitNormal.create(cpB.center, cpB.perpendicularVector);\n if (planeA === undefined || planeB === undefined)\n return;\n if (planeA.getNormalRef().isParallelTo(planeB.getNormalRef())) {\n if (planeA.isPointInPlane(planeB.getOriginRef()) && planeB.isPointInPlane(planeA.getOriginRef())) {\n // coplanar\n this.dispatchArcArcInPlane(cpA, extendA, cpB, extendB, reversed);\n }\n } else {\n const arcBPoints: CurveLocationDetail[] = [];\n cpB.appendPlaneIntersectionPoints(planeA, arcBPoints);\n const arcAPoints: CurveLocationDetail[] = [];\n cpA.appendPlaneIntersectionPoints(planeB, arcAPoints);\n for (const detailB of arcBPoints) {\n for (const detailA of arcAPoints) {\n if (detailA.point.isAlmostEqual(detailB.point)) {\n if (this.acceptFraction(extendA, detailA.fraction, extendA)\n && this.acceptFraction(extendB, detailB.fraction, extendB)) {\n this.recordPointWithLocalFractions(detailA.fraction, cpA, 0, 1, detailB.fraction, cpB, 0, 1, reversed);\n }\n }\n }\n }\n }\n }\n // Caller accesses data from two arcs.\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\".\n // Solves the arc-arc equations.\n private dispatchArcBsplineCurve3d(\n _arc: Arc3d, _extendA: boolean, _cpB: BSplineCurve3d, _extendB: boolean, _reversed: boolean,\n ): void {\n /*\n // Arc: X = C + cU + sV\n // implicitize the arc as viewed. This \"3d\" matrix is homogeneous \"XYW\" not \"xyz\"\n let matrixA: Matrix3d;\n if (this._worldToLocalPerspective) {\n const dataA = cpA.toTransformedPoint4d(this._worldToLocalPerspective);\n matrixA = Matrix3d.createColumnsXYW(\n dataA.vector0, dataA.vector0.w, dataA.vector90, dataA.vector90.w, dataA.center, dataA.center.w,\n );\n } else {\n const dataA = cpA.toTransformedVectors(this._worldToLocalAffine);\n matrixA = Matrix3d.createColumnsXYW(dataA.vector0, 0, dataA.vector90, 0, dataA.center, 1);\n }\n // The worldToLocal has moved the arc vectors into local space.\n // matrixA captures the xyw parts (ignoring z)\n // for any point in world space,\n // THIS CODE ONLY WORKS FOR\n const matrixAInverse = matrixA.inverse();\n if (matrixAInverse) {\n const orderF = cpB.order; // order of the beziers for simple coordinates\n const orderG = 2 * orderF - 1; // order of the (single) bezier for squared coordinates.\n const coffF = new Float64Array(orderF);\n const univariateBezierG = new UnivariateBezier(orderG);\n const axx = matrixAInverse.at(0, 0);\n const axy = matrixAInverse.at(0, 1);\n const axz = 0.0;\n const axw = matrixAInverse.at(0, 2);\n const ayx = matrixAInverse.at(1, 0);\n const ayy = matrixAInverse.at(1, 1);\n const ayz = 0.0;\n const ayw = matrixAInverse.at(1, 2);\n const awx = matrixAInverse.at(2, 0);\n const awy = matrixAInverse.at(2, 1);\n const awz = 0.0;\n const aww = matrixAInverse.at(2, 2);\n\n if (matrixAInverse) {\n let bezier: BezierCurve3dH | undefined;\n for (let spanIndex = 0; ; spanIndex++) {\n bezier = cpB.getSaturatedBezierSpan3dH(spanIndex, bezier);\n if (!bezier) break;\n if (this._worldToLocalPerspective)\n bezier.tryMultiplyMatrix4dInPlace(this._worldToLocalPerspective);\n else if (this._worldToLocalAffine)\n bezier.tryTransformInPlace(this._worldToLocalAffine);\n univariateBezierG.zero();\n bezier.poleProductsXYZW(coffF, axx, axy, axz, axw);\n univariateBezierG.addSquaredSquaredBezier(coffF, 1.0);\n bezier.poleProductsXYZW(coffF, ayx, ayy, ayz, ayw);\n univariateBezierG.addSquaredSquaredBezier(coffF, 1.0);\n bezier.poleProductsXYZW(coffF, awx, awy, awz, aww);\n univariateBezierG.addSquaredSquaredBezier(coffF, -1.0);\n const roots = univariateBezierG.roots(0.0, true);\n if (roots) {\n for (const root of roots) {\n const fractionB = bezier.fractionToParentFraction(root);\n // The univariate bezier (which has been transformed by the view transform) evaluates into xyw space\n const bcurvePoint4d = bezier.fractionToPoint4d(root);\n const c = bcurvePoint4d.dotProductXYZW(axx, axy, axz, axw);\n const s = bcurvePoint4d.dotProductXYZW(ayx, ayy, ayz, ayw);\n const arcFraction = cpA.sweep.radiansToSignedPeriodicFraction(Math.atan2(s, c));\n if (this.acceptFraction(extendA, arcFraction, extendA) &&\n this.acceptFraction(extendB, fractionB, extendB)) {\n this.recordPointWithLocalFractions(\n arcFraction, cpA, 0, 1, fractionB, cpB, 0, 1, reversed,\n );\n }\n }\n }\n }\n }\n }\n */\n }\n /*\n // Apply the transformation to bezier curves. Optionally construct ranges.\n private transformBeziers(beziers: BezierCurve3dH[]): void {\n if (this._worldToLocalAffine) {\n for (const bezier of beziers) bezier.tryTransformInPlace(this._worldToLocalAffine);\n } else if (this._worldToLocalPerspective) {\n for (const bezier of beziers) bezier.tryMultiplyMatrix4dInPlace(this._worldToLocalPerspective);\n }\n }\n */\n /*\n private getRanges(beziers: BezierCurveBase[]): Range3d[] {\n const ranges: Range3d[] = [];\n ranges.length = 0;\n for (const b of beziers) {\n ranges.push(b.range());\n }\n return ranges;\n }\n private dispatchBezierBezierStrokeFirst(\n bezierA: BezierCurve3dH,\n bcurveA: BSplineCurve3dBase,\n strokeCountA: number,\n bezierB: BezierCurve3dH,\n bcurveB: BSplineCurve3dBase,\n _strokeCountB: number,\n univariateBezierB: UnivariateBezier, // caller-allocated for univariate coefficients.\n reversed: boolean,\n ) {\n if (!this._xyzwA0)\n this._xyzwA0 = Point4d.create();\n if (!this._xyzwA1)\n this._xyzwA1 = Point4d.create();\n if (!this._xyzwPlane)\n this._xyzwPlane = Point4d.create();\n if (!this._xyzwB)\n this._xyzwB = Point4d.create();\n const roots = univariateBezierG.roots(0.0, true);\n if (roots) {\n for (const root of roots) {\n const fractionB = bezier.fractionToParentFraction(root);\n // The univariate bezier (which has been transformed by the view transform) evaluates into xyw space\n const bcurvePoint4d = bezier.fractionToPoint4d(root);\n const c = bcurvePoint4d.dotProductXYZW(axx, axy, axz, axw);\n const s = bcurvePoint4d.dotProductXYZW(ayx, ayy, ayz, ayw);\n const arcFraction = cpA.sweep.radiansToSignedPeriodicFraction(Math.atan2(s, c));\n if (this.acceptFraction(extendA, arcFraction, extendA) && this.acceptFraction(extendB, fractionB, extendB)) {\n this.recordPointWithLocalFractions(\n arcFraction, cpA, 0, 1, fractionB, cpB, 0, 1, reversed,\n );\n }\n }\n bezierA.fractionToPoint4d(0.0, this._xyzwA0);\n let f0 = 0.0;\n let f1 = 1.0;\n const intervalTolerance = 1.0e-5;\n const df = 1.0 / strokeCountA;\n for (let i = 1; i <= strokeCountA; i++ , f0 = f1, this._xyzwA0.setFrom(this._xyzwA1)) {\n f1 = i * df;\n bezierA.fractionToPoint4d(f1, this._xyzwA1);\n Point4d.createPlanePointPointZ(this._xyzwA0, this._xyzwA1, this._xyzwPlane);\n bezierB.poleProductsXYZW(\n univariateBezierB.coffs, this._xyzwPlane.x, this._xyzwPlane.y, this._xyzwPlane.z, this._xyzwPlane.w,\n );\n let errors = 0;\n const roots = univariateBezierB.roots(0.0, true);\n if (roots)\n for (const r of roots) {\n const bezierBFraction = r;\n bezierB.fractionToPoint4d(bezierBFraction, this._xyzwB);\n const segmentAFraction = SmallSystem.lineSegment3dHXYClosestPointUnbounded(this._xyzwA0, this._xyzwA1, this._xyzwB);\n if (segmentAFraction && Geometry.isIn01WithTolerance(segmentAFraction, intervalTolerance)) {\n const bezierAFraction = Geometry.interpolate(f0, segmentAFraction, f1);\n // TODO implement newton search\n const xyMatchingFunction = new BezierBezierIntersectionXYRRToRRD(bezierA, bezierB);\n const newtonSearcher = new Newton2dUnboundedWithDerivative(xyMatchingFunction);\n newtonSearcher.setUV(bezierAFraction, bezierBFraction);\n if (newtonSearcher.runIterations()) {\n bezierAFraction = newtonSearcher.getU();\n bezierBFraction = newtonSearcher.getV();\n }\n // We have a near intersection at fractions on the two beziers !!!\n // Iterate on the curves for a true intersection ....\n // NEEDS WORK -- just accept . . .\n const bcurveAFraction = bezierA.fractionToParentFraction(bezierAFraction);\n const bcurveBFraction = bezierB.fractionToParentFraction(bezierBFraction);\n const xyzA0 = bezierA.fractionToPoint(bezierAFraction);\n const xyzA1 = bcurveA.fractionToPoint(bcurveAFraction);\n const xyzB0 = bezierB.fractionToPoint(bezierBFraction);\n const xyzB1 = bcurveB.fractionToPoint(bcurveBFraction);\n if (!xyzA0.isAlmostEqualXY(xyzA1))\n errors++;\n if (!xyzB0.isAlmostEqualXY(xyzB1))\n errors++;\n if (errors > 0 && !xyzA0.isAlmostEqual(xyzB0))\n errors++;\n if (errors > 0 && !xyzA1.isAlmostEqual(xyzB1))\n errors++;\n if (this.acceptFraction(false, bcurveAFraction, false) &&\n this.acceptFraction(false, bcurveBFraction, false)) {\n this.recordPointWithLocalFractions(\n bcurveAFraction, bcurveA, 0, 1, bcurveBFraction, bcurveB, 0, 1, reversed,\n );\n }\n }\n }\n }\n }\n */\n // Caller accesses data from two arcs.\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\".\n // Solves the arc-arc equations.\n private dispatchBSplineCurve3dBSplineCurve3d(\n _bcurveA: BSplineCurve3dBase, _bcurveB: BSplineCurve3dBase, _reversed: boolean,\n ): void {\n /*\n const bezierSpanA = bcurveA.collectBezierSpans(true) as BezierCurve3dH[];\n const bezierSpanB = bcurveB.collectBezierSpans(true) as BezierCurve3dH[];\n const numA = bezierSpanA.length;\n const numB = bezierSpanB.length;\n this.transformBeziers(bezierSpanA);\n this.transformBeziers(bezierSpanB);\n const rangeA = this.getRanges(bezierSpanA);\n const rangeB = this.getRanges(bezierSpanB);\n const orderA = bcurveA.order;\n const orderB = bcurveB.order;\n const univariateCoffsA = new UnivariateBezier(orderA);\n const univariateCoffsB = new UnivariateBezier(orderB);\n for (let a = 0; a < numA; a++) {\n for (let b = 0; b < numB; b++) {\n if (rangeA[a].intersectsRangeXY(rangeB[b])) {\n const strokeCountA = bezierSpanA[a].computeStrokeCountForOptions();\n const strokeCountB = bezierSpanB[b].computeStrokeCountForOptions();\n if (strokeCountA < strokeCountB)\n this.dispatchBezierBezierStrokeFirst(\n bezierSpanA[a], bcurveA, strokeCountA, bezierSpanB[b], bcurveB, strokeCountB, univariateCoffsB, _reversed,\n );\n else\n this.dispatchBezierBezierStrokeFirst(\n bezierSpanB[b], bcurveB, strokeCountB, bezierSpanA[a], bcurveA, strokeCountA, univariateCoffsA, !_reversed,\n );\n }\n }\n }\n */\n }\n /*\n /**\n * Apply the projection transform (if any) to (xyz, w).\n * @param xyz xyz parts of input point.\n * @param w weight to use for homogeneous effects.\n */\n /*\n private projectPoint(xyz: XYAndZ, w: number = 1.0): Point4d {\n if (this._worldToLocalPerspective)\n return this._worldToLocalPerspective.multiplyPoint3d(xyz, w);\n if (this._worldToLocalAffine)\n return this._worldToLocalAffine.multiplyXYZW(xyz.x, xyz.y, xyz.z, w);\n return Point4d.createFromPointAndWeight(xyz, w);\n }\n private mapNPCPlaneToWorld(npcPlane: Point4d, worldPlane: Point4d) {\n // for NPC pointY, Y^ * H = 0 is \"on\" plane H. (Hat is transpose)\n // NPC Y is A*X for our transform A and worldPointX.\n // hence (A X)^ * H = 0\n // hence X^ * A^ * H = 0\n // hence K = A^ * H\n if (this._worldToLocalAffine) {\n this._worldToLocalAffine.multiplyTransposeXYZW(npcPlane.x, npcPlane.y, npcPlane.z, npcPlane.w, worldPlane);\n } else if (this._worldToLocalPerspective) {\n this._worldToLocalPerspective.multiplyTransposePoint4d(npcPlane, worldPlane);\n } else {\n npcPlane.clone(worldPlane);\n }\n }\n */\n // Caller accesses data from segment and bsplineCurve\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\"\n // Solves the arc-arc equations\n private dispatchSegmentBsplineCurve(\n _cpA: CurvePrimitive,\n _extendA0: boolean,\n _pointA0: Point3d,\n _fractionA0: number,\n _pointA1: Point3d,\n _fractionA1: number,\n _extendA1: boolean,\n _bcurve: BSplineCurve3d,\n _extendB: boolean,\n _reversed: boolean,\n ): void {\n /*\n const pointA0H = this.projectPoint(pointA0);\n const pointA1H = this.projectPoint(pointA1);\n const planeCoffs = Point4d.createPlanePointPointZ(pointA0H, pointA1H);\n this.mapNPCPlaneToWorld(planeCoffs, planeCoffs);\n // NOW .. we have a plane in world space. Intersect it with the bspline:\n const intersections: CurveLocationDetail[] = [];\n bcurve.appendPlaneIntersectionPoints(planeCoffs, intersections);\n // intersections has WORLD points with bspline fractions.\n // (the bspline fractions are all good 0..1 fractions within the spline).\n // accept those that are within the segment range.\n for (const detail of intersections) {\n const fractionB = detail.fraction;\n const curvePoint = detail.point;\n const curvePointH = this.projectPoint(curvePoint);\n const lineFraction = SmallSystem.lineSegment3dHXYClosestPointUnbounded(pointA0H, pointA1H, curvePointH);\n if (lineFraction !== undefined && this.acceptFraction(extendA0, lineFraction, extendA1) &&\n this.acceptFraction(extendB, fractionB, extendB)) {\n this.recordPointWithLocalFractions(\n lineFraction, cpA, fractionA0, fractionA1, fractionB, bcurve, 0, 1, reversed,\n );\n }\n }\n */\n }\n /** Low level dispatch of linestring with (beziers of) a bspline curve */\n public dispatchLineStringBSplineCurve(\n _lsA: LineString3d, _extendA: boolean, _curveB: BSplineCurve3d, _extendB: boolean, _reversed: boolean,\n ): any {\n /*\n const numA = lsA.numPoints();\n if (numA > 1) {\n const dfA = 1.0 / (numA - 1);\n let fA0;\n let fA1;\n fA0 = 0.0;\n const pointA0 = CurveCurveIntersectXYZ._workPointA0;\n const pointA1 = CurveCurveIntersectXYZ._workPointA1;\n lsA.pointAt(0, pointA0);\n for (let iA = 1; iA < numA; iA++, pointA0.setFrom(pointA1), fA0 = fA1) {\n lsA.pointAt(iA, pointA1);\n fA1 = iA * dfA;\n this.dispatchSegmentBsplineCurve(\n lsA, iA === 1 && extendA, pointA0, fA0, pointA1, fA1, (iA + 1) === numA && extendA,\n curveB, extendB, reversed);\n }\n }\n return undefined;\n */\n }\n /** Detail computation for segment intersecting linestring. */\n public computeSegmentLineString(\n lsA: LineSegment3d, extendA: boolean, lsB: LineString3d, extendB: boolean, reversed: boolean,\n ): any {\n const pointA0 = lsA.point0Ref;\n const pointA1 = lsA.point1Ref;\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\n const numB = lsB.numPoints();\n if (numB > 1) {\n const dfB = 1.0 / (numB - 1);\n let fB0;\n let fB1;\n fB0 = 0.0;\n lsB.pointAt(0, pointB0);\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\n lsB.pointAt(ib, pointB1);\n fB1 = ib * dfB;\n this.dispatchSegmentSegment(\n lsA, extendA, pointA0, 0.0, pointA1, 1.0, extendA,\n lsB, ib === 1 && extendB, pointB0, fB0, pointB1, fB1, (ib + 1) === numB && extendB,\n reversed,\n );\n }\n }\n return undefined;\n }\n /** Detail computation for arc intersecting linestring. */\n public computeArcLineString(\n arcA: Arc3d, extendA: boolean, lsB: LineString3d, extendB: boolean, reversed: boolean,\n ): any {\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\n const numB = lsB.numPoints();\n if (numB > 1) {\n const dfB = 1.0 / (numB - 1);\n let fB0;\n let fB1;\n fB0 = 0.0;\n lsB.pointAt(0, pointB0);\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\n lsB.pointAt(ib, pointB1);\n fB1 = ib * dfB;\n this.dispatchSegmentArc(\n lsB, ib === 1 && extendB, pointB0, fB0, pointB1, fB1,\n (ib + 1) === numB && extendB, arcA, extendA, extendA, !reversed,\n );\n }\n }\n return undefined;\n }\n /** Detail computation for linestring intersecting linestring. */\n private computeLineStringLineString(lsA: LineString3d, lsB: LineString3d, reversed: boolean): void {\n const pointA0 = CurveCurveIntersectXYZ._workPointAA0;\n const pointA1 = CurveCurveIntersectXYZ._workPointAA1;\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\n const numA = lsA.numPoints();\n const numB = lsB.numPoints();\n if (numA > 1 && numB > 1) {\n lsA.pointAt(0, pointA0);\n const dfA = 1.0 / (numA - 1);\n const dfB = 1.0 / (numB - 1);\n let fA0 = 0.0;\n let fB0;\n let fA1;\n let fB1;\n const extendA = this._extendA;\n const extendB = this._extendB;\n lsA.pointAt(0, pointA0);\n for (let ia = 1; ia < numA; ia++, pointA0.setFrom(pointA1), fA0 = fA1) {\n fA1 = ia * dfA;\n fB0 = 0.0;\n lsA.pointAt(ia, pointA1);\n lsB.pointAt(0, pointB0);\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\n lsB.pointAt(ib, pointB1);\n fB1 = ib * dfB;\n this.dispatchSegmentSegment(\n lsA, ia === 1 && extendA, pointA0, fA0, pointA1, fA1, (ia + 1) === numA && extendA,\n lsB, ib === 1 && extendB, pointB0, fB0, pointB1, fB1, (ib + 1) === numB && extendB,\n reversed,\n );\n }\n }\n }\n }\n /** Low level dispatch of curve collection. */\n private dispatchCurveCollection(geomA: AnyCurve, geomAHandler: (geomA: any) => any): void {\n const geomB = this._geometryB; // save\n if (!geomB || !geomB.children || !(geomB instanceof CurveCollection))\n return;\n for (const child of geomB.children) {\n this.resetGeometry(child);\n geomAHandler(geomA);\n }\n this._geometryB = geomB; // restore\n }\n /** Low level dispatch to geomA given a CurveChainWithDistanceIndex in geometryB. */\n private dispatchCurveChainWithDistanceIndex(geomA: AnyCurve, geomAHandler: (geomA: any) => any): void {\n if (!this._geometryB || !(this._geometryB instanceof CurveChainWithDistanceIndex))\n return;\n if (geomA instanceof CurveChainWithDistanceIndex) {\n assert(!!\"call handleCurveChainWithDistanceIndex(geomA) instead\");\n return;\n }\n const index0 = this._results.length;\n const geomB = this._geometryB; // save\n for (const child of geomB.path.children) {\n this.resetGeometry(child);\n geomAHandler(geomA);\n }\n this.resetGeometry(geomB); // restore\n this._results = CurveChainWithDistanceIndex.convertChildDetailToChainDetail(this._results, index0, undefined, geomB, true);\n }\n /** Double dispatch handler for strongly typed segment. */\n public override handleLineSegment3d(segmentA: LineSegment3d): any {\n if (this._geometryB instanceof LineSegment3d) {\n const segmentB = this._geometryB;\n this.dispatchSegmentSegment(\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, this._extendA,\n segmentB, this._extendB, segmentB.point0Ref, 0.0, segmentB.point1Ref, 1.0, this._extendB,\n false,\n );\n } else if (this._geometryB instanceof LineString3d) {\n this.computeSegmentLineString(segmentA, this._extendA, this._geometryB, this._extendB, false);\n } else if (this._geometryB instanceof Arc3d) {\n this.dispatchSegmentArc(\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref,\n 1.0, this._extendA, this._geometryB, this._extendB, this._extendB, false,\n );\n } else if (this._geometryB instanceof BSplineCurve3d) {\n this.dispatchSegmentBsplineCurve(\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref,\n 1.0, this._extendA, this._geometryB, this._extendB, false,\n );\n } else if (this._geometryB instanceof CurveCollection) {\n this.dispatchCurveCollection(segmentA, this.handleLineSegment3d.bind(this));\n } else if (this._geometryB instanceof CurveChainWithDistanceIndex) {\n this.dispatchCurveChainWithDistanceIndex(segmentA, this.handleLineSegment3d.bind(this));\n }\n return undefined;\n }\n /** double dispatch handler for strongly typed linestring. */\n public override handleLineString3d(lsA: LineString3d): any {\n if (this._geometryB instanceof LineString3d) {\n const lsB = this._geometryB;\n this.computeLineStringLineString(lsA, lsB, false);\n } else if (this._geometryB instanceof LineSegment3d) {\n this.computeSegmentLineString(this._geometryB, this._extendB, lsA, this._extendA, true);\n } else if (this._geometryB instanceof Arc3d) {\n this.computeArcLineString(this._geometryB, this._extendB, lsA, this._extendA, true);\n } else if (this._geometryB instanceof BSplineCurve3d) {\n this.dispatchLineStringBSplineCurve(lsA, this._extendA, this._geometryB, this._extendB, false);\n } else if (this._geometryB instanceof CurveCollection) {\n this.dispatchCurveCollection(lsA, this.handleLineString3d.bind(this));\n } else if (this._geometryB instanceof CurveChainWithDistanceIndex) {\n this.dispatchCurveChainWithDistanceIndex(lsA, this.handleLineString3d.bind(this));\n }\n return undefined;\n }\n /** Double dispatch handler for strongly typed arc. */\n public override handleArc3d(arc0: Arc3d): any {\n if (this._geometryB instanceof LineSegment3d) {\n this.dispatchSegmentArc(\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref,\n 1.0, this._extendB, arc0, this._extendA, this._extendA, true,\n );\n } else if (this._geometryB instanceof LineString3d) {\n this.computeArcLineString(arc0, this._extendA, this._geometryB, this._extendB, false);\n } else if (this._geometryB instanceof Arc3d) {\n this.dispatchArcArc(arc0, this._extendA, this._geometryB, this._extendB, false);\n } else if (this._geometryB instanceof BSplineCurve3d) {\n this.dispatchArcBsplineCurve3d(arc0, this._extendA, this._geometryB, this._extendB, false);\n } else if (this._geometryB instanceof CurveCollection) {\n this.dispatchCurveCollection(arc0, this.handleArc3d.bind(this));\n } else if (this._geometryB instanceof CurveChainWithDistanceIndex) {\n this.dispatchCurveChainWithDistanceIndex(arc0, this.handleArc3d.bind(this));\n }\n return undefined;\n }\n /** Double dispatch handler for strongly typed bspline curve. */\n public override handleBSplineCurve3d(curve: BSplineCurve3d): any {\n if (this._geometryB instanceof LineSegment3d) {\n this.dispatchSegmentBsplineCurve(\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref,\n 1.0, this._extendB, curve, this._extendA, true,\n );\n } else if (this._geometryB instanceof LineString3d) {\n this.dispatchLineStringBSplineCurve(this._geometryB, this._extendB, curve, this._extendA, true);\n } else if (this._geometryB instanceof Arc3d) {\n this.dispatchArcBsplineCurve3d(this._geometryB, this._extendB, curve, this._extendA, true);\n } else if (this._geometryB instanceof BSplineCurve3dBase) {\n this.dispatchBSplineCurve3dBSplineCurve3d(curve, this._geometryB, false);\n } else if (this._geometryB instanceof CurveCollection) {\n this.dispatchCurveCollection(curve, this.handleBSplineCurve3d.bind(this));\n } else if (this._geometryB instanceof CurveChainWithDistanceIndex) {\n this.dispatchCurveChainWithDistanceIndex(curve, this.handleBSplineCurve3d.bind(this));\n }\n return undefined;\n }\n /** Double dispatch handler for strongly typed CurveChainWithDistanceIndex. */\n public override handleCurveChainWithDistanceIndex(chain: CurveChainWithDistanceIndex): any {\n super.handleCurveChainWithDistanceIndex(chain);\n // if _geometryB is also a CurveChainWithDistanceIndex, it will already have been converted by dispatchCurveChainWithDistanceIndex\n this._results = CurveChainWithDistanceIndex.convertChildDetailToChainDetail(this._results, 0, chain, undefined, true);\n }\n /** Double dispatch handler for strongly typed homogeneous bspline curve. */\n public override handleBSplineCurve3dH(_curve: BSplineCurve3dH): any {\n /*\n // NEEDS WORK -- make \"dispatch\" methods tolerant of both 3d and 3dH\n // \"easy\" if both present BezierCurve3dH span loaders\n if (this._geometryB instanceof LineSegment3d) {\n this.dispatchSegmentBsplineCurve(\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref, 1.0, this._extendB,\n curve, this._extendA, true);\n } else if (this._geometryB instanceof LineString3d) {\n this.dispatchLineStringBSplineCurve(this._geometryB, this._extendB, curve, this._extendA, true);\n } else if (this._geometryB instanceof Arc3d) {\n this.dispatchArcBsplineCurve3d(this._geometryB, this._extendB, curve, this._extendA, true);\n }\n */\n return undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CurveCurveIntersectXYZ.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CurveCurveIntersectXYZ.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAA6C;AAC7C,6DAAgF;AAEhF,6CAA0C;AAC1C,sEAAkF;AAClF,gGAA6F;AAC7F,sEAA4D;AAC5D,sEAAqE;AACrE,4DAAyE;AACzE,oCAAiC;AACjC,gFAA6E;AAC7E,wDAAqD;AACrD,gEAAyG;AAGzG,oDAAiD;AACjD,kDAA+C;AAE/C,mBAAmB;AAEnB;;;;;GAKG;AACH,MAAa,sBAAuB,SAAQ,gDAA8B;IAUxE;;;;OAIG;IACH,YAAmB,OAAgB,EAAE,SAAmB,EAAE,OAAgB;QACxE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IACD,wGAAwG;IACjG,aAAa,CAAC,SAAmB;QACtC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IACD;;;OAGG;IACI,iBAAiB,CAAC,eAAwB,KAAK;QACpD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,IAAI,YAAY;YACd,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACrB,OAAO,MAAM,CAAC;IAChB,CAAC;IACO,cAAc,CAAC,OAAgB,EAAE,QAAgB,EAAE,OAAgB;QACzE,IAAI,CAAC,OAAO,IAAI,QAAQ,GAAG,GAAG;YAC5B,OAAO,KAAK,CAAC;QACf,IAAI,CAAC,OAA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;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;;AAzzBH,wDA0zBC;AArzBgB,qCAAc,GAAG,0BAAQ,CAAC,MAAM,EAAE,CAAC;AACnC,oCAAa,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC;AACjC,oCAAa,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC;AACjC,oCAAa,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC;AACjC,oCAAa,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { BSplineCurve3d, BSplineCurve3dBase } from \"../../bspline/BSplineCurve\";\nimport { BSplineCurve3dH } from \"../../bspline/BSplineCurve3dH\";\nimport { Geometry } from \"../../Geometry\";\nimport { RecurseToCurvesGeometryHandler } from \"../../geometry3d/GeometryHandler\";\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { Vector2d } from \"../../geometry3d/Point2dVector2d\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { SmallSystem, TrigPolynomial } from \"../../numerics/Polynomials\";\nimport { Arc3d } from \"../Arc3d\";\nimport { CurveChainWithDistanceIndex } from \"../CurveChainWithDistanceIndex\";\nimport { CurveCollection } from \"../CurveCollection\";\nimport { CurveIntervalRole, CurveLocationDetail, CurveLocationDetailPair } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\nimport { AnyCurve } from \"../CurveTypes\";\nimport { LineSegment3d } from \"../LineSegment3d\";\nimport { LineString3d } from \"../LineString3d\";\n\n// cspell:word XYRR\n\n/**\n * Handler class for XYZ intersections between _geometryB and another geometry.\n * * Instances are initialized and called from CurveCurve.\n * * geometryB is saved for later reference.\n * @internal\n */\nexport class CurveCurveIntersectXYZ extends RecurseToCurvesGeometryHandler {\n private _extendA: boolean;\n private _geometryB: AnyCurve;\n private _extendB: boolean;\n private _results: CurveLocationDetailPair[];\n private static _workVector2dA = Vector2d.create();\n private static _workPointAA0 = Point3d.create();\n private static _workPointAA1 = Point3d.create();\n private static _workPointBB0 = Point3d.create();\n private static _workPointBB1 = Point3d.create();\n /**\n * @param extendA flag to enable using extension of the other geometry.\n * @param geometryB second curve for intersection. Saved for reference by specific handler methods.\n * @param extendB flag for extension of geometryB.\n */\n public constructor(extendA: boolean, geometryB: AnyCurve, extendB: boolean) {\n super();\n this._extendA = extendA;\n this._geometryB = geometryB;\n this._extendB = extendB;\n this._results = [];\n }\n /** Reset the geometry, leaving all other parts unchanged (and preserving accumulated intersections). */\n public resetGeometry(geometryB: AnyCurve): void {\n this._geometryB = geometryB;\n }\n /**\n * Return the results structure for the intersection calculation, structured as an array of CurveLocationDetailPair.\n * @param reinitialize if true, a new results structure is created for use by later calls.\n */\n public grabPairedResults(reinitialize: boolean = false): CurveLocationDetailPair[] {\n const result = this._results;\n if (reinitialize)\n this._results = [];\n return result;\n }\n private acceptFraction(extend0: boolean, fraction: number, extend1: boolean) {\n if (!extend0 && fraction < 0.0)\n return false;\n if (!extend1 && fraction > 1.0)\n return false;\n return true;\n }\n /**\n * Compute intersection of two line segments.\n * Filter by extension rules.\n * Reject if evaluated points do not match coordinates (e.g. close approach point).\n * Record with fraction mapping.\n */\n private recordPointWithLocalFractions(\n localFractionA: number,\n cpA: CurvePrimitive,\n fractionA0: number,\n fractionA1: number,\n localFractionB: number,\n cpB: CurvePrimitive,\n fractionB0: number,\n fractionB1: number,\n reversed: boolean,\n ): void {\n const globalFractionA = Geometry.interpolate(fractionA0, localFractionA, fractionA1);\n const globalFractionB = Geometry.interpolate(fractionB0, localFractionB, fractionB1);\n // ignore duplicate of most recent point\n const numPrevious = this._results.length;\n if (numPrevious > 0) {\n const oldDetailA = this._results[numPrevious - 1].detailA;\n const oldDetailB = this._results[numPrevious - 1].detailB;\n if (reversed) {\n if (oldDetailB.isSameCurveAndFraction({ curve: cpA, fraction: globalFractionA }) &&\n oldDetailA.isSameCurveAndFraction({ curve: cpB, fraction: globalFractionB }))\n return;\n } else {\n if (oldDetailA.isSameCurveAndFraction({ curve: cpA, fraction: globalFractionA }) &&\n oldDetailB.isSameCurveAndFraction({ curve: cpB, fraction: globalFractionB }))\n return;\n }\n }\n const pointA = cpA.fractionToPoint(globalFractionA);\n const pointB = cpB.fractionToPoint(globalFractionB);\n if (!pointA.isAlmostEqualMetric(pointB))\n return;\n const detailA = CurveLocationDetail.createCurveFractionPoint(cpA, globalFractionA, pointA);\n detailA.setIntervalRole(CurveIntervalRole.isolated);\n const detailB = CurveLocationDetail.createCurveFractionPoint(cpB, globalFractionB, pointB);\n detailB.setIntervalRole(CurveIntervalRole.isolated);\n if (reversed) {\n const pair = new CurveLocationDetailPair(detailB, detailA);\n this._results.push(pair);\n } else {\n const pair = new CurveLocationDetailPair(detailA, detailB);\n this._results.push(pair);\n }\n }\n /**\n * Compute intersection of two line segments.\n * Filter by extension rules.\n * Record with fraction mapping.\n */\n private computeSegmentSegment3D(\n cpA: CurvePrimitive,\n extendA0: boolean,\n pointA0: Point3d,\n fractionA0: number,\n pointA1: Point3d,\n fractionA1: number,\n extendA1: boolean,\n cpB: CurvePrimitive,\n extendB0: boolean,\n pointB0: Point3d,\n fractionB0: number,\n pointB1: Point3d,\n fractionB1: number,\n extendB1: boolean,\n reversed: boolean,\n ): void {\n const uv = CurveCurveIntersectXYZ._workVector2dA;\n if (SmallSystem.lineSegment3dClosestApproachUnbounded(pointA0, pointA1, pointB0, pointB1, uv) &&\n this.acceptFraction(extendA0, uv.x, extendA1) && this.acceptFraction(extendB0, uv.y, extendB1)) {\n this.recordPointWithLocalFractions(uv.x, cpA, fractionA0, fractionA1, uv.y, cpB, fractionB0, fractionB1, reversed);\n }\n }\n // Caller accesses data from a line segment and passes to here.\n // The line segment in question might be (a) a full line segment or (b) a fragment within a linestring.\n // The fraction and extend parameters allow all combinations to be passed in.\n // This method applies transform.\n private dispatchSegmentSegment(\n cpA: CurvePrimitive,\n extendA0: boolean,\n pointA0: Point3d,\n fractionA0: number,\n pointA1: Point3d,\n fractionA1: number,\n extendA1: boolean,\n cpB: CurvePrimitive,\n extendB0: boolean,\n pointB0: Point3d,\n fractionB0: number,\n pointB1: Point3d,\n fractionB1: number,\n extendB1: boolean,\n reversed: boolean,\n ): void {\n this.computeSegmentSegment3D(\n cpA, extendA0, pointA0, fractionA0, pointA1, fractionA1, extendA1,\n cpB, extendB0, pointB0, fractionB0, pointB1, fractionB1, extendB1,\n reversed,\n );\n }\n /**\n * Create a plane whose normal is the \"better\" cross product: `vectorA.crossProduct(vectorB)` or\n * `vectorA.crossProduct(vectorC)`\n * * The heuristic for \"better\" is:\n * * first choice is cross product with `vectorB`, if `vectorA` and `vectorB` are sufficiently far from parallel\n * (or anti-parallel).\n * * otherwise use vectorC\n * @param origin plane origin\n * @param vectorA vector which must be in the plane.\n * @param cosineValue largest cosine of the angle theta between vectorA and vectorB to prefer their cross product, e.g.\n * passing 0.94 ~ cos(20deg) will switch to using vectorC in the cross product if theta < ~20deg or theta > ~160deg.\n * @param vectorB first candidate for additional in-plane vector\n * @param vectorC second candidate for additional in-plane vector\n */\n public createPlaneWithPreferredPerpendicular(\n origin: Point3d, vectorA: Vector3d, cosineValue: number, vectorB: Vector3d, vectorC: Vector3d,\n ): Plane3dByOriginAndUnitNormal | undefined {\n cosineValue = Geometry.restrictToInterval(Math.abs(cosineValue), 0.0, 1.0 - Geometry.smallFraction);\n const dotAA = vectorA.magnitudeSquared();\n const dotBB = vectorB.magnitudeSquared();\n const dotAB = Math.abs(vectorA.dotProduct(vectorB));\n const cross = vectorA.unitCrossProduct(\n dotAB * dotAB <= cosineValue * cosineValue * dotAA * dotBB ? vectorB : vectorC,\n );\n if (cross)\n return Plane3dByOriginAndUnitNormal.create(origin, cross);\n return undefined;\n }\n // Caller accesses data from a linestring or segment and passes it here.\n // The line in question might be (a) a full line segment or (b) a fragment within a linestring.\n // The fraction and extend parameters allow all combinations to be passed in.\n private dispatchSegmentArc(\n cpA: CurvePrimitive,\n extendA0: boolean,\n pointA0: Point3d,\n fractionA0: number,\n pointA1: Point3d,\n fractionA1: number,\n extendA1: boolean,\n arc: Arc3d,\n extendB0: boolean,\n extendB1: boolean,\n reversed: boolean,\n ): void {\n const lineVector = Vector3d.createStartEnd(pointA0, pointA1);\n const cosValue = 0.94; // cosine of 20 degrees\n const plane = this.createPlaneWithPreferredPerpendicular(\n pointA0, lineVector, cosValue, arc.perpendicularVector, arc.vector0,\n );\n if (plane !== undefined) {\n const candidates: CurveLocationDetail[] = [];\n arc.appendPlaneIntersectionPoints(plane, candidates);\n let lineFraction;\n let linePoint: Point3d | undefined;\n for (const c of candidates) {\n if (this.acceptFraction(extendB0, c.fraction, extendB1)) {\n lineFraction = SmallSystem.lineSegment3dClosestPointUnbounded(pointA0, pointA1, c.point);\n if (lineFraction !== undefined) {\n linePoint = pointA0.interpolate(lineFraction, pointA1, linePoint);\n if (linePoint.isAlmostEqualMetric(c.point)\n && this.acceptFraction(extendA0, lineFraction, extendA1)) {\n this.recordPointWithLocalFractions(\n lineFraction, cpA, fractionA0, fractionA1, c.fraction, arc, 0, 1, reversed,\n );\n }\n }\n }\n }\n }\n }\n // Caller promises arcs are coplanar.\n // Passes \"other\" as {center, vector0, vector90} in local xy space of cpA\n // Solves the arc-arc equations for that local ellipse with unit circle.\n // Solution fractions map directly to original arcs.\n private dispatchArcArcInPlane(\n cpA: Arc3d, extendA: boolean, cpB: Arc3d, extendB: boolean, reversed: boolean,\n ): void {\n const otherVectors = cpA.otherArcAsLocalVectors(cpB);\n if (otherVectors !== undefined) {\n const ellipseRadians: number[] = [];\n const circleRadians: number[] = [];\n TrigPolynomial.solveUnitCircleHomogeneousEllipseIntersection(\n otherVectors.center.x, otherVectors.center.y, 1.0,\n otherVectors.vector0.x, otherVectors.vector0.y, 0.0,\n otherVectors.vector90.x, otherVectors.vector90.y, 0.0,\n ellipseRadians, circleRadians,\n );\n for (let i = 0; i < ellipseRadians.length; i++) {\n const fractionA = cpA.sweep.radiansToSignedPeriodicFraction(circleRadians[i]);\n const fractionB = cpB.sweep.radiansToSignedPeriodicFraction(ellipseRadians[i]);\n // hm .. do we really need to check the fractions? We know they are internal to the beziers\n if (this.acceptFraction(extendA, fractionA, extendA) && this.acceptFraction(extendB, fractionB, extendB)) {\n this.recordPointWithLocalFractions(fractionA, cpA, 0, 1, fractionB, cpB, 0, 1, reversed);\n }\n }\n }\n }\n // Caller accesses data from two arcs.\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\".\n // Solves the arc-arc equations.\n private dispatchArcArc(\n cpA: Arc3d, extendA: boolean, cpB: Arc3d, extendB: boolean, reversed: boolean,\n ): void {\n // If arcs are in different planes:\n // 1) Intersect each plane with the other arc (quadratic)\n // 2) accept points that appear in both intersection sets.\n // If arcs are in parallel planes -- no intersections.\n // If arcs are in the same plane -- xy intersection in that plane.\n const planeA = Plane3dByOriginAndUnitNormal.create(cpA.center, cpA.perpendicularVector);\n const planeB = Plane3dByOriginAndUnitNormal.create(cpB.center, cpB.perpendicularVector);\n if (planeA === undefined || planeB === undefined)\n return;\n if (planeA.getNormalRef().isParallelTo(planeB.getNormalRef())) {\n if (planeA.isPointInPlane(planeB.getOriginRef()) && planeB.isPointInPlane(planeA.getOriginRef())) {\n // coplanar\n this.dispatchArcArcInPlane(cpA, extendA, cpB, extendB, reversed);\n }\n } else {\n const arcBPoints: CurveLocationDetail[] = [];\n cpB.appendPlaneIntersectionPoints(planeA, arcBPoints);\n const arcAPoints: CurveLocationDetail[] = [];\n cpA.appendPlaneIntersectionPoints(planeB, arcAPoints);\n for (const detailB of arcBPoints) {\n for (const detailA of arcAPoints) {\n if (detailA.point.isAlmostEqual(detailB.point)) {\n if (this.acceptFraction(extendA, detailA.fraction, extendA)\n && this.acceptFraction(extendB, detailB.fraction, extendB)) {\n this.recordPointWithLocalFractions(detailA.fraction, cpA, 0, 1, detailB.fraction, cpB, 0, 1, reversed);\n }\n }\n }\n }\n }\n }\n // Caller accesses data from two arcs.\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\".\n // Solves the arc-arc equations.\n private dispatchArcBsplineCurve3d(\n _arc: Arc3d, _extendA: boolean, _cpB: BSplineCurve3d, _extendB: boolean, _reversed: boolean,\n ): void {\n /*\n // Arc: X = C + cU + sV\n // implicitize the arc as viewed. This \"3d\" matrix is homogeneous \"XYW\" not \"xyz\"\n let matrixA: Matrix3d;\n if (this._worldToLocalPerspective) {\n const dataA = cpA.toTransformedPoint4d(this._worldToLocalPerspective);\n matrixA = Matrix3d.createColumnsXYW(\n dataA.vector0, dataA.vector0.w, dataA.vector90, dataA.vector90.w, dataA.center, dataA.center.w,\n );\n } else {\n const dataA = cpA.toTransformedVectors(this._worldToLocalAffine);\n matrixA = Matrix3d.createColumnsXYW(dataA.vector0, 0, dataA.vector90, 0, dataA.center, 1);\n }\n // The worldToLocal has moved the arc vectors into local space.\n // matrixA captures the xyw parts (ignoring z)\n // for any point in world space,\n // THIS CODE ONLY WORKS FOR\n const matrixAInverse = matrixA.inverse();\n if (matrixAInverse) {\n const orderF = cpB.order; // order of the beziers for simple coordinates\n const orderG = 2 * orderF - 1; // order of the (single) bezier for squared coordinates.\n const coffF = new Float64Array(orderF);\n const univariateBezierG = new UnivariateBezier(orderG);\n const axx = matrixAInverse.at(0, 0);\n const axy = matrixAInverse.at(0, 1);\n const axz = 0.0;\n const axw = matrixAInverse.at(0, 2);\n const ayx = matrixAInverse.at(1, 0);\n const ayy = matrixAInverse.at(1, 1);\n const ayz = 0.0;\n const ayw = matrixAInverse.at(1, 2);\n const awx = matrixAInverse.at(2, 0);\n const awy = matrixAInverse.at(2, 1);\n const awz = 0.0;\n const aww = matrixAInverse.at(2, 2);\n\n if (matrixAInverse) {\n let bezier: BezierCurve3dH | undefined;\n for (let spanIndex = 0; ; spanIndex++) {\n bezier = cpB.getSaturatedBezierSpan3dH(spanIndex, bezier);\n if (!bezier) break;\n if (this._worldToLocalPerspective)\n bezier.tryMultiplyMatrix4dInPlace(this._worldToLocalPerspective);\n else if (this._worldToLocalAffine)\n bezier.tryTransformInPlace(this._worldToLocalAffine);\n univariateBezierG.zero();\n bezier.poleProductsXYZW(coffF, axx, axy, axz, axw);\n univariateBezierG.addSquaredSquaredBezier(coffF, 1.0);\n bezier.poleProductsXYZW(coffF, ayx, ayy, ayz, ayw);\n univariateBezierG.addSquaredSquaredBezier(coffF, 1.0);\n bezier.poleProductsXYZW(coffF, awx, awy, awz, aww);\n univariateBezierG.addSquaredSquaredBezier(coffF, -1.0);\n const roots = univariateBezierG.roots(0.0, true);\n if (roots) {\n for (const root of roots) {\n const fractionB = bezier.fractionToParentFraction(root);\n // The univariate bezier (which has been transformed by the view transform) evaluates into xyw space\n const bcurvePoint4d = bezier.fractionToPoint4d(root);\n const c = bcurvePoint4d.dotProductXYZW(axx, axy, axz, axw);\n const s = bcurvePoint4d.dotProductXYZW(ayx, ayy, ayz, ayw);\n const arcFraction = cpA.sweep.radiansToSignedPeriodicFraction(Math.atan2(s, c));\n if (this.acceptFraction(extendA, arcFraction, extendA) &&\n this.acceptFraction(extendB, fractionB, extendB)) {\n this.recordPointWithLocalFractions(\n arcFraction, cpA, 0, 1, fractionB, cpB, 0, 1, reversed,\n );\n }\n }\n }\n }\n }\n }\n */\n }\n /*\n // Apply the transformation to bezier curves. Optionally construct ranges.\n private transformBeziers(beziers: BezierCurve3dH[]): void {\n if (this._worldToLocalAffine) {\n for (const bezier of beziers) bezier.tryTransformInPlace(this._worldToLocalAffine);\n } else if (this._worldToLocalPerspective) {\n for (const bezier of beziers) bezier.tryMultiplyMatrix4dInPlace(this._worldToLocalPerspective);\n }\n }\n */\n /*\n private getRanges(beziers: BezierCurveBase[]): Range3d[] {\n const ranges: Range3d[] = [];\n ranges.length = 0;\n for (const b of beziers) {\n ranges.push(b.range());\n }\n return ranges;\n }\n private dispatchBezierBezierStrokeFirst(\n bezierA: BezierCurve3dH,\n bcurveA: BSplineCurve3dBase,\n strokeCountA: number,\n bezierB: BezierCurve3dH,\n bcurveB: BSplineCurve3dBase,\n _strokeCountB: number,\n univariateBezierB: UnivariateBezier, // caller-allocated for univariate coefficients.\n reversed: boolean,\n ) {\n if (!this._xyzwA0)\n this._xyzwA0 = Point4d.create();\n if (!this._xyzwA1)\n this._xyzwA1 = Point4d.create();\n if (!this._xyzwPlane)\n this._xyzwPlane = Point4d.create();\n if (!this._xyzwB)\n this._xyzwB = Point4d.create();\n const roots = univariateBezierG.roots(0.0, true);\n if (roots) {\n for (const root of roots) {\n const fractionB = bezier.fractionToParentFraction(root);\n // The univariate bezier (which has been transformed by the view transform) evaluates into xyw space\n const bcurvePoint4d = bezier.fractionToPoint4d(root);\n const c = bcurvePoint4d.dotProductXYZW(axx, axy, axz, axw);\n const s = bcurvePoint4d.dotProductXYZW(ayx, ayy, ayz, ayw);\n const arcFraction = cpA.sweep.radiansToSignedPeriodicFraction(Math.atan2(s, c));\n if (this.acceptFraction(extendA, arcFraction, extendA) && this.acceptFraction(extendB, fractionB, extendB)) {\n this.recordPointWithLocalFractions(\n arcFraction, cpA, 0, 1, fractionB, cpB, 0, 1, reversed,\n );\n }\n }\n bezierA.fractionToPoint4d(0.0, this._xyzwA0);\n let f0 = 0.0;\n let f1 = 1.0;\n const intervalTolerance = 1.0e-5;\n const df = 1.0 / strokeCountA;\n for (let i = 1; i <= strokeCountA; i++ , f0 = f1, this._xyzwA0.setFrom(this._xyzwA1)) {\n f1 = i * df;\n bezierA.fractionToPoint4d(f1, this._xyzwA1);\n Point4d.createPlanePointPointZ(this._xyzwA0, this._xyzwA1, this._xyzwPlane);\n bezierB.poleProductsXYZW(\n univariateBezierB.coffs, this._xyzwPlane.x, this._xyzwPlane.y, this._xyzwPlane.z, this._xyzwPlane.w,\n );\n let errors = 0;\n const roots = univariateBezierB.roots(0.0, true);\n if (roots)\n for (const r of roots) {\n const bezierBFraction = r;\n bezierB.fractionToPoint4d(bezierBFraction, this._xyzwB);\n const segmentAFraction = SmallSystem.lineSegment3dHXYClosestPointUnbounded(this._xyzwA0, this._xyzwA1, this._xyzwB);\n if (segmentAFraction && Geometry.isIn01WithTolerance(segmentAFraction, intervalTolerance)) {\n const bezierAFraction = Geometry.interpolate(f0, segmentAFraction, f1);\n // TODO implement newton search\n const xyMatchingFunction = new BezierBezierIntersectionXYRRToRRD(bezierA, bezierB);\n const newtonSearcher = new Newton2dUnboundedWithDerivative(xyMatchingFunction);\n newtonSearcher.setUV(bezierAFraction, bezierBFraction);\n if (newtonSearcher.runIterations()) {\n bezierAFraction = newtonSearcher.getU();\n bezierBFraction = newtonSearcher.getV();\n }\n // We have a near intersection at fractions on the two beziers !!!\n // Iterate on the curves for a true intersection ....\n // NEEDS WORK -- just accept . . .\n const bcurveAFraction = bezierA.fractionToParentFraction(bezierAFraction);\n const bcurveBFraction = bezierB.fractionToParentFraction(bezierBFraction);\n const xyzA0 = bezierA.fractionToPoint(bezierAFraction);\n const xyzA1 = bcurveA.fractionToPoint(bcurveAFraction);\n const xyzB0 = bezierB.fractionToPoint(bezierBFraction);\n const xyzB1 = bcurveB.fractionToPoint(bcurveBFraction);\n if (!xyzA0.isAlmostEqualXY(xyzA1))\n errors++;\n if (!xyzB0.isAlmostEqualXY(xyzB1))\n errors++;\n if (errors > 0 && !xyzA0.isAlmostEqual(xyzB0))\n errors++;\n if (errors > 0 && !xyzA1.isAlmostEqual(xyzB1))\n errors++;\n if (this.acceptFraction(false, bcurveAFraction, false) &&\n this.acceptFraction(false, bcurveBFraction, false)) {\n this.recordPointWithLocalFractions(\n bcurveAFraction, bcurveA, 0, 1, bcurveBFraction, bcurveB, 0, 1, reversed,\n );\n }\n }\n }\n }\n }\n */\n // Caller accesses data from two arcs.\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\".\n // Solves the arc-arc equations.\n private dispatchBSplineCurve3dBSplineCurve3d(\n _bcurveA: BSplineCurve3dBase, _bcurveB: BSplineCurve3dBase, _reversed: boolean,\n ): void {\n /*\n const bezierSpanA = bcurveA.collectBezierSpans(true) as BezierCurve3dH[];\n const bezierSpanB = bcurveB.collectBezierSpans(true) as BezierCurve3dH[];\n const numA = bezierSpanA.length;\n const numB = bezierSpanB.length;\n this.transformBeziers(bezierSpanA);\n this.transformBeziers(bezierSpanB);\n const rangeA = this.getRanges(bezierSpanA);\n const rangeB = this.getRanges(bezierSpanB);\n const orderA = bcurveA.order;\n const orderB = bcurveB.order;\n const univariateCoffsA = new UnivariateBezier(orderA);\n const univariateCoffsB = new UnivariateBezier(orderB);\n for (let a = 0; a < numA; a++) {\n for (let b = 0; b < numB; b++) {\n if (rangeA[a].intersectsRangeXY(rangeB[b])) {\n const strokeCountA = bezierSpanA[a].computeStrokeCountForOptions();\n const strokeCountB = bezierSpanB[b].computeStrokeCountForOptions();\n if (strokeCountA < strokeCountB)\n this.dispatchBezierBezierStrokeFirst(\n bezierSpanA[a], bcurveA, strokeCountA, bezierSpanB[b], bcurveB, strokeCountB, univariateCoffsB, _reversed,\n );\n else\n this.dispatchBezierBezierStrokeFirst(\n bezierSpanB[b], bcurveB, strokeCountB, bezierSpanA[a], bcurveA, strokeCountA, univariateCoffsA, !_reversed,\n );\n }\n }\n }\n */\n }\n /*\n /**\n * Apply the projection transform (if any) to (xyz, w).\n * @param xyz xyz parts of input point.\n * @param w weight to use for homogeneous effects.\n */\n /*\n private projectPoint(xyz: XYAndZ, w: number = 1.0): Point4d {\n if (this._worldToLocalPerspective)\n return this._worldToLocalPerspective.multiplyPoint3d(xyz, w);\n if (this._worldToLocalAffine)\n return this._worldToLocalAffine.multiplyXYZW(xyz.x, xyz.y, xyz.z, w);\n return Point4d.createFromPointAndWeight(xyz, w);\n }\n private mapNPCPlaneToWorld(npcPlane: Point4d, worldPlane: Point4d) {\n // for NPC pointY, Y^ * H = 0 is \"on\" plane H. (Hat is transpose)\n // NPC Y is A*X for our transform A and worldPointX.\n // hence (A X)^ * H = 0\n // hence X^ * A^ * H = 0\n // hence K = A^ * H\n if (this._worldToLocalAffine) {\n this._worldToLocalAffine.multiplyTransposeXYZW(npcPlane.x, npcPlane.y, npcPlane.z, npcPlane.w, worldPlane);\n } else if (this._worldToLocalPerspective) {\n this._worldToLocalPerspective.multiplyTransposePoint4d(npcPlane, worldPlane);\n } else {\n npcPlane.clone(worldPlane);\n }\n }\n */\n // Caller accesses data from segment and bsplineCurve\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\"\n // Solves the arc-arc equations\n private dispatchSegmentBsplineCurve(\n _cpA: CurvePrimitive,\n _extendA0: boolean,\n _pointA0: Point3d,\n _fractionA0: number,\n _pointA1: Point3d,\n _fractionA1: number,\n _extendA1: boolean,\n _bcurve: BSplineCurve3d,\n _extendB: boolean,\n _reversed: boolean,\n ): void {\n /*\n const pointA0H = this.projectPoint(pointA0);\n const pointA1H = this.projectPoint(pointA1);\n const planeCoffs = Point4d.createPlanePointPointZ(pointA0H, pointA1H);\n this.mapNPCPlaneToWorld(planeCoffs, planeCoffs);\n // NOW .. we have a plane in world space. Intersect it with the bspline:\n const intersections: CurveLocationDetail[] = [];\n bcurve.appendPlaneIntersectionPoints(planeCoffs, intersections);\n // intersections has WORLD points with bspline fractions.\n // (the bspline fractions are all good 0..1 fractions within the spline).\n // accept those that are within the segment range.\n for (const detail of intersections) {\n const fractionB = detail.fraction;\n const curvePoint = detail.point;\n const curvePointH = this.projectPoint(curvePoint);\n const lineFraction = SmallSystem.lineSegment3dHXYClosestPointUnbounded(pointA0H, pointA1H, curvePointH);\n if (lineFraction !== undefined && this.acceptFraction(extendA0, lineFraction, extendA1) &&\n this.acceptFraction(extendB, fractionB, extendB)) {\n this.recordPointWithLocalFractions(\n lineFraction, cpA, fractionA0, fractionA1, fractionB, bcurve, 0, 1, reversed,\n );\n }\n }\n */\n }\n /** Low level dispatch of linestring with (beziers of) a bspline curve */\n public dispatchLineStringBSplineCurve(\n _lsA: LineString3d, _extendA: boolean, _curveB: BSplineCurve3d, _extendB: boolean, _reversed: boolean,\n ): any {\n /*\n const numA = lsA.numPoints();\n if (numA > 1) {\n const dfA = 1.0 / (numA - 1);\n let fA0;\n let fA1;\n fA0 = 0.0;\n const pointA0 = CurveCurveIntersectXYZ._workPointA0;\n const pointA1 = CurveCurveIntersectXYZ._workPointA1;\n lsA.pointAt(0, pointA0);\n for (let iA = 1; iA < numA; iA++, pointA0.setFrom(pointA1), fA0 = fA1) {\n lsA.pointAt(iA, pointA1);\n fA1 = iA * dfA;\n this.dispatchSegmentBsplineCurve(\n lsA, iA === 1 && extendA, pointA0, fA0, pointA1, fA1, (iA + 1) === numA && extendA,\n curveB, extendB, reversed);\n }\n }\n return undefined;\n */\n }\n /** Detail computation for segment intersecting linestring. */\n public computeSegmentLineString(\n lsA: LineSegment3d, extendA: boolean, lsB: LineString3d, extendB: boolean, reversed: boolean,\n ): any {\n const pointA0 = lsA.point0Ref;\n const pointA1 = lsA.point1Ref;\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\n const numB = lsB.numPoints();\n if (numB > 1) {\n const dfB = 1.0 / (numB - 1);\n let fB0;\n let fB1;\n fB0 = 0.0;\n lsB.pointAt(0, pointB0);\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\n lsB.pointAt(ib, pointB1);\n fB1 = ib * dfB;\n this.dispatchSegmentSegment(\n lsA, extendA, pointA0, 0.0, pointA1, 1.0, extendA,\n lsB, ib === 1 && extendB, pointB0, fB0, pointB1, fB1, (ib + 1) === numB && extendB,\n reversed,\n );\n }\n }\n return undefined;\n }\n /** Detail computation for arc intersecting linestring. */\n public computeArcLineString(\n arcA: Arc3d, extendA: boolean, lsB: LineString3d, extendB: boolean, reversed: boolean,\n ): any {\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\n const numB = lsB.numPoints();\n if (numB > 1) {\n const dfB = 1.0 / (numB - 1);\n let fB0;\n let fB1;\n fB0 = 0.0;\n lsB.pointAt(0, pointB0);\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\n lsB.pointAt(ib, pointB1);\n fB1 = ib * dfB;\n this.dispatchSegmentArc(\n lsB, ib === 1 && extendB, pointB0, fB0, pointB1, fB1,\n (ib + 1) === numB && extendB, arcA, extendA, extendA, !reversed,\n );\n }\n }\n return undefined;\n }\n /** Detail computation for linestring intersecting linestring. */\n private computeLineStringLineString(lsA: LineString3d, lsB: LineString3d, reversed: boolean): void {\n const pointA0 = CurveCurveIntersectXYZ._workPointAA0;\n const pointA1 = CurveCurveIntersectXYZ._workPointAA1;\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\n const numA = lsA.numPoints();\n const numB = lsB.numPoints();\n if (numA > 1 && numB > 1) {\n lsA.pointAt(0, pointA0);\n const dfA = 1.0 / (numA - 1);\n const dfB = 1.0 / (numB - 1);\n let fA0 = 0.0;\n let fB0;\n let fA1;\n let fB1;\n const extendA = this._extendA;\n const extendB = this._extendB;\n lsA.pointAt(0, pointA0);\n for (let ia = 1; ia < numA; ia++, pointA0.setFrom(pointA1), fA0 = fA1) {\n fA1 = ia * dfA;\n fB0 = 0.0;\n lsA.pointAt(ia, pointA1);\n lsB.pointAt(0, pointB0);\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\n lsB.pointAt(ib, pointB1);\n fB1 = ib * dfB;\n this.dispatchSegmentSegment(\n lsA, ia === 1 && extendA, pointA0, fA0, pointA1, fA1, (ia + 1) === numA && extendA,\n lsB, ib === 1 && extendB, pointB0, fB0, pointB1, fB1, (ib + 1) === numB && extendB,\n reversed,\n );\n }\n }\n }\n }\n /** Low level dispatch of curve collection. */\n private dispatchCurveCollection(geomA: AnyCurve, geomAHandler: (geomA: any) => any): void {\n const geomB = this._geometryB; // save\n if (!geomB || !geomB.children || !(geomB instanceof CurveCollection))\n return;\n for (const child of geomB.children) {\n this.resetGeometry(child);\n geomAHandler(geomA);\n }\n this._geometryB = geomB; // restore\n }\n /** Low level dispatch to geomA given a CurveChainWithDistanceIndex in geometryB. */\n private dispatchCurveChainWithDistanceIndex(geomA: AnyCurve, geomAHandler: (geomA: any) => any): void {\n if (!this._geometryB || !(this._geometryB instanceof CurveChainWithDistanceIndex))\n return;\n if (geomA instanceof CurveChainWithDistanceIndex) {\n assert(!\"call handleCurveChainWithDistanceIndex(geomA) instead\");\n return;\n }\n const index0 = this._results.length;\n const geomB = this._geometryB; // save\n for (const child of geomB.path.children) {\n this.resetGeometry(child);\n geomAHandler(geomA);\n }\n this.resetGeometry(geomB); // restore\n this._results = CurveChainWithDistanceIndex.convertChildDetailToChainDetail(this._results, index0, undefined, geomB, true);\n }\n /** Double dispatch handler for strongly typed segment. */\n public override handleLineSegment3d(segmentA: LineSegment3d): any {\n if (this._geometryB instanceof LineSegment3d) {\n const segmentB = this._geometryB;\n this.dispatchSegmentSegment(\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, this._extendA,\n segmentB, this._extendB, segmentB.point0Ref, 0.0, segmentB.point1Ref, 1.0, this._extendB,\n false,\n );\n } else if (this._geometryB instanceof LineString3d) {\n this.computeSegmentLineString(segmentA, this._extendA, this._geometryB, this._extendB, false);\n } else if (this._geometryB instanceof Arc3d) {\n this.dispatchSegmentArc(\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref,\n 1.0, this._extendA, this._geometryB, this._extendB, this._extendB, false,\n );\n } else if (this._geometryB instanceof BSplineCurve3d) {\n this.dispatchSegmentBsplineCurve(\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref,\n 1.0, this._extendA, this._geometryB, this._extendB, false,\n );\n } else if (this._geometryB instanceof CurveCollection) {\n this.dispatchCurveCollection(segmentA, this.handleLineSegment3d.bind(this));\n } else if (this._geometryB instanceof CurveChainWithDistanceIndex) {\n this.dispatchCurveChainWithDistanceIndex(segmentA, this.handleLineSegment3d.bind(this));\n }\n return undefined;\n }\n /** double dispatch handler for strongly typed linestring. */\n public override handleLineString3d(lsA: LineString3d): any {\n if (this._geometryB instanceof LineString3d) {\n const lsB = this._geometryB;\n this.computeLineStringLineString(lsA, lsB, false);\n } else if (this._geometryB instanceof LineSegment3d) {\n this.computeSegmentLineString(this._geometryB, this._extendB, lsA, this._extendA, true);\n } else if (this._geometryB instanceof Arc3d) {\n this.computeArcLineString(this._geometryB, this._extendB, lsA, this._extendA, true);\n } else if (this._geometryB instanceof BSplineCurve3d) {\n this.dispatchLineStringBSplineCurve(lsA, this._extendA, this._geometryB, this._extendB, false);\n } else if (this._geometryB instanceof CurveCollection) {\n this.dispatchCurveCollection(lsA, this.handleLineString3d.bind(this));\n } else if (this._geometryB instanceof CurveChainWithDistanceIndex) {\n this.dispatchCurveChainWithDistanceIndex(lsA, this.handleLineString3d.bind(this));\n }\n return undefined;\n }\n /** Double dispatch handler for strongly typed arc. */\n public override handleArc3d(arc0: Arc3d): any {\n if (this._geometryB instanceof LineSegment3d) {\n this.dispatchSegmentArc(\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref,\n 1.0, this._extendB, arc0, this._extendA, this._extendA, true,\n );\n } else if (this._geometryB instanceof LineString3d) {\n this.computeArcLineString(arc0, this._extendA, this._geometryB, this._extendB, false);\n } else if (this._geometryB instanceof Arc3d) {\n this.dispatchArcArc(arc0, this._extendA, this._geometryB, this._extendB, false);\n } else if (this._geometryB instanceof BSplineCurve3d) {\n this.dispatchArcBsplineCurve3d(arc0, this._extendA, this._geometryB, this._extendB, false);\n } else if (this._geometryB instanceof CurveCollection) {\n this.dispatchCurveCollection(arc0, this.handleArc3d.bind(this));\n } else if (this._geometryB instanceof CurveChainWithDistanceIndex) {\n this.dispatchCurveChainWithDistanceIndex(arc0, this.handleArc3d.bind(this));\n }\n return undefined;\n }\n /** Double dispatch handler for strongly typed bspline curve. */\n public override handleBSplineCurve3d(curve: BSplineCurve3d): any {\n if (this._geometryB instanceof LineSegment3d) {\n this.dispatchSegmentBsplineCurve(\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref,\n 1.0, this._extendB, curve, this._extendA, true,\n );\n } else if (this._geometryB instanceof LineString3d) {\n this.dispatchLineStringBSplineCurve(this._geometryB, this._extendB, curve, this._extendA, true);\n } else if (this._geometryB instanceof Arc3d) {\n this.dispatchArcBsplineCurve3d(this._geometryB, this._extendB, curve, this._extendA, true);\n } else if (this._geometryB instanceof BSplineCurve3dBase) {\n this.dispatchBSplineCurve3dBSplineCurve3d(curve, this._geometryB, false);\n } else if (this._geometryB instanceof CurveCollection) {\n this.dispatchCurveCollection(curve, this.handleBSplineCurve3d.bind(this));\n } else if (this._geometryB instanceof CurveChainWithDistanceIndex) {\n this.dispatchCurveChainWithDistanceIndex(curve, this.handleBSplineCurve3d.bind(this));\n }\n return undefined;\n }\n /** Double dispatch handler for strongly typed CurveChainWithDistanceIndex. */\n public override handleCurveChainWithDistanceIndex(chain: CurveChainWithDistanceIndex): any {\n super.handleCurveChainWithDistanceIndex(chain);\n // if _geometryB is also a CurveChainWithDistanceIndex, it will already have been converted by dispatchCurveChainWithDistanceIndex\n this._results = CurveChainWithDistanceIndex.convertChildDetailToChainDetail(this._results, 0, chain, undefined, true);\n }\n /** Double dispatch handler for strongly typed homogeneous bspline curve. */\n public override handleBSplineCurve3dH(_curve: BSplineCurve3dH): any {\n /*\n // NEEDS WORK -- make \"dispatch\" methods tolerant of both 3d and 3dH\n // \"easy\" if both present BezierCurve3dH span loaders\n if (this._geometryB instanceof LineSegment3d) {\n this.dispatchSegmentBsplineCurve(\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref, 1.0, this._extendB,\n curve, this._extendA, true);\n } else if (this._geometryB instanceof LineString3d) {\n this.dispatchLineStringBSplineCurve(this._geometryB, this._extendB, curve, this._extendA, true);\n } else if (this._geometryB instanceof Arc3d) {\n this.dispatchArcBsplineCurve3d(this._geometryB, this._extendB, curve, this._extendA, true);\n }\n */\n return undefined;\n }\n}\n"]}
|
|
@@ -54,6 +54,8 @@ export declare class XY implements XAndY {
|
|
|
54
54
|
indexOfMaxAbs(): number;
|
|
55
55
|
/** Returns true if the x,y components are both small by metric metric tolerance */
|
|
56
56
|
get isAlmostZero(): boolean;
|
|
57
|
+
/** Return true if the x and y components are all exactly zero */
|
|
58
|
+
get isZero(): boolean;
|
|
57
59
|
/** Return the largest absolute value of any component */
|
|
58
60
|
maxAbs(): number;
|
|
59
61
|
/** Return the magnitude of the vector */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Point2dVector2d.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/Point2dVector2d.ts"],"names":[],"mappings":"AAKA;;GAEG;AAIH,OAAO,EAAE,eAAe,EAAY,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;GAOG;AACH,qBAAa,EAAG,YAAW,KAAK;IAC9B,kBAAkB;IACX,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB;IACX,CAAC,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACjB,GAAG,CAAC,CAAC,GAAE,MAAU,EAAE,CAAC,GAAE,MAAU;IAIvC,+BAA+B;IACxB,OAAO;IAId,SAAS,aAAa,CAAC,GAAE,MAAU,EAAE,CAAC,GAAE,MAAU;IAIlD,mCAAmC;IAC5B,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK;IAS5B,8CAA8C;IACvC,MAAM,IAAI,QAAQ,CAAC,IAAI,CAAC;IAG/B,+FAA+F;IACxF,aAAa,CA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+125,10 @@ class XY {
|
|
|
125
125
|
get isAlmostZero() {
|
|
126
126
|
return Geometry_1.Geometry.isSmallMetricDistance(this.x) && Geometry_1.Geometry.isSmallMetricDistance(this.y);
|
|
127
127
|
}
|
|
128
|
+
/** Return true if the x and y components are all exactly zero */
|
|
129
|
+
get isZero() {
|
|
130
|
+
return this.x === 0.0 && this.y === 0.0;
|
|
131
|
+
}
|
|
128
132
|
/** Return the largest absolute value of any component */
|
|
129
133
|
maxAbs() {
|
|
130
134
|
return Math.max(Math.abs(this.x), Math.abs(this.y));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Point2dVector2d.js","sourceRoot":"","sources":["../../../src/geometry3d/Point2dVector2d.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,qBAAqB;AACrB,yBAAyB;AAEzB,0CAA6E;AAC7E,mCAAgC;AAGhC;;;;;;;GAOG;AACH,MAAa,EAAE;IAKb,wBAAwB;IACjB,GAAG,CAAC,IAAY,CAAC,EAAE,IAAY,CAAC;QACrC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IACD,+BAA+B;IACxB,OAAO;QACZ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IACD,YAAsB,IAAY,CAAC,EAAE,IAAY,CAAC;QAChD,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IACD,mCAAmC;IAC5B,OAAO,CAAC,KAAa;QAC1B,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;YACjB,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,CAAC,GAAG,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,IAAI,mBAAQ,CAAC,0BAA0B,CAAC;QACtG,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACnC,MAAM,EAAE,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QACpC,IAAI,EAAE,GAAG,kBAAkB,IAAI,EAAE,GAAG,kBAAkB;YACpD,OAAO,gCAAgC,CAAC;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACnC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,kBAAkB;YAClC,OAAO,KAAK,CAAC;QACf,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACvC,4DAA4D;QAC5D,qCAAqC;QACrC,4CAA4C;QAC5C,OAAO,KAAK,GAAG,KAAK,IAAI,gBAAgB,GAAG,EAAE,GAAG,EAAE,CAAC;IACrD,CAAC;IACD;;;;;;;OAOG;IACI,iBAAiB,CACtB,KAAe,EAAE,mCAA4C,KAAK,EAAE,OAA6B;QAEjG,MAAM,gBAAgB,GAAW,OAAO,EAAE,gBAAgB,IAAI,mBAAQ,CAAC,wBAAwB,CAAC;QAChG,MAAM,kBAAkB,GAAW,OAAO,EAAE,kBAAkB,IAAI,mBAAQ,CAAC,0BAA0B,CAAC;QACtG,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACnC,MAAM,EAAE,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QACpC,IAAI,EAAE,GAAG,kBAAkB,IAAI,EAAE,GAAG,kBAAkB;YACpD,OAAO,gCAAgC,CAAC;QAC1C,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO,EAAE,GAAG,EAAE,IAAI,gBAAgB,GAAG,EAAE,GAAG,EAAE,CAAC;IAC/C,CAAC;CACF;AAzTD,4BAyTC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n// cspell:word JSONXY\n// cspell:word CWXY CCWXY\n\nimport { BeJSONFunctions, Geometry, PerpParallelOptions } from \"../Geometry\";\nimport { Angle } from \"./Angle\";\nimport { XAndY, XYProps } from \"./XYZProps\";\n\n/**\n * Minimal object containing x,y and operations that are meaningful without change in both point and vector.\n * * `XY` is not instantiable.\n * * The derived (instantiable) classes are\n * * `Point2d`\n * * `Vector2d`\n * @public\n */\nexport class XY implements XAndY {\n /** x component */\n public x: number;\n /** y component */\n public y: number;\n /** Set both x and y. */\n public set(x: number = 0, y: number = 0) {\n this.x = x;\n this.y = y;\n }\n /** Set both x and y to zero */\n public setZero() {\n this.x = 0;\n this.y = 0;\n }\n protected constructor(x: number = 0, y: number = 0) {\n this.x = x;\n this.y = y;\n }\n /** Set both x and y from other. */\n public setFrom(other?: XAndY) {\n if (other) {\n this.x = other.x;\n this.y = other.y;\n } else {\n this.x = 0;\n this.y = 0;\n }\n }\n /** Freeze this instance so it is read-only */\n public freeze(): Readonly<this> {\n return Object.freeze(this);\n }\n /** Returns true if this and other have equal x,y parts within Geometry.smallMetricDistance. */\n public isAlmostEqual(other: XAndY, tol?: number): boolean {\n return Geometry.isSameCoordinate(this.x, other.x, tol) && Geometry.isSameCoordinate(this.y, other.y, tol);\n }\n /** Returns true if this and other have equal x,y parts within Geometry.smallMetricDistance. */\n public isAlmostEqualXY(x: number, y: number, tol?: number): boolean {\n return Geometry.isSameCoordinate(this.x, x, tol) && Geometry.isSameCoordinate(this.y, y, tol);\n }\n /** Return a json array `[x,y]` */\n public toJSON(): XYProps {\n return [this.x, this.y];\n }\n /** Return a json object `{x: 1, y:2}` */\n public toJSONXY(): XYProps {\n return { x: this.x, y: this.y };\n }\n /**\n * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`\n * * If no JSON input is provided, 0 would be used as default values for x and y.\n * @param json the JSON input\n */\n public setFromJSON(json?: XYProps): void {\n if (Array.isArray(json)) {\n this.set(json[0] || 0, json[1] || 0);\n return;\n }\n if (json) {\n this.set(json.x || 0, json.y || 0);\n return;\n }\n this.set(0, 0);\n }\n /** Return the distance from this point to other */\n public distance(other: XAndY): number {\n const xDist = other.x - this.x;\n const yDist = other.y - this.y;\n return Math.sqrt(xDist * xDist + yDist * yDist);\n }\n /** Return squared distance from this point to other */\n public distanceSquared(other: XAndY): number {\n const xDist = other.x - this.x;\n const yDist = other.y - this.y;\n return xDist * xDist + yDist * yDist;\n }\n /** Return the largest absolute distance between corresponding components */\n public maxDiff(other: XAndY): number {\n return Math.max(Math.abs(this.x - other.x), Math.abs(this.y - other.y));\n }\n /** Return the x,y component corresponding to 0,1 */\n public at(index: number): number {\n if (index < 0.5)\n return this.x;\n return this.y;\n }\n /** Set value at index 0 or 1 */\n public setAt(index: number, value: number): void {\n if (index < 0.5)\n this.x = value;\n else\n this.y = value;\n }\n /** Return the index (0,1) of the x,y component with largest absolute value */\n public indexOfMaxAbs(): number {\n let index = 0;\n const a = Math.abs(this.x);\n const b = Math.abs(this.y);\n if (b > a) {\n index = 1;\n }\n return index;\n }\n /** Returns true if the x,y components are both small by metric metric tolerance */\n public get isAlmostZero(): boolean {\n return Geometry.isSmallMetricDistance(this.x) && Geometry.isSmallMetricDistance(this.y);\n }\n /** Return the largest absolute value of any component */\n public maxAbs(): number {\n return Math.max(Math.abs(this.x), Math.abs(this.y));\n }\n /** Return the magnitude of the vector */\n public magnitude(): number {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }\n /** Return the squared magnitude of the vector. */\n public magnitudeSquared(): number {\n return this.x * this.x + this.y * this.y;\n }\n /** Returns true if the x,y components are exactly equal. */\n public isExactEqual(other: XAndY): boolean {\n return this.x === other.x && this.y === other.y;\n }\n /** Returns true if x,y match `other` within metric tolerance */\n public isAlmostEqualMetric(other: XAndY, distanceTol: number = Geometry.smallMetricDistance): boolean {\n return this.maxDiff(other) <= distanceTol;\n }\n /** Return a (full length) vector from this point to other */\n public vectorTo(other: XAndY, result?: Vector2d): Vector2d {\n return Vector2d.create(\n other.x - this.x,\n other.y - this.y,\n result);\n }\n /** Return a unit vector from this point to other */\n public unitVectorTo(other: XAndY, result?: Vector2d): Vector2d | undefined {\n return this.vectorTo(other, result).normalize(result);\n }\n /** Cross product of vectors from origin to targets */\n public static crossProductToPoints(origin: XAndY, targetA: XAndY, targetB: XAndY): number {\n return Geometry.crossProductXYXY(\n targetA.x - origin.x, targetA.y - origin.y, targetB.x - origin.x, targetB.y - origin.y);\n }\n}\n\n/** 2D point with `x`,`y` as properties\n * @public\n */\nexport class Point2d extends XY implements BeJSONFunctions {\n /** Constructor for Point2d */\n constructor(x: number = 0, y: number = 0) {\n super(x, y);\n }\n /** Return a new Point2d with x,y coordinates from this. */\n public clone(result?: Point2d): Point2d {\n return Point2d.create(this.x, this.y, result);\n }\n /**\n * Return a point (newly created unless result provided) with given x,y coordinates\n * @param x x coordinate\n * @param y y coordinate\n * @param result optional result\n */\n public static create(x: number = 0, y: number = 0, result?: Point2d): Point2d {\n if (result) {\n result.x = x;\n result.y = y;\n return result;\n }\n return new Point2d(x, y);\n }\n /**\n * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`\n * * If no JSON input is provided, 0 would be used as default values for x and y.\n * @param json the JSON input\n */\n public static fromJSON(json?: XYProps): Point2d {\n const val = new Point2d();\n val.setFromJSON(json);\n return val;\n }\n /** Create (or optionally reuse) a Point2d from another object with fields x and y */\n public static createFrom(xy: XAndY | undefined, result?: Point2d): Point2d {\n if (xy)\n return Point2d.create(xy.x, xy.y, result);\n return Point2d.create(0, 0, result);\n }\n /** Create a Point2d with both coordinates zero. */\n public static createZero(result?: Point2d): Point2d {\n return Point2d.create(0, 0, result);\n }\n /**\n * Starting at this point, move along `vector` by `tangentFraction` of its length, and then\n * by `leftFraction` of its length along the left perpendicular.\n * @param tangentFraction distance to move along `vector`, as a fraction of its length\n * @param leftFraction distance to move perpendicular to `vector`, as a fraction of its length\n * @param vector the other vector\n */\n public addForwardLeft(tangentFraction: number, leftFraction: number, vector: Vector2d, result?: Point2d): Point2d {\n const dx = vector.x;\n const dy = vector.y;\n return Point2d.create(\n this.x + tangentFraction * dx - leftFraction * dy,\n this.y + tangentFraction * dy + leftFraction * dx,\n result,\n );\n }\n /**\n * Interpolate at tangentFraction between this instance and point, and then Move by leftFraction\n * along the xy perpendicular of the vector between the points.\n */\n public forwardLeftInterpolate(tangentFraction: number, leftFraction: number, point: XAndY): Point2d {\n const dx = point.x - this.x;\n const dy = point.y - this.y;\n return Point2d.create(\n this.x + tangentFraction * dx - leftFraction * dy,\n this.y + tangentFraction * dy + leftFraction * dx,\n );\n }\n /** Return a point interpolated between this point and the right param. */\n public interpolate(fraction: number, other: XAndY, result?: Point2d): Point2d {\n if (fraction <= 0.5)\n return Point2d.create(\n this.x + fraction * (other.x - this.x),\n this.y + fraction * (other.y - this.y),\n result,\n );\n const t: number = fraction - 1.0;\n return Point2d.create(\n other.x + t * (other.x - this.x),\n other.y + t * (other.y - this.y),\n result,\n );\n }\n /** Return a point with independent x,y fractional interpolation. */\n public interpolateXY(fractionX: number, fractionY: number, other: XAndY, result?: Point2d): Point2d {\n return Point2d.create(\n Geometry.interpolate(this.x, fractionX, other.x),\n Geometry.interpolate(this.y, fractionY, other.y),\n result,\n );\n }\n /** Return this point minus vector */\n public minus(vector: XAndY, result?: Point2d): Point2d {\n return Point2d.create(\n this.x - vector.x,\n this.y - vector.y,\n result,\n );\n }\n /** Return point plus vector */\n public plus(vector: XAndY, result?: Point2d): Point2d {\n return Point2d.create(\n this.x + vector.x,\n this.y + vector.y,\n result,\n );\n }\n /** Return point plus vector */\n public plusXY(dx: number = 0, dy: number = 0, result?: Point2d): Point2d {\n return Point2d.create(\n this.x + dx,\n this.y + dy, result,\n );\n }\n /** Return point + vector * scalar */\n public plusScaled(vector: XAndY, scaleFactor: number, result?: Point2d): Point2d {\n return Point2d.create(\n this.x + vector.x * scaleFactor,\n this.y + vector.y * scaleFactor,\n result,\n );\n }\n /** Return point + vectorA * scalarA + vectorB * scalarB */\n public plus2Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number, result?: Point2d): Point2d {\n return Point2d.create(\n this.x + vectorA.x * scalarA + vectorB.x * scalarB,\n this.y + vectorA.y * scalarA + vectorB.y * scalarB,\n result,\n );\n }\n /** Return point + vectorA * scalarA + vectorB * scalarB + vectorC * scalarC */\n public plus3Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number,\n vectorC: XAndY, scalarC: number, result?: Point2d): Point2d {\n return Point2d.create(\n this.x + vectorA.x * scalarA + vectorB.x * scalarB + vectorC.x * scalarC,\n this.y + vectorA.y * scalarA + vectorB.y * scalarB + vectorC.y * scalarC,\n result,\n );\n }\n /** Multiply the x, y parts by scale. */\n public scaleInPlace(scale: number) {\n this.x *= scale;\n this.y *= scale;\n }\n /**\n * Return the dot product of vector from this to targetA and vector from this to targetB\n * @param targetA target of first vector\n * @param targetB target of second vector\n */\n public dotVectorsToTargets(targetA: XAndY, targetB: XAndY): number {\n return (targetA.x - this.x) * (targetB.x - this.x) + (targetA.y - this.y) * (targetB.y - this.y);\n }\n /**\n * Returns the (scalar) cross product of vector from this to targetA and vector from this to targetB\n * @param target1 target of first vector\n * @param target2 target of second vector\n */\n public crossProductToPoints(target1: XAndY, target2: XAndY): number {\n const x1 = target1.x - this.x;\n const y1 = target1.y - this.y;\n const x2 = target2.x - this.x;\n const y2 = target2.y - this.y;\n return x1 * y2 - y1 * x2;\n }\n /**\n * Return the fractional coordinate of the projection of this instance x,y onto the\n * line from startPoint to endPoint.\n * @param startPoint start point of line\n * @param endPoint end point of line\n * @param defaultFraction fraction to return if startPoint and endPoint are equal.\n */\n public fractionOfProjectionToLine(startPoint: Point2d, endPoint: Point2d, defaultFraction: number = 0): number {\n const denominator = startPoint.distanceSquared(endPoint);\n if (denominator < Geometry.smallMetricDistanceSquared)\n return defaultFraction;\n const numerator = startPoint.dotVectorsToTargets(endPoint, this);\n return numerator / denominator;\n }\n}\n\n/**\n * 2D vector with `x`,`y` as properties\n * @public\n */\nexport class Vector2d extends XY implements BeJSONFunctions {\n constructor(x: number = 0, y: number = 0) {\n super(x, y);\n }\n /** Return a new Vector2d with the same x,y */\n public clone(result?: Vector2d): Vector2d {\n return Vector2d.create(this.x, this.y, result);\n }\n /** Return a new Vector2d with given x and y */\n public static create(x: number = 0, y: number = 0, result?: Vector2d): Vector2d {\n if (result) {\n result.x = x;\n result.y = y;\n return result;\n }\n return new Vector2d(x, y);\n }\n /**\n * Return a (new) Vector2d with components scale,0\n * If scale is not given default value 1 is used.\n */\n public static unitX(scale: number = 1): Vector2d {\n return new Vector2d(scale, 0);\n }\n /**\n * Return a (new) Vector2d with components 0,scale\n * If scale is not given default value 1 is used.\n */\n public static unitY(scale: number = 1): Vector2d {\n return new Vector2d(0, scale);\n }\n /** Return a Vector2d with components 0,0 */\n public static createZero(result?: Vector2d): Vector2d {\n return Vector2d.create(0, 0, result);\n }\n /** Copy contents from another Point3d, Point2d, Vector2d, or Vector3d, or leading entries of Float64Array */\n public static createFrom(data: XAndY | Float64Array, result?: Vector2d): Vector2d {\n if (data instanceof Float64Array) {\n if (data.length >= 2)\n return Vector2d.create(data[0], data[1]);\n if (data.length >= 1)\n return Vector2d.create(data[0], 0);\n return Vector2d.create(0, 0);\n }\n return Vector2d.create(data.x, data.y, result);\n }\n /**\n * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`\n * * If no JSON input is provided, 0 would be used as default values for x and y.\n * @param json the JSON input\n */\n public static fromJSON(json?: XYProps): Vector2d {\n const val = new Vector2d();\n val.setFromJSON(json);\n return val;\n }\n /** Return a new Vector2d from polar coordinates for radius and Angle from x axis */\n public static createPolar(r: number, theta: Angle): Vector2d {\n return Vector2d.create(r * theta.cos(), r * theta.sin());\n }\n /** Return a new Vector2d extending from point0 to point1 */\n public static createStartEnd(point0: XAndY, point1: XAndY, result?: Vector2d): Vector2d {\n return Vector2d.create(point1.x - point0.x, point1.y - point0.y, result);\n }\n /**\n * Return a vector that bisects the angle between two normals and extends to the intersection of two offset lines\n * * returns `undefined` if `unitPerpA = -unitPerpB` (i.e., are opposite)\n * * math details can be found at docs/learning/geometry/PointVector.md\n * @param unitPerpA unit perpendicular to incoming direction\n * @param unitPerpB unit perpendicular to outgoing direction\n * @param offset offset distance\n */\n public static createOffsetBisector(unitPerpA: Vector2d, unitPerpB: Vector2d, offset: number): Vector2d | undefined {\n let bisector: Vector2d | undefined = unitPerpA.plus(unitPerpB);\n bisector = bisector.normalize();\n if (bisector) {\n const c = bisector.dotProduct(unitPerpA);\n bisector.scale(offset, bisector);\n return bisector.safeDivideOrNull(c);\n }\n return undefined;\n }\n /**\n * Return a (new or optionally reused) vector which is `this` divided by `denominator`\n * * return undefined if denominator is zero.\n */\n public safeDivideOrNull(denominator: number, result?: Vector2d): Vector2d | undefined {\n if (denominator !== 0.0) {\n return this.scale(1.0 / denominator, result);\n }\n return undefined;\n }\n /** Return a unit vector in direction of this instance (undefined if this instance has near zero length) */\n public normalize(result?: Vector2d): Vector2d | undefined {\n const mag = Geometry.correctSmallFraction(this.magnitude());\n result = result ? result : new Vector2d();\n return this.safeDivideOrNull(mag, result);\n }\n /**\n * Return fractional length of the projection of the instance onto the target vector.\n * @param target the target vector\n * @param defaultFraction the returned value in case the magnitude of `target` is too small\n * @returns the signed length of the projection divided by the length of `target`\n */\n public fractionOfProjectionToVector(target: Vector2d, defaultFraction?: number): number {\n /*\n * projection length is (this.target)/||target||\n * but here we return (this.target)/||target||^2\n */\n const denominator = target.magnitudeSquared();\n if (denominator < Geometry.smallMetricDistanceSquared)\n return defaultFraction ? defaultFraction : 0;\n const numerator = this.dotProduct(target);\n return numerator / denominator;\n }\n /** Return a new vector with components negated from this instance. */\n public negate(result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n result.x = -this.x;\n result.y = -this.y;\n return result;\n }\n /** Return a vector same length as this but rotated 90 degrees counter clockwise */\n public rotate90CCWXY(result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\n const xx: number = this.x;\n const yy: number = this.y;\n result.x = -yy;\n result.y = xx;\n return result;\n }\n /** Return a vector same length as this but rotated 90 degrees clockwise */\n public rotate90CWXY(result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\n const xx: number = this.x;\n const yy: number = this.y;\n result.x = yy;\n result.y = -xx;\n return result;\n }\n /** Return a unit vector perpendicular to this instance. */\n public unitPerpendicularXY(result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n const xx: number = this.x;\n const yy: number = this.y;\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\n result.x = -yy;\n result.y = xx;\n const d2: number = xx * xx + yy * yy;\n if (d2 !== 0.0) {\n const a = 1.0 / Math.sqrt(d2);\n result.x *= a;\n result.y *= a;\n }\n return result;\n }\n /** Return a new Vector2d rotated CCW by given angle */\n public rotateXY(angle: Angle, result?: Vector2d): Vector2d {\n const s = angle.sin();\n const c = angle.cos();\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\n const xx: number = this.x;\n const yy: number = this.y;\n result = result ? result : new Vector2d();\n result.x = xx * c - yy * s;\n result.y = xx * s + yy * c;\n return result;\n }\n /**\n * Return a vector computed at fractional position between this vector and vectorB\n * @param fraction fractional position. 0 is at `this`. 1 is at `vectorB`.\n * True fractions are \"between\", negatives are \"before this\", beyond 1 is \"beyond vectorB\".\n * @param vectorB second vector\n * @param result optional preallocated result.\n */\n public interpolate(fraction: number, vectorB: Vector2d, result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n /*\n * For best last-bit behavior, if fraction is below 0.5, use this as base point.\n * If above 0.5, use vectorB as base point.\n */\n if (fraction <= 0.5) {\n result.x = this.x + fraction * (vectorB.x - this.x);\n result.y = this.y + fraction * (vectorB.y - this.y);\n } else {\n const t: number = fraction - 1.0;\n result.x = vectorB.x + t * (vectorB.x - this.x);\n result.y = vectorB.y + t * (vectorB.y - this.y);\n }\n return result;\n }\n /** Return {this + vector}. */\n public plus(vector: XAndY, result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n result.x = this.x + vector.x;\n result.y = this.y + vector.y;\n return result;\n }\n /** Return {this - vector}. */\n public minus(vector: XAndY, result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n result.x = this.x - vector.x;\n result.y = this.y - vector.y;\n return result;\n }\n /** Return {point + vector \\* scalar} */\n public plusScaled(vector: XAndY, scaleFactor: number, result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n result.x = this.x + vector.x * scaleFactor;\n result.y = this.y + vector.y * scaleFactor;\n return result;\n }\n /** Return {point + vectorA \\* scalarA + vectorB \\* scalarB} */\n public plus2Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number, result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n result.x = this.x + vectorA.x * scalarA + vectorB.x * scalarB;\n result.y = this.y + vectorA.y * scalarA + vectorB.y * scalarB;\n return result;\n }\n /** Return {this + vectorA \\* scalarA + vectorB \\* scalarB + vectorC \\* scalarC} */\n public plus3Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number, vectorC: XAndY, scalarC: number, result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n result.x = this.x + vectorA.x * scalarA + vectorB.x * scalarB + vectorC.x * scalarC;\n result.y = this.y + vectorA.y * scalarA + vectorB.y * scalarB + vectorC.y * scalarC;\n return result;\n }\n /** Return {this * scale} */\n public scale(scale: number, result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n result.x = this.x * scale;\n result.y = this.y * scale;\n return result;\n }\n /** Return a vector parallel to this but with specified length */\n public scaleToLength(length: number, result?: Vector2d): Vector2d | undefined {\n const mag = Geometry.correctSmallFraction(this.magnitude());\n if (mag === 0)\n return undefined;\n return this.scale(length / mag, result);\n }\n /** Return the dot product of this with vectorB */\n public dotProduct(vectorB: XAndY): number {\n return this.x * vectorB.x + this.y * vectorB.y;\n }\n /** Dot product with vector from pointA to pointB */\n public dotProductStartEnd(pointA: XAndY, pointB: XAndY): number {\n return this.x * (pointB.x - pointA.x) + this.y * (pointB.y - pointA.y);\n }\n /** Vector cross product {this CROSS vectorB} */\n public crossProduct(vectorB: XAndY): number {\n return this.x * vectorB.y - this.y * vectorB.x;\n }\n /**\n * Return the radians (as a simple number, not strongly typed Angle) signed angle from this to vectorB.\n * This is positive if the shortest turn is counterclockwise, negative if clockwise.\n */\n public radiansTo(vectorB: XAndY): number {\n return Math.atan2(this.crossProduct(vectorB), this.dotProduct(vectorB));\n }\n /**\n * Return the (strongly typed) signed angle from this to vectorB.\n * This is positive if the shortest turn is counterclockwise, negative if clockwise.\n */\n public angleTo(vectorB: XAndY): Angle {\n return Angle.createRadians(this.radiansTo(vectorB));\n }\n /**\n * Test if this vector is parallel to other.\n * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,\n * so if you have a distance or angle tolerance t, you should pass in t * t.\n * @param other second vector for comparison.\n * @param oppositeIsParallel whether to consider diametrically opposed vectors as parallel.\n * @param options optional radian and distance tolerances.\n */\n public isParallelTo(other: Vector2d, oppositeIsParallel: boolean = false,\n returnValueIfAnInputIsZeroLength: boolean = false, options?: PerpParallelOptions): boolean {\n const radianSquaredTol: number = options?.radianSquaredTol ?? Geometry.smallAngleRadiansSquared;\n const distanceSquaredTol: number = options?.distanceSquaredTol ?? Geometry.smallMetricDistanceSquared;\n const a2 = this.magnitudeSquared();\n const b2 = other.magnitudeSquared();\n if (a2 < distanceSquaredTol || b2 < distanceSquaredTol)\n return returnValueIfAnInputIsZeroLength;\n const dot = this.dotProduct(other);\n if (dot < 0.0 && !oppositeIsParallel)\n return false;\n const cross = this.crossProduct(other);\n /* a2,b2,cross2 are squared lengths of respective vectors */\n /* cross2 = sin^2(theta) * a2 * b2 */\n /* For small theta, sin^2(theta)~~theta^2 */\n return cross * cross <= radianSquaredTol * a2 * b2;\n }\n /**\n * Test if this vector is perpendicular to other.\n * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,\n * so if you have a distance or angle tolerance t, you should pass in t * t.\n * @param other second vector in comparison.\n * @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.\n * @param options optional radian and distance tolerances.\n */\n public isPerpendicularTo(\n other: Vector2d, returnValueIfAnInputIsZeroLength: boolean = false, options?: PerpParallelOptions,\n ): boolean {\n const radianSquaredTol: number = options?.radianSquaredTol ?? Geometry.smallAngleRadiansSquared;\n const distanceSquaredTol: number = options?.distanceSquaredTol ?? Geometry.smallMetricDistanceSquared;\n const aa = this.magnitudeSquared();\n const bb = other.magnitudeSquared();\n if (aa < distanceSquaredTol || bb < distanceSquaredTol)\n return returnValueIfAnInputIsZeroLength;\n const ab = this.dotProduct(other);\n return ab * ab <= radianSquaredTol * aa * bb;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Point2dVector2d.js","sourceRoot":"","sources":["../../../src/geometry3d/Point2dVector2d.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,qBAAqB;AACrB,yBAAyB;AAEzB,0CAA6E;AAC7E,mCAAgC;AAGhC;;;;;;;GAOG;AACH,MAAa,EAAE;IAKb,wBAAwB;IACjB,GAAG,CAAC,IAAY,CAAC,EAAE,IAAY,CAAC;QACrC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IACD,+BAA+B;IACxB,OAAO;QACZ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IACD,YAAsB,IAAY,CAAC,EAAE,IAAY,CAAC;QAChD,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,I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AE,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACnC,MAAM,EAAE,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QACpC,IAAI,EAAE,GAAG,kBAAkB,IAAI,EAAE,GAAG,kBAAkB;YACpD,OAAO,gCAAgC,CAAC;QAC1C,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO,EAAE,GAAG,EAAE,IAAI,gBAAgB,GAAG,EAAE,GAAG,EAAE,CAAC;IAC/C,CAAC;CACF;AAzTD,4BAyTC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n// cspell:word JSONXY\n// cspell:word CWXY CCWXY\n\nimport { BeJSONFunctions, Geometry, PerpParallelOptions } from \"../Geometry\";\nimport { Angle } from \"./Angle\";\nimport { XAndY, XYProps } from \"./XYZProps\";\n\n/**\n * Minimal object containing x,y and operations that are meaningful without change in both point and vector.\n * * `XY` is not instantiable.\n * * The derived (instantiable) classes are\n * * `Point2d`\n * * `Vector2d`\n * @public\n */\nexport class XY implements XAndY {\n /** x component */\n public x: number;\n /** y component */\n public y: number;\n /** Set both x and y. */\n public set(x: number = 0, y: number = 0) {\n this.x = x;\n this.y = y;\n }\n /** Set both x and y to zero */\n public setZero() {\n this.x = 0;\n this.y = 0;\n }\n protected constructor(x: number = 0, y: number = 0) {\n this.x = x;\n this.y = y;\n }\n /** Set both x and y from other. */\n public setFrom(other?: XAndY) {\n if (other) {\n this.x = other.x;\n this.y = other.y;\n } else {\n this.x = 0;\n this.y = 0;\n }\n }\n /** Freeze this instance so it is read-only */\n public freeze(): Readonly<this> {\n return Object.freeze(this);\n }\n /** Returns true if this and other have equal x,y parts within Geometry.smallMetricDistance. */\n public isAlmostEqual(other: XAndY, tol?: number): boolean {\n return Geometry.isSameCoordinate(this.x, other.x, tol) && Geometry.isSameCoordinate(this.y, other.y, tol);\n }\n /** Returns true if this and other have equal x,y parts within Geometry.smallMetricDistance. */\n public isAlmostEqualXY(x: number, y: number, tol?: number): boolean {\n return Geometry.isSameCoordinate(this.x, x, tol) && Geometry.isSameCoordinate(this.y, y, tol);\n }\n /** Return a json array `[x,y]` */\n public toJSON(): XYProps {\n return [this.x, this.y];\n }\n /** Return a json object `{x: 1, y:2}` */\n public toJSONXY(): XYProps {\n return { x: this.x, y: this.y };\n }\n /**\n * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`\n * * If no JSON input is provided, 0 would be used as default values for x and y.\n * @param json the JSON input\n */\n public setFromJSON(json?: XYProps): void {\n if (Array.isArray(json)) {\n this.set(json[0] || 0, json[1] || 0);\n return;\n }\n if (json) {\n this.set(json.x || 0, json.y || 0);\n return;\n }\n this.set(0, 0);\n }\n /** Return the distance from this point to other */\n public distance(other: XAndY): number {\n const xDist = other.x - this.x;\n const yDist = other.y - this.y;\n return Math.sqrt(xDist * xDist + yDist * yDist);\n }\n /** Return squared distance from this point to other */\n public distanceSquared(other: XAndY): number {\n const xDist = other.x - this.x;\n const yDist = other.y - this.y;\n return xDist * xDist + yDist * yDist;\n }\n /** Return the largest absolute distance between corresponding components */\n public maxDiff(other: XAndY): number {\n return Math.max(Math.abs(this.x - other.x), Math.abs(this.y - other.y));\n }\n /** Return the x,y component corresponding to 0,1 */\n public at(index: number): number {\n if (index < 0.5)\n return this.x;\n return this.y;\n }\n /** Set value at index 0 or 1 */\n public setAt(index: number, value: number): void {\n if (index < 0.5)\n this.x = value;\n else\n this.y = value;\n }\n /** Return the index (0,1) of the x,y component with largest absolute value */\n public indexOfMaxAbs(): number {\n let index = 0;\n const a = Math.abs(this.x);\n const b = Math.abs(this.y);\n if (b > a) {\n index = 1;\n }\n return index;\n }\n /** Returns true if the x,y components are both small by metric metric tolerance */\n public get isAlmostZero(): boolean {\n return Geometry.isSmallMetricDistance(this.x) && Geometry.isSmallMetricDistance(this.y);\n }\n /** Return true if the x and y components are all exactly zero */\n public get isZero(): boolean {\n return this.x === 0.0 && this.y === 0.0;\n }\n /** Return the largest absolute value of any component */\n public maxAbs(): number {\n return Math.max(Math.abs(this.x), Math.abs(this.y));\n }\n /** Return the magnitude of the vector */\n public magnitude(): number {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }\n /** Return the squared magnitude of the vector. */\n public magnitudeSquared(): number {\n return this.x * this.x + this.y * this.y;\n }\n /** Returns true if the x,y components are exactly equal. */\n public isExactEqual(other: XAndY): boolean {\n return this.x === other.x && this.y === other.y;\n }\n /** Returns true if x,y match `other` within metric tolerance */\n public isAlmostEqualMetric(other: XAndY, distanceTol: number = Geometry.smallMetricDistance): boolean {\n return this.maxDiff(other) <= distanceTol;\n }\n /** Return a (full length) vector from this point to other */\n public vectorTo(other: XAndY, result?: Vector2d): Vector2d {\n return Vector2d.create(\n other.x - this.x,\n other.y - this.y,\n result);\n }\n /** Return a unit vector from this point to other */\n public unitVectorTo(other: XAndY, result?: Vector2d): Vector2d | undefined {\n return this.vectorTo(other, result).normalize(result);\n }\n /** Cross product of vectors from origin to targets */\n public static crossProductToPoints(origin: XAndY, targetA: XAndY, targetB: XAndY): number {\n return Geometry.crossProductXYXY(\n targetA.x - origin.x, targetA.y - origin.y, targetB.x - origin.x, targetB.y - origin.y);\n }\n}\n\n/** 2D point with `x`,`y` as properties\n * @public\n */\nexport class Point2d extends XY implements BeJSONFunctions {\n /** Constructor for Point2d */\n constructor(x: number = 0, y: number = 0) {\n super(x, y);\n }\n /** Return a new Point2d with x,y coordinates from this. */\n public clone(result?: Point2d): Point2d {\n return Point2d.create(this.x, this.y, result);\n }\n /**\n * Return a point (newly created unless result provided) with given x,y coordinates\n * @param x x coordinate\n * @param y y coordinate\n * @param result optional result\n */\n public static create(x: number = 0, y: number = 0, result?: Point2d): Point2d {\n if (result) {\n result.x = x;\n result.y = y;\n return result;\n }\n return new Point2d(x, y);\n }\n /**\n * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`\n * * If no JSON input is provided, 0 would be used as default values for x and y.\n * @param json the JSON input\n */\n public static fromJSON(json?: XYProps): Point2d {\n const val = new Point2d();\n val.setFromJSON(json);\n return val;\n }\n /** Create (or optionally reuse) a Point2d from another object with fields x and y */\n public static createFrom(xy: XAndY | undefined, result?: Point2d): Point2d {\n if (xy)\n return Point2d.create(xy.x, xy.y, result);\n return Point2d.create(0, 0, result);\n }\n /** Create a Point2d with both coordinates zero. */\n public static createZero(result?: Point2d): Point2d {\n return Point2d.create(0, 0, result);\n }\n /**\n * Starting at this point, move along `vector` by `tangentFraction` of its length, and then\n * by `leftFraction` of its length along the left perpendicular.\n * @param tangentFraction distance to move along `vector`, as a fraction of its length\n * @param leftFraction distance to move perpendicular to `vector`, as a fraction of its length\n * @param vector the other vector\n */\n public addForwardLeft(tangentFraction: number, leftFraction: number, vector: Vector2d, result?: Point2d): Point2d {\n const dx = vector.x;\n const dy = vector.y;\n return Point2d.create(\n this.x + tangentFraction * dx - leftFraction * dy,\n this.y + tangentFraction * dy + leftFraction * dx,\n result,\n );\n }\n /**\n * Interpolate at tangentFraction between this instance and point, and then Move by leftFraction\n * along the xy perpendicular of the vector between the points.\n */\n public forwardLeftInterpolate(tangentFraction: number, leftFraction: number, point: XAndY): Point2d {\n const dx = point.x - this.x;\n const dy = point.y - this.y;\n return Point2d.create(\n this.x + tangentFraction * dx - leftFraction * dy,\n this.y + tangentFraction * dy + leftFraction * dx,\n );\n }\n /** Return a point interpolated between this point and the right param. */\n public interpolate(fraction: number, other: XAndY, result?: Point2d): Point2d {\n if (fraction <= 0.5)\n return Point2d.create(\n this.x + fraction * (other.x - this.x),\n this.y + fraction * (other.y - this.y),\n result,\n );\n const t: number = fraction - 1.0;\n return Point2d.create(\n other.x + t * (other.x - this.x),\n other.y + t * (other.y - this.y),\n result,\n );\n }\n /** Return a point with independent x,y fractional interpolation. */\n public interpolateXY(fractionX: number, fractionY: number, other: XAndY, result?: Point2d): Point2d {\n return Point2d.create(\n Geometry.interpolate(this.x, fractionX, other.x),\n Geometry.interpolate(this.y, fractionY, other.y),\n result,\n );\n }\n /** Return this point minus vector */\n public minus(vector: XAndY, result?: Point2d): Point2d {\n return Point2d.create(\n this.x - vector.x,\n this.y - vector.y,\n result,\n );\n }\n /** Return point plus vector */\n public plus(vector: XAndY, result?: Point2d): Point2d {\n return Point2d.create(\n this.x + vector.x,\n this.y + vector.y,\n result,\n );\n }\n /** Return point plus vector */\n public plusXY(dx: number = 0, dy: number = 0, result?: Point2d): Point2d {\n return Point2d.create(\n this.x + dx,\n this.y + dy, result,\n );\n }\n /** Return point + vector * scalar */\n public plusScaled(vector: XAndY, scaleFactor: number, result?: Point2d): Point2d {\n return Point2d.create(\n this.x + vector.x * scaleFactor,\n this.y + vector.y * scaleFactor,\n result,\n );\n }\n /** Return point + vectorA * scalarA + vectorB * scalarB */\n public plus2Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number, result?: Point2d): Point2d {\n return Point2d.create(\n this.x + vectorA.x * scalarA + vectorB.x * scalarB,\n this.y + vectorA.y * scalarA + vectorB.y * scalarB,\n result,\n );\n }\n /** Return point + vectorA * scalarA + vectorB * scalarB + vectorC * scalarC */\n public plus3Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number,\n vectorC: XAndY, scalarC: number, result?: Point2d): Point2d {\n return Point2d.create(\n this.x + vectorA.x * scalarA + vectorB.x * scalarB + vectorC.x * scalarC,\n this.y + vectorA.y * scalarA + vectorB.y * scalarB + vectorC.y * scalarC,\n result,\n );\n }\n /** Multiply the x, y parts by scale. */\n public scaleInPlace(scale: number) {\n this.x *= scale;\n this.y *= scale;\n }\n /**\n * Return the dot product of vector from this to targetA and vector from this to targetB\n * @param targetA target of first vector\n * @param targetB target of second vector\n */\n public dotVectorsToTargets(targetA: XAndY, targetB: XAndY): number {\n return (targetA.x - this.x) * (targetB.x - this.x) + (targetA.y - this.y) * (targetB.y - this.y);\n }\n /**\n * Returns the (scalar) cross product of vector from this to targetA and vector from this to targetB\n * @param target1 target of first vector\n * @param target2 target of second vector\n */\n public crossProductToPoints(target1: XAndY, target2: XAndY): number {\n const x1 = target1.x - this.x;\n const y1 = target1.y - this.y;\n const x2 = target2.x - this.x;\n const y2 = target2.y - this.y;\n return x1 * y2 - y1 * x2;\n }\n /**\n * Return the fractional coordinate of the projection of this instance x,y onto the\n * line from startPoint to endPoint.\n * @param startPoint start point of line\n * @param endPoint end point of line\n * @param defaultFraction fraction to return if startPoint and endPoint are equal.\n */\n public fractionOfProjectionToLine(startPoint: Point2d, endPoint: Point2d, defaultFraction: number = 0): number {\n const denominator = startPoint.distanceSquared(endPoint);\n if (denominator < Geometry.smallMetricDistanceSquared)\n return defaultFraction;\n const numerator = startPoint.dotVectorsToTargets(endPoint, this);\n return numerator / denominator;\n }\n}\n\n/**\n * 2D vector with `x`,`y` as properties\n * @public\n */\nexport class Vector2d extends XY implements BeJSONFunctions {\n constructor(x: number = 0, y: number = 0) {\n super(x, y);\n }\n /** Return a new Vector2d with the same x,y */\n public clone(result?: Vector2d): Vector2d {\n return Vector2d.create(this.x, this.y, result);\n }\n /** Return a new Vector2d with given x and y */\n public static create(x: number = 0, y: number = 0, result?: Vector2d): Vector2d {\n if (result) {\n result.x = x;\n result.y = y;\n return result;\n }\n return new Vector2d(x, y);\n }\n /**\n * Return a (new) Vector2d with components scale,0\n * If scale is not given default value 1 is used.\n */\n public static unitX(scale: number = 1): Vector2d {\n return new Vector2d(scale, 0);\n }\n /**\n * Return a (new) Vector2d with components 0,scale\n * If scale is not given default value 1 is used.\n */\n public static unitY(scale: number = 1): Vector2d {\n return new Vector2d(0, scale);\n }\n /** Return a Vector2d with components 0,0 */\n public static createZero(result?: Vector2d): Vector2d {\n return Vector2d.create(0, 0, result);\n }\n /** Copy contents from another Point3d, Point2d, Vector2d, or Vector3d, or leading entries of Float64Array */\n public static createFrom(data: XAndY | Float64Array, result?: Vector2d): Vector2d {\n if (data instanceof Float64Array) {\n if (data.length >= 2)\n return Vector2d.create(data[0], data[1]);\n if (data.length >= 1)\n return Vector2d.create(data[0], 0);\n return Vector2d.create(0, 0);\n }\n return Vector2d.create(data.x, data.y, result);\n }\n /**\n * Set x and y from a JSON input such as `[1,2]` or `{x:1, y:2}`\n * * If no JSON input is provided, 0 would be used as default values for x and y.\n * @param json the JSON input\n */\n public static fromJSON(json?: XYProps): Vector2d {\n const val = new Vector2d();\n val.setFromJSON(json);\n return val;\n }\n /** Return a new Vector2d from polar coordinates for radius and Angle from x axis */\n public static createPolar(r: number, theta: Angle): Vector2d {\n return Vector2d.create(r * theta.cos(), r * theta.sin());\n }\n /** Return a new Vector2d extending from point0 to point1 */\n public static createStartEnd(point0: XAndY, point1: XAndY, result?: Vector2d): Vector2d {\n return Vector2d.create(point1.x - point0.x, point1.y - point0.y, result);\n }\n /**\n * Return a vector that bisects the angle between two normals and extends to the intersection of two offset lines\n * * returns `undefined` if `unitPerpA = -unitPerpB` (i.e., are opposite)\n * * math details can be found at docs/learning/geometry/PointVector.md\n * @param unitPerpA unit perpendicular to incoming direction\n * @param unitPerpB unit perpendicular to outgoing direction\n * @param offset offset distance\n */\n public static createOffsetBisector(unitPerpA: Vector2d, unitPerpB: Vector2d, offset: number): Vector2d | undefined {\n let bisector: Vector2d | undefined = unitPerpA.plus(unitPerpB);\n bisector = bisector.normalize();\n if (bisector) {\n const c = bisector.dotProduct(unitPerpA);\n bisector.scale(offset, bisector);\n return bisector.safeDivideOrNull(c);\n }\n return undefined;\n }\n /**\n * Return a (new or optionally reused) vector which is `this` divided by `denominator`\n * * return undefined if denominator is zero.\n */\n public safeDivideOrNull(denominator: number, result?: Vector2d): Vector2d | undefined {\n if (denominator !== 0.0) {\n return this.scale(1.0 / denominator, result);\n }\n return undefined;\n }\n /** Return a unit vector in direction of this instance (undefined if this instance has near zero length) */\n public normalize(result?: Vector2d): Vector2d | undefined {\n const mag = Geometry.correctSmallFraction(this.magnitude());\n result = result ? result : new Vector2d();\n return this.safeDivideOrNull(mag, result);\n }\n /**\n * Return fractional length of the projection of the instance onto the target vector.\n * @param target the target vector\n * @param defaultFraction the returned value in case the magnitude of `target` is too small\n * @returns the signed length of the projection divided by the length of `target`\n */\n public fractionOfProjectionToVector(target: Vector2d, defaultFraction?: number): number {\n /*\n * projection length is (this.target)/||target||\n * but here we return (this.target)/||target||^2\n */\n const denominator = target.magnitudeSquared();\n if (denominator < Geometry.smallMetricDistanceSquared)\n return defaultFraction ? defaultFraction : 0;\n const numerator = this.dotProduct(target);\n return numerator / denominator;\n }\n /** Return a new vector with components negated from this instance. */\n public negate(result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n result.x = -this.x;\n result.y = -this.y;\n return result;\n }\n /** Return a vector same length as this but rotated 90 degrees counter clockwise */\n public rotate90CCWXY(result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\n const xx: number = this.x;\n const yy: number = this.y;\n result.x = -yy;\n result.y = xx;\n return result;\n }\n /** Return a vector same length as this but rotated 90 degrees clockwise */\n public rotate90CWXY(result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\n const xx: number = this.x;\n const yy: number = this.y;\n result.x = yy;\n result.y = -xx;\n return result;\n }\n /** Return a unit vector perpendicular to this instance. */\n public unitPerpendicularXY(result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n const xx: number = this.x;\n const yy: number = this.y;\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\n result.x = -yy;\n result.y = xx;\n const d2: number = xx * xx + yy * yy;\n if (d2 !== 0.0) {\n const a = 1.0 / Math.sqrt(d2);\n result.x *= a;\n result.y *= a;\n }\n return result;\n }\n /** Return a new Vector2d rotated CCW by given angle */\n public rotateXY(angle: Angle, result?: Vector2d): Vector2d {\n const s = angle.sin();\n const c = angle.cos();\n // save x,y to allow aliasing (\"this\" can be passed to the function as \"result\")\n const xx: number = this.x;\n const yy: number = this.y;\n result = result ? result : new Vector2d();\n result.x = xx * c - yy * s;\n result.y = xx * s + yy * c;\n return result;\n }\n /**\n * Return a vector computed at fractional position between this vector and vectorB\n * @param fraction fractional position. 0 is at `this`. 1 is at `vectorB`.\n * True fractions are \"between\", negatives are \"before this\", beyond 1 is \"beyond vectorB\".\n * @param vectorB second vector\n * @param result optional preallocated result.\n */\n public interpolate(fraction: number, vectorB: Vector2d, result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n /*\n * For best last-bit behavior, if fraction is below 0.5, use this as base point.\n * If above 0.5, use vectorB as base point.\n */\n if (fraction <= 0.5) {\n result.x = this.x + fraction * (vectorB.x - this.x);\n result.y = this.y + fraction * (vectorB.y - this.y);\n } else {\n const t: number = fraction - 1.0;\n result.x = vectorB.x + t * (vectorB.x - this.x);\n result.y = vectorB.y + t * (vectorB.y - this.y);\n }\n return result;\n }\n /** Return {this + vector}. */\n public plus(vector: XAndY, result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n result.x = this.x + vector.x;\n result.y = this.y + vector.y;\n return result;\n }\n /** Return {this - vector}. */\n public minus(vector: XAndY, result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n result.x = this.x - vector.x;\n result.y = this.y - vector.y;\n return result;\n }\n /** Return {point + vector \\* scalar} */\n public plusScaled(vector: XAndY, scaleFactor: number, result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n result.x = this.x + vector.x * scaleFactor;\n result.y = this.y + vector.y * scaleFactor;\n return result;\n }\n /** Return {point + vectorA \\* scalarA + vectorB \\* scalarB} */\n public plus2Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number, result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n result.x = this.x + vectorA.x * scalarA + vectorB.x * scalarB;\n result.y = this.y + vectorA.y * scalarA + vectorB.y * scalarB;\n return result;\n }\n /** Return {this + vectorA \\* scalarA + vectorB \\* scalarB + vectorC \\* scalarC} */\n public plus3Scaled(vectorA: XAndY, scalarA: number, vectorB: XAndY, scalarB: number, vectorC: XAndY, scalarC: number, result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n result.x = this.x + vectorA.x * scalarA + vectorB.x * scalarB + vectorC.x * scalarC;\n result.y = this.y + vectorA.y * scalarA + vectorB.y * scalarB + vectorC.y * scalarC;\n return result;\n }\n /** Return {this * scale} */\n public scale(scale: number, result?: Vector2d): Vector2d {\n result = result ? result : new Vector2d();\n result.x = this.x * scale;\n result.y = this.y * scale;\n return result;\n }\n /** Return a vector parallel to this but with specified length */\n public scaleToLength(length: number, result?: Vector2d): Vector2d | undefined {\n const mag = Geometry.correctSmallFraction(this.magnitude());\n if (mag === 0)\n return undefined;\n return this.scale(length / mag, result);\n }\n /** Return the dot product of this with vectorB */\n public dotProduct(vectorB: XAndY): number {\n return this.x * vectorB.x + this.y * vectorB.y;\n }\n /** Dot product with vector from pointA to pointB */\n public dotProductStartEnd(pointA: XAndY, pointB: XAndY): number {\n return this.x * (pointB.x - pointA.x) + this.y * (pointB.y - pointA.y);\n }\n /** Vector cross product {this CROSS vectorB} */\n public crossProduct(vectorB: XAndY): number {\n return this.x * vectorB.y - this.y * vectorB.x;\n }\n /**\n * Return the radians (as a simple number, not strongly typed Angle) signed angle from this to vectorB.\n * This is positive if the shortest turn is counterclockwise, negative if clockwise.\n */\n public radiansTo(vectorB: XAndY): number {\n return Math.atan2(this.crossProduct(vectorB), this.dotProduct(vectorB));\n }\n /**\n * Return the (strongly typed) signed angle from this to vectorB.\n * This is positive if the shortest turn is counterclockwise, negative if clockwise.\n */\n public angleTo(vectorB: XAndY): Angle {\n return Angle.createRadians(this.radiansTo(vectorB));\n }\n /**\n * Test if this vector is parallel to other.\n * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,\n * so if you have a distance or angle tolerance t, you should pass in t * t.\n * @param other second vector for comparison.\n * @param oppositeIsParallel whether to consider diametrically opposed vectors as parallel.\n * @param options optional radian and distance tolerances.\n */\n public isParallelTo(other: Vector2d, oppositeIsParallel: boolean = false,\n returnValueIfAnInputIsZeroLength: boolean = false, options?: PerpParallelOptions): boolean {\n const radianSquaredTol: number = options?.radianSquaredTol ?? Geometry.smallAngleRadiansSquared;\n const distanceSquaredTol: number = options?.distanceSquaredTol ?? Geometry.smallMetricDistanceSquared;\n const a2 = this.magnitudeSquared();\n const b2 = other.magnitudeSquared();\n if (a2 < distanceSquaredTol || b2 < distanceSquaredTol)\n return returnValueIfAnInputIsZeroLength;\n const dot = this.dotProduct(other);\n if (dot < 0.0 && !oppositeIsParallel)\n return false;\n const cross = this.crossProduct(other);\n /* a2,b2,cross2 are squared lengths of respective vectors */\n /* cross2 = sin^2(theta) * a2 * b2 */\n /* For small theta, sin^2(theta)~~theta^2 */\n return cross * cross <= radianSquaredTol * a2 * b2;\n }\n /**\n * Test if this vector is perpendicular to other.\n * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,\n * so if you have a distance or angle tolerance t, you should pass in t * t.\n * @param other second vector in comparison.\n * @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.\n * @param options optional radian and distance tolerances.\n */\n public isPerpendicularTo(\n other: Vector2d, returnValueIfAnInputIsZeroLength: boolean = false, options?: PerpParallelOptions,\n ): boolean {\n const radianSquaredTol: number = options?.radianSquaredTol ?? Geometry.smallAngleRadiansSquared;\n const distanceSquaredTol: number = options?.distanceSquaredTol ?? Geometry.smallMetricDistanceSquared;\n const aa = this.magnitudeSquared();\n const bb = other.magnitudeSquared();\n if (aa < distanceSquaredTol || bb < distanceSquaredTol)\n return returnValueIfAnInputIsZeroLength;\n const ab = this.dotProduct(other);\n return ab * ab <= radianSquaredTol * aa * bb;\n }\n}\n"]}
|
|
@@ -726,10 +726,10 @@ export declare class Vector3d extends XYZ {
|
|
|
726
726
|
*/
|
|
727
727
|
angleToXY(vectorB: Vector3d): Angle;
|
|
728
728
|
/**
|
|
729
|
-
* Return the angle in radians (not as strongly-typed Angle) from this vector to vectorB
|
|
730
|
-
* in their containing plane whose normal lies in the same half-space as vectorW
|
|
729
|
+
* Return the angle in radians (not as strongly-typed Angle) from `this` vector to `vectorB`, measured
|
|
730
|
+
* in their containing plane whose normal lies in the same half-space as `vectorW`.
|
|
731
731
|
* * The returned angle is between `-Math.PI` and `Math.PI`.
|
|
732
|
-
* * If the cross product of this vector and vectorB lies on the same side of the plane as vectorW
|
|
732
|
+
* * If the cross product of `this` vector and `vectorB` lies on the same side of the plane as `vectorW`,
|
|
733
733
|
* this function returns `radiansTo(vectorB)`; otherwise, it returns `-radiansTo(vectorB)`.
|
|
734
734
|
* * `vectorW` does not have to be perpendicular to the plane.
|
|
735
735
|
* * Use `planarRadiansTo` to measure the angle between vectors that are projected to another plane.
|