@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
|
@@ -22,14 +22,19 @@ export var UVSelect;
|
|
|
22
22
|
(function (UVSelect) {
|
|
23
23
|
/** index of u direction */
|
|
24
24
|
UVSelect[UVSelect["uDirection"] = 0] = "uDirection";
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* index of v direction
|
|
27
|
+
* @deprecated in 4.x. Use vDirection instead.
|
|
28
|
+
*/
|
|
26
29
|
UVSelect[UVSelect["VDirection"] = 1] = "VDirection";
|
|
30
|
+
/** index of v direction */
|
|
31
|
+
UVSelect[UVSelect["vDirection"] = 1] = "vDirection";
|
|
27
32
|
})(UVSelect || (UVSelect = {}));
|
|
28
33
|
/**
|
|
29
34
|
* Enumeration of how weights are carried
|
|
30
35
|
* * UnWeighted (0) -- there are no weights
|
|
31
|
-
* * WeightsAlreadyAppliedToCoordinates (1) -- for real point (x,y,z) the homogeneous point
|
|
32
|
-
* * WeightsSeparateFromCoordinates (2) -- for real point (x,y,z) the homogeneous point is (x,y,z,w)
|
|
36
|
+
* * WeightsAlreadyAppliedToCoordinates (1) -- for real point (x,y,z) the homogeneous point (wx,wy,wx,w) is stored as (wx,wy,wz,w)
|
|
37
|
+
* * WeightsSeparateFromCoordinates (2) -- for real point (x,y,z) the homogeneous point (wx,wy,wx,w) is stored as (x,y,z,w)
|
|
33
38
|
* * Note that "internal" computations never use WeightsSeparateFromCoordinates.
|
|
34
39
|
* * WeightsSeparateFromCoordinates is only useful as input or output state in serializer.
|
|
35
40
|
* @public
|
|
@@ -39,13 +44,13 @@ export var WeightStyle;
|
|
|
39
44
|
/** There are no weights. */
|
|
40
45
|
WeightStyle[WeightStyle["UnWeighted"] = 0] = "UnWeighted";
|
|
41
46
|
/**
|
|
42
|
-
* * Data is weighted
|
|
43
|
-
* * point with normalized coordinate `[x,y,z]` and weight `w`
|
|
47
|
+
* * Data is weighted.
|
|
48
|
+
* * The point with normalized coordinate `[x,y,z]` and weight `w` is stored as `[x*w,y*w,z*w,w]`
|
|
44
49
|
* */
|
|
45
50
|
WeightStyle[WeightStyle["WeightsAlreadyAppliedToCoordinates"] = 1] = "WeightsAlreadyAppliedToCoordinates";
|
|
46
51
|
/**
|
|
47
|
-
* * Data is weighted
|
|
48
|
-
* * point with normalized coordinate `[x,y,z]` and weight `w`
|
|
52
|
+
* * Data is weighted.
|
|
53
|
+
* * The point with normalized coordinate `[x,y,z]` and weight `w` is stored as `[x,y,z,w]`
|
|
49
54
|
* */
|
|
50
55
|
WeightStyle[WeightStyle["WeightsSeparateFromCoordinates"] = 2] = "WeightsSeparateFromCoordinates";
|
|
51
56
|
})(WeightStyle || (WeightStyle = {}));
|
|
@@ -76,18 +81,30 @@ export class BSpline2dNd extends GeometryQuery {
|
|
|
76
81
|
return false;
|
|
77
82
|
return true;
|
|
78
83
|
}
|
|
79
|
-
/** Get the Point3d
|
|
84
|
+
/** Get the indexed Point3d.
|
|
80
85
|
* * (IMPORTANT) This assumes this is an xyz surface. Data will be incorrect if this is an xyzw surface.
|
|
86
|
+
* @param i index in [0, numPolesU)
|
|
87
|
+
* @param j index in [0, numPolesV)
|
|
81
88
|
*/
|
|
82
89
|
getPoint3dPole(i, j, result) {
|
|
83
90
|
return Point3d.createFromPacked(this.coffs, i + j * this._numPoles[0], result);
|
|
84
91
|
}
|
|
85
|
-
/** Get the Point3d
|
|
92
|
+
/** Get the indexed Point3d, projecting the weight away to get to xyz.
|
|
86
93
|
* * (IMPORTANT) This assumes this is an xyzw surface. Data will be incorrect if this is an xyz surface.
|
|
94
|
+
* @param i index in [0, numPolesU)
|
|
95
|
+
* @param j index in [0, numPolesV)
|
|
87
96
|
*/
|
|
88
97
|
getPoint3dPoleXYZW(i, j, result) {
|
|
89
98
|
return Point3d.createFromPackedXYZW(this.coffs, i + j * this._numPoles[0], result);
|
|
90
99
|
}
|
|
100
|
+
/** Get the indexed Point4d.
|
|
101
|
+
* * (IMPORTANT) This assumes this is an xyzw surface. Data will be incorrect if this is an xyz surface.
|
|
102
|
+
* @param i index in [0, numPolesU)
|
|
103
|
+
* @param j index in [0, numPolesV)
|
|
104
|
+
*/
|
|
105
|
+
getPoint4dPole(i, j, result) {
|
|
106
|
+
return Point4d.createFromPacked(this.coffs, (i + j * this._numPoles[0]) * 4, result);
|
|
107
|
+
}
|
|
91
108
|
/**
|
|
92
109
|
* Return 0 for 0 input, 1 for any nonzero input.
|
|
93
110
|
* @param value numeric value to convert to strict 0 or 1.
|
|
@@ -181,6 +198,7 @@ export class BSpline2dNd extends GeometryQuery {
|
|
|
181
198
|
* * choice of u or v
|
|
182
199
|
* * span index
|
|
183
200
|
* * local fraction within the span.
|
|
201
|
+
* @returns true if and only if output arrays are sufficiently sized
|
|
184
202
|
*/
|
|
185
203
|
spanFractionsToBasisFunctions(select, spanIndex, spanFraction, f, df) {
|
|
186
204
|
spanIndex = Geometry.clampToStartEnd(spanIndex, 0, this.numSpanUV(select));
|
|
@@ -210,9 +228,15 @@ export class BSpline2dNd extends GeometryQuery {
|
|
|
210
228
|
kU += stepV;
|
|
211
229
|
}
|
|
212
230
|
}
|
|
213
|
-
|
|
214
|
-
|
|
231
|
+
/**
|
|
232
|
+
* sum poles by the weights in the basisBuffer, using poles for given span
|
|
233
|
+
* @deprecated in 4.x. Use sumPoleBufferDerivativesForSpan instead.
|
|
234
|
+
*/
|
|
215
235
|
sumpoleBufferDerivativesForSpan(spanIndexU, spanIndexV) {
|
|
236
|
+
return this.sumPoleBufferDerivativesForSpan(spanIndexU, spanIndexV);
|
|
237
|
+
}
|
|
238
|
+
/** sum derivatives by the weights in the basisBuffer, using poles for given span */
|
|
239
|
+
sumPoleBufferDerivativesForSpan(spanIndexU, spanIndexV) {
|
|
216
240
|
const poleBuffer1U = this._poleBuffer1UV[0];
|
|
217
241
|
const poleBuffer1V = this._poleBuffer1UV[1];
|
|
218
242
|
poleBuffer1U.fill(0);
|
|
@@ -266,7 +290,7 @@ export class BSpline2dNd extends GeometryQuery {
|
|
|
266
290
|
this.knots[0].evaluateBasisFunctions1(knotIndex0U, u, this._basisBufferUV[0], this._basisBuffer1UV[0]);
|
|
267
291
|
this.knots[1].evaluateBasisFunctions1(knotIndex0V, v, this._basisBufferUV[1], this._basisBuffer1UV[1]);
|
|
268
292
|
this.sumPoleBufferForSpan(poleIndex0U, poleIndex0V);
|
|
269
|
-
this.
|
|
293
|
+
this.sumPoleBufferDerivativesForSpan(poleIndex0U, poleIndex0V);
|
|
270
294
|
}
|
|
271
295
|
}
|
|
272
296
|
// Swap numSwap entries in coffs, starting at i0 and i1 (absolute indices -- not blocks)
|
|
@@ -305,31 +329,33 @@ export class BSpline2dNd extends GeometryQuery {
|
|
|
305
329
|
this.knots[select].reflectKnots();
|
|
306
330
|
}
|
|
307
331
|
/**
|
|
308
|
-
*
|
|
332
|
+
* Get the flag indicating the surface might be suitable for having wrapped "closed" interpretation.
|
|
333
|
+
*/
|
|
334
|
+
getWrappable(select) {
|
|
335
|
+
return this.knots[select].wrappable;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Set the flag indicating the surface might be suitable for having wrapped "closed" interpretation.
|
|
309
339
|
*/
|
|
310
340
|
setWrappable(select, value) {
|
|
311
341
|
this.knots[select].wrappable = value;
|
|
312
342
|
}
|
|
313
343
|
/**
|
|
314
|
-
* Test if
|
|
315
|
-
* @param
|
|
316
|
-
* @
|
|
344
|
+
* Test if leading and trailing blocks of points match in a given direction.
|
|
345
|
+
* @param data packed array of points in row-major order (numRows x numColumns x dimension numbers)
|
|
346
|
+
* @param numRows number of rows of points in the array
|
|
347
|
+
* @param numColumns number of columns of points in the array (equal to the number of points in each row)
|
|
348
|
+
* @param dimension point dimension (e.g., 2,3,4)
|
|
349
|
+
* @param blockLength number of leading/trailing points to check
|
|
350
|
+
* @param select 0 to test first/last columns of points; 1 to test first/last rows of points
|
|
351
|
+
* @returns true if coordinates matched
|
|
317
352
|
*/
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
const numV = this.numPolesUV(1);
|
|
325
|
-
const blockSize = this.poleDimension;
|
|
326
|
-
const rowToRowStep = numU * blockSize;
|
|
327
|
-
const degreeU = this.degreeUV(0);
|
|
328
|
-
const degreeV = this.degreeUV(1);
|
|
329
|
-
const data = this.coffs;
|
|
330
|
-
if (select === 0) {
|
|
331
|
-
const numTest = blockSize * degreeU; // degreeU contiguous poles.
|
|
332
|
-
for (let row = 0; row < numV; row++) {
|
|
353
|
+
static isWrappedGrid(data, numRows, numColumns, dimension, blockLength, select) {
|
|
354
|
+
const rowToRowStep = numColumns * dimension;
|
|
355
|
+
if (UVSelect.uDirection === select) {
|
|
356
|
+
// Test the contiguous block at the start/end of each row
|
|
357
|
+
const numTest = dimension * blockLength;
|
|
358
|
+
for (let row = 0; row < numRows; row++) {
|
|
333
359
|
const i0 = row * rowToRowStep;
|
|
334
360
|
const i1 = i0 + rowToRowStep - numTest;
|
|
335
361
|
for (let i = 0; i < numTest; i++) {
|
|
@@ -339,9 +365,9 @@ export class BSpline2dNd extends GeometryQuery {
|
|
|
339
365
|
}
|
|
340
366
|
}
|
|
341
367
|
else {
|
|
342
|
-
// Test the entire multi-row contiguous block
|
|
343
|
-
const numTest =
|
|
344
|
-
const i1 =
|
|
368
|
+
// Test the entire multi-row contiguous block at the start/end of the array
|
|
369
|
+
const numTest = blockLength * rowToRowStep;
|
|
370
|
+
const i1 = numRows * numColumns * dimension - numTest;
|
|
345
371
|
for (let i = 0; i < numTest; i++) {
|
|
346
372
|
if (!Geometry.isSameCoordinate(data[i], data[i1 + i]))
|
|
347
373
|
return false;
|
|
@@ -349,6 +375,43 @@ export class BSpline2dNd extends GeometryQuery {
|
|
|
349
375
|
}
|
|
350
376
|
return true;
|
|
351
377
|
}
|
|
378
|
+
/**
|
|
379
|
+
* Test if `degree` leading and trailing (one of U or V) blocks match, as if the data is a non-periodic physically closed spline in the selected direction.
|
|
380
|
+
* @param select select U or V direction
|
|
381
|
+
* @returns true if coordinates matched.
|
|
382
|
+
*/
|
|
383
|
+
testClosableGrid(select, mode) {
|
|
384
|
+
if (mode === undefined)
|
|
385
|
+
mode = this.knots[select].wrappable;
|
|
386
|
+
if (mode === BSplineWrapMode.OpenByAddingControlPoints) // the last degree poles equal the first degree poles
|
|
387
|
+
return BSpline2dNd.isWrappedGrid(this.coffs, this.numPolesUV(UVSelect.vDirection), this.numPolesUV(UVSelect.uDirection), this.poleDimension, this.degreeUV(select), select);
|
|
388
|
+
if (mode === BSplineWrapMode.OpenByRemovingKnots) // the last pole equals the first pole
|
|
389
|
+
return BSpline2dNd.isWrappedGrid(this.coffs, this.numPolesUV(UVSelect.vDirection), this.numPolesUV(UVSelect.uDirection), this.poleDimension, 1, select);
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Test knots and control points to determine if it is possible to close (aka "wrap") the surface in the selected parametric direction.
|
|
394
|
+
* @param select select U or V direction
|
|
395
|
+
* @return whether the surface can be wrapped in the given parametric direction.
|
|
396
|
+
*/
|
|
397
|
+
isClosable(select) {
|
|
398
|
+
return BSplineWrapMode.None !== this.isClosableSurface(select);
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Test knots and control points to determine if it is possible to close (aka "wrap") the surface in the selected parametric direction.
|
|
402
|
+
* @param select select U or V direction
|
|
403
|
+
* @return the manner of closing. See `BSplineWrapMode` for particulars of each mode.
|
|
404
|
+
*/
|
|
405
|
+
isClosableSurface(select) {
|
|
406
|
+
const mode = this.knots[select].wrappable;
|
|
407
|
+
if (mode === BSplineWrapMode.None)
|
|
408
|
+
return BSplineWrapMode.None;
|
|
409
|
+
if (!this.knots[select].testClosable(mode))
|
|
410
|
+
return BSplineWrapMode.None;
|
|
411
|
+
if (!this.testClosableGrid(select, mode))
|
|
412
|
+
return BSplineWrapMode.None;
|
|
413
|
+
return mode;
|
|
414
|
+
}
|
|
352
415
|
}
|
|
353
416
|
/** BSplineSurface3d is a parametric surface in xyz space.
|
|
354
417
|
* * This (BSplineSurface3d) is an unweighted surface. Use the separate class BSplineSurface3dH for a weighted surface.
|
|
@@ -389,7 +452,8 @@ export class BSplineSurface3d extends BSpline2dNd {
|
|
|
389
452
|
getPointGridJSON() {
|
|
390
453
|
const result = {
|
|
391
454
|
points: Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 3, this.numPolesUV(0)),
|
|
392
|
-
weighStyle: WeightStyle.
|
|
455
|
+
weighStyle: WeightStyle.WeightsAlreadyAppliedToCoordinates,
|
|
456
|
+
weightStyle: WeightStyle.UnWeighted,
|
|
393
457
|
numCartesianDimensions: 3,
|
|
394
458
|
};
|
|
395
459
|
return result;
|
|
@@ -401,23 +465,24 @@ export class BSplineSurface3d extends BSpline2dNd {
|
|
|
401
465
|
* in classic over-clamped manner
|
|
402
466
|
*/
|
|
403
467
|
copyKnots(select, includeExtraEndKnot) { return this.knots[select].copyKnots(includeExtraEndKnot); }
|
|
404
|
-
/**
|
|
468
|
+
/**
|
|
469
|
+
* Create a bspline surface.
|
|
405
470
|
* * This `create` variant takes control points in a "flattened" array, with
|
|
406
471
|
* points from succeeding U rows packed together in one array. Use `createGrid` if the points are in
|
|
407
472
|
* a row-by-row grid structure
|
|
408
473
|
* * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).
|
|
409
|
-
* *
|
|
410
|
-
*
|
|
474
|
+
* * When knots are given, two knot count conditions are recognized:
|
|
475
|
+
* * If poleArray.length + order == knotArray.length, the first and last are assumed to be the
|
|
411
476
|
* extraneous knots of classic clamping.
|
|
412
|
-
*
|
|
477
|
+
* * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
|
|
413
478
|
* the classic unused first and last knot.
|
|
414
479
|
* @param controlPointArray Array of points, ordered along the U direction.
|
|
415
|
-
* @param numPoleU number of poles in each row
|
|
480
|
+
* @param numPoleU number of poles in each row
|
|
416
481
|
* @param orderU order for the U direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
|
|
417
|
-
* @param
|
|
418
|
-
* @param numPoleV number of
|
|
482
|
+
* @param knotArrayU knots for the V direction. See note above about knot counts.
|
|
483
|
+
* @param numPoleV number of rows of poles
|
|
419
484
|
* @param orderV order for the V direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
|
|
420
|
-
* @param
|
|
485
|
+
* @param knotArrayV knots for the V direction. See note above about knot counts.
|
|
421
486
|
*/
|
|
422
487
|
static create(controlPointArray, numPolesU, orderU, knotArrayU, numPolesV, orderV, knotArrayV) {
|
|
423
488
|
let numPoles = controlPointArray.length;
|
|
@@ -454,40 +519,41 @@ export class BSplineSurface3d extends BSpline2dNd {
|
|
|
454
519
|
const surface = new BSplineSurface3d(numPolesU, numPolesV, knotsU, knotsV, coffs);
|
|
455
520
|
return surface;
|
|
456
521
|
}
|
|
457
|
-
/**
|
|
522
|
+
/**
|
|
523
|
+
* Create a bspline surface.
|
|
458
524
|
* * This `create` variant takes control points in a "grid" array, with the points from
|
|
459
|
-
*
|
|
525
|
+
* each grid row `[rowIndex]` being an independent array `points[rowIndex][indexAlongRow][x,y,z]`
|
|
460
526
|
* * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).
|
|
461
|
-
* *
|
|
462
|
-
*
|
|
527
|
+
* * When knots are given, two knot count conditions are recognized in each direction:
|
|
528
|
+
* * If poleArray.length + order == knotArray.length, the first and last are assumed to be the
|
|
463
529
|
* extraneous knots of classic clamping.
|
|
464
|
-
*
|
|
530
|
+
* * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
|
|
465
531
|
* the classic unused first and last knot.
|
|
466
|
-
* @param
|
|
467
|
-
* @param numPoleU number of poles in each row in the U direction.
|
|
532
|
+
* @param points Array of points, ordered along the U direction.
|
|
468
533
|
* @param orderU order for the U direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
|
|
469
|
-
* @param
|
|
470
|
-
* @param numPoleV number of poles in each row in the U direction.
|
|
534
|
+
* @param knotArrayU knots for the V direction. See note above about knot counts.
|
|
471
535
|
* @param orderV order for the V direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
|
|
472
|
-
* @param
|
|
536
|
+
* @param knotArrayV knots for the V direction. See note above about knot counts.
|
|
473
537
|
*/
|
|
474
538
|
static createGrid(points, orderU, knotArrayU, orderV, knotArrayV) {
|
|
475
539
|
const numPolesV = points.length;
|
|
476
540
|
const numPolesU = points[0].length;
|
|
477
541
|
const numPoles = numPolesU * numPolesV;
|
|
542
|
+
if (3 !== points[0][0].length)
|
|
543
|
+
return undefined;
|
|
544
|
+
if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))
|
|
545
|
+
return undefined;
|
|
478
546
|
// shift knots-of-interest limits for overclamped case ...
|
|
479
547
|
const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;
|
|
480
548
|
const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;
|
|
481
549
|
const skipFirstAndLastU = (numPolesU + orderU === numKnotsU);
|
|
482
550
|
const skipFirstAndLastV = (numPolesV + orderV === numKnotsV);
|
|
483
|
-
if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))
|
|
484
|
-
return undefined;
|
|
485
551
|
const knotsU = knotArrayU ?
|
|
486
552
|
KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :
|
|
487
553
|
KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);
|
|
488
554
|
const knotsV = knotArrayV ?
|
|
489
555
|
KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :
|
|
490
|
-
KnotVector.createUniformClamped(
|
|
556
|
+
KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);
|
|
491
557
|
const coffs = new Float64Array(3 * numPolesU * numPolesV);
|
|
492
558
|
let i = 0;
|
|
493
559
|
for (const row of points) {
|
|
@@ -497,8 +563,7 @@ export class BSplineSurface3d extends BSpline2dNd {
|
|
|
497
563
|
coffs[i++] = xyz[2];
|
|
498
564
|
}
|
|
499
565
|
}
|
|
500
|
-
|
|
501
|
-
return surface;
|
|
566
|
+
return new BSplineSurface3d(numPolesU, numPolesV, knotsU, knotsV, coffs);
|
|
502
567
|
}
|
|
503
568
|
/**
|
|
504
569
|
* Return a complete copy of the bspline surface.
|
|
@@ -553,6 +618,14 @@ export class BSplineSurface3d extends BSpline2dNd {
|
|
|
553
618
|
const knotV = this.knots[1].fractionToKnot(fractionV);
|
|
554
619
|
return this.knotToPointAndDerivatives(knotU, knotV, result);
|
|
555
620
|
}
|
|
621
|
+
/** Implementation of the UVSurface interface; allows `PolyfaceBuilder.addUVGridBody` to facet this B-spline surface. */
|
|
622
|
+
uvFractionToPoint(u, v) {
|
|
623
|
+
return this.fractionToPoint(u, v);
|
|
624
|
+
}
|
|
625
|
+
/** Implementation of the UVSurface interface; allows `PolyfaceBuilder.addUVGridBody` to facet this B-spline surface. */
|
|
626
|
+
uvFractionToPointAndTangents(u, v, result) {
|
|
627
|
+
return this.fractionToPointAndDerivatives(u, v, result);
|
|
628
|
+
}
|
|
556
629
|
/** test for identical counts and near-equal coordinates */
|
|
557
630
|
isAlmostEqual(other) {
|
|
558
631
|
if (other instanceof BSplineSurface3d) {
|
|
@@ -595,13 +668,20 @@ export class BSplineSurface3dH extends BSpline2dNd {
|
|
|
595
668
|
constructor(numPolesU, numPolesV, knotsU, knotsV, coffs) {
|
|
596
669
|
super(numPolesU, numPolesV, 4, knotsU, knotsV, coffs);
|
|
597
670
|
}
|
|
598
|
-
/**
|
|
671
|
+
/** Unpack the control points to a Point4d array of form [wx,wy,wz,w]. */
|
|
599
672
|
copyPoints4d() { return Point4dArray.unpackToPoint4dArray(this.coffs); }
|
|
600
|
-
/**
|
|
673
|
+
/**
|
|
674
|
+
* Unpack the control points to a Point3d array and an array of weights.
|
|
675
|
+
* @param points output xyz, weighted by default formatter
|
|
676
|
+
* @param weights output weights
|
|
677
|
+
* @param formatter optional xyz formatter. By default, returns a Point3d of form [wx,wy,wz].
|
|
678
|
+
*/
|
|
601
679
|
copyPointsAndWeights(points, weights, formatter = (x, y, z) => Point3d.create(x, y, z)) {
|
|
602
680
|
Point4dArray.unpackFloat64ArrayToPointsAndWeights(this.coffs, points, weights, formatter);
|
|
603
681
|
}
|
|
604
|
-
/**
|
|
682
|
+
/**
|
|
683
|
+
* Copy the control points to a packed 3D array.
|
|
684
|
+
* @param unweight if true, output array has form x,y,z; if false, output array has form wx,wy,wz.
|
|
605
685
|
*/
|
|
606
686
|
copyXYZToFloat64Array(unweight) {
|
|
607
687
|
const numPoints = Math.floor(this.coffs.length / 4);
|
|
@@ -623,7 +703,7 @@ export class BSplineSurface3dH extends BSpline2dNd {
|
|
|
623
703
|
}
|
|
624
704
|
return result;
|
|
625
705
|
}
|
|
626
|
-
/** unpack from xyzw xyzw ... to packed
|
|
706
|
+
/** unpack from xyzw xyzw ... to packed weights
|
|
627
707
|
*/
|
|
628
708
|
copyWeightsToFloat64Array() {
|
|
629
709
|
const numPoints = Math.floor(this.coffs.length / 4);
|
|
@@ -640,24 +720,23 @@ export class BSplineSurface3dH extends BSpline2dNd {
|
|
|
640
720
|
* in classic over-clamped manner
|
|
641
721
|
*/
|
|
642
722
|
copyKnots(select, includeExtraEndKnot) { return this.knots[select].copyKnots(includeExtraEndKnot); }
|
|
643
|
-
/**
|
|
644
|
-
*
|
|
645
|
-
*
|
|
646
|
-
* a deeper grid array structure.
|
|
723
|
+
/**
|
|
724
|
+
* Create a weighted bspline surface, with control points and weights each organized as flattened arrays continuing from one U row to the next.
|
|
725
|
+
* * Use `createGrid` if the control points are in a deeper grid array structure.
|
|
647
726
|
* * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).
|
|
648
|
-
* *
|
|
649
|
-
*
|
|
727
|
+
* * When knots are given, two knot count conditions are recognized:
|
|
728
|
+
* * If poleArray.length + order == knotArray.length, the first and last are assumed to be the
|
|
650
729
|
* extraneous knots of classic clamping.
|
|
651
|
-
*
|
|
730
|
+
* * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
|
|
652
731
|
* the classic unused first and last knot.
|
|
653
|
-
* @param controlPointArray Array of points, ordered along the U direction.
|
|
654
|
-
* @param weightArray array of weights, ordered along the U direction.
|
|
655
|
-
* @param
|
|
732
|
+
* @param controlPointArray Array of [wx,wy,wz] points, ordered along the U direction.
|
|
733
|
+
* @param weightArray array of weights, ordered along the U direction. If undefined, unit weights are installed.
|
|
734
|
+
* @param numPolesU number of poles in each row in the U direction.
|
|
656
735
|
* @param orderU order for the U direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
|
|
657
|
-
* @param
|
|
658
|
-
* @param
|
|
736
|
+
* @param knotArrayU optional knots for the V direction. See note above about knot counts.
|
|
737
|
+
* @param numPolesV number of poles in each column in the V direction (the number of rows).
|
|
659
738
|
* @param orderV order for the V direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
|
|
660
|
-
* @param
|
|
739
|
+
* @param knotArrayV optional knots for the V direction. See note above about knot counts.
|
|
661
740
|
*/
|
|
662
741
|
static create(controlPointArray, weightArray, numPolesU, orderU, knotArrayU, numPolesV, orderV, knotArrayV) {
|
|
663
742
|
const numPoles = numPolesU * numPolesV;
|
|
@@ -673,62 +752,95 @@ export class BSplineSurface3dH extends BSpline2dNd {
|
|
|
673
752
|
const knotsV = knotArrayV ?
|
|
674
753
|
KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :
|
|
675
754
|
KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);
|
|
755
|
+
if (undefined === weightArray)
|
|
756
|
+
weightArray = Array(numPoles).fill(1.0); // unit weights
|
|
676
757
|
const coffs = Point4dArray.packPointsAndWeightsToFloat64Array(controlPointArray, weightArray);
|
|
677
758
|
if (coffs === undefined || coffs.length !== 4 * numPolesU * numPolesV)
|
|
678
759
|
return undefined;
|
|
679
760
|
const surface = new BSplineSurface3dH(numPolesU, numPolesV, knotsU, knotsV, coffs);
|
|
680
761
|
return surface;
|
|
681
762
|
}
|
|
682
|
-
/**
|
|
683
|
-
*
|
|
684
|
-
*
|
|
685
|
-
*
|
|
686
|
-
*
|
|
763
|
+
/**
|
|
764
|
+
* Create a bspline surface with given knots.
|
|
765
|
+
* * This `create` variant takes control points in a "grid" array, with the points from
|
|
766
|
+
* each grid row `[rowIndex]` being an independent array `points[rowIndex][indexAlongRow][x,y,z,w]`
|
|
767
|
+
* * knotArrayU and knotArrayV are optional -- uniform knots are implied if they are omitted (undefined).
|
|
768
|
+
* * When knots are given, two count conditions are recognized in each direction:
|
|
769
|
+
* * If poleArray.length + order == knotArray.length, the first and last are assumed to be the
|
|
687
770
|
* extraneous knots of classic clamping.
|
|
688
|
-
*
|
|
689
|
-
*
|
|
771
|
+
* * If poleArray.length + order == knotArray.length + 2, the knots are in modern form that does not have
|
|
772
|
+
* the classic unused first and last knot.
|
|
773
|
+
* @param xyzwGrid Array of points, ordered along the U direction.
|
|
774
|
+
* @param weightStyle how the points are weighted
|
|
775
|
+
* @param orderU order for the U direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
|
|
776
|
+
* @param knotArrayU knots for the V direction. See note above about knot counts.
|
|
777
|
+
* @param orderV order for the V direction polynomial (`order` is one more than the `degree`. "cubic" polynomial is order 4.)
|
|
778
|
+
* @param knotArrayV knots for the V direction. See note above about knot counts.
|
|
690
779
|
*/
|
|
691
780
|
static createGrid(xyzwGrid, weightStyle, orderU, knotArrayU, orderV, knotArrayV) {
|
|
692
781
|
const numPolesV = xyzwGrid.length;
|
|
693
782
|
const numPolesU = xyzwGrid[0].length;
|
|
694
783
|
const numPoles = numPolesU * numPolesV;
|
|
784
|
+
if (4 !== xyzwGrid[0][0].length)
|
|
785
|
+
return undefined;
|
|
695
786
|
if (!this.validOrderAndPoleCounts(orderU, numPolesU, orderV, numPolesV, numPoles))
|
|
696
787
|
return undefined;
|
|
697
|
-
//
|
|
698
|
-
|
|
699
|
-
const
|
|
700
|
-
const
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
const
|
|
704
|
-
|
|
788
|
+
// validate knot counts
|
|
789
|
+
const numKnotsU = knotArrayU ? knotArrayU.length : numPolesU + orderU - 2;
|
|
790
|
+
const numKnotsV = knotArrayV ? knotArrayV.length : numPolesV + orderV - 2;
|
|
791
|
+
const skipFirstAndLastU = (numPolesU + orderU === numKnotsU); // classic over-clamped input knots
|
|
792
|
+
if (!skipFirstAndLastU && numPolesU + orderU !== numKnotsU + 2) // modern knots
|
|
793
|
+
return undefined;
|
|
794
|
+
const skipFirstAndLastV = (numPolesV + orderV === numKnotsV); // classic
|
|
795
|
+
if (!skipFirstAndLastV && numPolesV + orderV !== numKnotsV + 2) // modern
|
|
796
|
+
return undefined;
|
|
797
|
+
const knotsU = knotArrayU ?
|
|
798
|
+
KnotVector.create(knotArrayU, orderU - 1, skipFirstAndLastU) :
|
|
799
|
+
KnotVector.createUniformClamped(numPolesU, orderU - 1, 0.0, 1.0);
|
|
800
|
+
const knotsV = knotArrayV ?
|
|
801
|
+
KnotVector.create(knotArrayV, orderV - 1, skipFirstAndLastV) :
|
|
802
|
+
KnotVector.createUniformClamped(numPolesV, orderV - 1, 0.0, 1.0);
|
|
705
803
|
const coffs = new Float64Array(4 * numPoles);
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
for (const
|
|
710
|
-
const
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
804
|
+
let i = 0;
|
|
805
|
+
switch (weightStyle) {
|
|
806
|
+
case WeightStyle.WeightsSeparateFromCoordinates: {
|
|
807
|
+
for (const row of xyzwGrid) {
|
|
808
|
+
for (const point of row) {
|
|
809
|
+
const w = point[3];
|
|
810
|
+
coffs[i++] = point[0] * w;
|
|
811
|
+
coffs[i++] = point[1] * w;
|
|
812
|
+
coffs[i++] = point[2] * w;
|
|
813
|
+
coffs[i++] = point[3];
|
|
814
|
+
}
|
|
715
815
|
}
|
|
816
|
+
break;
|
|
716
817
|
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
818
|
+
case WeightStyle.WeightsAlreadyAppliedToCoordinates: {
|
|
819
|
+
for (const row of xyzwGrid) {
|
|
820
|
+
for (const point of row) {
|
|
821
|
+
coffs[i++] = point[0];
|
|
822
|
+
coffs[i++] = point[1];
|
|
823
|
+
coffs[i++] = point[2];
|
|
824
|
+
coffs[i++] = point[3];
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
break;
|
|
828
|
+
}
|
|
829
|
+
case WeightStyle.UnWeighted: {
|
|
830
|
+
for (const row of xyzwGrid) {
|
|
831
|
+
for (const point of row) {
|
|
832
|
+
coffs[i++] = point[0];
|
|
833
|
+
coffs[i++] = point[1];
|
|
834
|
+
coffs[i++] = point[2];
|
|
835
|
+
coffs[i++] = 1.0;
|
|
836
|
+
}
|
|
727
837
|
}
|
|
838
|
+
break;
|
|
728
839
|
}
|
|
840
|
+
default:
|
|
841
|
+
return undefined; // unrecognized WeightStyle
|
|
729
842
|
}
|
|
730
|
-
|
|
731
|
-
return surface;
|
|
843
|
+
return new BSplineSurface3dH(numPolesU, numPolesV, knotsU, knotsV, coffs);
|
|
732
844
|
}
|
|
733
845
|
/** Return a deep clone */
|
|
734
846
|
clone() {
|
|
@@ -753,27 +865,30 @@ export class BSplineSurface3dH extends BSpline2dNd {
|
|
|
753
865
|
const result = {
|
|
754
866
|
points: Point3dArray.unpackNumbersToNestedArraysIJK(this.coffs, 4, this.numPolesUV(0)),
|
|
755
867
|
numCartesianDimensions: 3,
|
|
868
|
+
weighStyle: WeightStyle.WeightsAlreadyAppliedToCoordinates,
|
|
756
869
|
weightStyle: WeightStyle.WeightsAlreadyAppliedToCoordinates,
|
|
757
870
|
};
|
|
758
871
|
return result;
|
|
759
872
|
}
|
|
760
|
-
/** Evaluate at a position given by a knot value.
|
|
761
|
-
knotToPoint4d(u, v) {
|
|
873
|
+
/** Evaluate at a position given by a knot value. If deweight fails, returns 000. */
|
|
874
|
+
knotToPoint4d(u, v, result) {
|
|
762
875
|
this.evaluateBuffersAtKnot(u, v);
|
|
763
|
-
|
|
876
|
+
result = Point4d.createFromPacked(this._poleBuffer, 0, result);
|
|
877
|
+
return result ? result : Point4d.createZero();
|
|
764
878
|
}
|
|
765
879
|
/** Evaluate at a position given by a knot value. */
|
|
766
880
|
knotToPointAndDerivatives(u, v, result) {
|
|
767
881
|
this.evaluateBuffersAtKnot(u, v, 1);
|
|
768
882
|
return Plane3dByOriginAndVectors.createOriginAndVectorsWeightedArrays(this._poleBuffer, this._poleBuffer1UV[0], this._poleBuffer1UV[1], result);
|
|
769
883
|
}
|
|
770
|
-
/** Evaluate the Point4d (leaving weights in the point) at given fractional coordinates. */
|
|
771
|
-
fractionToPoint4d(fractionU, fractionV) {
|
|
772
|
-
|
|
884
|
+
/** Evaluate the Point4d (leaving weights in the point) at given fractional coordinates. If deweight fails, returns 000. */
|
|
885
|
+
fractionToPoint4d(fractionU, fractionV, result) {
|
|
886
|
+
result = this.knotToPoint4d(this.knots[0].fractionToKnot(fractionU), this.knots[1].fractionToKnot(fractionV), result);
|
|
887
|
+
return result ? result : Point4d.createZero();
|
|
773
888
|
}
|
|
774
889
|
/**
|
|
775
|
-
*
|
|
776
|
-
* *
|
|
890
|
+
* Evaluate the surface and return the Cartesian point (weight = 1).
|
|
891
|
+
* * If the surface XYZW point has weight 0, returns 000.
|
|
777
892
|
* @param fractionU u direction fraction
|
|
778
893
|
* @param fractionV v direction fraction
|
|
779
894
|
* @param result optional result
|
|
@@ -806,6 +921,14 @@ export class BSplineSurface3dH extends BSpline2dNd {
|
|
|
806
921
|
const knotV = this.knots[1].fractionToKnot(fractionV);
|
|
807
922
|
return this.knotToPointAndDerivatives(knotU, knotV, result);
|
|
808
923
|
}
|
|
924
|
+
/** Implementation of the UVSurface interface; allows `PolyfaceBuilder.addUVGridBody` to facet this B-spline surface. */
|
|
925
|
+
uvFractionToPoint(u, v) {
|
|
926
|
+
return this.fractionToPoint(u, v);
|
|
927
|
+
}
|
|
928
|
+
/** Implementation of the UVSurface interface; allows `PolyfaceBuilder.addUVGridBody` to facet this B-spline surface. */
|
|
929
|
+
uvFractionToPointAndTangents(u, v, result) {
|
|
930
|
+
return this.fractionToPointAndDerivatives(u, v, result);
|
|
931
|
+
}
|
|
809
932
|
/** test for identical counts and near-equal coordinates */
|
|
810
933
|
isAlmostEqual(other) {
|
|
811
934
|
if (other instanceof BSplineSurface3dH) {
|