@itwin/core-geometry 4.0.0-dev.23 → 4.0.0-dev.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -2
- package/lib/cjs/Geometry.d.ts +23 -0
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +25 -1
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js +4 -5
- package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js +7 -10
- package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js +2 -2
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +4 -4
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js +2 -2
- package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +1 -1
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js +1 -2
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js +1 -2
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +1 -2
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +195 -8
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js +459 -11
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js +2 -2
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js +2 -2
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYCollection.d.ts +22 -7
- package/lib/cjs/geometry3d/IndexedXYCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYCollection.js +41 -5
- package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +58 -4
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js +102 -4
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts +10 -0
- package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js +14 -0
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +4 -6
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts +0 -6
- package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js +0 -6
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +6 -8
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts +14 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +33 -1
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +120 -10
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +413 -13
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js +1 -1
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/polyface/AuxData.js +1 -1
- package/lib/cjs/polyface/AuxData.js.map +1 -1
- package/lib/cjs/polyface/FacetLocationDetail.d.ts +264 -0
- package/lib/cjs/polyface/FacetLocationDetail.d.ts.map +1 -0
- package/lib/cjs/polyface/FacetLocationDetail.js +376 -0
- package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -0
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +2 -5
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +5 -2
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +20 -14
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +21 -17
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js +6 -7
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +22 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +52 -2
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js +4 -4
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +1 -2
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/solid/Sphere.d.ts +5 -5
- package/lib/cjs/solid/Sphere.js +5 -5
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/SweepContour.js +1 -1
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/topology/Triangulation.js +1 -1
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/esm/Geometry.d.ts +23 -0
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +24 -0
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js +4 -5
- package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js +7 -10
- package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js +2 -2
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +4 -4
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js +2 -2
- package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.js +1 -1
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.js +1 -2
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js +1 -2
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js +1 -2
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts +195 -8
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js +459 -12
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js +2 -2
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js +2 -2
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYCollection.d.ts +22 -7
- package/lib/esm/geometry3d/IndexedXYCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYCollection.js +41 -5
- package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +58 -4
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js +103 -5
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts +10 -0
- package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.js +14 -0
- package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +4 -6
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts +0 -6
- package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js +0 -6
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +6 -8
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts +14 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +33 -1
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +120 -10
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +412 -13
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js +1 -1
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/polyface/AuxData.js +1 -1
- package/lib/esm/polyface/AuxData.js.map +1 -1
- package/lib/esm/polyface/FacetLocationDetail.d.ts +264 -0
- package/lib/esm/polyface/FacetLocationDetail.d.ts.map +1 -0
- package/lib/esm/polyface/FacetLocationDetail.js +369 -0
- package/lib/esm/polyface/FacetLocationDetail.js.map +1 -0
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +2 -5
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js +5 -2
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +20 -14
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +21 -17
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js +6 -7
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +22 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +52 -2
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.js +4 -4
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +1 -2
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/solid/Sphere.d.ts +5 -5
- package/lib/esm/solid/Sphere.js +5 -5
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/SweepContour.js +1 -1
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/topology/Triangulation.js +1 -1
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/package.json +4 -4
|
@@ -8,7 +8,6 @@ exports.IndexedReadWriteXYZCollection = exports.IndexedXYZCollection = void 0;
|
|
|
8
8
|
/** @packageDocumentation
|
|
9
9
|
* @module ArraysAndInterfaces
|
|
10
10
|
*/
|
|
11
|
-
// import { Point2d } from "./Geometry2d";
|
|
12
11
|
const Geometry_1 = require("../Geometry");
|
|
13
12
|
const Point3dVector3d_1 = require("./Point3dVector3d");
|
|
14
13
|
const Range_1 = require("./Range");
|
|
@@ -32,13 +31,84 @@ class PointsIterator {
|
|
|
32
31
|
/**
|
|
33
32
|
* abstract base class for read-only access to XYZ data with indexed reference.
|
|
34
33
|
* * This allows algorithms to work with Point3d[] or GrowableXYZ.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* * In addition to "point by point" accessors,
|
|
34
|
+
* * GrowableXYZArray implements these for its data.
|
|
35
|
+
* * Point3dArrayCarrier carries a (reference to) a Point3d[] and implements the methods with calls on that array reference.
|
|
36
|
+
* * In addition to "point by point" accessors, other abstract members compute commonly useful vector data "between points".
|
|
38
37
|
* * Methods that create vectors among multiple indices allow callers to avoid creating temporaries.
|
|
39
38
|
* @public
|
|
40
39
|
*/
|
|
41
40
|
class IndexedXYZCollection {
|
|
41
|
+
/**
|
|
42
|
+
* Return a vector from the point at `indexA` to `target`
|
|
43
|
+
* @param indexA index of point within the array
|
|
44
|
+
* @param target target for vector
|
|
45
|
+
* @param result caller-allocated vector.
|
|
46
|
+
* @returns undefined if index is out of bounds
|
|
47
|
+
*/
|
|
48
|
+
vectorIndexXYAndZ(indexA, target, result) {
|
|
49
|
+
const reversed = this.vectorXYAndZIndex(target, indexA, result);
|
|
50
|
+
return reversed?.negate(reversed);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Return the dot product of the vectors from the point at `origin` to the points at `indexA` and `indexB`.
|
|
54
|
+
* @param origin index of point within the array; origin of both vectors
|
|
55
|
+
* @param indexA index of point within the array; target of the first vector
|
|
56
|
+
* @param indexA index of point within the array; target of the second vector
|
|
57
|
+
* @returns undefined if index is out of bounds
|
|
58
|
+
*/
|
|
59
|
+
dotProductIndexIndexIndex(origin, indexA, indexB) {
|
|
60
|
+
if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length || indexB < 0 || indexB >= this.length)
|
|
61
|
+
return undefined;
|
|
62
|
+
const x0 = this.getXAtUncheckedPointIndex(origin);
|
|
63
|
+
const y0 = this.getYAtUncheckedPointIndex(origin);
|
|
64
|
+
const z0 = this.getZAtUncheckedPointIndex(origin);
|
|
65
|
+
return (this.getXAtUncheckedPointIndex(indexA) - x0) * (this.getXAtUncheckedPointIndex(indexB) - x0) +
|
|
66
|
+
(this.getYAtUncheckedPointIndex(indexA) - y0) * (this.getYAtUncheckedPointIndex(indexB) - y0) +
|
|
67
|
+
(this.getZAtUncheckedPointIndex(indexA) - z0) * (this.getZAtUncheckedPointIndex(indexB) - z0);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Return the dot product of the vectors from the point at `origin` to the point at `indexA` and to `targetB`.
|
|
71
|
+
* @param origin index of point within the array; origin of both vectors
|
|
72
|
+
* @param indexA index of point within the array; target of the first vector
|
|
73
|
+
* @param targetB target for second vector
|
|
74
|
+
* @returns undefined if index is out of bounds
|
|
75
|
+
*/
|
|
76
|
+
dotProductIndexIndexXYAndZ(origin, indexA, targetB) {
|
|
77
|
+
if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length)
|
|
78
|
+
return undefined;
|
|
79
|
+
const x0 = this.getXAtUncheckedPointIndex(origin);
|
|
80
|
+
const y0 = this.getYAtUncheckedPointIndex(origin);
|
|
81
|
+
const z0 = this.getZAtUncheckedPointIndex(origin);
|
|
82
|
+
return (this.getXAtUncheckedPointIndex(indexA) - x0) * (targetB.x - x0) +
|
|
83
|
+
(this.getYAtUncheckedPointIndex(indexA) - y0) * (targetB.y - y0) +
|
|
84
|
+
(this.getZAtUncheckedPointIndex(indexA) - z0) * (targetB.z - z0);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Return the cross product of the vectors from `origin` to the point at `indexA` and to `targetB`
|
|
88
|
+
* @param origin index of point within the array; origin of both vectors
|
|
89
|
+
* @param indexA index of point within the array; target of the first vector
|
|
90
|
+
* @param targetB target of second vector
|
|
91
|
+
* @param result optional caller-allocated result to fill and return
|
|
92
|
+
* @returns undefined if an index is out of bounds
|
|
93
|
+
*/
|
|
94
|
+
crossProductIndexIndexXYAndZ(origin, indexA, targetB, result) {
|
|
95
|
+
if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length)
|
|
96
|
+
return undefined;
|
|
97
|
+
const x0 = this.getXAtUncheckedPointIndex(origin);
|
|
98
|
+
const y0 = this.getYAtUncheckedPointIndex(origin);
|
|
99
|
+
const z0 = this.getZAtUncheckedPointIndex(origin);
|
|
100
|
+
return Point3dVector3d_1.Vector3d.createCrossProduct(this.getXAtUncheckedPointIndex(indexA) - x0, this.getYAtUncheckedPointIndex(indexA) - y0, this.getZAtUncheckedPointIndex(indexA) - z0, targetB.x - x0, targetB.y - y0, targetB.z - z0, result);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Return distance squared between the point at index0 and target.
|
|
104
|
+
* @param index0 first point index
|
|
105
|
+
* @param target second point
|
|
106
|
+
*/
|
|
107
|
+
distanceSquaredIndexXYAndZ(index0, target) {
|
|
108
|
+
if (index0 < 0 || index0 >= this.length)
|
|
109
|
+
return undefined;
|
|
110
|
+
return Geometry_1.Geometry.hypotenuseSquaredXYZ(target.x - this.getXAtUncheckedPointIndex(index0), target.y - this.getYAtUncheckedPointIndex(index0), target.z - this.getZAtUncheckedPointIndex(index0));
|
|
111
|
+
}
|
|
42
112
|
/** Adjust index into range by modulo with the length. */
|
|
43
113
|
cyclicIndex(i) {
|
|
44
114
|
return (i % this.length);
|
|
@@ -76,6 +146,34 @@ class IndexedXYZCollection {
|
|
|
76
146
|
}
|
|
77
147
|
return indices;
|
|
78
148
|
}
|
|
149
|
+
/** Compute the linear combination s of the indexed p_i and given scales s_i.
|
|
150
|
+
* @param scales array of scales. For best results, scales should have same length as the instance.
|
|
151
|
+
* @param result optional pre-allocated object to fill and return
|
|
152
|
+
* @return s = sum(p_i * s_i), where i ranges from 0 to min(this.length, scales.length).
|
|
153
|
+
*/
|
|
154
|
+
linearCombination(scales, result) {
|
|
155
|
+
const n = Math.min(this.length, scales.length);
|
|
156
|
+
const sum = (result instanceof Point3dVector3d_1.Vector3d) ? Point3dVector3d_1.Vector3d.createZero(result) : Point3dVector3d_1.Point3d.createZero(result);
|
|
157
|
+
for (let i = 0; i < n; ++i) {
|
|
158
|
+
sum.x += scales[i] * this.getXAtUncheckedPointIndex(i);
|
|
159
|
+
sum.y += scales[i] * this.getYAtUncheckedPointIndex(i);
|
|
160
|
+
sum.z += scales[i] * this.getZAtUncheckedPointIndex(i);
|
|
161
|
+
}
|
|
162
|
+
return sum;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Interpolate the points at the given indices.
|
|
166
|
+
* @param index0 index of point p0 within the array
|
|
167
|
+
* @param fraction fraction f such that returned point is p0 + f * (p1 - p0)
|
|
168
|
+
* @param index1 index of point p1 within the array
|
|
169
|
+
* @param result optional caller-allocated result to fill and return
|
|
170
|
+
* @returns undefined if an index is out of bounds
|
|
171
|
+
*/
|
|
172
|
+
interpolateIndexIndex(index0, fraction, index1, result) {
|
|
173
|
+
if (index0 < 0 || index0 >= this.length || index1 < 0 || index1 >= this.length)
|
|
174
|
+
return undefined;
|
|
175
|
+
return Point3dVector3d_1.Point3d.create(Geometry_1.Geometry.interpolate(this.getXAtUncheckedPointIndex(index0), fraction, this.getXAtUncheckedPointIndex(index1)), Geometry_1.Geometry.interpolate(this.getYAtUncheckedPointIndex(index0), fraction, this.getYAtUncheckedPointIndex(index1)), Geometry_1.Geometry.interpolate(this.getZAtUncheckedPointIndex(index0), fraction, this.getZAtUncheckedPointIndex(index1)), result);
|
|
176
|
+
}
|
|
79
177
|
/** Return iterator over the points in this collection. Usage:
|
|
80
178
|
* ```ts
|
|
81
179
|
* for (const point: Point3d of collection.points) { ... }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedXYZCollection.js","sourceRoot":"","sources":["../../../src/geometry3d/IndexedXYZCollection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAA0C;AAC1C,0CAAuC;AACvC,uDAAsD;AACtD,mCAAkC;AAIlC,MAAM,cAAc;IAIlB,YAAmB,UAAgC;QAF3C,cAAS,GAAG,CAAC,CAAC,CAAC;QAGrB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAEM,IAAI;QACT,IAAI,EAAE,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;YAC/C,0JAA0J;YAC1J,OAAO,EAAE,IAAI,EAAE,I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B,MAAM,KAAK,GAAG,IAAI,CAAC,yBAAyB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;oBACnD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,GAAG,IAAI;wBACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;wBAEhB,MAAM;iBACT;gBACD,CAAC,GAAG,CAAC,CAAC,CAAC,0BAA0B;aAClC;SACF;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAgBD;;;;OAIG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IACD,2BAA2B;IACpB,QAAQ;QACb,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM;YACzB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAxJD,oDAwJC;AACD;;;GAGG;AACH,MAAsB,6BAA8B,SAAQ,oBAAoB;CAsB/E;AAtBD,sEAsBC","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 ArraysAndInterfaces\n */\n\n// import { Point2d } from \"./Geometry2d\";\nimport { Geometry } from \"../Geometry\";\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\nimport { Range3d } from \"./Range\";\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\nimport { XYAndZ } from \"./XYZProps\";\n\nclass PointsIterator implements Iterator<Point3d>, Iterable<Point3d> {\n private readonly _collection: IndexedXYZCollection;\n private _curIndex = -1;\n\n public constructor(collection: IndexedXYZCollection) {\n this._collection = collection;\n }\n\n public next(): IteratorResult<Point3d> {\n if (++this._curIndex >= this._collection.length) {\n // The ECMAScript spec states that value=undefined is valid if done=true. The TypeScript interface violates the spec hence the cast to any and back below.\n return { done: true } as any as IteratorResult<Point3d>;\n }\n\n return {\n value: this._collection.getPoint3dAtUncheckedPointIndex(this._curIndex),\n done: false,\n };\n }\n\n public [Symbol.iterator](): Iterator<Point3d> { return this; }\n}\n/**\n * abstract base class for read-only access to XYZ data with indexed reference.\n * * This allows algorithms to work with Point3d[] or GrowableXYZ.\n * ** GrowableXYZArray implements these for its data.\n * ** Point3dArrayCarrier carries a (reference to) a Point3d[] and implements the methods with calls on that array reference.\n * * In addition to \"point by point\" accessors, there abstract members compute commonly useful vector data \"between points\".\n * * Methods that create vectors among multiple indices allow callers to avoid creating temporaries.\n * @public\n */\nexport abstract class IndexedXYZCollection {\n /**\n * Return the point at `index` as a strongly typed Point3d.\n * @param index index of point within the array\n * @param result caller-allocated destination\n * @returns undefined if the index is out of bounds\n */\n public abstract getPoint3dAtCheckedPointIndex(index: number, result?: Point3d): Point3d | undefined;\n /**\n * Return the point at `index` as a strongly typed Point3d, without checking the point index validity.\n * @param index index of point within the array\n * @param result caller-allocated destination\n * @returns undefined if the index is out of bounds\n */\n public abstract getPoint3dAtUncheckedPointIndex(index: number, result?: Point3d): Point3d;\n /**\n * Get from `index` as a strongly typed Vector3d.\n * @param index index of point within the array\n * @param result caller-allocated destination\n * @returns undefined if the index is out of bounds\n */\n public abstract getVector3dAtCheckedVectorIndex(index: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return a vector from the point at `indexA` to the point at `indexB`\n * @param indexA index of point within the array\n * @param indexB index of point within the array\n * @param result caller-allocated vector.\n * @returns undefined if either index is out of bounds\n */\n public abstract vectorIndexIndex(indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return a vector from `origin` to the point at `indexB`\n * @param origin origin for vector\n * @param indexB index of point within the array\n * @param result caller-allocated vector.\n * @returns undefined if index is out of bounds\n */\n public abstract vectorXYAndZIndex(origin: XYAndZ, indexB: number, result?: Vector3d): Vector3d | undefined;\n\n /**\n * Return the cross product of the vectors from `origin` to points at `indexA` and `indexB`\n * @param origin origin for vector\n * @param indexA index of first target within the array\n * @param indexB index of second target within the array\n * @param result caller-allocated vector.\n * @returns undefined if either index is out of bounds\n */\n public abstract crossProductXYAndZIndexIndex(origin: XYAndZ, indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return the cross product of vectors from `origin` to points at `indexA` and `indexB`\n * @param origin origin for vector\n * @param indexA index of first target within the array\n * @param indexB index of second target within the array\n * @param result optional caller-allocated vector.\n * @returns undefined if either index is out of bounds\n */\n public abstract crossProductIndexIndexIndex(origin: number, indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return the cross product of vectors from origin point at `indexA` to target points at `indexB` and `indexC`\n * @param origin index of origin\n * @param indexA index of first target within the array\n * @param indexB index of second target within the array\n * @param result caller-allocated vector.\n * @returns return true if indexA, indexB both valid\n */\n public abstract accumulateCrossProductIndexIndexIndex(origin: number, indexA: number, indexB: number, result: Vector3d): void;\n\n /**\n * read-only property for number of XYZ in the collection.\n */\n public abstract get length(): number;\n /**\n * Return distance squared between indicated points.\n * @param index0 first point index\n * @param index1 second point index\n */\n public abstract distanceSquaredIndexIndex(index0: number, index1: number): number | undefined;\n /**\n * Return distance between indicated points.\n * @param index0 first point index\n * @param index1 second point index\n */\n public abstract distanceIndexIndex(index0: number, index1: number): number | undefined;\n\n /** Adjust index into range by modulo with the length. */\n public cyclicIndex(i: number): number {\n return (i % this.length);\n }\n /** Return the range of the points. */\n public getRange(): Range3d {\n const range = Range3d.createNull();\n const n = this.length;\n const point = Point3d.create();\n for (let i = 0; i < n; i++) {\n this.getPoint3dAtUncheckedPointIndex(i, point);\n range.extendPoint(point);\n }\n return range;\n }\n\n /**\n * For each run of points with indices i+1 to i+n within distance tolerance of points[i], return the indices i+1, ..., i+n.\n * @return ordered array of 0-based indices of duplicate points\n */\n public findOrderedDuplicates(tolerance: number = Geometry.smallMetricDistance): number[] {\n const tol2 = tolerance * tolerance;\n const indices: number[] = [];\n if (this.length > 1) {\n for (let i = 0; i < this.length - 1;) {\n let j = i + 1;\n for (; j < this.length; ++j) {\n const dist2 = this.distanceSquaredIndexIndex(i, j);\n if (dist2 !== undefined && dist2 < tol2)\n indices.push(j);\n else\n break;\n }\n i = j; // found next unique point\n }\n }\n return indices;\n }\n\n /** Accumulate scale times the x,y,z values at index.\n * * No action if index is out of bounds.\n */\n public abstract accumulateScaledXYZ(index: number, scale: number, sum: Point3d): void;\n\n /** access x of indexed point */\n public abstract getXAtUncheckedPointIndex(pointIndex: number): number;\n\n /** access y of indexed point */\n public abstract getYAtUncheckedPointIndex(pointIndex: number): number;\n\n /** access z of indexed point */\n public abstract getZAtUncheckedPointIndex(pointIndex: number): number;\n\n /** Return iterator over the points in this collection. Usage:\n * ```ts\n * for (const point: Point3d of collection.points) { ... }\n * ```\n */\n public get points(): Iterable<Point3d> {\n return new PointsIterator(this);\n }\n /** convert to Point3d[] */\n public getArray(): Point3d[] {\n const result = [];\n for (const p of this.points)\n result.push(p);\n return result;\n }\n}\n/**\n * abstract base class extends IndexedXYZCollection, adding methods to push, peek, and pop, and rewrite.\n * @public\n */\nexport abstract class IndexedReadWriteXYZCollection extends IndexedXYZCollection {\n /** push a (clone of) point onto the collection\n * * point itself is not pushed -- xyz data is extracted into the native form of the collection.\n */\n public abstract push(data: XYAndZ): void;\n /**\n * push a new point (given by coordinates) onto the collection\n * @param x x coordinate\n * @param y y coordinate\n * @param z z coordinate\n */\n public abstract pushXYZ(x?: number, y?: number, z?: number): void;\n /** extract the final point */\n public abstract back(result?: Point3d): Point3d | undefined;\n /** extract the first point */\n public abstract front(result?: Point3d): Point3d | undefined;\n /** remove the final point. */\n public abstract pop(): void;\n /** clear all entries */\n public abstract clear(): void;\n /** reverse the points in place. */\n public abstract reverseInPlace(): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IndexedXYZCollection.js","sourceRoot":"","sources":["../../../src/geometry3d/IndexedXYZCollection.ts"],"names":[],"mappings":";AAAA;;;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yBAAyB,CAAC,MAAM,CAAC,CAAC,EAC9G,mBAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,EAC9G,mBAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAChJ,CAAC;IAWD;;;;OAIG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IACD,2BAA2B;IACpB,QAAQ;QACb,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM;YACzB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAtQD,oDAsQC;AACD;;;GAGG;AACH,MAAsB,6BAA8B,SAAQ,oBAAoB;CAsB/E;AAtBD,sEAsBC","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 ArraysAndInterfaces\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { Point3d, Vector3d, XYZ } from \"./Point3dVector3d\";\nimport { Range3d } from \"./Range\";\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\nimport { XYAndZ } from \"./XYZProps\";\n\nclass PointsIterator implements Iterator<Point3d>, Iterable<Point3d> {\n private readonly _collection: IndexedXYZCollection;\n private _curIndex = -1;\n\n public constructor(collection: IndexedXYZCollection) {\n this._collection = collection;\n }\n\n public next(): IteratorResult<Point3d> {\n if (++this._curIndex >= this._collection.length) {\n // The ECMAScript spec states that value=undefined is valid if done=true. The TypeScript interface violates the spec hence the cast to any and back below.\n return { done: true } as any as IteratorResult<Point3d>;\n }\n\n return {\n value: this._collection.getPoint3dAtUncheckedPointIndex(this._curIndex),\n done: false,\n };\n }\n\n public [Symbol.iterator](): Iterator<Point3d> { return this; }\n}\n/**\n * abstract base class for read-only access to XYZ data with indexed reference.\n * * This allows algorithms to work with Point3d[] or GrowableXYZ.\n * * GrowableXYZArray implements these for its data.\n * * Point3dArrayCarrier carries a (reference to) a Point3d[] and implements the methods with calls on that array reference.\n * * In addition to \"point by point\" accessors, other abstract members compute commonly useful vector data \"between points\".\n * * Methods that create vectors among multiple indices allow callers to avoid creating temporaries.\n * @public\n */\nexport abstract class IndexedXYZCollection {\n /**\n * Return the point at `index` as a strongly typed Point3d.\n * @param index index of point within the array\n * @param result caller-allocated destination\n * @returns undefined if the index is out of bounds\n */\n public abstract getPoint3dAtCheckedPointIndex(index: number, result?: Point3d): Point3d | undefined;\n /**\n * Return the point at `index` as a strongly typed Point3d, without checking the point index validity.\n * @param index index of point within the array\n * @param result caller-allocated destination\n * @returns undefined if the index is out of bounds\n */\n public abstract getPoint3dAtUncheckedPointIndex(index: number, result?: Point3d): Point3d;\n /**\n * Get from `index` as a strongly typed Vector3d.\n * @param index index of point within the array\n * @param result caller-allocated destination\n * @returns undefined if the index is out of bounds\n */\n public abstract getVector3dAtCheckedVectorIndex(index: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return a vector from the point at `indexA` to the point at `indexB`\n * @param indexA index of point within the array\n * @param indexB index of point within the array\n * @param result caller-allocated vector.\n * @returns undefined if either index is out of bounds\n */\n public abstract vectorIndexIndex(indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return a vector from `origin` to the point at `indexB`\n * @param origin origin for vector\n * @param indexB index of point within the array\n * @param result caller-allocated vector.\n * @returns undefined if index is out of bounds\n */\n public abstract vectorXYAndZIndex(origin: XYAndZ, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return a vector from the point at `indexA` to `target`\n * @param indexA index of point within the array\n * @param target target for vector\n * @param result caller-allocated vector.\n * @returns undefined if index is out of bounds\n */\n public vectorIndexXYAndZ(indexA: number, target: XYAndZ, result?: Vector3d): Vector3d | undefined {\n const reversed = this.vectorXYAndZIndex(target, indexA, result);\n return reversed?.negate(reversed);\n }\n /**\n * Return the dot product of the vectors from the point at `origin` to the points at `indexA` and `indexB`.\n * @param origin index of point within the array; origin of both vectors\n * @param indexA index of point within the array; target of the first vector\n * @param indexA index of point within the array; target of the second vector\n * @returns undefined if index is out of bounds\n */\n public dotProductIndexIndexIndex(origin: number, indexA: number, indexB: number): number | undefined {\n if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length || indexB < 0 || indexB >= this.length)\n return undefined;\n const x0 = this.getXAtUncheckedPointIndex(origin);\n const y0 = this.getYAtUncheckedPointIndex(origin);\n const z0 = this.getZAtUncheckedPointIndex(origin);\n return (this.getXAtUncheckedPointIndex(indexA) - x0) * (this.getXAtUncheckedPointIndex(indexB) - x0) +\n (this.getYAtUncheckedPointIndex(indexA) - y0) * (this.getYAtUncheckedPointIndex(indexB) - y0) +\n (this.getZAtUncheckedPointIndex(indexA) - z0) * (this.getZAtUncheckedPointIndex(indexB) - z0);\n }\n /**\n * Return the dot product of the vectors from the point at `origin` to the point at `indexA` and to `targetB`.\n * @param origin index of point within the array; origin of both vectors\n * @param indexA index of point within the array; target of the first vector\n * @param targetB target for second vector\n * @returns undefined if index is out of bounds\n */\n public dotProductIndexIndexXYAndZ(origin: number, indexA: number, targetB: XYAndZ): number | undefined {\n if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length)\n return undefined;\n const x0 = this.getXAtUncheckedPointIndex(origin);\n const y0 = this.getYAtUncheckedPointIndex(origin);\n const z0 = this.getZAtUncheckedPointIndex(origin);\n return (this.getXAtUncheckedPointIndex(indexA) - x0) * (targetB.x - x0) +\n (this.getYAtUncheckedPointIndex(indexA) - y0) * (targetB.y - y0) +\n (this.getZAtUncheckedPointIndex(indexA) - z0) * (targetB.z - z0);\n }\n /**\n * Return the cross product of the vectors from `origin` to points at `indexA` and `indexB`\n * @param origin origin for vector\n * @param indexA index of first target within the array\n * @param indexB index of second target within the array\n * @param result caller-allocated vector.\n * @returns undefined if either index is out of bounds\n */\n public abstract crossProductXYAndZIndexIndex(origin: XYAndZ, indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return the cross product of the vectors from `origin` to the point at `indexA` and to `targetB`\n * @param origin index of point within the array; origin of both vectors\n * @param indexA index of point within the array; target of the first vector\n * @param targetB target of second vector\n * @param result optional caller-allocated result to fill and return\n * @returns undefined if an index is out of bounds\n */\n public crossProductIndexIndexXYAndZ(origin: number, indexA: number, targetB: XYAndZ, result?: Vector3d): Vector3d | undefined {\n if (origin < 0 || origin >= this.length || indexA < 0 || indexA >= this.length)\n return undefined;\n const x0 = this.getXAtUncheckedPointIndex(origin);\n const y0 = this.getYAtUncheckedPointIndex(origin);\n const z0 = this.getZAtUncheckedPointIndex(origin);\n return Vector3d.createCrossProduct(this.getXAtUncheckedPointIndex(indexA) - x0,\n this.getYAtUncheckedPointIndex(indexA) - y0,\n this.getZAtUncheckedPointIndex(indexA) - z0,\n targetB.x - x0,\n targetB.y - y0,\n targetB.z - z0, result);\n }\n /**\n * Return the cross product of vectors from `origin` to points at `indexA` and `indexB`\n * @param origin origin for vector\n * @param indexA index of first target within the array\n * @param indexB index of second target within the array\n * @param result optional caller-allocated vector.\n * @returns undefined if either index is out of bounds\n */\n public abstract crossProductIndexIndexIndex(origin: number, indexA: number, indexB: number, result?: Vector3d): Vector3d | undefined;\n /**\n * Return the cross product of vectors from origin point at `indexA` to target points at `indexB` and `indexC`\n * @param origin index of origin\n * @param indexA index of first target within the array\n * @param indexB index of second target within the array\n * @param result caller-allocated vector.\n * @returns return true if indexA, indexB both valid\n */\n public abstract accumulateCrossProductIndexIndexIndex(origin: number, indexA: number, indexB: number, result: Vector3d): void;\n\n /**\n * read-only property for number of XYZ in the collection.\n */\n public abstract get length(): number;\n /**\n * Return distance squared between indicated points.\n * @param index0 first point index\n * @param index1 second point index\n */\n public abstract distanceSquaredIndexIndex(index0: number, index1: number): number | undefined;\n /**\n * Return distance squared between the point at index0 and target.\n * @param index0 first point index\n * @param target second point\n */\n public distanceSquaredIndexXYAndZ(index0: number, target: XYAndZ): number | undefined {\n if (index0 < 0 || index0 >= this.length)\n return undefined;\n return Geometry.hypotenuseSquaredXYZ(\n target.x - this.getXAtUncheckedPointIndex(index0),\n target.y - this.getYAtUncheckedPointIndex(index0),\n target.z - this.getZAtUncheckedPointIndex(index0));\n }\n /**\n * Return distance between indicated points.\n * @param index0 first point index\n * @param index1 second point index\n */\n public abstract distanceIndexIndex(index0: number, index1: number): number | undefined;\n\n /** Adjust index into range by modulo with the length. */\n public cyclicIndex(i: number): number {\n return (i % this.length);\n }\n /** Return the range of the points. */\n public getRange(): Range3d {\n const range = Range3d.createNull();\n const n = this.length;\n const point = Point3d.create();\n for (let i = 0; i < n; i++) {\n this.getPoint3dAtUncheckedPointIndex(i, point);\n range.extendPoint(point);\n }\n return range;\n }\n\n /**\n * For each run of points with indices i+1 to i+n within distance tolerance of points[i], return the indices i+1, ..., i+n.\n * @return ordered array of 0-based indices of duplicate points\n */\n public findOrderedDuplicates(tolerance: number = Geometry.smallMetricDistance): number[] {\n const tol2 = tolerance * tolerance;\n const indices: number[] = [];\n if (this.length > 1) {\n for (let i = 0; i < this.length - 1;) {\n let j = i + 1;\n for (; j < this.length; ++j) {\n const dist2 = this.distanceSquaredIndexIndex(i, j);\n if (dist2 !== undefined && dist2 < tol2)\n indices.push(j);\n else\n break;\n }\n i = j; // found next unique point\n }\n }\n return indices;\n }\n\n /** Accumulate scale times the x,y,z values at index.\n * * No action if index is out of bounds.\n */\n public abstract accumulateScaledXYZ(index: number, scale: number, sum: Point3d): void;\n\n /** Compute the linear combination s of the indexed p_i and given scales s_i.\n * @param scales array of scales. For best results, scales should have same length as the instance.\n * @param result optional pre-allocated object to fill and return\n * @return s = sum(p_i * s_i), where i ranges from 0 to min(this.length, scales.length).\n */\n public linearCombination(scales: number[], result?: Point3d | Vector3d): XYZ {\n const n = Math.min(this.length, scales.length);\n const sum = (result instanceof Vector3d) ? Vector3d.createZero(result) : Point3d.createZero(result);\n for (let i = 0; i < n; ++i) {\n sum.x += scales[i] * this.getXAtUncheckedPointIndex(i);\n sum.y += scales[i] * this.getYAtUncheckedPointIndex(i);\n sum.z += scales[i] * this.getZAtUncheckedPointIndex(i);\n }\n return sum;\n }\n\n /**\n * Interpolate the points at the given indices.\n * @param index0 index of point p0 within the array\n * @param fraction fraction f such that returned point is p0 + f * (p1 - p0)\n * @param index1 index of point p1 within the array\n * @param result optional caller-allocated result to fill and return\n * @returns undefined if an index is out of bounds\n */\n public interpolateIndexIndex(index0: number, fraction: number, index1: number, result?: Point3d): Point3d | undefined {\n if (index0 < 0 || index0 >= this.length || index1 < 0 || index1 >= this.length)\n return undefined;\n return Point3d.create(Geometry.interpolate(this.getXAtUncheckedPointIndex(index0), fraction, this.getXAtUncheckedPointIndex(index1)),\n Geometry.interpolate(this.getYAtUncheckedPointIndex(index0), fraction, this.getYAtUncheckedPointIndex(index1)),\n Geometry.interpolate(this.getZAtUncheckedPointIndex(index0), fraction, this.getZAtUncheckedPointIndex(index1)), result);\n }\n\n /** access x of indexed point */\n public abstract getXAtUncheckedPointIndex(pointIndex: number): number;\n\n /** access y of indexed point */\n public abstract getYAtUncheckedPointIndex(pointIndex: number): number;\n\n /** access z of indexed point */\n public abstract getZAtUncheckedPointIndex(pointIndex: number): number;\n\n /** Return iterator over the points in this collection. Usage:\n * ```ts\n * for (const point: Point3d of collection.points) { ... }\n * ```\n */\n public get points(): Iterable<Point3d> {\n return new PointsIterator(this);\n }\n /** convert to Point3d[] */\n public getArray(): Point3d[] {\n const result = [];\n for (const p of this.points)\n result.push(p);\n return result;\n }\n}\n/**\n * abstract base class extends IndexedXYZCollection, adding methods to push, peek, and pop, and rewrite.\n * @public\n */\nexport abstract class IndexedReadWriteXYZCollection extends IndexedXYZCollection {\n /** push a (clone of) point onto the collection\n * * point itself is not pushed -- xyz data is extracted into the native form of the collection.\n */\n public abstract push(data: XYAndZ): void;\n /**\n * push a new point (given by coordinates) onto the collection\n * @param x x coordinate\n * @param y y coordinate\n * @param z z coordinate\n */\n public abstract pushXYZ(x?: number, y?: number, z?: number): void;\n /** extract the final point */\n public abstract back(result?: Point3d): Point3d | undefined;\n /** extract the first point */\n public abstract front(result?: Point3d): Point3d | undefined;\n /** remove the final point. */\n public abstract pop(): void;\n /** clear all entries */\n public abstract clear(): void;\n /** reverse the points in place. */\n public abstract reverseInPlace(): void;\n}\n"]}
|
|
@@ -71,5 +71,15 @@ export declare class Point2dArrayCarrier extends IndexedXYCollection {
|
|
|
71
71
|
* read-only property for number of XYZ in the collection.
|
|
72
72
|
*/
|
|
73
73
|
get length(): number;
|
|
74
|
+
/**
|
|
75
|
+
* Get x coordinate by point index, with no index checking
|
|
76
|
+
* @param pointIndex index to access
|
|
77
|
+
*/
|
|
78
|
+
getXAtUncheckedPointIndex(pointIndex: number): number;
|
|
79
|
+
/**
|
|
80
|
+
* Get y coordinate by point index, with no index checking
|
|
81
|
+
* @param pointIndex index to access
|
|
82
|
+
*/
|
|
83
|
+
getYAtUncheckedPointIndex(pointIndex: number): number;
|
|
74
84
|
}
|
|
75
85
|
//# sourceMappingURL=Point2dArrayCarrier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Point2dArrayCarrier.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/Point2dArrayCarrier.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAM,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;;;;;EA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;OAOG;IACa,2BAA2B,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAK9G;;;;;;;KAOC;IACe,2BAA2B,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAKpH;;OAEG;IACH,IAAoB,MAAM,IAAI,MAAM,CAEnC;IAED;;;OAGG;IACa,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAIrE;;;OAGG;IACa,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;CAGtE"}
|
|
@@ -111,6 +111,20 @@ class Point2dArrayCarrier extends IndexedXYCollection_1.IndexedXYCollection {
|
|
|
111
111
|
get length() {
|
|
112
112
|
return this.data.length;
|
|
113
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Get x coordinate by point index, with no index checking
|
|
116
|
+
* @param pointIndex index to access
|
|
117
|
+
*/
|
|
118
|
+
getXAtUncheckedPointIndex(pointIndex) {
|
|
119
|
+
return this.data[pointIndex].x;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get y coordinate by point index, with no index checking
|
|
123
|
+
* @param pointIndex index to access
|
|
124
|
+
*/
|
|
125
|
+
getYAtUncheckedPointIndex(pointIndex) {
|
|
126
|
+
return this.data[pointIndex].y;
|
|
127
|
+
}
|
|
114
128
|
}
|
|
115
129
|
exports.Point2dArrayCarrier = Point2dArrayCarrier;
|
|
116
130
|
//# sourceMappingURL=Point2dArrayCarrier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Point2dArrayCarrier.js","sourceRoot":"","sources":["../../../src/geometry3d/Point2dArrayCarrier.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,mEAAmE;;;AAEnE,+DAA4D;AAC5D,uDAA0D;AAG1D;;;;;;EA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CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;YAC1F,OAAO,oBAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAC/F,OAAO,SAAS,CAAC;IACnB,CAAC;IACD;;OAEG;IACH,IAAoB,MAAM;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACa,yBAAyB,CAAC,UAAkB;QAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IAED;;;OAGG;IACa,yBAAyB,CAAC,UAAkB;QAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;CACF;AAhHD,kDAgHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\n\nimport { IndexedXYCollection } from \"./IndexedXYCollection\";\nimport { Point2d, Vector2d, XY } from \"./Point2dVector2d\";\nimport { XAndY } from \"./XYZProps\";\n\n/**\n * Helper object to access members of a Point2d[] in geometric calculations.\n * * The collection holds only a reference to the actual array.\n * * The actual array may be replaced by the user as needed.\n * * When replaced, there is no cached data to be updated.\n * @public\n*/\nexport class Point2dArrayCarrier extends IndexedXYCollection {\n /** reference to array being queried. */\n public data: Point2d[];\n /** CAPTURE caller supplied array ... */\n public constructor(data: Point2d[]) {\n super();\n this.data = data;\n }\n /** test if index is valid */\n public isValidIndex(index: number): boolean {\n return index >= 0 && index < this.data.length;\n }\n /**\n * Access by index, returning strongly typed Point2d\n * * This returns the xy value but NOT reference to the point in the \"carried\" array.\n * @param index index of point within the array\n * @param result caller-allocated destination\n * @returns undefined if the index is out of bounds\n */\n public override getPoint2dAtCheckedPointIndex(index: number, result?: Point2d): Point2d | undefined {\n if (this.isValidIndex(index)) {\n const source = this.data[index];\n return Point2d.create(source.x, source.y, result);\n }\n return undefined;\n }\n /**\n * Access by index, returning strongly typed Vector2d\n * @param index index of point within the array\n * @param result caller-allocated destination\n * @returns undefined if the index is out of bounds\n */\n public override getVector2dAtCheckedVectorIndex(index: number, result?: Vector2d): Vector2d | undefined {\n if (this.isValidIndex(index)) {\n const source = this.data[index];\n return Vector2d.create(source.x, source.y, result);\n }\n return undefined;\n }\n /**\n * Return a vector from the point at indexA to the point at indexB\n * @param indexA index of point within the array\n * @param indexB index of point within the array\n * @param result caller-allocated vector.\n * @returns undefined if either index is out of bounds\n */\n public override vectorIndexIndex(indexA: number, indexB: number, result?: Vector2d): Vector2d | undefined {\n if (this.isValidIndex(indexA) && this.isValidIndex(indexB))\n return Vector2d.createStartEnd(this.data[indexA], this.data[indexB], result);\n return undefined;\n }\n /**\n * Return a vector from given origin to point at indexB\n * @param origin origin for vector\n * @param indexB index of point within the array\n * @param result caller-allocated vector.\n * @returns undefined if index is out of bounds\n */\n public override vectorXAndYIndex(origin: XAndY, indexB: number, result?: Vector2d): Vector2d | undefined {\n if (this.isValidIndex(indexB))\n return Vector2d.createStartEnd(origin, this.data[indexB], result);\n return undefined;\n }\n\n /**\n * Return the cross product of vectors from origin to points at indexA and indexB\n * @param origin origin for vector\n * @param indexA index of first target within the array\n * @param indexB index of second target within the array\n * @param result caller-allocated vector.\n * @returns undefined if either index is out of bounds\n */\n public override crossProductXAndYIndexIndex(origin: XAndY, indexA: number, indexB: number): number | undefined {\n if (this.isValidIndex(indexA) && this.isValidIndex(indexB))\n return XY.crossProductToPoints(origin, this.data[indexA], this.data[indexB]);\n return undefined;\n }\n /**\n * Return the cross product of vectors from point at originIndex to points at indexA and indexB\n * @param originIndex index of origin\n * @param indexA index of first target within the array\n * @param indexB index of second target within the array\n * @param result caller-allocated vector.\n * @returns return true if indexA, indexB both valid\n */\n public override crossProductIndexIndexIndex(originIndex: number, indexA: number, indexB: number): number | undefined {\n if (this.isValidIndex(originIndex) && this.isValidIndex(indexA) && this.isValidIndex(indexB))\n return XY.crossProductToPoints(this.data[originIndex], this.data[indexA], this.data[indexB]);\n return undefined;\n }\n /**\n * read-only property for number of XYZ in the collection.\n */\n public override get length(): number {\n return this.data.length;\n }\n\n /**\n * Get x coordinate by point index, with no index checking\n * @param pointIndex index to access\n */\n public override getXAtUncheckedPointIndex(pointIndex: number): number {\n return this.data[pointIndex].x;\n }\n\n /**\n * Get y coordinate by point index, with no index checking\n * @param pointIndex index to access\n */\n public override getYAtUncheckedPointIndex(pointIndex: number): number {\n return this.data[pointIndex].y;\n }\n}\n"]}
|
|
@@ -577,9 +577,8 @@ class Vector2d extends XY {
|
|
|
577
577
|
* @param options optional radian and distance tolerances.
|
|
578
578
|
*/
|
|
579
579
|
isParallelTo(other, oppositeIsParallel = false, returnValueIfAnInputIsZeroLength = false, options) {
|
|
580
|
-
|
|
581
|
-
const
|
|
582
|
-
const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : Geometry_1.Geometry.smallMetricDistanceSquared;
|
|
580
|
+
const radianSquaredTol = options?.radianSquaredTol ?? Geometry_1.Geometry.smallAngleRadiansSquared;
|
|
581
|
+
const distanceSquaredTol = options?.distanceSquaredTol ?? Geometry_1.Geometry.smallMetricDistanceSquared;
|
|
583
582
|
const a2 = this.magnitudeSquared();
|
|
584
583
|
const b2 = other.magnitudeSquared();
|
|
585
584
|
if (a2 < distanceSquaredTol || b2 < distanceSquaredTol)
|
|
@@ -602,9 +601,8 @@ class Vector2d extends XY {
|
|
|
602
601
|
* @param options optional radian and distance tolerances.
|
|
603
602
|
*/
|
|
604
603
|
isPerpendicularTo(other, returnValueIfAnInputIsZeroLength = false, options) {
|
|
605
|
-
|
|
606
|
-
const
|
|
607
|
-
const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : Geometry_1.Geometry.smallMetricDistanceSquared;
|
|
604
|
+
const radianSquaredTol = options?.radianSquaredTol ?? Geometry_1.Geometry.smallAngleRadiansSquared;
|
|
605
|
+
const distanceSquaredTol = options?.distanceSquaredTol ?? Geometry_1.Geometry.smallMetricDistanceSquared;
|
|
608
606
|
const aa = this.magnitudeSquared();
|
|
609
607
|
const bb = other.magnitudeSquared();
|
|
610
608
|
if (aa < distanceSquaredTol || bb < distanceSquaredTol)
|
|
@@ -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,mBAAmB;AAEnB,0CAA6E;AAC7E,mCAAgC;AAGhC;;;;;;GAMG;AACH,MAAa,EAAE;IAeb,YAAsB,IAAY,CAAC,EAAE,IAAY,CAAC;QAChD,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IAbD,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;IAKD,mCAAmC;IAC5B,OAAO,CAAC,KAAa;QAC1B,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,CAAC,GAAG,KAAK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AgB,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,CAAC,KAAe,EAAE,mCAA4C,KAAK,EAAE,OAA6B;;QACxH,MAAM,gBAAgB,GAAW,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,mCAAI,mBAAQ,CAAC,wBAAwB,CAAC;QAChG,MAAM,kBAAkB,GAAW,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,kBAAkB,mCAAI,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;AAtTD,4BAsTC","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\n\nimport { BeJSONFunctions, Geometry, PerpParallelOptions } from \"../Geometry\";\nimport { Angle } from \"./Angle\";\nimport { XAndY, XYProps } from \"./XYZProps\";\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 /**\n * Return the x,y component corresponding to 0,1.\n */\n public at(index: number): number {\n if (index < 0.5)\n return this.x;\n return this.y;\n }\n /**\n * Set value at index 0 or 1.\n */\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 /** Starting at this point, move along vector by tangentFraction of the vector length, and then\n * to the left by leftFraction of the perpendicular vector length.\n * @param tangentFraction distance to move along the vector, as a fraction of vector\n * @param leftFraction distance to move perpendicular to the vector, as a fraction of the rotated vector\n * @param vector the other vector\n */\n public addForwardLeft(tangentFraction: number, leftFraction: number, vector: Vector2d): 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 );\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 /**\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 /** 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/** 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 /** 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.correctSmallMetricDistance(this.magnitude());\n result = result ? result : new Vector2d();\n return this.safeDivideOrNull(mag, result);\n }\n /**\n * Return fractional projection of target vector onto this\n * * It's returning the signed projection magnitude divided by the target magnitude. In other words,\n * it's returning the length of the projection as a fraction of the target magnitude.\n * @param target the target vector\n * @param defaultFraction the returned value in case magnitude square of target vector is very small\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 /** 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.correctSmallMetricDistance(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(other: Vector2d, returnValueIfAnInputIsZeroLength: boolean = false, options?: PerpParallelOptions): 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,mBAAmB;AAEnB,0CAA6E;AAC7E,mCAAgC;AAGhC;;;;;;GAMG;AACH,MAAa,EAAE;IAeb,YAAsB,IAAY,CAAC,EAAE,IAAY,CAAC;QAChD,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IAbD,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;IAKD,mCAAmC;IAC5B,OAAO,CAAC,KAAa;QAC1B,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;YACjB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AAgC,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,CAAC,KAAe,EAAE,mCAA4C,KAAK,EAAE,OAA6B;QACxH,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;AAtTD,4BAsTC","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\n\nimport { BeJSONFunctions, Geometry, PerpParallelOptions } from \"../Geometry\";\nimport { Angle } from \"./Angle\";\nimport { XAndY, XYProps } from \"./XYZProps\";\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 /**\n * Return the x,y component corresponding to 0,1.\n */\n public at(index: number): number {\n if (index < 0.5)\n return this.x;\n return this.y;\n }\n /**\n * Set value at index 0 or 1.\n */\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 /** Starting at this point, move along vector by tangentFraction of the vector length, and then\n * to the left by leftFraction of the perpendicular vector length.\n * @param tangentFraction distance to move along the vector, as a fraction of vector\n * @param leftFraction distance to move perpendicular to the vector, as a fraction of the rotated vector\n * @param vector the other vector\n */\n public addForwardLeft(tangentFraction: number, leftFraction: number, vector: Vector2d): 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 );\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 /**\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 /** 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/** 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 /** 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.correctSmallMetricDistance(this.magnitude());\n result = result ? result : new Vector2d();\n return this.safeDivideOrNull(mag, result);\n }\n /**\n * Return fractional projection of target vector onto this\n * * It's returning the signed projection magnitude divided by the target magnitude. In other words,\n * it's returning the length of the projection as a fraction of the target magnitude.\n * @param target the target vector\n * @param defaultFraction the returned value in case magnitude square of target vector is very small\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 /** 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.correctSmallMetricDistance(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(other: Vector2d, returnValueIfAnInputIsZeroLength: boolean = false, options?: PerpParallelOptions): 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"]}
|
|
@@ -31,7 +31,6 @@ export declare class Point3dArrayCarrier extends IndexedReadWriteXYZCollection {
|
|
|
31
31
|
* * This returns the xyz value but NOT reference to the point in the "carried" array.
|
|
32
32
|
* @param index index of point within the array
|
|
33
33
|
* @param result caller-allocated destination
|
|
34
|
-
* @returns undefined if the index is out of bounds
|
|
35
34
|
*/
|
|
36
35
|
getPoint3dAtUncheckedPointIndex(index: number, result?: Point3d): Point3d;
|
|
37
36
|
/**
|
|
@@ -131,19 +130,14 @@ export declare class Point3dArrayCarrier extends IndexedReadWriteXYZCollection {
|
|
|
131
130
|
reverseInPlace(): void;
|
|
132
131
|
/**
|
|
133
132
|
* Return distance squared between indicated points.
|
|
134
|
-
* * Concrete classes may be able to implement this without creating a temporary.
|
|
135
133
|
* @param index0 first point index
|
|
136
134
|
* @param index1 second point index
|
|
137
|
-
* @param defaultDistanceSquared distance squared to return if either point index is invalid.
|
|
138
|
-
*
|
|
139
135
|
*/
|
|
140
136
|
distanceSquaredIndexIndex(index0: number, index1: number): number | undefined;
|
|
141
137
|
/**
|
|
142
138
|
* Return distance between indicated points.
|
|
143
|
-
* * Concrete classes may be able to implement this without creating a temporary.
|
|
144
139
|
* @param index0 first point index
|
|
145
140
|
* @param index1 second point index
|
|
146
|
-
* @param defaultDistanceSquared distance squared to return if either point index is invalid.
|
|
147
141
|
*/
|
|
148
142
|
distanceIndexIndex(index0: number, index1: number): number | undefined;
|
|
149
143
|
/** Adjust index into range by modulo with the length. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Point3dArrayCarrier.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/Point3dArrayCarrier.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC;;;;;;GAMG;AACH,qBAAa,mBAAoB,SAAQ,6BAA6B;IACpE,wCAAwC;IACjC,IAAI,EAAE,OAAO,EAAE,CAAC;IACvB,wCAAwC;gBACrB,IAAI,EAAE,OAAO,EAAE;IAIlC,uDAAuD;IAChD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAG3C;;;;;;OAMG;IACI,6BAA6B,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;IAO1F
|
|
1
|
+
{"version":3,"file":"Point3dArrayCarrier.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/Point3dArrayCarrier.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC;;;;;;GAMG;AACH,qBAAa,mBAAoB,SAAQ,6BAA6B;IACpE,wCAAwC;IACjC,IAAI,EAAE,OAAO,EAAE,CAAC;IACvB,wCAAwC;gBACrB,IAAI,EAAE,OAAO,EAAE;IAIlC,uDAAuD;IAChD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAG3C;;;;;;OAMG;IACI,6BAA6B,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAA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