@itwin/core-geometry 4.3.0-dev.13 → 4.3.0-dev.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/bspline/BSpline1dNd.d.ts +12 -2
- package/lib/cjs/bspline/BSpline1dNd.d.ts.map +1 -1
- package/lib/cjs/bspline/BSpline1dNd.js +27 -17
- package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts +30 -16
- package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +68 -44
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve3dH.d.ts +27 -20
- package/lib/cjs/bspline/BSplineCurve3dH.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurve3dH.js +136 -87
- package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.d.ts +138 -74
- package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.js +242 -119
- package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
- package/lib/cjs/bspline/Bezier1dNd.d.ts +18 -4
- package/lib/cjs/bspline/Bezier1dNd.d.ts.map +1 -1
- package/lib/cjs/bspline/Bezier1dNd.js +19 -5
- package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3dH.d.ts.map +1 -1
- package/lib/cjs/bspline/BezierCurve3dH.js +2 -1
- package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.d.ts +30 -33
- package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
- package/lib/cjs/bspline/KnotVector.js +76 -69
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +20 -13
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +28 -21
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +3 -2
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +6 -5
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts +58 -20
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +213 -62
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +2 -3
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +2 -3
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.d.ts +13 -0
- package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js +21 -0
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.d.ts +88 -64
- package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.js +92 -73
- package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
- package/lib/cjs/numerics/PascalCoefficients.d.ts +8 -12
- package/lib/cjs/numerics/PascalCoefficients.d.ts.map +1 -1
- package/lib/cjs/numerics/PascalCoefficients.js +10 -12
- package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.d.ts +10 -10
- package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js +69 -42
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.d.ts +8 -8
- package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js +80 -55
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +6 -8
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +6 -14
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +84 -262
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.d.ts +109 -0
- package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -0
- package/lib/cjs/serialization/SerializationHelpers.js +591 -0
- package/lib/cjs/serialization/SerializationHelpers.js.map +1 -0
- package/lib/esm/bspline/BSpline1dNd.d.ts +12 -2
- package/lib/esm/bspline/BSpline1dNd.d.ts.map +1 -1
- package/lib/esm/bspline/BSpline1dNd.js +27 -17
- package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +30 -16
- package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js +68 -44
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve3dH.d.ts +27 -20
- package/lib/esm/bspline/BSplineCurve3dH.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurve3dH.js +137 -88
- package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BSplineSurface.d.ts +138 -74
- package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineSurface.js +242 -119
- package/lib/esm/bspline/BSplineSurface.js.map +1 -1
- package/lib/esm/bspline/Bezier1dNd.d.ts +18 -4
- package/lib/esm/bspline/Bezier1dNd.d.ts.map +1 -1
- package/lib/esm/bspline/Bezier1dNd.js +19 -5
- package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3dH.d.ts.map +1 -1
- package/lib/esm/bspline/BezierCurve3dH.js +2 -1
- package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/esm/bspline/KnotVector.d.ts +30 -33
- package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
- package/lib/esm/bspline/KnotVector.js +76 -69
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +20 -13
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +28 -21
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +3 -2
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +6 -5
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts +58 -20
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +213 -62
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +2 -3
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +2 -3
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.d.ts +13 -0
- package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Point4d.js +21 -0
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.d.ts +88 -64
- package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.js +92 -73
- package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
- package/lib/esm/numerics/PascalCoefficients.d.ts +8 -12
- package/lib/esm/numerics/PascalCoefficients.d.ts.map +1 -1
- package/lib/esm/numerics/PascalCoefficients.js +10 -12
- package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.d.ts +10 -10
- package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBReader.js +69 -42
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.d.ts +8 -8
- package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js +80 -55
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +7 -9
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +6 -14
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +85 -263
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.d.ts +109 -0
- package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -0
- package/lib/esm/serialization/SerializationHelpers.js +588 -0
- package/lib/esm/serialization/SerializationHelpers.js.map +1 -0
- package/package.json +3 -3
|
@@ -18,7 +18,7 @@ export declare class NumberArray {
|
|
|
18
18
|
/** Return true if arrays have identical counts and equal entries (using `!==` comparison) */
|
|
19
19
|
static isExactEqual(dataA: any[] | Float64Array | undefined, dataB: any[] | Float64Array | undefined): boolean;
|
|
20
20
|
/** Return true if arrays have identical counts and entries equal within tolerance */
|
|
21
|
-
static isAlmostEqual(dataA: number[] | Float64Array | undefined, dataB: number[] | Float64Array | undefined, tolerance
|
|
21
|
+
static isAlmostEqual(dataA: number[] | Float64Array | undefined, dataB: number[] | Float64Array | undefined, tolerance?: number): boolean;
|
|
22
22
|
/** return the sum of numbers in an array. Note that "PreciseSum" may be more accurate. */
|
|
23
23
|
static sum(data: number[] | Float64Array): number;
|
|
24
24
|
/** test if coordinate x appears (to tolerance by `Geometry.isSameCoordinate`) in this array of numbers */
|
|
@@ -42,8 +42,23 @@ export declare class NumberArray {
|
|
|
42
42
|
* @param step max permitted step
|
|
43
43
|
*/
|
|
44
44
|
static createArrayWithMaxStepSize(low: number, high: number, step: number): number[];
|
|
45
|
-
/**
|
|
45
|
+
/** Copy numbers from variant sources to number[]. */
|
|
46
46
|
static create(source: number[] | Float64Array): number[];
|
|
47
|
+
/** Copy number[][]. */
|
|
48
|
+
static copy2d(source: number[][]): number[][];
|
|
49
|
+
/** Copy number[][][]. */
|
|
50
|
+
static copy3d(source: number[][][]): number[][][];
|
|
51
|
+
/** Copy numbers from Float64Array to number[][].
|
|
52
|
+
* @param numPerBlock block size
|
|
53
|
+
*/
|
|
54
|
+
static unpack2d(source: Float64Array, numPerBlock: number): number[][] | undefined;
|
|
55
|
+
/** Copy numbers from Float64Array to number[][][].
|
|
56
|
+
* @param numPerRow row size
|
|
57
|
+
* @param numPerBlock block size
|
|
58
|
+
*/
|
|
59
|
+
static unpack3d(source: Float64Array, numPerRow: number, numPerBlock: number): number[][][] | undefined;
|
|
60
|
+
/** Copy numbers from 1d/2d/3d array to Float64Array. */
|
|
61
|
+
static pack(source: number[] | number[][] | number[][][]): Float64Array;
|
|
47
62
|
/** Return a copy of the knots array, with multiplicity of first and last knots raised or lowered to expectedMultiplicity. */
|
|
48
63
|
static cloneWithStartAndEndMultiplicity(knots: number[] | undefined, target0: number, target1: number): number[];
|
|
49
64
|
/** Compute the linear combination s of the numbers and scales.
|
|
@@ -96,13 +111,30 @@ export declare class Vector3dArray {
|
|
|
96
111
|
* @public
|
|
97
112
|
*/
|
|
98
113
|
export declare class Point4dArray {
|
|
99
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* Copy each weighted point and its corresponding weight into a packed buffer.
|
|
116
|
+
* @param data array of weighted xyz
|
|
117
|
+
* @param weights scalar weight array
|
|
118
|
+
* @param result optional destination array. If insufficiently sized, a new array is returned.
|
|
119
|
+
* @return packed weighted point array
|
|
120
|
+
*/
|
|
100
121
|
static packPointsAndWeightsToFloat64Array(data: Point3d[] | Float64Array | number[], weights: number[] | Float64Array, result?: Float64Array): Float64Array | undefined;
|
|
101
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* Copy 4d points into a packed buffer.
|
|
124
|
+
* @param data array of xyzw
|
|
125
|
+
* @param result optional destination array. If insufficiently sized, a new array is returned.
|
|
126
|
+
* @return packed point array
|
|
127
|
+
*/
|
|
102
128
|
static packToFloat64Array(data: Point4d[], result?: Float64Array): Float64Array;
|
|
103
129
|
/** unpack from ... to array of Point4d */
|
|
104
130
|
static unpackToPoint4dArray(data: Float64Array): Point4d[];
|
|
105
|
-
/**
|
|
131
|
+
/**
|
|
132
|
+
* Unpack packed 4D data to a Point3d array and an array of weights.
|
|
133
|
+
* * `WeightStyle` of `data` is not assumed. If input data is of form [a,b,c,d], default output arrays will have form [a,b,c] and [d].
|
|
134
|
+
* @param data input 4D points (packed)
|
|
135
|
+
* @param points output 3D data
|
|
136
|
+
* @param weights output weights (w portion of input)
|
|
137
|
+
* @param pointFormatter optional xyz formatter. By default, returns a Point3d created from the xyz portion of the input.
|
|
106
138
|
*/
|
|
107
139
|
static unpackFloat64ArrayToPointsAndWeights(data: Float64Array, points: Point3d[], weights: number[], pointFormatter?: (x: number, y: number, z: number) => any): void;
|
|
108
140
|
private static _workPoint4d;
|
|
@@ -112,7 +144,7 @@ export declare class Point4dArray {
|
|
|
112
144
|
* @param xyzw array of x,y,z,w points.
|
|
113
145
|
*/
|
|
114
146
|
static multiplyInPlace(transform: Transform, xyzw: Float64Array): void;
|
|
115
|
-
/**
|
|
147
|
+
/** Test arrays for near equality of all corresponding numeric values, treated as coordinates. */
|
|
116
148
|
static isAlmostEqual(dataA: Point4d[] | Float64Array | undefined, dataB: Point4d[] | Float64Array | undefined): boolean;
|
|
117
149
|
/** return true iff all xyzw points' altitudes are within tolerance of the plane.*/
|
|
118
150
|
static isCloseToPlane(data: Point4d[] | Float64Array, plane: Plane3dByOriginAndUnitNormal, tolerance?: number): boolean;
|
|
@@ -122,8 +154,13 @@ export declare class Point4dArray {
|
|
|
122
154
|
* @public
|
|
123
155
|
*/
|
|
124
156
|
export declare class Point3dArray {
|
|
125
|
-
/**
|
|
126
|
-
|
|
157
|
+
/**
|
|
158
|
+
* Copy 3d points into a packed buffer.
|
|
159
|
+
* @param data array of xyz
|
|
160
|
+
* @param result optional destination array. If insufficiently sized, a new array is returned.
|
|
161
|
+
* @return packed point array
|
|
162
|
+
*/
|
|
163
|
+
static packToFloat64Array(data: Point3d[], result?: Float64Array): Float64Array;
|
|
127
164
|
/**
|
|
128
165
|
* Compute the 8 weights of trilinear mapping
|
|
129
166
|
* By appropriate choice of weights, this can be used for both point and derivative mappings.
|
|
@@ -187,14 +224,15 @@ export declare class Point3dArray {
|
|
|
187
224
|
*/
|
|
188
225
|
static unpackNumbersToNestedArrays(data: Float64Array, numPerBlock: number): any[];
|
|
189
226
|
/**
|
|
190
|
-
*
|
|
227
|
+
* Return a 3-dimensional array containing all the values of `data` in rows of numPerRow blocks of size numPerBlock.
|
|
191
228
|
* @param data simple array of numbers
|
|
192
|
-
* @param numPerBlock number of values in each block
|
|
229
|
+
* @param numPerBlock number of values in each block
|
|
230
|
+
* @param numPerRow number of blocks per row
|
|
193
231
|
*/
|
|
194
232
|
static unpackNumbersToNestedArraysIJK(data: Float64Array, numPerBlock: number, numPerRow: number): any[];
|
|
195
233
|
/** multiply a transform times each x,y,z triple and replace the x,y,z in the packed array */
|
|
196
234
|
static multiplyInPlace(transform: Transform, xyz: Float64Array): void;
|
|
197
|
-
/**
|
|
235
|
+
/** Test arrays for near equality of all corresponding numeric values, treated as coordinates. */
|
|
198
236
|
static isAlmostEqual(dataA: Point3d[] | Float64Array | undefined, dataB: Point3d[] | Float64Array | undefined): boolean;
|
|
199
237
|
/** return simple average of all coordinates. (000 if empty array) */
|
|
200
238
|
static centroid(points: IndexedXYZCollection | Point3d[], result?: Point3d): Point3d;
|
|
@@ -255,18 +293,18 @@ export declare class Point3dArray {
|
|
|
255
293
|
*/
|
|
256
294
|
static cloneDeepXYZPoint3dArrays(data: MultiLineStringDataVariant): any[];
|
|
257
295
|
/**
|
|
258
|
-
*
|
|
259
|
-
* *
|
|
260
|
-
* * false ==>
|
|
261
|
-
* * true ==>
|
|
262
|
-
*
|
|
296
|
+
* Return perpendicular distance from points[indexB] to the segment from points[indexA] to points[indexC].
|
|
297
|
+
* * Extrapolation options when the projection is outside of the fraction range [0,1] are:
|
|
298
|
+
* * false ==> return distance to closest endpoint
|
|
299
|
+
* * true ==> return distance to extended line segment
|
|
300
|
+
* * There is no index checking!
|
|
263
301
|
*/
|
|
264
302
|
static distanceIndexedPointBToSegmentAC(points: Point3d[], indexA: number, indexB: number, indexC: number, extrapolate: boolean): number;
|
|
265
303
|
/** Computes the hull of the XY projection of points.
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
304
|
+
* @param points input points, z-coordinates ignored
|
|
305
|
+
* @param hullPoints (output) points on the convex hull (cloned from input points)
|
|
306
|
+
* @param insidePoints (output) points not on the convex hull (cloned from input points)
|
|
307
|
+
* @param addClosurePoint whether to append the first hull point to `hullPoints`
|
|
270
308
|
*/
|
|
271
309
|
static computeConvexHullXY(points: Point3d[], hullPoints: Point3d[], insidePoints: Point3d[], addClosurePoint?: boolean): void;
|
|
272
310
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointHelpers.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/PointHelpers.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EA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AAS,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS;CAc5I"}
|
|
@@ -68,12 +68,12 @@ class NumberArray {
|
|
|
68
68
|
return (dataA === undefined && dataB === undefined);
|
|
69
69
|
}
|
|
70
70
|
/** Return true if arrays have identical counts and entries equal within tolerance */
|
|
71
|
-
static isAlmostEqual(dataA, dataB, tolerance) {
|
|
71
|
+
static isAlmostEqual(dataA, dataB, tolerance = Geometry_1.Geometry.smallMetricDistance) {
|
|
72
72
|
if (dataA && dataB) {
|
|
73
73
|
if (dataA.length !== dataB.length)
|
|
74
74
|
return false;
|
|
75
75
|
for (let i = 0; i < dataA.length; i++)
|
|
76
|
-
if (Math.abs(dataA[i] - dataB[i])
|
|
76
|
+
if (Math.abs(dataA[i] - dataB[i]) > tolerance)
|
|
77
77
|
return false;
|
|
78
78
|
return true;
|
|
79
79
|
}
|
|
@@ -159,13 +159,97 @@ class NumberArray {
|
|
|
159
159
|
result.push(high);
|
|
160
160
|
return result;
|
|
161
161
|
}
|
|
162
|
-
/**
|
|
162
|
+
/** Copy numbers from variant sources to number[]. */
|
|
163
163
|
static create(source) {
|
|
164
164
|
const result = [];
|
|
165
165
|
for (const q of source)
|
|
166
166
|
result.push(q);
|
|
167
167
|
return result;
|
|
168
168
|
}
|
|
169
|
+
/** Copy number[][]. */
|
|
170
|
+
static copy2d(source) {
|
|
171
|
+
const result = [];
|
|
172
|
+
for (const row of source) {
|
|
173
|
+
const newRow = [];
|
|
174
|
+
for (const entry of row)
|
|
175
|
+
newRow.push(entry);
|
|
176
|
+
result.push(newRow);
|
|
177
|
+
}
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
/** Copy number[][][]. */
|
|
181
|
+
static copy3d(source) {
|
|
182
|
+
const result = [];
|
|
183
|
+
for (const row of source) {
|
|
184
|
+
const newRow = [];
|
|
185
|
+
for (const block of row) {
|
|
186
|
+
const newBlock = [];
|
|
187
|
+
for (const entry of block)
|
|
188
|
+
newBlock.push(entry);
|
|
189
|
+
newRow.push(newBlock);
|
|
190
|
+
}
|
|
191
|
+
result.push(newRow);
|
|
192
|
+
}
|
|
193
|
+
return result;
|
|
194
|
+
}
|
|
195
|
+
/** Copy numbers from Float64Array to number[][].
|
|
196
|
+
* @param numPerBlock block size
|
|
197
|
+
*/
|
|
198
|
+
static unpack2d(source, numPerBlock) {
|
|
199
|
+
if (numPerBlock < 1)
|
|
200
|
+
return undefined;
|
|
201
|
+
return Point3dArray.unpackNumbersToNestedArrays(source, numPerBlock);
|
|
202
|
+
}
|
|
203
|
+
/** Copy numbers from Float64Array to number[][][].
|
|
204
|
+
* @param numPerRow row size
|
|
205
|
+
* @param numPerBlock block size
|
|
206
|
+
*/
|
|
207
|
+
static unpack3d(source, numPerRow, numPerBlock) {
|
|
208
|
+
if (numPerBlock < 1 || numPerRow < 1)
|
|
209
|
+
return undefined;
|
|
210
|
+
return Point3dArray.unpackNumbersToNestedArraysIJK(source, numPerBlock, numPerRow);
|
|
211
|
+
}
|
|
212
|
+
/** Copy numbers from 1d/2d/3d array to Float64Array. */
|
|
213
|
+
static pack(source) {
|
|
214
|
+
const numRows = source.length;
|
|
215
|
+
let numPerRow = 0;
|
|
216
|
+
let numPerBlock = 0;
|
|
217
|
+
let numCoords = 0;
|
|
218
|
+
if (numRows > 0) {
|
|
219
|
+
numCoords = numRows;
|
|
220
|
+
if (Array.isArray(source[0])) {
|
|
221
|
+
numPerRow = source[0].length;
|
|
222
|
+
if (numPerRow > 0) {
|
|
223
|
+
numCoords *= numPerRow;
|
|
224
|
+
if (Array.isArray(source[0][0])) {
|
|
225
|
+
numPerBlock = source[0][0].length;
|
|
226
|
+
if (numPerBlock > 0)
|
|
227
|
+
numCoords *= numPerBlock;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
const result = new Float64Array(numCoords);
|
|
233
|
+
if (numPerBlock > 0) {
|
|
234
|
+
const src3d = source;
|
|
235
|
+
for (let i = 0, c = 0; i < numRows; ++i)
|
|
236
|
+
for (let j = 0; j < numPerRow; ++j)
|
|
237
|
+
for (let k = 0; k < numPerBlock; ++k)
|
|
238
|
+
result[c++] = src3d[i][j][k];
|
|
239
|
+
}
|
|
240
|
+
else if (numPerRow > 0) {
|
|
241
|
+
const src2d = source;
|
|
242
|
+
for (let i = 0, c = 0; i < numRows; ++i)
|
|
243
|
+
for (let j = 0; j < numPerRow; ++j)
|
|
244
|
+
result[c++] = src2d[i][j];
|
|
245
|
+
}
|
|
246
|
+
else if (numRows > 0) {
|
|
247
|
+
const src1d = source;
|
|
248
|
+
for (let i = 0, c = 0; i < numRows; ++i)
|
|
249
|
+
result[c++] = src1d[i];
|
|
250
|
+
}
|
|
251
|
+
return result;
|
|
252
|
+
}
|
|
169
253
|
/** Return a copy of the knots array, with multiplicity of first and last knots raised or lowered to expectedMultiplicity. */
|
|
170
254
|
static cloneWithStartAndEndMultiplicity(knots, target0, target1) {
|
|
171
255
|
const result = [];
|
|
@@ -299,16 +383,23 @@ exports.Vector3dArray = Vector3dArray;
|
|
|
299
383
|
* @public
|
|
300
384
|
*/
|
|
301
385
|
class Point4dArray {
|
|
302
|
-
/**
|
|
386
|
+
/**
|
|
387
|
+
* Copy each weighted point and its corresponding weight into a packed buffer.
|
|
388
|
+
* @param data array of weighted xyz
|
|
389
|
+
* @param weights scalar weight array
|
|
390
|
+
* @param result optional destination array. If insufficiently sized, a new array is returned.
|
|
391
|
+
* @return packed weighted point array
|
|
392
|
+
*/
|
|
303
393
|
static packPointsAndWeightsToFloat64Array(data, weights, result) {
|
|
394
|
+
let points;
|
|
304
395
|
if (Array.isArray(data) && data[0] instanceof Point3dVector3d_1.Point3d) {
|
|
305
|
-
|
|
396
|
+
points = data;
|
|
306
397
|
if (points.length !== weights.length)
|
|
307
398
|
return undefined;
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
for (k = 0; k < points.length; k++) {
|
|
399
|
+
const numValues = 4 * points.length;
|
|
400
|
+
if (!result || result.length < numValues)
|
|
401
|
+
result = new Float64Array(numValues);
|
|
402
|
+
for (let i = 0, k = 0; k < points.length; k++) {
|
|
312
403
|
result[i++] = points[k].x;
|
|
313
404
|
result[i++] = points[k].y;
|
|
314
405
|
result[i++] = points[k].z;
|
|
@@ -316,28 +407,32 @@ class Point4dArray {
|
|
|
316
407
|
}
|
|
317
408
|
return result;
|
|
318
409
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
result[i++] = weights[k];
|
|
333
|
-
}
|
|
334
|
-
return result;
|
|
410
|
+
points = data;
|
|
411
|
+
const numPoints = weights.length;
|
|
412
|
+
if (points.length !== 3 * numPoints)
|
|
413
|
+
return undefined;
|
|
414
|
+
const numValues1 = 4 * numPoints;
|
|
415
|
+
if (!result || result.length < numValues1)
|
|
416
|
+
result = new Float64Array(numValues1);
|
|
417
|
+
for (let i = 0, k = 0; k < numPoints; k++) {
|
|
418
|
+
const k0 = 3 * k;
|
|
419
|
+
result[i++] = points[k0];
|
|
420
|
+
result[i++] = points[k0 + 1];
|
|
421
|
+
result[i++] = points[k0 + 2];
|
|
422
|
+
result[i++] = weights[k];
|
|
335
423
|
}
|
|
336
|
-
return
|
|
424
|
+
return result;
|
|
337
425
|
}
|
|
338
|
-
/**
|
|
426
|
+
/**
|
|
427
|
+
* Copy 4d points into a packed buffer.
|
|
428
|
+
* @param data array of xyzw
|
|
429
|
+
* @param result optional destination array. If insufficiently sized, a new array is returned.
|
|
430
|
+
* @return packed point array
|
|
431
|
+
*/
|
|
339
432
|
static packToFloat64Array(data, result) {
|
|
340
|
-
|
|
433
|
+
const numValues = 4 * data.length;
|
|
434
|
+
if (!result || result.length < numValues)
|
|
435
|
+
result = new Float64Array(numValues);
|
|
341
436
|
let i = 0;
|
|
342
437
|
for (const p of data) {
|
|
343
438
|
result[i++] = p.x;
|
|
@@ -355,7 +450,13 @@ class Point4dArray {
|
|
|
355
450
|
}
|
|
356
451
|
return result;
|
|
357
452
|
}
|
|
358
|
-
/**
|
|
453
|
+
/**
|
|
454
|
+
* Unpack packed 4D data to a Point3d array and an array of weights.
|
|
455
|
+
* * `WeightStyle` of `data` is not assumed. If input data is of form [a,b,c,d], default output arrays will have form [a,b,c] and [d].
|
|
456
|
+
* @param data input 4D points (packed)
|
|
457
|
+
* @param points output 3D data
|
|
458
|
+
* @param weights output weights (w portion of input)
|
|
459
|
+
* @param pointFormatter optional xyz formatter. By default, returns a Point3d created from the xyz portion of the input.
|
|
359
460
|
*/
|
|
360
461
|
static unpackFloat64ArrayToPointsAndWeights(data, points, weights, pointFormatter = (x, y, z) => Point3dVector3d_1.Point3d.create(x, y, z)) {
|
|
361
462
|
points.length = 0;
|
|
@@ -381,21 +482,36 @@ class Point4dArray {
|
|
|
381
482
|
xyzw[i + 3] = xyzw1.w;
|
|
382
483
|
}
|
|
383
484
|
}
|
|
384
|
-
/**
|
|
485
|
+
/** Test arrays for near equality of all corresponding numeric values, treated as coordinates. */
|
|
385
486
|
static isAlmostEqual(dataA, dataB) {
|
|
386
487
|
if (dataA && dataB) {
|
|
387
|
-
if (dataA.length !== dataB.length)
|
|
388
|
-
return false;
|
|
389
488
|
if (dataA instanceof Float64Array && dataB instanceof Float64Array) {
|
|
489
|
+
if (dataA.length !== dataB.length)
|
|
490
|
+
return false;
|
|
390
491
|
for (let i = 0; i < dataA.length; i++)
|
|
391
492
|
if (!Geometry_1.Geometry.isSameCoordinate(dataA[i], dataB[i]))
|
|
392
493
|
return false;
|
|
393
494
|
}
|
|
394
495
|
else if (Array.isArray(dataA) && Array.isArray(dataB)) {
|
|
496
|
+
if (dataA.length !== dataB.length)
|
|
497
|
+
return false;
|
|
395
498
|
for (let i = 0; i < dataA.length; i++)
|
|
396
499
|
if (!dataA[i].isAlmostEqual(dataB[i]))
|
|
397
500
|
return false;
|
|
398
501
|
}
|
|
502
|
+
else { // different types
|
|
503
|
+
const points = dataA instanceof Float64Array ? dataB : dataA;
|
|
504
|
+
const numbers = dataA instanceof Float64Array ? dataA : dataB;
|
|
505
|
+
if (numbers.length !== points.length * 4)
|
|
506
|
+
return false;
|
|
507
|
+
for (let iPoint = 0; iPoint < points.length; ++iPoint) {
|
|
508
|
+
if (!Geometry_1.Geometry.isSameCoordinate(points[iPoint].x, numbers[4 * iPoint]) ||
|
|
509
|
+
!Geometry_1.Geometry.isSameCoordinate(points[iPoint].y, numbers[4 * iPoint + 1]) ||
|
|
510
|
+
!Geometry_1.Geometry.isSameCoordinate(points[iPoint].z, numbers[4 * iPoint + 2]) ||
|
|
511
|
+
!Geometry_1.Geometry.isSameCoordinate(points[iPoint].w, numbers[4 * iPoint + 3]))
|
|
512
|
+
return false;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
399
515
|
return true;
|
|
400
516
|
}
|
|
401
517
|
// if both are null it is equal, otherwise unequal
|
|
@@ -426,9 +542,16 @@ exports.Point4dArray = Point4dArray;
|
|
|
426
542
|
* @public
|
|
427
543
|
*/
|
|
428
544
|
class Point3dArray {
|
|
429
|
-
/**
|
|
430
|
-
|
|
431
|
-
|
|
545
|
+
/**
|
|
546
|
+
* Copy 3d points into a packed buffer.
|
|
547
|
+
* @param data array of xyz
|
|
548
|
+
* @param result optional destination array. If insufficiently sized, a new array is returned.
|
|
549
|
+
* @return packed point array
|
|
550
|
+
*/
|
|
551
|
+
static packToFloat64Array(data, result) {
|
|
552
|
+
const numValues = 3 * data.length;
|
|
553
|
+
if (!result || result.length < numValues)
|
|
554
|
+
result = new Float64Array(numValues);
|
|
432
555
|
let i = 0;
|
|
433
556
|
for (const p of data) {
|
|
434
557
|
result[i++] = p.x;
|
|
@@ -564,9 +687,10 @@ class Point3dArray {
|
|
|
564
687
|
return result;
|
|
565
688
|
}
|
|
566
689
|
/**
|
|
567
|
-
*
|
|
690
|
+
* Return a 3-dimensional array containing all the values of `data` in rows of numPerRow blocks of size numPerBlock.
|
|
568
691
|
* @param data simple array of numbers
|
|
569
|
-
* @param numPerBlock number of values in each block
|
|
692
|
+
* @param numPerBlock number of values in each block
|
|
693
|
+
* @param numPerRow number of blocks per row
|
|
570
694
|
*/
|
|
571
695
|
static unpackNumbersToNestedArraysIJK(data, numPerBlock, numPerRow) {
|
|
572
696
|
const result = [];
|
|
@@ -602,21 +726,35 @@ class Point3dArray {
|
|
|
602
726
|
xyz[i + 2] = xyz1.z;
|
|
603
727
|
}
|
|
604
728
|
}
|
|
605
|
-
/**
|
|
729
|
+
/** Test arrays for near equality of all corresponding numeric values, treated as coordinates. */
|
|
606
730
|
static isAlmostEqual(dataA, dataB) {
|
|
607
731
|
if (dataA && dataB) {
|
|
608
|
-
if (dataA.length !== dataB.length)
|
|
609
|
-
return false;
|
|
610
732
|
if (dataA instanceof Float64Array && dataB instanceof Float64Array) {
|
|
733
|
+
if (dataA.length !== dataB.length)
|
|
734
|
+
return false;
|
|
611
735
|
for (let i = 0; i < dataA.length; i++)
|
|
612
736
|
if (!Geometry_1.Geometry.isSameCoordinate(dataA[i], dataB[i]))
|
|
613
737
|
return false;
|
|
614
738
|
}
|
|
615
739
|
else if (Array.isArray(dataA) && Array.isArray(dataB)) {
|
|
740
|
+
if (dataA.length !== dataB.length)
|
|
741
|
+
return false;
|
|
616
742
|
for (let i = 0; i < dataA.length; i++)
|
|
617
743
|
if (!dataA[i].isAlmostEqual(dataB[i]))
|
|
618
744
|
return false;
|
|
619
745
|
}
|
|
746
|
+
else { // different types
|
|
747
|
+
const points = dataA instanceof Float64Array ? dataB : dataA;
|
|
748
|
+
const numbers = dataA instanceof Float64Array ? dataA : dataB;
|
|
749
|
+
if (numbers.length !== points.length * 3)
|
|
750
|
+
return false;
|
|
751
|
+
for (let iPoint = 0; iPoint < points.length; ++iPoint) {
|
|
752
|
+
if (!Geometry_1.Geometry.isSameCoordinate(points[iPoint].x, numbers[3 * iPoint]) ||
|
|
753
|
+
!Geometry_1.Geometry.isSameCoordinate(points[iPoint].y, numbers[3 * iPoint + 1]) ||
|
|
754
|
+
!Geometry_1.Geometry.isSameCoordinate(points[iPoint].z, numbers[3 * iPoint + 2]))
|
|
755
|
+
return false;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
620
758
|
return true;
|
|
621
759
|
}
|
|
622
760
|
// if both are null it is equal, otherwise unequal
|
|
@@ -825,7 +963,16 @@ class Point3dArray {
|
|
|
825
963
|
result.push([p.x, p.y, p.z]);
|
|
826
964
|
}
|
|
827
965
|
else if (Array.isArray(p)) {
|
|
828
|
-
|
|
966
|
+
const x = p.length > 0 ? p[0] : 0.0;
|
|
967
|
+
const y = p.length > 1 ? p[1] : 0.0;
|
|
968
|
+
const z = p.length > 2 ? p[2] : 0.0;
|
|
969
|
+
result.push([x, y, z]);
|
|
970
|
+
}
|
|
971
|
+
else {
|
|
972
|
+
const x = p.x !== undefined ? p.x : 0.0;
|
|
973
|
+
const y = p.y !== undefined ? p.y : 0.0;
|
|
974
|
+
const z = p.z !== undefined ? p.z : 0.0;
|
|
975
|
+
result.push([x, y, z]);
|
|
829
976
|
}
|
|
830
977
|
}
|
|
831
978
|
return result;
|
|
@@ -843,9 +990,14 @@ class Point3dArray {
|
|
|
843
990
|
result[i++] = p.z;
|
|
844
991
|
}
|
|
845
992
|
else if (Array.isArray(p)) {
|
|
846
|
-
result[i++] = p[0];
|
|
847
|
-
result[i++] = p[1];
|
|
848
|
-
result[i++] = p.length > 2 ? p[2] : 0.0;
|
|
993
|
+
result[i++] = p.length > 0 ? p[0] : 0.0;
|
|
994
|
+
result[i++] = p.length > 1 ? p[1] : 0.0;
|
|
995
|
+
result[i++] = p.length > 2 ? p[2] : 0.0;
|
|
996
|
+
}
|
|
997
|
+
else {
|
|
998
|
+
result[i++] = p.x !== undefined ? p.x : 0.0;
|
|
999
|
+
result[i++] = p.y !== undefined ? p.y : 0.0;
|
|
1000
|
+
result[i++] = p.z !== undefined ? p.z : 0.0;
|
|
849
1001
|
}
|
|
850
1002
|
}
|
|
851
1003
|
return result;
|
|
@@ -860,37 +1012,36 @@ class Point3dArray {
|
|
|
860
1012
|
return collector.claimResult();
|
|
861
1013
|
}
|
|
862
1014
|
/**
|
|
863
|
-
*
|
|
864
|
-
* *
|
|
865
|
-
* * false ==>
|
|
866
|
-
* * true ==>
|
|
867
|
-
*
|
|
1015
|
+
* Return perpendicular distance from points[indexB] to the segment from points[indexA] to points[indexC].
|
|
1016
|
+
* * Extrapolation options when the projection is outside of the fraction range [0,1] are:
|
|
1017
|
+
* * false ==> return distance to closest endpoint
|
|
1018
|
+
* * true ==> return distance to extended line segment
|
|
1019
|
+
* * There is no index checking!
|
|
868
1020
|
*/
|
|
869
1021
|
static distanceIndexedPointBToSegmentAC(points, indexA, indexB, indexC, extrapolate) {
|
|
870
1022
|
const vectorU = Point3dVector3d_1.Vector3d.createStartEnd(points[indexA], points[indexC]);
|
|
871
1023
|
const vectorV = Point3dVector3d_1.Vector3d.createStartEnd(points[indexA], points[indexB]);
|
|
872
1024
|
const uDotU = vectorU.dotProduct(vectorU);
|
|
873
1025
|
const uDotV = vectorU.dotProduct(vectorV);
|
|
874
|
-
|
|
1026
|
+
const fraction = Geometry_1.Geometry.conditionalDivideFraction(uDotV, uDotU);
|
|
875
1027
|
if (fraction === undefined)
|
|
876
|
-
|
|
1028
|
+
return vectorV.magnitude(); // AC is degenerate; return ||B-A||
|
|
877
1029
|
if (!extrapolate) {
|
|
878
1030
|
if (fraction > 1.0)
|
|
879
|
-
|
|
1031
|
+
return points[indexB].distance(points[indexC]); // return ||B-C||
|
|
880
1032
|
if (fraction < 0.0)
|
|
881
|
-
|
|
1033
|
+
return vectorV.magnitude(); // return ||B-A||
|
|
882
1034
|
}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
return Math.sqrt(h2);
|
|
1035
|
+
// return distance to projection on (extended) segment
|
|
1036
|
+
const h2 = vectorV.magnitudeSquared() - fraction * fraction * uDotU;
|
|
1037
|
+
// h2 should never be negative except for quirky tolerance...
|
|
1038
|
+
return h2 <= 0.0 ? 0.0 : Math.sqrt(h2);
|
|
888
1039
|
}
|
|
889
1040
|
/** Computes the hull of the XY projection of points.
|
|
890
|
-
*
|
|
891
|
-
*
|
|
892
|
-
*
|
|
893
|
-
*
|
|
1041
|
+
* @param points input points, z-coordinates ignored
|
|
1042
|
+
* @param hullPoints (output) points on the convex hull (cloned from input points)
|
|
1043
|
+
* @param insidePoints (output) points not on the convex hull (cloned from input points)
|
|
1044
|
+
* @param addClosurePoint whether to append the first hull point to `hullPoints`
|
|
894
1045
|
*/
|
|
895
1046
|
static computeConvexHullXY(points, hullPoints, insidePoints, addClosurePoint = false) {
|
|
896
1047
|
hullPoints.length = 0;
|