@itwin/core-geometry 4.7.0-dev.7 → 4.7.0-dev.9
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/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +7 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +20 -4
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +3 -3
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +4 -3
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts +7 -0
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +19 -0
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/polyface/AuxData.d.ts +18 -10
- package/lib/cjs/polyface/AuxData.d.ts.map +1 -1
- package/lib/cjs/polyface/AuxData.js +24 -12
- package/lib/cjs/polyface/AuxData.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +2 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +2 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +10 -2
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +29 -17
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +10 -9
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +17 -2
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +321 -270
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +405 -351
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.d.ts +18 -20
- package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js +119 -84
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.d.ts +1 -1
- package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js +10 -15
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +52 -7
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +26 -78
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.d.ts +17 -0
- package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.js +85 -0
- package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
- package/lib/cjs/solid/Sphere.d.ts +1 -0
- package/lib/cjs/solid/Sphere.d.ts.map +1 -1
- package/lib/cjs/solid/Sphere.js +4 -2
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +7 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +20 -4
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +3 -3
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +4 -3
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts +7 -0
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +19 -0
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/polyface/AuxData.d.ts +18 -10
- package/lib/esm/polyface/AuxData.d.ts.map +1 -1
- package/lib/esm/polyface/AuxData.js +24 -12
- package/lib/esm/polyface/AuxData.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +2 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js +2 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +10 -2
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +29 -17
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +10 -9
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +17 -2
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +321 -270
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +405 -351
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.d.ts +18 -20
- package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBReader.js +119 -84
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.d.ts +1 -1
- package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js +10 -15
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +52 -7
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +26 -78
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.d.ts +17 -0
- package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.js +85 -0
- package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
- package/lib/esm/solid/Sphere.d.ts +1 -0
- package/lib/esm/solid/Sphere.d.ts.map +1 -1
- package/lib/esm/solid/Sphere.js +4 -2
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/package.json +3 -3
|
@@ -61,6 +61,23 @@ export declare namespace SerializationHelpers {
|
|
|
61
61
|
function cloneBSplineCurveData(source: BSplineCurveData): BSplineCurveData;
|
|
62
62
|
/** Clone B-spline surface data */
|
|
63
63
|
function cloneBSplineSurfaceData(source: BSplineSurfaceData): BSplineSurfaceData;
|
|
64
|
+
/**
|
|
65
|
+
* Process 1-based blocked indices into 0-based indices.
|
|
66
|
+
* @param sourceIndices signed, 1-based, 0-terminated/padded source indices, blocking specified by `numPerBlock`
|
|
67
|
+
* @param numPerBlock index blocking: fixed blocks of size numPerBlock > 1, possibly 0-padded; otherwise, variable-sized blocks terminated by 0
|
|
68
|
+
* @param announceZeroBasedIndex callback to receive a 0-based index and optional flag indicating whether the sign of the source index is positive
|
|
69
|
+
* @param terminateBlock optional callback called after each index block has been announced
|
|
70
|
+
*/
|
|
71
|
+
function announceZeroBasedIndicesFromSignedOneBasedIndices(sourceIndices: Int32Array, numPerBlock: number, announceZeroBasedIndex: (i0: number, flag?: boolean) => any, terminateBlock?: () => any): void;
|
|
72
|
+
/**
|
|
73
|
+
* Process 0-based indices with blocking specified by another index array.
|
|
74
|
+
* @param sourceIndices 0-based source indices. This array is compressed (has no blocking).
|
|
75
|
+
* @param blockingIndices 1-based source indices, blocking specified by `numPerBlock`. Assumed to have length equal to its zero count plus `sourceIndices.length`.
|
|
76
|
+
* @param numPerBlock index blocking: fixed blocks of size numPerBlock > 1, possibly 0-padded; otherwise, variable-sized blocks terminated by 0
|
|
77
|
+
* @param announceZeroBasedIndex callback to receive a 0-based index
|
|
78
|
+
* @param terminateBlock optional callback called after each index block has been announced
|
|
79
|
+
*/
|
|
80
|
+
function announceZeroBasedIndicesWithExternalBlocking(sourceIndices: Int32Array, blockingIndices: Int32Array, numPerBlock: number, announceZeroBasedIndex: (i0: number) => any, terminateBlock?: () => any): void;
|
|
64
81
|
/** Helper class for preparing geometry data for import. */
|
|
65
82
|
class Import {
|
|
66
83
|
/** copy knots, with options to control destination type and extraneous knot removal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SerializationHelpers.d.ts","sourceRoot":"","sources":["../../../src/serialization/SerializationHelpers.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAc,MAAM,uBAAuB,CAAC;AAGpE;;;GAGG;AACH,yBAAiB,oBAAoB,CAAC;IACpC,iEAAiE;IACjE,UAAiB,aAAa;QAC5B,+CAA+C;QAC/C,QAAQ,EAAE,MAAM,CAAC;QACjB,gDAAgD;QAChD,KAAK,EAAE,MAAM,CAAC;QACd,uDAAu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,CAAC,MAAM,CAAC,uBAAuB;QAmBtC;;;;;;WAMG;eACW,uBAAuB,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO;QA+CpG;;;;;;WAMG;eACW,yBAAyB,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO;KA0FzG;IAED,2DAA2D;IAC3D,MAAa,MAAM;QACjB;;;;;;;;WAQG;QACH,OAAO,CAAC,MAAM,CAAC,wBAAwB;QA0BvC;;;;;;;WAOG;eACW,uBAAuB,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO;QA6CpG;;;;;;;WAOG;eACW,yBAAyB,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO;KAgFzG;CACF"}
|
|
@@ -221,6 +221,91 @@ export var SerializationHelpers;
|
|
|
221
221
|
data.vParams.knots = NumberArray.pack(data.vParams.knots);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Process 1-based blocked indices into 0-based indices.
|
|
226
|
+
* @param sourceIndices signed, 1-based, 0-terminated/padded source indices, blocking specified by `numPerBlock`
|
|
227
|
+
* @param numPerBlock index blocking: fixed blocks of size numPerBlock > 1, possibly 0-padded; otherwise, variable-sized blocks terminated by 0
|
|
228
|
+
* @param announceZeroBasedIndex callback to receive a 0-based index and optional flag indicating whether the sign of the source index is positive
|
|
229
|
+
* @param terminateBlock optional callback called after each index block has been announced
|
|
230
|
+
*/
|
|
231
|
+
function announceZeroBasedIndicesFromSignedOneBasedIndices(sourceIndices, numPerBlock, announceZeroBasedIndex, terminateBlock) {
|
|
232
|
+
let numIndices = sourceIndices.length;
|
|
233
|
+
if (!numIndices)
|
|
234
|
+
return;
|
|
235
|
+
if (numPerBlock > 1) {
|
|
236
|
+
numIndices -= sourceIndices.length % numPerBlock;
|
|
237
|
+
for (let i = 0; i < numIndices; i++) {
|
|
238
|
+
const p = sourceIndices[i];
|
|
239
|
+
if (p !== 0) // skip padding
|
|
240
|
+
announceZeroBasedIndex(Math.abs(p) - 1, p > 0);
|
|
241
|
+
if (terminateBlock && ((i + 1) % numPerBlock) === 0)
|
|
242
|
+
terminateBlock();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
for (let i = 0; i < numIndices; i++) {
|
|
247
|
+
const p = sourceIndices[i];
|
|
248
|
+
if (p !== 0) // skip terminator
|
|
249
|
+
announceZeroBasedIndex(Math.abs(p) - 1, p > 0);
|
|
250
|
+
if (terminateBlock) {
|
|
251
|
+
if (p === 0) {
|
|
252
|
+
if (i + 1 === numIndices || sourceIndices[i + 1] !== 0) // skip extra terminators
|
|
253
|
+
terminateBlock();
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
if (i + 1 === numIndices) // missing last terminator
|
|
257
|
+
terminateBlock();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices = announceZeroBasedIndicesFromSignedOneBasedIndices;
|
|
264
|
+
/**
|
|
265
|
+
* Process 0-based indices with blocking specified by another index array.
|
|
266
|
+
* @param sourceIndices 0-based source indices. This array is compressed (has no blocking).
|
|
267
|
+
* @param blockingIndices 1-based source indices, blocking specified by `numPerBlock`. Assumed to have length equal to its zero count plus `sourceIndices.length`.
|
|
268
|
+
* @param numPerBlock index blocking: fixed blocks of size numPerBlock > 1, possibly 0-padded; otherwise, variable-sized blocks terminated by 0
|
|
269
|
+
* @param announceZeroBasedIndex callback to receive a 0-based index
|
|
270
|
+
* @param terminateBlock optional callback called after each index block has been announced
|
|
271
|
+
*/
|
|
272
|
+
function announceZeroBasedIndicesWithExternalBlocking(sourceIndices, blockingIndices, numPerBlock, announceZeroBasedIndex, terminateBlock) {
|
|
273
|
+
if (!sourceIndices.length || !blockingIndices.length)
|
|
274
|
+
return;
|
|
275
|
+
const blockingZeroCount = blockingIndices.filter((i) => i === 0).length;
|
|
276
|
+
if (sourceIndices.length + blockingZeroCount !== blockingIndices.length)
|
|
277
|
+
return; // invalid input
|
|
278
|
+
let iSource = 0;
|
|
279
|
+
let numBlocking = blockingIndices.length;
|
|
280
|
+
if (numPerBlock > 1) {
|
|
281
|
+
numBlocking -= blockingIndices.length % numPerBlock;
|
|
282
|
+
for (let iBlocking = 0; iBlocking < numBlocking && iSource < sourceIndices.length; iBlocking++) {
|
|
283
|
+
const p = blockingIndices[iBlocking];
|
|
284
|
+
if (p !== 0) // skip padding
|
|
285
|
+
announceZeroBasedIndex(sourceIndices[iSource++]);
|
|
286
|
+
if (terminateBlock && ((iBlocking + 1) % numPerBlock) === 0)
|
|
287
|
+
terminateBlock();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
for (let iBlocking = 0; iBlocking < numBlocking && iSource < sourceIndices.length; iBlocking++) {
|
|
292
|
+
const p = blockingIndices[iBlocking];
|
|
293
|
+
if (p !== 0) // skip terminator
|
|
294
|
+
announceZeroBasedIndex(sourceIndices[iSource++]);
|
|
295
|
+
if (terminateBlock) {
|
|
296
|
+
if (p === 0) {
|
|
297
|
+
if (iBlocking + 1 === numBlocking || blockingIndices[iBlocking + 1] !== 0) // skip extra terminators
|
|
298
|
+
terminateBlock();
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
if (iBlocking + 1 === numBlocking) // missing last terminator
|
|
302
|
+
terminateBlock();
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
SerializationHelpers.announceZeroBasedIndicesWithExternalBlocking = announceZeroBasedIndicesWithExternalBlocking;
|
|
224
309
|
/** Helper class for preparing geometry data for import. */
|
|
225
310
|
class Import {
|
|
226
311
|
/** copy knots, with options to control destination type and extraneous knot removal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SerializationHelpers.js","sourceRoot":"","sources":["../../../src/serialization/SerializationHelpers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD;;;GAGG;AACH,MAAM,KAAW,oBAAoB,CAyoBpC;AAzoBD,WAAiB,oBAAoB;IAgDnC,0GAA0G;IAC1G,SAAgB,sBAAsB,CAAC,KAAgC,EAAE,GAAW,EAAE,KAA8B,EAAE,QAAgB,EAAE,KAAa;QACnJ,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC;IAC5D,CAAC;IAFe,2CAAsB,yBAErC,CAAA;IAED,4GAA4G;IAC5G,SAAgB,wBAAwB,CAAC,KAAkC,EAAE,GAAW,EAAE,MAA+B,EAAE,SAAiB,EAAE,MAAc,EAAE,MAA+B,EAAE,SAAiB,EAAE,MAAc;QAC9N,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC;IACxJ,CAAC;IAFe,6CAAwB,2BAEvC,CAAA;IAED,gCAAgC;IAChC,SAAgB,qBAAqB,CAAC,MAAwB;QAC5D,OAAO;YACL,KAAK,EAAE,CAAC,MAAM,CAAC,KAAK,YAAY,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC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AI,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAErH,+BAA+B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC/C,OAAO,IAAI,CAAC;QACd,CAAC;KACF;IAjLY,2BAAM,SAiLlB,CAAA;AACH,CAAC,EAzoBgB,oBAAoB,KAApB,oBAAoB,QAyoBpC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Serialization\r\n */\r\nimport { BSplineWrapMode, KnotVector } from \"../bspline/KnotVector\";\r\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\r\n\r\n/**\r\n * The `SerializationHelpers` namespace has helper classes for serializing and deserializing geometry, such as B-spline curves and surfaces.\r\n * @public\r\n */\r\nexport namespace SerializationHelpers {\r\n /** Interface for data common to B-spline curves and surfaces. */\r\n export interface BSplineParams {\r\n /** The number of control points, aka poles. */\r\n numPoles: number;\r\n /** B-spline order, one more than the degree. */\r\n order: number;\r\n /** Whether the B-spline is to be considered closed. */\r\n closed?: boolean;\r\n /** Full knot vector. */\r\n knots: number[] | Float64Array;\r\n /** Wrap mode, for data roundtrip. */\r\n wrapMode?: BSplineWrapMode;\r\n }\r\n /** Interface for B-spline curve data. */\r\n export interface BSplineCurveData {\r\n /** Control points, aka poles. */\r\n poles: number[][] | Float64Array;\r\n /** The number of coordinates per pole. This is the inner dimension of the poles number array. Possible values: 3, 4. Dimension 4 means the curve is rational, with poles of homogeneous form [wx,wy,wz,w]. */\r\n dim: number;\r\n /** Weights for a rational curve that is specified by parallel arrays of poles and weights. If defined, dim is expected to be 3, and poles are of homogeneous form [wx,wy,wz]. */\r\n weights?: number[] | Float64Array;\r\n /** Knots and other B-spline data. */\r\n params: BSplineParams;\r\n }\r\n /** Interface for B-spline surface data. */\r\n export interface BSplineSurfaceData {\r\n /** Control points, aka poles in row-major order. */\r\n poles: number[][][] | Float64Array;\r\n /** The number of coordinates per pole. This is the inner dimension of the poles number array. Possible values: 3, 4. Dimension 4 means the surface is rational, with poles of homogeneous form [wx,wy,wz,w]. */\r\n dim: number;\r\n /** Weights for a rational surface that is specified by parallel arrays of poles and weights. If defined, dim is expected to be 3, and poles are of homogeneous form [wx,wy,wz]. */\r\n weights?: number[][] | Float64Array;\r\n /** Knots and other B-spline data with respect to the surface u parameter. uParams.numPoles = # columns (middle dimension) of the poles array. */\r\n uParams: BSplineParams;\r\n /** Knots and other B-spline data with respect to the surface v parameter. vParams.numPoles = # rows (outer dimension) of the poles array. */\r\n vParams: BSplineParams;\r\n }\r\n /** Interface of options for import/export. */\r\n export interface BSplineDataOptions {\r\n /** Type of output pole/weight arrays. true: structured number array; false: Float64Array; undefined: either. */\r\n jsonPoles?: boolean;\r\n /** Type of output knot arrays. true: number array; false: Float64Array; undefined: either. */\r\n jsonKnots?: boolean;\r\n /** Extraneous knot handling during Import: true: remove them; false | undefined: leave them. Has no effect during Export, which always outputs the extraneous knots. */\r\n removeExtraKnots?: boolean;\r\n }\r\n\r\n /** Constructor for BSplineCurveData that populates the required data. Inputs are captured, not copied. */\r\n export function createBSplineCurveData(poles: number[][] | Float64Array, dim: number, knots: number[] | Float64Array, numPoles: number, order: number): BSplineCurveData {\r\n return { poles, dim, params: { numPoles, order, knots } };\r\n }\r\n\r\n /** Constructor for BSplineSurfaceData that populates the required data. Inputs are captured, not copied. */\r\n export function createBSplineSurfaceData(poles: number[][][] | Float64Array, dim: number, uKnots: number[] | Float64Array, uNumPoles: number, uOrder: number, vKnots: number[] | Float64Array, vNumPoles: number, vOrder: number): BSplineSurfaceData {\r\n return { poles, dim, uParams: { numPoles: uNumPoles, order: uOrder, knots: uKnots }, vParams: { numPoles: vNumPoles, order: vOrder, knots: vKnots } };\r\n }\r\n\r\n /** Clone B-spline curve data */\r\n export function cloneBSplineCurveData(source: BSplineCurveData): BSplineCurveData {\r\n return {\r\n poles: (source.poles instanceof Float64Array) ? new Float64Array(source.poles) : NumberArray.copy2d(source.poles),\r\n dim: source.dim,\r\n weights: source.weights ? source.weights.slice() : undefined,\r\n params: {\r\n numPoles: source.params.numPoles,\r\n order: source.params.order,\r\n closed: source.params.closed,\r\n knots: source.params.knots.slice(),\r\n wrapMode: source.params.wrapMode,\r\n },\r\n };\r\n }\r\n\r\n /** Clone B-spline surface data */\r\n export function cloneBSplineSurfaceData(source: BSplineSurfaceData): BSplineSurfaceData {\r\n return {\r\n poles: (source.poles instanceof Float64Array) ? new Float64Array(source.poles) : NumberArray.copy3d(source.poles),\r\n dim: source.dim,\r\n weights: source.weights ? ((source.weights instanceof Float64Array) ? source.weights.slice() : NumberArray.copy2d(source.weights)) : undefined,\r\n uParams: {\r\n numPoles: source.uParams.numPoles,\r\n order: source.uParams.order,\r\n closed: source.uParams.closed,\r\n knots: source.uParams.knots.slice(),\r\n wrapMode: source.uParams.wrapMode,\r\n },\r\n vParams: {\r\n numPoles: source.vParams.numPoles,\r\n order: source.vParams.order,\r\n closed: source.vParams.closed,\r\n knots: source.vParams.knots.slice(),\r\n wrapMode: source.vParams.wrapMode,\r\n },\r\n };\r\n }\r\n\r\n /** Copy B-spline curve data from source to dest */\r\n function copyBSplineCurveDataPoles(source: BSplineCurveData): {poles?: number[][], weights?: number[]} {\r\n let nPole = 0;\r\n let nCoordPerPole = 0;\r\n let nPoleCoords = 0;\r\n let poleDimProduct = 0;\r\n if (source.poles instanceof Float64Array) {\r\n nPole = source.params.numPoles;\r\n nCoordPerPole = source.dim;\r\n nPoleCoords = source.poles.length;\r\n poleDimProduct = nPole * nCoordPerPole;\r\n } else {\r\n nPole = source.poles.length;\r\n if (nPole > 0)\r\n nCoordPerPole = source.poles[0].length;\r\n nPoleCoords = poleDimProduct = nPole * nCoordPerPole;\r\n }\r\n if (0 === poleDimProduct || poleDimProduct > nPoleCoords || nCoordPerPole !== source.dim)\r\n return {};\r\n\r\n let nWeight = 0;\r\n let nWeightCoords = 0;\r\n let weightDimProduct = 0;\r\n if (source.weights !== undefined) {\r\n if (source.weights instanceof Float64Array) {\r\n nWeight = source.params.numPoles;\r\n nWeightCoords = source.weights.length;\r\n weightDimProduct = nWeight;\r\n } else {\r\n nWeight = source.weights.length;\r\n nWeightCoords = weightDimProduct = nWeight;\r\n }\r\n if (0 === weightDimProduct || weightDimProduct > nWeightCoords || nWeight !== nPole)\r\n return {};\r\n }\r\n\r\n // convert variant source to structured number array\r\n let poles: number[][] | undefined;\r\n let weights: number[] | undefined;\r\n if (source.poles instanceof Float64Array)\r\n poles = NumberArray.unpack2d(source.poles, nCoordPerPole);\r\n else\r\n poles = NumberArray.copy2d(source.poles);\r\n if (poles && source.weights)\r\n weights = NumberArray.create(source.weights);\r\n return {poles, weights};\r\n }\r\n\r\n /** Copy B-spline surface data from source to dest */\r\n function copyBSplineSurfaceDataPoles(source: BSplineSurfaceData): {poles?: number[][][], weights?: number[][]} {\r\n let nPoleRow = 0;\r\n let nPolePerRow = 0;\r\n let nCoordPerPole = 0;\r\n let nCoords = 0;\r\n let poleDimProduct = 0;\r\n if (source.poles instanceof Float64Array) {\r\n nPoleRow = source.vParams.numPoles;\r\n nPolePerRow = source.uParams.numPoles;\r\n nCoordPerPole = source.dim;\r\n nCoords = source.poles.length;\r\n poleDimProduct = nPoleRow * nPolePerRow * nCoordPerPole;\r\n } else {\r\n nPoleRow = source.poles.length;\r\n if (nPoleRow > 0)\r\n nPolePerRow = source.poles[0].length;\r\n if (nPolePerRow > 0)\r\n nCoordPerPole = source.poles[0][0].length;\r\n nCoords = poleDimProduct = nPoleRow * nPolePerRow * nCoordPerPole;\r\n }\r\n if (0 === poleDimProduct || poleDimProduct > nCoords || nCoordPerPole !== source.dim)\r\n return {};\r\n\r\n let nWeightRow = 0;\r\n let nWeightPerRow = 0;\r\n let nWeightCoords = 0;\r\n let weightDimProduct = 0;\r\n if (source.weights !== undefined) {\r\n if (source.weights instanceof Float64Array) {\r\n nWeightRow = source.vParams.numPoles;\r\n nWeightPerRow = source.uParams.numPoles;\r\n nWeightCoords = source.weights.length;\r\n weightDimProduct = nWeightRow * nWeightPerRow;\r\n } else {\r\n nWeightRow = source.weights.length;\r\n if (nWeightRow > 0)\r\n nWeightPerRow = source.weights[0].length;\r\n nWeightCoords = weightDimProduct = nWeightRow * nWeightPerRow;\r\n }\r\n if (0 === weightDimProduct || weightDimProduct > nWeightCoords || nWeightRow !== nPoleRow || nWeightPerRow !== nPolePerRow)\r\n return {};\r\n }\r\n\r\n // convert variant source to structured number array\r\n let poles: number[][][] | undefined;\r\n let weights: number[][] | undefined;\r\n if (source.poles instanceof Float64Array)\r\n poles = NumberArray.unpack3d(source.poles, nPolePerRow, nCoordPerPole);\r\n else\r\n poles = NumberArray.copy3d(source.poles);\r\n if (poles && source.weights) {\r\n if (source.weights instanceof Float64Array)\r\n weights = NumberArray.unpack2d(source.weights, nWeightPerRow);\r\n else\r\n weights = NumberArray.copy2d(source.weights);\r\n }\r\n return {poles, weights};\r\n }\r\n\r\n /** Convert B-spline curve data arrays to the types specified by options. */\r\n function convertBSplineCurveDataArrays(data: BSplineCurveData, options?: BSplineDataOptions) {\r\n if (undefined !== options?.jsonPoles) {\r\n const packedPoles = data.poles instanceof Float64Array;\r\n if (options.jsonPoles && packedPoles)\r\n data.poles = NumberArray.unpack2d(data.poles as Float64Array, data.dim)!;\r\n else if (!options.jsonPoles && !packedPoles)\r\n data.poles = NumberArray.pack(data.poles as number[][]);\r\n\r\n if (data.weights) {\r\n const packedWeights = data.weights instanceof Float64Array;\r\n if (options.jsonPoles && packedWeights)\r\n data.weights = NumberArray.create(data.weights);\r\n else if (!options.jsonPoles && !packedWeights)\r\n data.weights = NumberArray.pack(data.weights as number[]);\r\n }\r\n }\r\n if (undefined !== options?.jsonKnots) {\r\n const packedKnots = data.params.knots instanceof Float64Array;\r\n if (options.jsonKnots && packedKnots)\r\n data.params.knots = NumberArray.create(data.params.knots);\r\n else if (!options.jsonKnots && !packedKnots)\r\n data.params.knots = NumberArray.pack(data.params.knots as number[]);\r\n }\r\n }\r\n\r\n /** Convert B-spline surface data arrays to the types specified by options. */\r\n function convertBSplineSurfaceDataArrays(data: BSplineSurfaceData, options?: BSplineDataOptions) {\r\n if (undefined !== options?.jsonPoles) {\r\n const packedPoles = data.poles instanceof Float64Array;\r\n if (options.jsonPoles && packedPoles)\r\n data.poles = NumberArray.unpack3d(data.poles as Float64Array, data.uParams.numPoles, data.dim)!;\r\n else if (!options.jsonPoles && !packedPoles)\r\n data.poles = NumberArray.pack(data.poles as number[][][]);\r\n\r\n if (data.weights) {\r\n const packedWeights = data.weights instanceof Float64Array;\r\n if (options.jsonPoles && packedWeights)\r\n data.weights = NumberArray.unpack2d(data.weights as Float64Array, data.uParams.numPoles);\r\n else if (!options.jsonPoles && !packedWeights)\r\n data.weights = NumberArray.pack(data.weights as number[][]);\r\n }\r\n }\r\n if (undefined !== options?.jsonKnots) {\r\n const packedKnotsU = data.uParams.knots instanceof Float64Array;\r\n if (options.jsonKnots && packedKnotsU)\r\n data.uParams.knots = NumberArray.create(data.uParams.knots);\r\n else if (!options.jsonKnots && !packedKnotsU)\r\n data.uParams.knots = NumberArray.pack(data.uParams.knots as number[]);\r\n\r\n const packedKnotsV = data.vParams.knots instanceof Float64Array;\r\n if (options.jsonKnots && packedKnotsV)\r\n data.vParams.knots = NumberArray.create(data.vParams.knots);\r\n else if (!options.jsonKnots && !packedKnotsV)\r\n data.vParams.knots = NumberArray.pack(data.vParams.knots as number[]);\r\n }\r\n }\r\n\r\n /** Helper class for preparing geometry data for import. */\r\n export class Import {\r\n /** copy knots, with options to control destination type and extraneous knot removal */\r\n private static copyKnots(knots: Float64Array | number[], options?: BSplineDataOptions, iStart?: number, iEnd?: number): Float64Array| number[] {\r\n if (undefined === iStart)\r\n iStart = 0;\r\n if (undefined === iEnd)\r\n iEnd = knots.length;\r\n if (options?.removeExtraKnots) {\r\n ++iStart; // ignore start knot\r\n --iEnd; // ignore end knot\r\n }\r\n let newNumKnots = iEnd - iStart;\r\n if (newNumKnots < 0)\r\n newNumKnots = 0;\r\n const newKnots = options?.jsonKnots ? new Array<number>(newNumKnots) : new Float64Array(newNumKnots);\r\n for (let i = iStart, k = 0; i < iEnd; i++, k++)\r\n newKnots[k] = knots[i];\r\n return newKnots;\r\n }\r\n\r\n /**\r\n * Recognize the special legacy periodic B-spline data of mode BSplineWrapMode.OpenByRemovingKnots, and return the corresponding modern open clamped knots.\r\n * * Note that the B-spline poles corresponding to the converted knots remain unchanged, but it is assumed that first and last poles are equal.\r\n * * Example: the legacy 7-point quadratic circle periodic knots {-1/3 0 0 0 1/3 1/3 2/3 2/3 1 1 1 4/3} are converted to open knots {0 0 1/3 1/3 2/3 2/3 1 1}.\r\n * * General form of knot vector (k = order, d = k-1 = degree, p = numPoles):\r\n * * * legacy input: {k/2 periodically extended knots} {start knot multiplicity k} {p-k interior knots} {end knot multiplicity k} {d/2 periodically extended knots}\r\n * * * converted output: {start knot multiplicity d} {p-k interior knots} {end knot multiplicity d}\r\n * @param knots classic knot vector to test\r\n * @param numPoles number of poles\r\n * @param order B-spline order\r\n * @param options for output type, extraneous knot removal\r\n * @returns open knots if legacy periodic B-spline input data is recognized; otherwise, undefined\r\n * @see Export.closeLegacyPeriodicKnots\r\n */\r\n private static openLegacyPeriodicKnots(knots: Float64Array | number[], numPoles: number, order: number, options?: BSplineDataOptions): Float64Array | number[] | undefined {\r\n const numKnots = knots.length;\r\n if (order < 2 || numPoles + 2 * order - 1 !== numKnots)\r\n return undefined; // not legacy periodic knots\r\n\r\n const startKnot = knots[order - 1];\r\n const endKnot = knots[numKnots - order];\r\n const iStart0 = Math.floor(order / 2); // index of first expected multiple of the start knot\r\n const iEnd0 = iStart0 + numPoles; // index of first expected multiple of the end knot\r\n const iEnd1 = iEnd0 + order; // one past index of last expected multiple of the end knot\r\n for (let i = 0; i < order; ++i) {\r\n if (Math.abs(knots[iStart0 + i] - startKnot) >= KnotVector.knotTolerance)\r\n return undefined; // start knot multiplicity too small\r\n if (Math.abs(knots[iEnd0 + i] - endKnot) >= KnotVector.knotTolerance)\r\n return undefined; // end knot multiplicity too small\r\n }\r\n return this.copyKnots(knots, options, iStart0, iEnd1);\r\n }\r\n\r\n /** Prepare imported B-spline curve data for eventual conversion to BSplineCurve3d | BSplineCurve3dH:\r\n * * Opens legacy \"fake\" periodic data by expanding knots\r\n * * Opens true periodic data by expanding poles and weights\r\n * @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.\r\n * @param options output specifications\r\n * @returns whether data was successfully prepared\r\n */\r\n public static prepareBSplineCurveData(data: BSplineCurveData, options?: BSplineDataOptions): boolean {\r\n let polesExpanded: number[][] | undefined;\r\n let weightsExpanded: number[] | undefined;\r\n let knotsCorrected: number[] | Float64Array | undefined;\r\n data.params.wrapMode = undefined;\r\n\r\n if (true === data.params.closed) {\r\n knotsCorrected = this.openLegacyPeriodicKnots(data.params.knots, data.params.numPoles, data.params.order, options);\r\n if (undefined !== knotsCorrected) {\r\n // legacy periodic knots removed, poles untouched\r\n data.params.knots = knotsCorrected;\r\n data.params.wrapMode = BSplineWrapMode.OpenByRemovingKnots;\r\n } else {\r\n // wrap poles, knots untouched\r\n if (!polesExpanded) {\r\n const arrays = copyBSplineCurveDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesExpanded = arrays.poles;\r\n data.weights = weightsExpanded = arrays.weights;\r\n }\r\n for (let i = 0; i < data.params.order - 1; ++i) {\r\n const wraparoundPt = [];\r\n for (let j = 0; j < data.dim; ++j)\r\n wraparoundPt.push(polesExpanded[i][j]);\r\n polesExpanded.push(wraparoundPt); // append degree wraparound poles\r\n }\r\n if (weightsExpanded) {\r\n for (let i = 0; i < data.params.order - 1; ++i)\r\n weightsExpanded.push(weightsExpanded[i]); // append degree wraparound weights\r\n }\r\n data.params.numPoles += data.params.order - 1;\r\n data.params.wrapMode = BSplineWrapMode.OpenByAddingControlPoints;\r\n }\r\n }\r\n\r\n if (options?.removeExtraKnots) {\r\n if (!knotsCorrected)\r\n data.params.knots = this.copyKnots(data.params.knots, options);\r\n }\r\n\r\n data.params.closed = undefined; // we are open\r\n\r\n convertBSplineCurveDataArrays(data, options);\r\n return true;\r\n }\r\n\r\n /** Prepare imported B-spline surface data for eventual conversion to BSplineSurface3d | BSplineSurface3dH:\r\n * * Opens legacy \"fake\" periodic data by expanding knots\r\n * * Opens true periodic data by expanding poles and weights\r\n * @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.\r\n * @param options output specifications\r\n * @returns whether data was successfully prepared\r\n */\r\n public static prepareBSplineSurfaceData(data: BSplineSurfaceData, options?: BSplineDataOptions): boolean {\r\n let polesExpanded: number[][][] | undefined;\r\n let weightsExpanded: number[][] | undefined;\r\n let uKnotsCorrected: number[] | Float64Array | undefined;\r\n let vKnotsCorrected: number[] | Float64Array | undefined;\r\n data.uParams.wrapMode = data.vParams.wrapMode = undefined;\r\n\r\n if (true === data.uParams.closed) {\r\n uKnotsCorrected = this.openLegacyPeriodicKnots(data.uParams.knots, data.uParams.numPoles, data.uParams.order, options);\r\n if (undefined !== uKnotsCorrected) {\r\n // legacy periodic knots removed, poles untouched\r\n data.uParams.knots = uKnotsCorrected;\r\n data.uParams.wrapMode = BSplineWrapMode.OpenByRemovingKnots;\r\n } else {\r\n // wrap poles, knots untouched\r\n if (!polesExpanded) {\r\n const arrays = copyBSplineSurfaceDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesExpanded = arrays.poles;\r\n data.weights = weightsExpanded = arrays.weights;\r\n }\r\n for (let i = 0; i < data.vParams.numPoles; ++i) { // #rows\r\n for (let j = 0; j < data.uParams.order - 1; ++j) {\r\n const wraparoundPt = [];\r\n for (let k = 0; k < data.dim; ++k)\r\n wraparoundPt.push(polesExpanded[i][j][k]);\r\n polesExpanded[i].push(wraparoundPt); // append degreeU wraparound poles to each row\r\n }\r\n }\r\n if (weightsExpanded) {\r\n for (let i = 0; i < data.vParams.numPoles; ++i) // #rows\r\n for (let j = 0; j < data.uParams.order - 1; ++j)\r\n weightsExpanded[i].push(weightsExpanded[i][j]); // append degreeU wraparound weights to each row\r\n }\r\n data.uParams.numPoles += data.uParams.order - 1;\r\n data.uParams.wrapMode = BSplineWrapMode.OpenByAddingControlPoints;\r\n }\r\n }\r\n\r\n if (true === data.vParams.closed) {\r\n vKnotsCorrected = this.openLegacyPeriodicKnots(data.vParams.knots, data.vParams.numPoles, data.vParams.order, options);\r\n if (undefined !== vKnotsCorrected) {\r\n // legacy periodic knots removed, poles untouched\r\n data.vParams.knots = vKnotsCorrected;\r\n data.vParams.wrapMode = BSplineWrapMode.OpenByRemovingKnots;\r\n } else {\r\n // wrap poles, knots untouched\r\n if (!polesExpanded) {\r\n const arrays = copyBSplineSurfaceDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesExpanded = arrays.poles;\r\n data.weights = weightsExpanded = arrays.weights;\r\n }\r\n for (let i = 0; i < data.vParams.order - 1; ++i) {\r\n const wrapAroundRow = [];\r\n for (let j = 0; j < data.uParams.numPoles; ++j) { // #cols\r\n const wrapAroundPt = [];\r\n for (let k = 0; k < data.dim; ++k)\r\n wrapAroundPt.push(polesExpanded[i][j][k]);\r\n wrapAroundRow.push(wrapAroundPt);\r\n }\r\n polesExpanded.push(wrapAroundRow); // append degreeV wraparound rows of poles\r\n }\r\n if (weightsExpanded) {\r\n for (let i = 0; i < data.vParams.order - 1; ++i) {\r\n const wrapAroundRow = [];\r\n for (let j = 0; j < data.uParams.numPoles; ++j) // #cols\r\n wrapAroundRow.push(weightsExpanded[i][j]);\r\n weightsExpanded.push(wrapAroundRow); // append degreeV wraparound rows of weights\r\n }\r\n }\r\n data.vParams.numPoles += data.vParams.order - 1;\r\n data.vParams.wrapMode = BSplineWrapMode.OpenByAddingControlPoints;\r\n }\r\n }\r\n\r\n if (options?.removeExtraKnots) {\r\n if (!uKnotsCorrected)\r\n data.uParams.knots = this.copyKnots(data.uParams.knots, options);\r\n if (!vKnotsCorrected)\r\n data.vParams.knots = this.copyKnots(data.vParams.knots, options);\r\n }\r\n\r\n data.uParams.closed = data.vParams.closed = undefined; // we are open\r\n\r\n convertBSplineSurfaceDataArrays(data, options);\r\n return true;\r\n }\r\n }\r\n\r\n /** Helper class for preparing geometry data for export. */\r\n export class Export {\r\n /**\r\n * Restore special legacy periodic B-spline knots opened via BSplineWrapMode.OpenByRemovingKnots logic.\r\n * @param knots modern knot vector: {start knot multiplicity d} {p-k interior knots} {end knot multiplicity d}\r\n * @param order B-spline order\r\n * @param options for output type\r\n * @param wrapMode wrap mode of the knots\r\n * @returns legacy periodic knots (with classic extraneous start/end knot) if wrapMode recognized; otherwise, undefined\r\n * @see Import.openLegacyPeriodicKnots\r\n */\r\n private static closeLegacyPeriodicKnots(knots: Float64Array | number[], order: number, options?: BSplineDataOptions, wrapMode?: BSplineWrapMode): Float64Array | number[] | undefined {\r\n if (wrapMode === undefined || wrapMode !== BSplineWrapMode.OpenByRemovingKnots)\r\n return undefined;\r\n\r\n const degree = order - 1;\r\n const leftIndex = degree - 1;\r\n const rightIndex = knots.length - degree;\r\n const leftKnot = knots[leftIndex];\r\n const rightKnot = knots[rightIndex];\r\n const knotPeriod = rightKnot - leftKnot;\r\n const newNumKnots = knots.length + degree + 2;\r\n const newKnots = options?.jsonKnots ? new Array<number>(newNumKnots) : new Float64Array(newNumKnots);\r\n\r\n let k = 0;\r\n for (let i = Math.floor(order / 2); i > 0; --i)\r\n newKnots[k++] = knots[rightIndex - i] - knotPeriod;\r\n newKnots[k++] = leftKnot; // extraneous start knot\r\n for (const knot of knots)\r\n newKnots[k++] = knot;\r\n newKnots[k++] = rightKnot; // extraneous end knot\r\n for (let i = 1; i <= Math.floor(degree / 2); ++i)\r\n newKnots[k++] = knots[leftIndex + i] + knotPeriod;\r\n\r\n return newKnots;\r\n }\r\n\r\n /**\r\n * Prepare data from a B-spline curve for export.\r\n * * adds classic extraneous knot at start and end of knot vector\r\n * * re-closes periodic data based on BSplineWrapMode\r\n * @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.\r\n * @param options output specifications\r\n * @returns whether data was successfully prepared\r\n */\r\n public static prepareBSplineCurveData(data: BSplineCurveData, options?: BSplineDataOptions): boolean {\r\n let polesTrimmed: number[][] | undefined;\r\n let weightsTrimmed: number[] | undefined;\r\n let knotsCorrected: number[] | Float64Array | undefined;\r\n data.params.closed = undefined;\r\n\r\n switch (data.params.wrapMode) {\r\n case BSplineWrapMode.OpenByRemovingKnots: {\r\n // add legacy periodic and extraneous knots, poles untouched\r\n knotsCorrected = this.closeLegacyPeriodicKnots(data.params.knots, data.params.order, options, data.params.wrapMode);\r\n if (undefined === knotsCorrected)\r\n return false; // invalid input\r\n data.params.knots = knotsCorrected;\r\n data.params.closed = true;\r\n break;\r\n }\r\n case BSplineWrapMode.OpenByAddingControlPoints: {\r\n // unwrap poles, knots untouched\r\n if (!polesTrimmed) {\r\n const arrays = copyBSplineCurveDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesTrimmed = arrays.poles;\r\n data.weights = weightsTrimmed = arrays.weights;\r\n }\r\n for (let i = 0; i < data.params.order - 1; ++i)\r\n polesTrimmed.pop(); // remove last degree poles\r\n if (weightsTrimmed) {\r\n for (let i = 0; i < data.params.order - 1; ++i)\r\n weightsTrimmed.pop(); // remove last degree weights\r\n }\r\n data.params.numPoles -= data.params.order - 1;\r\n data.params.closed = true;\r\n break;\r\n }\r\n }\r\n\r\n // always add extraneous knots\r\n if (!knotsCorrected)\r\n data.params.knots = KnotVector.copyKnots(data.params.knots, data.params.order - 1, true, data.params.wrapMode);\r\n\r\n convertBSplineCurveDataArrays(data, options);\r\n return true;\r\n }\r\n\r\n /**\r\n * Prepare data from a B-spline surface for export.\r\n * * adds classic extraneous knot at start and end of knot vectors\r\n * * re-closes periodic data based on BSplineWrapMode\r\n * @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.\r\n * @param options output specifications\r\n * @returns whether data was successfully prepared\r\n */\r\n public static prepareBSplineSurfaceData(data: BSplineSurfaceData, options?: BSplineDataOptions): boolean {\r\n let polesTrimmed: number[][][] | undefined;\r\n let weightsTrimmed: number[][] | undefined;\r\n let uKnotsCorrected: number[] | Float64Array | undefined;\r\n let vKnotsCorrected: number[] | Float64Array | undefined;\r\n data.uParams.closed = data.vParams.closed = undefined;\r\n\r\n switch (data.uParams.wrapMode) {\r\n case BSplineWrapMode.OpenByRemovingKnots: {\r\n // add legacy periodic and extraneous knots, poles untouched\r\n uKnotsCorrected = this.closeLegacyPeriodicKnots(data.uParams.knots, data.uParams.order, options, data.uParams.wrapMode);\r\n if (undefined === uKnotsCorrected)\r\n return false; // invalid input\r\n data.uParams.knots = uKnotsCorrected;\r\n data.uParams.closed = true;\r\n break;\r\n }\r\n case BSplineWrapMode.OpenByAddingControlPoints: {\r\n // unwrap poles, knots untouched\r\n if (!polesTrimmed) {\r\n const arrays = copyBSplineSurfaceDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesTrimmed = arrays.poles;\r\n data.weights = weightsTrimmed = arrays.weights;\r\n }\r\n for (let i = 0; i < data.vParams.numPoles; ++i) // #rows\r\n for (let j = 0; j < data.uParams.order - 1; ++j)\r\n polesTrimmed[i].pop(); // remove last degreeU poles from each row\r\n if (weightsTrimmed) {\r\n for (let i = 0; i < data.vParams.numPoles; ++i) // #rows\r\n for (let j = 0; j < data.uParams.order - 1; ++j)\r\n weightsTrimmed[i].pop(); // remove last degreeU weights from each row\r\n }\r\n data.uParams.numPoles -= data.uParams.order - 1;\r\n data.uParams.closed = true;\r\n break;\r\n }\r\n }\r\n\r\n switch (data.vParams.wrapMode) {\r\n case BSplineWrapMode.OpenByRemovingKnots: {\r\n // add legacy periodic and extraneous knots, poles untouched\r\n vKnotsCorrected = this.closeLegacyPeriodicKnots(data.vParams.knots, data.vParams.order, options, data.vParams.wrapMode);\r\n if (undefined === vKnotsCorrected)\r\n return false; // invalid input\r\n data.vParams.knots = vKnotsCorrected;\r\n data.vParams.closed = true;\r\n break;\r\n }\r\n case BSplineWrapMode.OpenByAddingControlPoints: {\r\n // unwrap poles, knots untouched\r\n if (!polesTrimmed) {\r\n const arrays = copyBSplineSurfaceDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesTrimmed = arrays.poles;\r\n data.weights = weightsTrimmed = arrays.weights;\r\n }\r\n for (let i = 0; i < data.vParams.order - 1; ++i)\r\n polesTrimmed.pop(); // remove last degreeV rows of poles\r\n if (weightsTrimmed) {\r\n for (let i = 0; i < data.vParams.order - 1; ++i)\r\n weightsTrimmed.pop(); // remove last degreeV rows of weights\r\n }\r\n data.vParams.numPoles -= data.vParams.order - 1;\r\n data.vParams.closed = true;\r\n break;\r\n }\r\n }\r\n\r\n // always add extraneous knots\r\n if (!uKnotsCorrected)\r\n data.uParams.knots = KnotVector.copyKnots(data.uParams.knots, data.uParams.order - 1, true, data.uParams.wrapMode);\r\n if (!vKnotsCorrected)\r\n data.vParams.knots = KnotVector.copyKnots(data.vParams.knots, data.vParams.order - 1, true, data.vParams.wrapMode);\r\n\r\n convertBSplineSurfaceDataArrays(data, options);\r\n return true;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SerializationHelpers.js","sourceRoot":"","sources":["../../../src/serialization/SerializationHelpers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD;;;GAGG;AACH,MAAM,KAAW,oBAAoB,CAquBpC;AAruBD,WAAiB,oBAAoB;IAgDnC,0GAA0G;IAC1G,SAAgB,sBAAsB,CAAC,KAAgC,EAAE,GAAW,EAAE,KAA8B,EAAE,QAAgB,EAAE,KAAa;QACn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CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACrH,IAAI,CAAC,eAAe;gBAClB,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAErH,+BAA+B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC/C,OAAO,IAAI,CAAC;QACd,CAAC;KACF;IAjLY,2BAAM,SAiLlB,CAAA;AACH,CAAC,EAruBgB,oBAAoB,KAApB,oBAAoB,QAquBpC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Serialization\r\n */\r\nimport { BSplineWrapMode, KnotVector } from \"../bspline/KnotVector\";\r\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\r\n\r\n/**\r\n * The `SerializationHelpers` namespace has helper classes for serializing and deserializing geometry, such as B-spline curves and surfaces.\r\n * @public\r\n */\r\nexport namespace SerializationHelpers {\r\n /** Interface for data common to B-spline curves and surfaces. */\r\n export interface BSplineParams {\r\n /** The number of control points, aka poles. */\r\n numPoles: number;\r\n /** B-spline order, one more than the degree. */\r\n order: number;\r\n /** Whether the B-spline is to be considered closed. */\r\n closed?: boolean;\r\n /** Full knot vector. */\r\n knots: number[] | Float64Array;\r\n /** Wrap mode, for data roundtrip. */\r\n wrapMode?: BSplineWrapMode;\r\n }\r\n /** Interface for B-spline curve data. */\r\n export interface BSplineCurveData {\r\n /** Control points, aka poles. */\r\n poles: number[][] | Float64Array;\r\n /** The number of coordinates per pole. This is the inner dimension of the poles number array. Possible values: 3, 4. Dimension 4 means the curve is rational, with poles of homogeneous form [wx,wy,wz,w]. */\r\n dim: number;\r\n /** Weights for a rational curve that is specified by parallel arrays of poles and weights. If defined, dim is expected to be 3, and poles are of homogeneous form [wx,wy,wz]. */\r\n weights?: number[] | Float64Array;\r\n /** Knots and other B-spline data. */\r\n params: BSplineParams;\r\n }\r\n /** Interface for B-spline surface data. */\r\n export interface BSplineSurfaceData {\r\n /** Control points, aka poles in row-major order. */\r\n poles: number[][][] | Float64Array;\r\n /** The number of coordinates per pole. This is the inner dimension of the poles number array. Possible values: 3, 4. Dimension 4 means the surface is rational, with poles of homogeneous form [wx,wy,wz,w]. */\r\n dim: number;\r\n /** Weights for a rational surface that is specified by parallel arrays of poles and weights. If defined, dim is expected to be 3, and poles are of homogeneous form [wx,wy,wz]. */\r\n weights?: number[][] | Float64Array;\r\n /** Knots and other B-spline data with respect to the surface u parameter. uParams.numPoles = # columns (middle dimension) of the poles array. */\r\n uParams: BSplineParams;\r\n /** Knots and other B-spline data with respect to the surface v parameter. vParams.numPoles = # rows (outer dimension) of the poles array. */\r\n vParams: BSplineParams;\r\n }\r\n /** Interface of options for import/export. */\r\n export interface BSplineDataOptions {\r\n /** Type of output pole/weight arrays. true: structured number array; false: Float64Array; undefined: either. */\r\n jsonPoles?: boolean;\r\n /** Type of output knot arrays. true: number array; false: Float64Array; undefined: either. */\r\n jsonKnots?: boolean;\r\n /** Extraneous knot handling during Import: true: remove them; false | undefined: leave them. Has no effect during Export, which always outputs the extraneous knots. */\r\n removeExtraKnots?: boolean;\r\n }\r\n\r\n /** Constructor for BSplineCurveData that populates the required data. Inputs are captured, not copied. */\r\n export function createBSplineCurveData(poles: number[][] | Float64Array, dim: number, knots: number[] | Float64Array, numPoles: number, order: number): BSplineCurveData {\r\n return { poles, dim, params: { numPoles, order, knots } };\r\n }\r\n\r\n /** Constructor for BSplineSurfaceData that populates the required data. Inputs are captured, not copied. */\r\n export function createBSplineSurfaceData(poles: number[][][] | Float64Array, dim: number, uKnots: number[] | Float64Array, uNumPoles: number, uOrder: number, vKnots: number[] | Float64Array, vNumPoles: number, vOrder: number): BSplineSurfaceData {\r\n return { poles, dim, uParams: { numPoles: uNumPoles, order: uOrder, knots: uKnots }, vParams: { numPoles: vNumPoles, order: vOrder, knots: vKnots } };\r\n }\r\n\r\n /** Clone B-spline curve data */\r\n export function cloneBSplineCurveData(source: BSplineCurveData): BSplineCurveData {\r\n return {\r\n poles: (source.poles instanceof Float64Array) ? new Float64Array(source.poles) : NumberArray.copy2d(source.poles),\r\n dim: source.dim,\r\n weights: source.weights ? source.weights.slice() : undefined,\r\n params: {\r\n numPoles: source.params.numPoles,\r\n order: source.params.order,\r\n closed: source.params.closed,\r\n knots: source.params.knots.slice(),\r\n wrapMode: source.params.wrapMode,\r\n },\r\n };\r\n }\r\n\r\n /** Clone B-spline surface data */\r\n export function cloneBSplineSurfaceData(source: BSplineSurfaceData): BSplineSurfaceData {\r\n return {\r\n poles: (source.poles instanceof Float64Array) ? new Float64Array(source.poles) : NumberArray.copy3d(source.poles),\r\n dim: source.dim,\r\n weights: source.weights ? ((source.weights instanceof Float64Array) ? source.weights.slice() : NumberArray.copy2d(source.weights)) : undefined,\r\n uParams: {\r\n numPoles: source.uParams.numPoles,\r\n order: source.uParams.order,\r\n closed: source.uParams.closed,\r\n knots: source.uParams.knots.slice(),\r\n wrapMode: source.uParams.wrapMode,\r\n },\r\n vParams: {\r\n numPoles: source.vParams.numPoles,\r\n order: source.vParams.order,\r\n closed: source.vParams.closed,\r\n knots: source.vParams.knots.slice(),\r\n wrapMode: source.vParams.wrapMode,\r\n },\r\n };\r\n }\r\n\r\n /** Copy B-spline curve data from source to dest */\r\n function copyBSplineCurveDataPoles(source: BSplineCurveData): {poles?: number[][], weights?: number[]} {\r\n let nPole = 0;\r\n let nCoordPerPole = 0;\r\n let nPoleCoords = 0;\r\n let poleDimProduct = 0;\r\n if (source.poles instanceof Float64Array) {\r\n nPole = source.params.numPoles;\r\n nCoordPerPole = source.dim;\r\n nPoleCoords = source.poles.length;\r\n poleDimProduct = nPole * nCoordPerPole;\r\n } else {\r\n nPole = source.poles.length;\r\n if (nPole > 0)\r\n nCoordPerPole = source.poles[0].length;\r\n nPoleCoords = poleDimProduct = nPole * nCoordPerPole;\r\n }\r\n if (0 === poleDimProduct || poleDimProduct > nPoleCoords || nCoordPerPole !== source.dim)\r\n return {};\r\n\r\n let nWeight = 0;\r\n let nWeightCoords = 0;\r\n let weightDimProduct = 0;\r\n if (source.weights !== undefined) {\r\n if (source.weights instanceof Float64Array) {\r\n nWeight = source.params.numPoles;\r\n nWeightCoords = source.weights.length;\r\n weightDimProduct = nWeight;\r\n } else {\r\n nWeight = source.weights.length;\r\n nWeightCoords = weightDimProduct = nWeight;\r\n }\r\n if (0 === weightDimProduct || weightDimProduct > nWeightCoords || nWeight !== nPole)\r\n return {};\r\n }\r\n\r\n // convert variant source to structured number array\r\n let poles: number[][] | undefined;\r\n let weights: number[] | undefined;\r\n if (source.poles instanceof Float64Array)\r\n poles = NumberArray.unpack2d(source.poles, nCoordPerPole);\r\n else\r\n poles = NumberArray.copy2d(source.poles);\r\n if (poles && source.weights)\r\n weights = NumberArray.create(source.weights);\r\n return {poles, weights};\r\n }\r\n\r\n /** Copy B-spline surface data from source to dest */\r\n function copyBSplineSurfaceDataPoles(source: BSplineSurfaceData): {poles?: number[][][], weights?: number[][]} {\r\n let nPoleRow = 0;\r\n let nPolePerRow = 0;\r\n let nCoordPerPole = 0;\r\n let nCoords = 0;\r\n let poleDimProduct = 0;\r\n if (source.poles instanceof Float64Array) {\r\n nPoleRow = source.vParams.numPoles;\r\n nPolePerRow = source.uParams.numPoles;\r\n nCoordPerPole = source.dim;\r\n nCoords = source.poles.length;\r\n poleDimProduct = nPoleRow * nPolePerRow * nCoordPerPole;\r\n } else {\r\n nPoleRow = source.poles.length;\r\n if (nPoleRow > 0)\r\n nPolePerRow = source.poles[0].length;\r\n if (nPolePerRow > 0)\r\n nCoordPerPole = source.poles[0][0].length;\r\n nCoords = poleDimProduct = nPoleRow * nPolePerRow * nCoordPerPole;\r\n }\r\n if (0 === poleDimProduct || poleDimProduct > nCoords || nCoordPerPole !== source.dim)\r\n return {};\r\n\r\n let nWeightRow = 0;\r\n let nWeightPerRow = 0;\r\n let nWeightCoords = 0;\r\n let weightDimProduct = 0;\r\n if (source.weights !== undefined) {\r\n if (source.weights instanceof Float64Array) {\r\n nWeightRow = source.vParams.numPoles;\r\n nWeightPerRow = source.uParams.numPoles;\r\n nWeightCoords = source.weights.length;\r\n weightDimProduct = nWeightRow * nWeightPerRow;\r\n } else {\r\n nWeightRow = source.weights.length;\r\n if (nWeightRow > 0)\r\n nWeightPerRow = source.weights[0].length;\r\n nWeightCoords = weightDimProduct = nWeightRow * nWeightPerRow;\r\n }\r\n if (0 === weightDimProduct || weightDimProduct > nWeightCoords || nWeightRow !== nPoleRow || nWeightPerRow !== nPolePerRow)\r\n return {};\r\n }\r\n\r\n // convert variant source to structured number array\r\n let poles: number[][][] | undefined;\r\n let weights: number[][] | undefined;\r\n if (source.poles instanceof Float64Array)\r\n poles = NumberArray.unpack3d(source.poles, nPolePerRow, nCoordPerPole);\r\n else\r\n poles = NumberArray.copy3d(source.poles);\r\n if (poles && source.weights) {\r\n if (source.weights instanceof Float64Array)\r\n weights = NumberArray.unpack2d(source.weights, nWeightPerRow);\r\n else\r\n weights = NumberArray.copy2d(source.weights);\r\n }\r\n return {poles, weights};\r\n }\r\n\r\n /** Convert B-spline curve data arrays to the types specified by options. */\r\n function convertBSplineCurveDataArrays(data: BSplineCurveData, options?: BSplineDataOptions) {\r\n if (undefined !== options?.jsonPoles) {\r\n const packedPoles = data.poles instanceof Float64Array;\r\n if (options.jsonPoles && packedPoles)\r\n data.poles = NumberArray.unpack2d(data.poles as Float64Array, data.dim)!;\r\n else if (!options.jsonPoles && !packedPoles)\r\n data.poles = NumberArray.pack(data.poles as number[][]);\r\n\r\n if (data.weights) {\r\n const packedWeights = data.weights instanceof Float64Array;\r\n if (options.jsonPoles && packedWeights)\r\n data.weights = NumberArray.create(data.weights);\r\n else if (!options.jsonPoles && !packedWeights)\r\n data.weights = NumberArray.pack(data.weights as number[]);\r\n }\r\n }\r\n if (undefined !== options?.jsonKnots) {\r\n const packedKnots = data.params.knots instanceof Float64Array;\r\n if (options.jsonKnots && packedKnots)\r\n data.params.knots = NumberArray.create(data.params.knots);\r\n else if (!options.jsonKnots && !packedKnots)\r\n data.params.knots = NumberArray.pack(data.params.knots as number[]);\r\n }\r\n }\r\n\r\n /** Convert B-spline surface data arrays to the types specified by options. */\r\n function convertBSplineSurfaceDataArrays(data: BSplineSurfaceData, options?: BSplineDataOptions) {\r\n if (undefined !== options?.jsonPoles) {\r\n const packedPoles = data.poles instanceof Float64Array;\r\n if (options.jsonPoles && packedPoles)\r\n data.poles = NumberArray.unpack3d(data.poles as Float64Array, data.uParams.numPoles, data.dim)!;\r\n else if (!options.jsonPoles && !packedPoles)\r\n data.poles = NumberArray.pack(data.poles as number[][][]);\r\n\r\n if (data.weights) {\r\n const packedWeights = data.weights instanceof Float64Array;\r\n if (options.jsonPoles && packedWeights)\r\n data.weights = NumberArray.unpack2d(data.weights as Float64Array, data.uParams.numPoles);\r\n else if (!options.jsonPoles && !packedWeights)\r\n data.weights = NumberArray.pack(data.weights as number[][]);\r\n }\r\n }\r\n if (undefined !== options?.jsonKnots) {\r\n const packedKnotsU = data.uParams.knots instanceof Float64Array;\r\n if (options.jsonKnots && packedKnotsU)\r\n data.uParams.knots = NumberArray.create(data.uParams.knots);\r\n else if (!options.jsonKnots && !packedKnotsU)\r\n data.uParams.knots = NumberArray.pack(data.uParams.knots as number[]);\r\n\r\n const packedKnotsV = data.vParams.knots instanceof Float64Array;\r\n if (options.jsonKnots && packedKnotsV)\r\n data.vParams.knots = NumberArray.create(data.vParams.knots);\r\n else if (!options.jsonKnots && !packedKnotsV)\r\n data.vParams.knots = NumberArray.pack(data.vParams.knots as number[]);\r\n }\r\n }\r\n\r\n /**\r\n * Process 1-based blocked indices into 0-based indices.\r\n * @param sourceIndices signed, 1-based, 0-terminated/padded source indices, blocking specified by `numPerBlock`\r\n * @param numPerBlock index blocking: fixed blocks of size numPerBlock > 1, possibly 0-padded; otherwise, variable-sized blocks terminated by 0\r\n * @param announceZeroBasedIndex callback to receive a 0-based index and optional flag indicating whether the sign of the source index is positive\r\n * @param terminateBlock optional callback called after each index block has been announced\r\n */\r\n export function announceZeroBasedIndicesFromSignedOneBasedIndices(\r\n sourceIndices: Int32Array,\r\n numPerBlock: number,\r\n announceZeroBasedIndex: (i0: number, flag?: boolean) => any,\r\n terminateBlock?: () => any,\r\n ): void {\r\n let numIndices = sourceIndices.length;\r\n if (!numIndices)\r\n return;\r\n if (numPerBlock > 1) {\r\n numIndices -= sourceIndices.length % numPerBlock;\r\n for (let i = 0; i < numIndices; i++) {\r\n const p = sourceIndices[i];\r\n if (p !== 0) // skip padding\r\n announceZeroBasedIndex(Math.abs(p) - 1, p > 0);\r\n if (terminateBlock && ((i + 1) % numPerBlock) === 0)\r\n terminateBlock();\r\n }\r\n } else {\r\n for (let i = 0; i < numIndices; i++) {\r\n const p = sourceIndices[i];\r\n if (p !== 0) // skip terminator\r\n announceZeroBasedIndex(Math.abs(p) - 1, p > 0);\r\n if (terminateBlock) {\r\n if (p === 0) {\r\n if (i + 1 === numIndices || sourceIndices[i + 1] !== 0) // skip extra terminators\r\n terminateBlock();\r\n } else {\r\n if (i + 1 === numIndices) // missing last terminator\r\n terminateBlock();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Process 0-based indices with blocking specified by another index array.\r\n * @param sourceIndices 0-based source indices. This array is compressed (has no blocking).\r\n * @param blockingIndices 1-based source indices, blocking specified by `numPerBlock`. Assumed to have length equal to its zero count plus `sourceIndices.length`.\r\n * @param numPerBlock index blocking: fixed blocks of size numPerBlock > 1, possibly 0-padded; otherwise, variable-sized blocks terminated by 0\r\n * @param announceZeroBasedIndex callback to receive a 0-based index\r\n * @param terminateBlock optional callback called after each index block has been announced\r\n */\r\n export function announceZeroBasedIndicesWithExternalBlocking(\r\n sourceIndices: Int32Array,\r\n blockingIndices: Int32Array,\r\n numPerBlock: number,\r\n announceZeroBasedIndex: (i0: number) => any,\r\n terminateBlock?: () => any,\r\n ): void {\r\n if (!sourceIndices.length || !blockingIndices.length)\r\n return;\r\n const blockingZeroCount = blockingIndices.filter((i) => i === 0).length;\r\n if (sourceIndices.length + blockingZeroCount !== blockingIndices.length)\r\n return; // invalid input\r\n let iSource = 0;\r\n let numBlocking = blockingIndices.length;\r\n if (numPerBlock > 1) {\r\n numBlocking -= blockingIndices.length % numPerBlock;\r\n for (let iBlocking = 0; iBlocking < numBlocking && iSource < sourceIndices.length; iBlocking++) {\r\n const p = blockingIndices[iBlocking];\r\n if (p !== 0) // skip padding\r\n announceZeroBasedIndex(sourceIndices[iSource++]);\r\n if (terminateBlock && ((iBlocking + 1) % numPerBlock) === 0)\r\n terminateBlock();\r\n }\r\n } else {\r\n for (let iBlocking = 0; iBlocking < numBlocking && iSource < sourceIndices.length; iBlocking++) {\r\n const p = blockingIndices[iBlocking];\r\n if (p !== 0) // skip terminator\r\n announceZeroBasedIndex(sourceIndices[iSource++]);\r\n if (terminateBlock) {\r\n if (p === 0) {\r\n if (iBlocking + 1 === numBlocking || blockingIndices[iBlocking + 1] !== 0) // skip extra terminators\r\n terminateBlock();\r\n } else {\r\n if (iBlocking + 1 === numBlocking) // missing last terminator\r\n terminateBlock();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** Helper class for preparing geometry data for import. */\r\n export class Import {\r\n /** copy knots, with options to control destination type and extraneous knot removal */\r\n private static copyKnots(knots: Float64Array | number[], options?: BSplineDataOptions, iStart?: number, iEnd?: number): Float64Array| number[] {\r\n if (undefined === iStart)\r\n iStart = 0;\r\n if (undefined === iEnd)\r\n iEnd = knots.length;\r\n if (options?.removeExtraKnots) {\r\n ++iStart; // ignore start knot\r\n --iEnd; // ignore end knot\r\n }\r\n let newNumKnots = iEnd - iStart;\r\n if (newNumKnots < 0)\r\n newNumKnots = 0;\r\n const newKnots = options?.jsonKnots ? new Array<number>(newNumKnots) : new Float64Array(newNumKnots);\r\n for (let i = iStart, k = 0; i < iEnd; i++, k++)\r\n newKnots[k] = knots[i];\r\n return newKnots;\r\n }\r\n\r\n /**\r\n * Recognize the special legacy periodic B-spline data of mode BSplineWrapMode.OpenByRemovingKnots, and return the corresponding modern open clamped knots.\r\n * * Note that the B-spline poles corresponding to the converted knots remain unchanged, but it is assumed that first and last poles are equal.\r\n * * Example: the legacy 7-point quadratic circle periodic knots {-1/3 0 0 0 1/3 1/3 2/3 2/3 1 1 1 4/3} are converted to open knots {0 0 1/3 1/3 2/3 2/3 1 1}.\r\n * * General form of knot vector (k = order, d = k-1 = degree, p = numPoles):\r\n * * * legacy input: {k/2 periodically extended knots} {start knot multiplicity k} {p-k interior knots} {end knot multiplicity k} {d/2 periodically extended knots}\r\n * * * converted output: {start knot multiplicity d} {p-k interior knots} {end knot multiplicity d}\r\n * @param knots classic knot vector to test\r\n * @param numPoles number of poles\r\n * @param order B-spline order\r\n * @param options for output type, extraneous knot removal\r\n * @returns open knots if legacy periodic B-spline input data is recognized; otherwise, undefined\r\n * @see Export.closeLegacyPeriodicKnots\r\n */\r\n private static openLegacyPeriodicKnots(knots: Float64Array | number[], numPoles: number, order: number, options?: BSplineDataOptions): Float64Array | number[] | undefined {\r\n const numKnots = knots.length;\r\n if (order < 2 || numPoles + 2 * order - 1 !== numKnots)\r\n return undefined; // not legacy periodic knots\r\n\r\n const startKnot = knots[order - 1];\r\n const endKnot = knots[numKnots - order];\r\n const iStart0 = Math.floor(order / 2); // index of first expected multiple of the start knot\r\n const iEnd0 = iStart0 + numPoles; // index of first expected multiple of the end knot\r\n const iEnd1 = iEnd0 + order; // one past index of last expected multiple of the end knot\r\n for (let i = 0; i < order; ++i) {\r\n if (Math.abs(knots[iStart0 + i] - startKnot) >= KnotVector.knotTolerance)\r\n return undefined; // start knot multiplicity too small\r\n if (Math.abs(knots[iEnd0 + i] - endKnot) >= KnotVector.knotTolerance)\r\n return undefined; // end knot multiplicity too small\r\n }\r\n return this.copyKnots(knots, options, iStart0, iEnd1);\r\n }\r\n\r\n /** Prepare imported B-spline curve data for eventual conversion to BSplineCurve3d | BSplineCurve3dH:\r\n * * Opens legacy \"fake\" periodic data by expanding knots\r\n * * Opens true periodic data by expanding poles and weights\r\n * @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.\r\n * @param options output specifications\r\n * @returns whether data was successfully prepared\r\n */\r\n public static prepareBSplineCurveData(data: BSplineCurveData, options?: BSplineDataOptions): boolean {\r\n let polesExpanded: number[][] | undefined;\r\n let weightsExpanded: number[] | undefined;\r\n let knotsCorrected: number[] | Float64Array | undefined;\r\n data.params.wrapMode = undefined;\r\n\r\n if (true === data.params.closed) {\r\n knotsCorrected = this.openLegacyPeriodicKnots(data.params.knots, data.params.numPoles, data.params.order, options);\r\n if (undefined !== knotsCorrected) {\r\n // legacy periodic knots removed, poles untouched\r\n data.params.knots = knotsCorrected;\r\n data.params.wrapMode = BSplineWrapMode.OpenByRemovingKnots;\r\n } else {\r\n // wrap poles, knots untouched\r\n if (!polesExpanded) {\r\n const arrays = copyBSplineCurveDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesExpanded = arrays.poles;\r\n data.weights = weightsExpanded = arrays.weights;\r\n }\r\n for (let i = 0; i < data.params.order - 1; ++i) {\r\n const wraparoundPt = [];\r\n for (let j = 0; j < data.dim; ++j)\r\n wraparoundPt.push(polesExpanded[i][j]);\r\n polesExpanded.push(wraparoundPt); // append degree wraparound poles\r\n }\r\n if (weightsExpanded) {\r\n for (let i = 0; i < data.params.order - 1; ++i)\r\n weightsExpanded.push(weightsExpanded[i]); // append degree wraparound weights\r\n }\r\n data.params.numPoles += data.params.order - 1;\r\n data.params.wrapMode = BSplineWrapMode.OpenByAddingControlPoints;\r\n }\r\n }\r\n\r\n if (options?.removeExtraKnots) {\r\n if (!knotsCorrected)\r\n data.params.knots = this.copyKnots(data.params.knots, options);\r\n }\r\n\r\n data.params.closed = undefined; // we are open\r\n\r\n convertBSplineCurveDataArrays(data, options);\r\n return true;\r\n }\r\n\r\n /** Prepare imported B-spline surface data for eventual conversion to BSplineSurface3d | BSplineSurface3dH:\r\n * * Opens legacy \"fake\" periodic data by expanding knots\r\n * * Opens true periodic data by expanding poles and weights\r\n * @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.\r\n * @param options output specifications\r\n * @returns whether data was successfully prepared\r\n */\r\n public static prepareBSplineSurfaceData(data: BSplineSurfaceData, options?: BSplineDataOptions): boolean {\r\n let polesExpanded: number[][][] | undefined;\r\n let weightsExpanded: number[][] | undefined;\r\n let uKnotsCorrected: number[] | Float64Array | undefined;\r\n let vKnotsCorrected: number[] | Float64Array | undefined;\r\n data.uParams.wrapMode = data.vParams.wrapMode = undefined;\r\n\r\n if (true === data.uParams.closed) {\r\n uKnotsCorrected = this.openLegacyPeriodicKnots(data.uParams.knots, data.uParams.numPoles, data.uParams.order, options);\r\n if (undefined !== uKnotsCorrected) {\r\n // legacy periodic knots removed, poles untouched\r\n data.uParams.knots = uKnotsCorrected;\r\n data.uParams.wrapMode = BSplineWrapMode.OpenByRemovingKnots;\r\n } else {\r\n // wrap poles, knots untouched\r\n if (!polesExpanded) {\r\n const arrays = copyBSplineSurfaceDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesExpanded = arrays.poles;\r\n data.weights = weightsExpanded = arrays.weights;\r\n }\r\n for (let i = 0; i < data.vParams.numPoles; ++i) { // #rows\r\n for (let j = 0; j < data.uParams.order - 1; ++j) {\r\n const wraparoundPt = [];\r\n for (let k = 0; k < data.dim; ++k)\r\n wraparoundPt.push(polesExpanded[i][j][k]);\r\n polesExpanded[i].push(wraparoundPt); // append degreeU wraparound poles to each row\r\n }\r\n }\r\n if (weightsExpanded) {\r\n for (let i = 0; i < data.vParams.numPoles; ++i) // #rows\r\n for (let j = 0; j < data.uParams.order - 1; ++j)\r\n weightsExpanded[i].push(weightsExpanded[i][j]); // append degreeU wraparound weights to each row\r\n }\r\n data.uParams.numPoles += data.uParams.order - 1;\r\n data.uParams.wrapMode = BSplineWrapMode.OpenByAddingControlPoints;\r\n }\r\n }\r\n\r\n if (true === data.vParams.closed) {\r\n vKnotsCorrected = this.openLegacyPeriodicKnots(data.vParams.knots, data.vParams.numPoles, data.vParams.order, options);\r\n if (undefined !== vKnotsCorrected) {\r\n // legacy periodic knots removed, poles untouched\r\n data.vParams.knots = vKnotsCorrected;\r\n data.vParams.wrapMode = BSplineWrapMode.OpenByRemovingKnots;\r\n } else {\r\n // wrap poles, knots untouched\r\n if (!polesExpanded) {\r\n const arrays = copyBSplineSurfaceDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesExpanded = arrays.poles;\r\n data.weights = weightsExpanded = arrays.weights;\r\n }\r\n for (let i = 0; i < data.vParams.order - 1; ++i) {\r\n const wrapAroundRow = [];\r\n for (let j = 0; j < data.uParams.numPoles; ++j) { // #cols\r\n const wrapAroundPt = [];\r\n for (let k = 0; k < data.dim; ++k)\r\n wrapAroundPt.push(polesExpanded[i][j][k]);\r\n wrapAroundRow.push(wrapAroundPt);\r\n }\r\n polesExpanded.push(wrapAroundRow); // append degreeV wraparound rows of poles\r\n }\r\n if (weightsExpanded) {\r\n for (let i = 0; i < data.vParams.order - 1; ++i) {\r\n const wrapAroundRow = [];\r\n for (let j = 0; j < data.uParams.numPoles; ++j) // #cols\r\n wrapAroundRow.push(weightsExpanded[i][j]);\r\n weightsExpanded.push(wrapAroundRow); // append degreeV wraparound rows of weights\r\n }\r\n }\r\n data.vParams.numPoles += data.vParams.order - 1;\r\n data.vParams.wrapMode = BSplineWrapMode.OpenByAddingControlPoints;\r\n }\r\n }\r\n\r\n if (options?.removeExtraKnots) {\r\n if (!uKnotsCorrected)\r\n data.uParams.knots = this.copyKnots(data.uParams.knots, options);\r\n if (!vKnotsCorrected)\r\n data.vParams.knots = this.copyKnots(data.vParams.knots, options);\r\n }\r\n\r\n data.uParams.closed = data.vParams.closed = undefined; // we are open\r\n\r\n convertBSplineSurfaceDataArrays(data, options);\r\n return true;\r\n }\r\n }\r\n\r\n /** Helper class for preparing geometry data for export. */\r\n export class Export {\r\n /**\r\n * Restore special legacy periodic B-spline knots opened via BSplineWrapMode.OpenByRemovingKnots logic.\r\n * @param knots modern knot vector: {start knot multiplicity d} {p-k interior knots} {end knot multiplicity d}\r\n * @param order B-spline order\r\n * @param options for output type\r\n * @param wrapMode wrap mode of the knots\r\n * @returns legacy periodic knots (with classic extraneous start/end knot) if wrapMode recognized; otherwise, undefined\r\n * @see Import.openLegacyPeriodicKnots\r\n */\r\n private static closeLegacyPeriodicKnots(knots: Float64Array | number[], order: number, options?: BSplineDataOptions, wrapMode?: BSplineWrapMode): Float64Array | number[] | undefined {\r\n if (wrapMode === undefined || wrapMode !== BSplineWrapMode.OpenByRemovingKnots)\r\n return undefined;\r\n\r\n const degree = order - 1;\r\n const leftIndex = degree - 1;\r\n const rightIndex = knots.length - degree;\r\n const leftKnot = knots[leftIndex];\r\n const rightKnot = knots[rightIndex];\r\n const knotPeriod = rightKnot - leftKnot;\r\n const newNumKnots = knots.length + degree + 2;\r\n const newKnots = options?.jsonKnots ? new Array<number>(newNumKnots) : new Float64Array(newNumKnots);\r\n\r\n let k = 0;\r\n for (let i = Math.floor(order / 2); i > 0; --i)\r\n newKnots[k++] = knots[rightIndex - i] - knotPeriod;\r\n newKnots[k++] = leftKnot; // extraneous start knot\r\n for (const knot of knots)\r\n newKnots[k++] = knot;\r\n newKnots[k++] = rightKnot; // extraneous end knot\r\n for (let i = 1; i <= Math.floor(degree / 2); ++i)\r\n newKnots[k++] = knots[leftIndex + i] + knotPeriod;\r\n\r\n return newKnots;\r\n }\r\n\r\n /**\r\n * Prepare data from a B-spline curve for export.\r\n * * adds classic extraneous knot at start and end of knot vector\r\n * * re-closes periodic data based on BSplineWrapMode\r\n * @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.\r\n * @param options output specifications\r\n * @returns whether data was successfully prepared\r\n */\r\n public static prepareBSplineCurveData(data: BSplineCurveData, options?: BSplineDataOptions): boolean {\r\n let polesTrimmed: number[][] | undefined;\r\n let weightsTrimmed: number[] | undefined;\r\n let knotsCorrected: number[] | Float64Array | undefined;\r\n data.params.closed = undefined;\r\n\r\n switch (data.params.wrapMode) {\r\n case BSplineWrapMode.OpenByRemovingKnots: {\r\n // add legacy periodic and extraneous knots, poles untouched\r\n knotsCorrected = this.closeLegacyPeriodicKnots(data.params.knots, data.params.order, options, data.params.wrapMode);\r\n if (undefined === knotsCorrected)\r\n return false; // invalid input\r\n data.params.knots = knotsCorrected;\r\n data.params.closed = true;\r\n break;\r\n }\r\n case BSplineWrapMode.OpenByAddingControlPoints: {\r\n // unwrap poles, knots untouched\r\n if (!polesTrimmed) {\r\n const arrays = copyBSplineCurveDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesTrimmed = arrays.poles;\r\n data.weights = weightsTrimmed = arrays.weights;\r\n }\r\n for (let i = 0; i < data.params.order - 1; ++i)\r\n polesTrimmed.pop(); // remove last degree poles\r\n if (weightsTrimmed) {\r\n for (let i = 0; i < data.params.order - 1; ++i)\r\n weightsTrimmed.pop(); // remove last degree weights\r\n }\r\n data.params.numPoles -= data.params.order - 1;\r\n data.params.closed = true;\r\n break;\r\n }\r\n }\r\n\r\n // always add extraneous knots\r\n if (!knotsCorrected)\r\n data.params.knots = KnotVector.copyKnots(data.params.knots, data.params.order - 1, true, data.params.wrapMode);\r\n\r\n convertBSplineCurveDataArrays(data, options);\r\n return true;\r\n }\r\n\r\n /**\r\n * Prepare data from a B-spline surface for export.\r\n * * adds classic extraneous knot at start and end of knot vectors\r\n * * re-closes periodic data based on BSplineWrapMode\r\n * @param data updated in place. If poles/weights/knots are updated, their respective arrays are reallocated.\r\n * @param options output specifications\r\n * @returns whether data was successfully prepared\r\n */\r\n public static prepareBSplineSurfaceData(data: BSplineSurfaceData, options?: BSplineDataOptions): boolean {\r\n let polesTrimmed: number[][][] | undefined;\r\n let weightsTrimmed: number[][] | undefined;\r\n let uKnotsCorrected: number[] | Float64Array | undefined;\r\n let vKnotsCorrected: number[] | Float64Array | undefined;\r\n data.uParams.closed = data.vParams.closed = undefined;\r\n\r\n switch (data.uParams.wrapMode) {\r\n case BSplineWrapMode.OpenByRemovingKnots: {\r\n // add legacy periodic and extraneous knots, poles untouched\r\n uKnotsCorrected = this.closeLegacyPeriodicKnots(data.uParams.knots, data.uParams.order, options, data.uParams.wrapMode);\r\n if (undefined === uKnotsCorrected)\r\n return false; // invalid input\r\n data.uParams.knots = uKnotsCorrected;\r\n data.uParams.closed = true;\r\n break;\r\n }\r\n case BSplineWrapMode.OpenByAddingControlPoints: {\r\n // unwrap poles, knots untouched\r\n if (!polesTrimmed) {\r\n const arrays = copyBSplineSurfaceDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesTrimmed = arrays.poles;\r\n data.weights = weightsTrimmed = arrays.weights;\r\n }\r\n for (let i = 0; i < data.vParams.numPoles; ++i) // #rows\r\n for (let j = 0; j < data.uParams.order - 1; ++j)\r\n polesTrimmed[i].pop(); // remove last degreeU poles from each row\r\n if (weightsTrimmed) {\r\n for (let i = 0; i < data.vParams.numPoles; ++i) // #rows\r\n for (let j = 0; j < data.uParams.order - 1; ++j)\r\n weightsTrimmed[i].pop(); // remove last degreeU weights from each row\r\n }\r\n data.uParams.numPoles -= data.uParams.order - 1;\r\n data.uParams.closed = true;\r\n break;\r\n }\r\n }\r\n\r\n switch (data.vParams.wrapMode) {\r\n case BSplineWrapMode.OpenByRemovingKnots: {\r\n // add legacy periodic and extraneous knots, poles untouched\r\n vKnotsCorrected = this.closeLegacyPeriodicKnots(data.vParams.knots, data.vParams.order, options, data.vParams.wrapMode);\r\n if (undefined === vKnotsCorrected)\r\n return false; // invalid input\r\n data.vParams.knots = vKnotsCorrected;\r\n data.vParams.closed = true;\r\n break;\r\n }\r\n case BSplineWrapMode.OpenByAddingControlPoints: {\r\n // unwrap poles, knots untouched\r\n if (!polesTrimmed) {\r\n const arrays = copyBSplineSurfaceDataPoles(data);\r\n if (undefined === arrays.poles)\r\n return false; // invalid input\r\n data.poles = polesTrimmed = arrays.poles;\r\n data.weights = weightsTrimmed = arrays.weights;\r\n }\r\n for (let i = 0; i < data.vParams.order - 1; ++i)\r\n polesTrimmed.pop(); // remove last degreeV rows of poles\r\n if (weightsTrimmed) {\r\n for (let i = 0; i < data.vParams.order - 1; ++i)\r\n weightsTrimmed.pop(); // remove last degreeV rows of weights\r\n }\r\n data.vParams.numPoles -= data.vParams.order - 1;\r\n data.vParams.closed = true;\r\n break;\r\n }\r\n }\r\n\r\n // always add extraneous knots\r\n if (!uKnotsCorrected)\r\n data.uParams.knots = KnotVector.copyKnots(data.uParams.knots, data.uParams.order - 1, true, data.uParams.wrapMode);\r\n if (!vKnotsCorrected)\r\n data.vParams.knots = KnotVector.copyKnots(data.vParams.knots, data.vParams.order - 1, true, data.vParams.wrapMode);\r\n\r\n convertBSplineSurfaceDataArrays(data, options);\r\n return true;\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -28,6 +28,7 @@ export declare class Sphere extends SolidPrimitive implements UVSurface {
|
|
|
28
28
|
vFractionToRadians(v: number): number;
|
|
29
29
|
/** Return the longitude (in radians) all fractional u. */
|
|
30
30
|
uFractionToRadians(u: number): number;
|
|
31
|
+
/** Constructor CAPTURES inputs */
|
|
31
32
|
private constructor();
|
|
32
33
|
/** return a deep clone */
|
|
33
34
|
clone(): Sphere;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sphere.d.ts","sourceRoot":"","sources":["../../../src/solid/Sphere.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAA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,GAAG,GAAG;IAG/D;;;OAGG;IACI,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAUvE,6CAA6C;IACtC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI;IAiB/D;;;OAGG;IACI,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAUzF;;;OAGG;IACI,4BAA4B,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,yBAAyB,GAAG,yBAAyB;IAexI;;;;;OAKG;IACH,IAAW,cAAc,IAAI,OAAO,CAEnC;IACD;;;;OAIG;IACI,wBAAwB,IAAI,QAAQ;CAa5C"}
|
package/lib/esm/solid/Sphere.js
CHANGED
|
@@ -34,12 +34,14 @@ export class Sphere extends SolidPrimitive {
|
|
|
34
34
|
uFractionToRadians(u) {
|
|
35
35
|
return u * Math.PI * 2.0;
|
|
36
36
|
}
|
|
37
|
+
/** Constructor CAPTURES inputs */
|
|
37
38
|
constructor(localToWorld, latitudeSweep, capped) {
|
|
38
39
|
super(capped);
|
|
39
40
|
/** String name for schema properties */
|
|
40
41
|
this.solidPrimitiveType = "sphere";
|
|
41
42
|
this._localToWorld = localToWorld;
|
|
42
43
|
this._latitudeSweep = latitudeSweep ? latitudeSweep : AngleSweep.createFullLatitude();
|
|
44
|
+
this._latitudeSweep.capLatitudeInPlace();
|
|
43
45
|
}
|
|
44
46
|
/** return a deep clone */
|
|
45
47
|
clone() {
|
|
@@ -78,11 +80,11 @@ export class Sphere extends SolidPrimitive {
|
|
|
78
80
|
/** Create from center and radius, with optional restricted latitudes. */
|
|
79
81
|
static createCenterRadius(center, radius, latitudeSweep) {
|
|
80
82
|
const localToWorld = Transform.createOriginAndMatrix(center, Matrix3d.createUniformScale(radius));
|
|
81
|
-
return new Sphere(localToWorld, latitudeSweep ? latitudeSweep : AngleSweep.createFullLatitude(), false);
|
|
83
|
+
return new Sphere(localToWorld, latitudeSweep ? latitudeSweep.clone() : AngleSweep.createFullLatitude(), false);
|
|
82
84
|
}
|
|
83
85
|
/** Create an ellipsoid which is a unit sphere mapped to position by an (arbitrary, possibly skewed and scaled) transform. */
|
|
84
86
|
static createEllipsoid(localToWorld, latitudeSweep, capped) {
|
|
85
|
-
return new Sphere(localToWorld, latitudeSweep, capped);
|
|
87
|
+
return new Sphere(localToWorld.clone(), latitudeSweep.clone(), capped);
|
|
86
88
|
}
|
|
87
89
|
/** Create a sphere from the typical parameters of the Dgn file */
|
|
88
90
|
static createDgnSphere(center, vectorX, vectorZ, radiusXY, radiusZ, latitudeSweep, capped) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sphere.js","sourceRoot":"","sources":["../../../src/solid/Sphere.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAW,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;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------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Solid\r\n */\r\n\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { AngleSweep } from \"../geometry3d/AngleSweep\";\r\nimport { GeometryHandler, UVSurface } from \"../geometry3d/GeometryHandler\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { SolidPrimitive } from \"./SolidPrimitive\";\r\n\r\n/**\r\n * A Sphere is\r\n *\r\n * * A unit sphere (but read on ....)\r\n * * mapped by an arbitrary (possibly skewed, non-uniform scaled) transform\r\n * * hence possibly the final geometry is ellipsoidal\r\n * @public\r\n */\r\nexport class Sphere extends SolidPrimitive implements UVSurface {\r\n /** String name for schema properties */\r\n public readonly solidPrimitiveType = \"sphere\";\r\n\r\n private _localToWorld: Transform; // unit sphere maps to world through the transform0 part of this map.\r\n private _latitudeSweep: AngleSweep;\r\n /** Return the latitude (in radians) all fractional v. */\r\n public vFractionToRadians(v: number): number {\r\n return this._latitudeSweep.fractionToRadians(v);\r\n }\r\n /** Return the longitude (in radians) all fractional u. */\r\n public uFractionToRadians(u: number): number {\r\n return u * Math.PI * 2.0;\r\n }\r\n\r\n private constructor(localToWorld: Transform, latitudeSweep: AngleSweep, capped: boolean) {\r\n super(capped);\r\n this._localToWorld = localToWorld;\r\n this._latitudeSweep = latitudeSweep ? latitudeSweep : AngleSweep.createFullLatitude();\r\n }\r\n /** return a deep clone */\r\n public clone(): Sphere {\r\n return new Sphere(this._localToWorld.clone(), this._latitudeSweep.clone(), this.capped);\r\n }\r\n /** Transform the sphere in place.\r\n * * Fails if the transform is singular.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n if (transform.matrix.isSingular())\r\n return false;\r\n transform.multiplyTransformTransform(this._localToWorld, this._localToWorld);\r\n return true;\r\n }\r\n /** Return a transformed clone. */\r\n public cloneTransformed(transform: Transform): Sphere | undefined {\r\n const sphere1 = this.clone();\r\n transform.multiplyTransformTransform(sphere1._localToWorld, sphere1._localToWorld);\r\n if (transform.matrix.determinant() < 0.0) {\r\n if (sphere1._latitudeSweep !== undefined) {\r\n sphere1._latitudeSweep.reverseInPlace();\r\n }\r\n }\r\n return sphere1;\r\n }\r\n /** Return a coordinate frame (right handed, unit axes)\r\n * * origin at sphere center\r\n * * equator in xy plane\r\n * * z axis perpendicular\r\n */\r\n public getConstructiveFrame(): Transform | undefined {\r\n return this._localToWorld.cloneRigid();\r\n }\r\n /** Return the latitude sweep as fraction of south pole to north pole. */\r\n public get latitudeSweepFraction(): number { return this._latitudeSweep.sweepRadians / Math.PI; }\r\n /** Create from center and radius, with optional restricted latitudes. */\r\n public static createCenterRadius(center: Point3d, radius: number, latitudeSweep?: AngleSweep): Sphere {\r\n const localToWorld = Transform.createOriginAndMatrix(center, Matrix3d.createUniformScale(radius));\r\n return new Sphere(localToWorld,\r\n latitudeSweep ? latitudeSweep : AngleSweep.createFullLatitude(), false);\r\n }\r\n /** Create an ellipsoid which is a unit sphere mapped to position by an (arbitrary, possibly skewed and scaled) transform. */\r\n public static createEllipsoid(localToWorld: Transform, latitudeSweep: AngleSweep, capped: boolean): Sphere | undefined {\r\n return new Sphere(localToWorld, latitudeSweep, capped);\r\n }\r\n\r\n /** Create a sphere from the typical parameters of the Dgn file */\r\n public static createDgnSphere(center: Point3d, vectorX: Vector3d, vectorZ: Vector3d, radiusXY: number, radiusZ: number,\r\n latitudeSweep: AngleSweep,\r\n capped: boolean): Sphere | undefined {\r\n const vectorY = vectorX.rotate90Around(vectorZ);\r\n if (vectorY && !vectorX.isParallelTo(vectorZ)) {\r\n const matrix = Matrix3d.createColumns(vectorX, vectorY, vectorZ);\r\n matrix.scaleColumns(radiusXY, radiusXY, radiusZ, matrix);\r\n const frame = Transform.createOriginAndMatrix(center, matrix);\r\n return new Sphere(frame, latitudeSweep.clone(), capped);\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Create a sphere from the typical parameters of the Dgn file */\r\n public static createFromAxesAndScales(center: Point3d, axes: undefined | Matrix3d, radiusX: number, radiusY: number, radiusZ: number,\r\n latitudeSweep: AngleSweep | undefined,\r\n capped: boolean): Sphere | undefined {\r\n const localToWorld = Transform.createOriginAndMatrix(center, axes);\r\n localToWorld.matrix.scaleColumnsInPlace(radiusX, radiusY, radiusZ);\r\n return new Sphere(localToWorld, latitudeSweep ? latitudeSweep.clone() : AngleSweep.createFullLatitude(), capped);\r\n }\r\n\r\n /** return (copy of) sphere center */\r\n public cloneCenter(): Point3d { return this._localToWorld.getOrigin(); }\r\n /** return the (full length, i.e. scaled by radius) X vector from the sphere transform */\r\n public cloneVectorX(): Vector3d { return this._localToWorld.matrix.columnX(); }\r\n /** return the (full length, i.e. scaled by radius) Y vector from the sphere transform */\r\n public cloneVectorY(): Vector3d { return this._localToWorld.matrix.columnY(); }\r\n /** return the (full length, i.e. scaled by radius) Z vector from the sphere transform */\r\n public cloneVectorZ(): Vector3d { return this._localToWorld.matrix.columnZ(); }\r\n /** return (a copy of) the sphere's angle sweep. */\r\n public cloneLatitudeSweep(): AngleSweep { return this._latitudeSweep.clone(); }\r\n /** Test if the geometry is a true sphere taking the transform (which might have nonuniform scaling) is applied. */\r\n public trueSphereRadius(): number | undefined {\r\n const factors = this._localToWorld.matrix.factorRigidWithSignedScale();\r\n if (!factors) return undefined;\r\n if (factors && factors.scale > 0) // why do we rule out mirror?\r\n return factors.scale;\r\n return undefined;\r\n }\r\n /**\r\n * Return the largest of the primary xyz axis radii\r\n */\r\n public maxAxisRadius(): number {\r\n const matrix = this._localToWorld.matrix;\r\n return Geometry.maxXYZ(matrix.columnXMagnitude(), matrix.columnYMagnitude(), matrix.columnZMagnitude());\r\n }\r\n /**\r\n * Return a (clone of) the sphere's local to world transformation.\r\n */\r\n public cloneLocalToWorld(): Transform { return this._localToWorld.clone(); }\r\n /** Test if `other` is a `Sphere` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof Sphere; }\r\n /** Test for same geometry in `other` */\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof Sphere) {\r\n if (this.capped !== other.capped) return false;\r\n if (!this._localToWorld.isAlmostEqual(other._localToWorld)) return false;\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * return strokes for a cross-section (elliptic arc) at specified fraction v along the axis.\r\n * * if strokeOptions is supplied, it is applied to the equator radii.\r\n * @param v fractional position along the cone axis\r\n * @param strokes stroke count or options.\r\n */\r\n public strokeConstantVSection(v: number, fixedStrokeCount: number | undefined,\r\n options?: StrokeOptions): LineString3d {\r\n let strokeCount = 16;\r\n if (fixedStrokeCount !== undefined && Number.isFinite(fixedStrokeCount)) {\r\n strokeCount = fixedStrokeCount;\r\n } else if (options instanceof StrokeOptions) {\r\n strokeCount = options.applyTolerancesToArc(Geometry.maxXY(this._localToWorld.matrix.columnXMagnitude(), this._localToWorld.matrix.columnYMagnitude()));\r\n }\r\n strokeCount = Geometry.clampToStartEnd(strokeCount, 4, 64);\r\n const transform = this._localToWorld;\r\n const phi = this.vFractionToRadians(v);\r\n const c1 = Math.cos(phi);\r\n const s1 = Math.sin(phi);\r\n let c0, s0;\r\n const result = LineString3d.createForStrokes(fixedStrokeCount, options);\r\n const deltaRadians = Math.PI * 2.0 / strokeCount;\r\n const fractions = result.fractions; // possibly undefined !!!\r\n const derivatives = result.packedDerivatives; // possibly undefined !!!\r\n const uvParams = result.packedUVParams; // possibly undefined !!\r\n const surfaceNormals = result.packedSurfaceNormals;\r\n const dXdu = Vector3d.create();\r\n const dXdv = Vector3d.create();\r\n const normal = Vector3d.create();\r\n let radians = 0;\r\n for (let i = 0; i <= strokeCount; i++) {\r\n if (i * 2 <= strokeCount)\r\n radians = i * deltaRadians;\r\n else\r\n radians = (i - strokeCount) * deltaRadians;\r\n c0 = Math.cos(radians);\r\n s0 = Math.sin(radians);\r\n const xyz = transform.multiplyXYZ(c1 * c0, c1 * s0, s1);\r\n result.addPoint(xyz);\r\n\r\n if (fractions)\r\n fractions.push(i / strokeCount);\r\n\r\n if (derivatives) {\r\n transform.matrix.multiplyXYZ(-c1 * s0, c1 * c0, 0.0, dXdu);\r\n derivatives.push(dXdu);\r\n }\r\n if (uvParams) {\r\n uvParams.pushXY(i / strokeCount, v);\r\n }\r\n if (surfaceNormals) {\r\n transform.matrix.multiplyXYZ(-s0, c0, 0, dXdu);\r\n transform.matrix.multiplyXYZ(-s1 * c0, -s1 * s0, c1, dXdv);\r\n dXdu.unitCrossProduct(dXdv, normal);\r\n surfaceNormals.push(normal);\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /** Second step of double dispatch: call `handler.handleSphere(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleSphere(this);\r\n }\r\n /**\r\n * Return the Arc3d section at vFraction. For the sphere, this is a latitude circle.\r\n * @param vFraction fractional position along the sweep direction\r\n */\r\n public constantVSection(vFraction: number): CurveCollection | undefined {\r\n const phi = this._latitudeSweep.fractionToRadians(vFraction);\r\n const s1 = Math.sin(phi);\r\n const c1 = Math.cos(phi);\r\n const transform = this._localToWorld;\r\n const center = transform.multiplyXYZ(0, 0, s1);\r\n const vector0 = transform.matrix.multiplyXYZ(c1, 0, 0);\r\n const vector90 = transform.matrix.multiplyXYZ(0, c1, 0);\r\n return Loop.create(Arc3d.create(center, vector0, vector90));\r\n }\r\n /** Extend a range to contain this sphere. */\r\n public extendRange(range: Range3d, transform?: Transform): void {\r\n let placement = this._localToWorld;\r\n if (transform) {\r\n placement = transform.multiplyTransformTransform(placement);\r\n }\r\n\r\n range.extendTransformedXYZ(placement, -1, -1, -1);\r\n range.extendTransformedXYZ(placement, 1, -1, -1);\r\n range.extendTransformedXYZ(placement, -1, 1, -1);\r\n range.extendTransformedXYZ(placement, 1, 1, -1);\r\n\r\n range.extendTransformedXYZ(placement, -1, -1, 1);\r\n range.extendTransformedXYZ(placement, 1, -1, 1);\r\n range.extendTransformedXYZ(placement, -1, 1, 1);\r\n range.extendTransformedXYZ(placement, 1, 1, 1);\r\n\r\n }\r\n /** Evaluate as a uv surface\r\n * @param uFraction fractional position on minor arc (theta, longitude)\r\n * @param vFraction fractional position on major arc (phi, latitude)\r\n */\r\n public uvFractionToPoint(uFraction: number, vFraction: number, result?: Point3d): Point3d {\r\n // sphere with radius 1 . . .\r\n const thetaRadians = this.uFractionToRadians(uFraction);\r\n const phiRadians = this.vFractionToRadians(vFraction);\r\n const cosTheta = Math.cos(thetaRadians);\r\n const sinTheta = Math.sin(thetaRadians);\r\n const sinPhi = Math.sin(phiRadians);\r\n const cosPhi = Math.cos(phiRadians);\r\n return this._localToWorld.multiplyXYZ(cosTheta * cosPhi, sinTheta * cosPhi, sinPhi, result);\r\n }\r\n /** Evaluate as a uv surface, returning point and two vectors.\r\n * @param uFraction fractional position on minor arc (theta, longitude)\r\n * @param vFraction fractional position on major arc (phi, latitude)\r\n */\r\n public uvFractionToPointAndTangents(uFraction: number, vFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const thetaRadians = this.uFractionToRadians(uFraction);\r\n const phiRadians = this.vFractionToRadians(vFraction);\r\n const fTheta = Math.PI * 2.0;\r\n const fPhi = this._latitudeSweep.sweepRadians;\r\n const cosTheta = Math.cos(thetaRadians);\r\n const sinTheta = Math.sin(thetaRadians);\r\n const sinPhi = Math.sin(phiRadians);\r\n const cosPhi = Math.cos(phiRadians);\r\n return Plane3dByOriginAndVectors.createOriginAndVectors(\r\n this._localToWorld.multiplyXYZ(cosTheta * cosPhi, sinTheta * cosPhi, sinPhi),\r\n this._localToWorld.matrix.multiplyXYZ(-fTheta * sinTheta, fTheta * cosTheta, 0), // !!! note cosTheta term is omitted -- scale is wrong, but remains non-zero at poles.\r\n this._localToWorld.matrix.multiplyXYZ(-fPhi * cosTheta * sinPhi, -fPhi * sinTheta * sinPhi, fPhi * cosPhi),\r\n result);\r\n }\r\n /**\r\n * * A sphere is can be closed two ways:\r\n * * full sphere (no caps needed for closure)\r\n * * incomplete but with caps\r\n * @return true if this is a closed volume.\r\n */\r\n public get isClosedVolume(): boolean {\r\n return this.capped || this._latitudeSweep.isFullLatitudeSweep;\r\n }\r\n /**\r\n * Directional distance query\r\n * * u direction is around latitude circle at maximum distance from axis.\r\n * * v direction is on a line of longitude between the latitude limits.\r\n */\r\n public maxIsoParametricDistance(): Vector2d {\r\n // approximate radius at equator .. if elliptic, this is not exact . . .\r\n const rX = this._localToWorld.matrix.columnXMagnitude();\r\n const rY = this._localToWorld.matrix.columnYMagnitude();\r\n const rZ = this._localToWorld.matrix.columnZMagnitude();\r\n const rMaxU = Math.max(rX, rY);\r\n let dMaxU = Math.PI * 2.0 * rMaxU;\r\n if (!this._latitudeSweep.isRadiansInSweep(0.0))\r\n dMaxU *= Math.max(Math.cos(Math.abs(this._latitudeSweep.startRadians)), Math.cos(Math.abs(this._latitudeSweep.endRadians)));\r\n const dMaxV = Math.max(rMaxU, rZ) * Math.abs(this._latitudeSweep.sweepRadians);\r\n\r\n return Vector2d.create(dMaxU, dMaxV);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Sphere.js","sourceRoot":"","sources":["../../../src/solid/Sphere.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EA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AAE,CAAC;QACxD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC/B,IAAI,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,KAAK,CAAC;QAClC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,GAAG,CAAC;YAC5C,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9H,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QAE/E,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Solid\r\n */\r\n\r\nimport { Arc3d } from \"../curve/Arc3d\";\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { AngleSweep } from \"../geometry3d/AngleSweep\";\r\nimport { GeometryHandler, UVSurface } from \"../geometry3d/GeometryHandler\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { SolidPrimitive } from \"./SolidPrimitive\";\r\n\r\n/**\r\n * A Sphere is\r\n *\r\n * * A unit sphere (but read on ....)\r\n * * mapped by an arbitrary (possibly skewed, non-uniform scaled) transform\r\n * * hence possibly the final geometry is ellipsoidal\r\n * @public\r\n */\r\nexport class Sphere extends SolidPrimitive implements UVSurface {\r\n /** String name for schema properties */\r\n public readonly solidPrimitiveType = \"sphere\";\r\n\r\n private _localToWorld: Transform; // unit sphere maps to world through the transform0 part of this map.\r\n private _latitudeSweep: AngleSweep;\r\n /** Return the latitude (in radians) all fractional v. */\r\n public vFractionToRadians(v: number): number {\r\n return this._latitudeSweep.fractionToRadians(v);\r\n }\r\n /** Return the longitude (in radians) all fractional u. */\r\n public uFractionToRadians(u: number): number {\r\n return u * Math.PI * 2.0;\r\n }\r\n\r\n /** Constructor CAPTURES inputs */\r\n private constructor(localToWorld: Transform, latitudeSweep: AngleSweep, capped: boolean) {\r\n super(capped);\r\n this._localToWorld = localToWorld;\r\n this._latitudeSweep = latitudeSweep ? latitudeSweep : AngleSweep.createFullLatitude();\r\n this._latitudeSweep.capLatitudeInPlace();\r\n }\r\n /** return a deep clone */\r\n public clone(): Sphere {\r\n return new Sphere(this._localToWorld.clone(), this._latitudeSweep.clone(), this.capped);\r\n }\r\n /** Transform the sphere in place.\r\n * * Fails if the transform is singular.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n if (transform.matrix.isSingular())\r\n return false;\r\n transform.multiplyTransformTransform(this._localToWorld, this._localToWorld);\r\n return true;\r\n }\r\n /** Return a transformed clone. */\r\n public cloneTransformed(transform: Transform): Sphere | undefined {\r\n const sphere1 = this.clone();\r\n transform.multiplyTransformTransform(sphere1._localToWorld, sphere1._localToWorld);\r\n if (transform.matrix.determinant() < 0.0) {\r\n if (sphere1._latitudeSweep !== undefined) {\r\n sphere1._latitudeSweep.reverseInPlace();\r\n }\r\n }\r\n return sphere1;\r\n }\r\n /** Return a coordinate frame (right handed, unit axes)\r\n * * origin at sphere center\r\n * * equator in xy plane\r\n * * z axis perpendicular\r\n */\r\n public getConstructiveFrame(): Transform | undefined {\r\n return this._localToWorld.cloneRigid();\r\n }\r\n /** Return the latitude sweep as fraction of south pole to north pole. */\r\n public get latitudeSweepFraction(): number { return this._latitudeSweep.sweepRadians / Math.PI; }\r\n /** Create from center and radius, with optional restricted latitudes. */\r\n public static createCenterRadius(center: Point3d, radius: number, latitudeSweep?: AngleSweep): Sphere {\r\n const localToWorld = Transform.createOriginAndMatrix(center, Matrix3d.createUniformScale(radius));\r\n return new Sphere(localToWorld, latitudeSweep ? latitudeSweep.clone() : AngleSweep.createFullLatitude(), false);\r\n }\r\n /** Create an ellipsoid which is a unit sphere mapped to position by an (arbitrary, possibly skewed and scaled) transform. */\r\n public static createEllipsoid(localToWorld: Transform, latitudeSweep: AngleSweep, capped: boolean): Sphere | undefined {\r\n return new Sphere(localToWorld.clone(), latitudeSweep.clone(), capped);\r\n }\r\n\r\n /** Create a sphere from the typical parameters of the Dgn file */\r\n public static createDgnSphere(center: Point3d, vectorX: Vector3d, vectorZ: Vector3d, radiusXY: number, radiusZ: number,\r\n latitudeSweep: AngleSweep,\r\n capped: boolean): Sphere | undefined {\r\n const vectorY = vectorX.rotate90Around(vectorZ);\r\n if (vectorY && !vectorX.isParallelTo(vectorZ)) {\r\n const matrix = Matrix3d.createColumns(vectorX, vectorY, vectorZ);\r\n matrix.scaleColumns(radiusXY, radiusXY, radiusZ, matrix);\r\n const frame = Transform.createOriginAndMatrix(center, matrix);\r\n return new Sphere(frame, latitudeSweep.clone(), capped);\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Create a sphere from the typical parameters of the Dgn file */\r\n public static createFromAxesAndScales(center: Point3d, axes: undefined | Matrix3d, radiusX: number, radiusY: number, radiusZ: number,\r\n latitudeSweep: AngleSweep | undefined,\r\n capped: boolean): Sphere | undefined {\r\n const localToWorld = Transform.createOriginAndMatrix(center, axes);\r\n localToWorld.matrix.scaleColumnsInPlace(radiusX, radiusY, radiusZ);\r\n return new Sphere(localToWorld, latitudeSweep ? latitudeSweep.clone() : AngleSweep.createFullLatitude(), capped);\r\n }\r\n\r\n /** return (copy of) sphere center */\r\n public cloneCenter(): Point3d { return this._localToWorld.getOrigin(); }\r\n /** return the (full length, i.e. scaled by radius) X vector from the sphere transform */\r\n public cloneVectorX(): Vector3d { return this._localToWorld.matrix.columnX(); }\r\n /** return the (full length, i.e. scaled by radius) Y vector from the sphere transform */\r\n public cloneVectorY(): Vector3d { return this._localToWorld.matrix.columnY(); }\r\n /** return the (full length, i.e. scaled by radius) Z vector from the sphere transform */\r\n public cloneVectorZ(): Vector3d { return this._localToWorld.matrix.columnZ(); }\r\n /** return (a copy of) the sphere's angle sweep. */\r\n public cloneLatitudeSweep(): AngleSweep { return this._latitudeSweep.clone(); }\r\n /** Test if the geometry is a true sphere taking the transform (which might have nonuniform scaling) is applied. */\r\n public trueSphereRadius(): number | undefined {\r\n const factors = this._localToWorld.matrix.factorRigidWithSignedScale();\r\n if (!factors) return undefined;\r\n if (factors && factors.scale > 0) // why do we rule out mirror?\r\n return factors.scale;\r\n return undefined;\r\n }\r\n /**\r\n * Return the largest of the primary xyz axis radii\r\n */\r\n public maxAxisRadius(): number {\r\n const matrix = this._localToWorld.matrix;\r\n return Geometry.maxXYZ(matrix.columnXMagnitude(), matrix.columnYMagnitude(), matrix.columnZMagnitude());\r\n }\r\n /**\r\n * Return a (clone of) the sphere's local to world transformation.\r\n */\r\n public cloneLocalToWorld(): Transform { return this._localToWorld.clone(); }\r\n /** Test if `other` is a `Sphere` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof Sphere; }\r\n /** Test for same geometry in `other` */\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof Sphere) {\r\n if (this.capped !== other.capped) return false;\r\n if (!this._localToWorld.isAlmostEqual(other._localToWorld)) return false;\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * return strokes for a cross-section (elliptic arc) at specified fraction v along the axis.\r\n * * if strokeOptions is supplied, it is applied to the equator radii.\r\n * @param v fractional position along the cone axis\r\n * @param strokes stroke count or options.\r\n */\r\n public strokeConstantVSection(v: number, fixedStrokeCount: number | undefined,\r\n options?: StrokeOptions): LineString3d {\r\n let strokeCount = 16;\r\n if (fixedStrokeCount !== undefined && Number.isFinite(fixedStrokeCount)) {\r\n strokeCount = fixedStrokeCount;\r\n } else if (options instanceof StrokeOptions) {\r\n strokeCount = options.applyTolerancesToArc(Geometry.maxXY(this._localToWorld.matrix.columnXMagnitude(), this._localToWorld.matrix.columnYMagnitude()));\r\n }\r\n strokeCount = Geometry.clampToStartEnd(strokeCount, 4, 64);\r\n const transform = this._localToWorld;\r\n const phi = this.vFractionToRadians(v);\r\n const c1 = Math.cos(phi);\r\n const s1 = Math.sin(phi);\r\n let c0, s0;\r\n const result = LineString3d.createForStrokes(fixedStrokeCount, options);\r\n const deltaRadians = Math.PI * 2.0 / strokeCount;\r\n const fractions = result.fractions; // possibly undefined !!!\r\n const derivatives = result.packedDerivatives; // possibly undefined !!!\r\n const uvParams = result.packedUVParams; // possibly undefined !!\r\n const surfaceNormals = result.packedSurfaceNormals;\r\n const dXdu = Vector3d.create();\r\n const dXdv = Vector3d.create();\r\n const normal = Vector3d.create();\r\n let radians = 0;\r\n for (let i = 0; i <= strokeCount; i++) {\r\n if (i * 2 <= strokeCount)\r\n radians = i * deltaRadians;\r\n else\r\n radians = (i - strokeCount) * deltaRadians;\r\n c0 = Math.cos(radians);\r\n s0 = Math.sin(radians);\r\n const xyz = transform.multiplyXYZ(c1 * c0, c1 * s0, s1);\r\n result.addPoint(xyz);\r\n\r\n if (fractions)\r\n fractions.push(i / strokeCount);\r\n\r\n if (derivatives) {\r\n transform.matrix.multiplyXYZ(-c1 * s0, c1 * c0, 0.0, dXdu);\r\n derivatives.push(dXdu);\r\n }\r\n if (uvParams) {\r\n uvParams.pushXY(i / strokeCount, v);\r\n }\r\n if (surfaceNormals) {\r\n transform.matrix.multiplyXYZ(-s0, c0, 0, dXdu);\r\n transform.matrix.multiplyXYZ(-s1 * c0, -s1 * s0, c1, dXdv);\r\n dXdu.unitCrossProduct(dXdv, normal);\r\n surfaceNormals.push(normal);\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n /** Second step of double dispatch: call `handler.handleSphere(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleSphere(this);\r\n }\r\n /**\r\n * Return the Arc3d section at vFraction. For the sphere, this is a latitude circle.\r\n * @param vFraction fractional position along the sweep direction\r\n */\r\n public constantVSection(vFraction: number): CurveCollection | undefined {\r\n const phi = this._latitudeSweep.fractionToRadians(vFraction);\r\n const s1 = Math.sin(phi);\r\n const c1 = Math.cos(phi);\r\n const transform = this._localToWorld;\r\n const center = transform.multiplyXYZ(0, 0, s1);\r\n const vector0 = transform.matrix.multiplyXYZ(c1, 0, 0);\r\n const vector90 = transform.matrix.multiplyXYZ(0, c1, 0);\r\n return Loop.create(Arc3d.create(center, vector0, vector90));\r\n }\r\n /** Extend a range to contain this sphere. */\r\n public extendRange(range: Range3d, transform?: Transform): void {\r\n let placement = this._localToWorld;\r\n if (transform) {\r\n placement = transform.multiplyTransformTransform(placement);\r\n }\r\n\r\n range.extendTransformedXYZ(placement, -1, -1, -1);\r\n range.extendTransformedXYZ(placement, 1, -1, -1);\r\n range.extendTransformedXYZ(placement, -1, 1, -1);\r\n range.extendTransformedXYZ(placement, 1, 1, -1);\r\n\r\n range.extendTransformedXYZ(placement, -1, -1, 1);\r\n range.extendTransformedXYZ(placement, 1, -1, 1);\r\n range.extendTransformedXYZ(placement, -1, 1, 1);\r\n range.extendTransformedXYZ(placement, 1, 1, 1);\r\n\r\n }\r\n /** Evaluate as a uv surface\r\n * @param uFraction fractional position on minor arc (theta, longitude)\r\n * @param vFraction fractional position on major arc (phi, latitude)\r\n */\r\n public uvFractionToPoint(uFraction: number, vFraction: number, result?: Point3d): Point3d {\r\n // sphere with radius 1 . . .\r\n const thetaRadians = this.uFractionToRadians(uFraction);\r\n const phiRadians = this.vFractionToRadians(vFraction);\r\n const cosTheta = Math.cos(thetaRadians);\r\n const sinTheta = Math.sin(thetaRadians);\r\n const sinPhi = Math.sin(phiRadians);\r\n const cosPhi = Math.cos(phiRadians);\r\n return this._localToWorld.multiplyXYZ(cosTheta * cosPhi, sinTheta * cosPhi, sinPhi, result);\r\n }\r\n /** Evaluate as a uv surface, returning point and two vectors.\r\n * @param uFraction fractional position on minor arc (theta, longitude)\r\n * @param vFraction fractional position on major arc (phi, latitude)\r\n */\r\n public uvFractionToPointAndTangents(uFraction: number, vFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors {\r\n const thetaRadians = this.uFractionToRadians(uFraction);\r\n const phiRadians = this.vFractionToRadians(vFraction);\r\n const fTheta = Math.PI * 2.0;\r\n const fPhi = this._latitudeSweep.sweepRadians;\r\n const cosTheta = Math.cos(thetaRadians);\r\n const sinTheta = Math.sin(thetaRadians);\r\n const sinPhi = Math.sin(phiRadians);\r\n const cosPhi = Math.cos(phiRadians);\r\n return Plane3dByOriginAndVectors.createOriginAndVectors(\r\n this._localToWorld.multiplyXYZ(cosTheta * cosPhi, sinTheta * cosPhi, sinPhi),\r\n this._localToWorld.matrix.multiplyXYZ(-fTheta * sinTheta, fTheta * cosTheta, 0), // !!! note cosTheta term is omitted -- scale is wrong, but remains non-zero at poles.\r\n this._localToWorld.matrix.multiplyXYZ(-fPhi * cosTheta * sinPhi, -fPhi * sinTheta * sinPhi, fPhi * cosPhi),\r\n result);\r\n }\r\n /**\r\n * * A sphere is can be closed two ways:\r\n * * full sphere (no caps needed for closure)\r\n * * incomplete but with caps\r\n * @return true if this is a closed volume.\r\n */\r\n public get isClosedVolume(): boolean {\r\n return this.capped || this._latitudeSweep.isFullLatitudeSweep;\r\n }\r\n /**\r\n * Directional distance query\r\n * * u direction is around latitude circle at maximum distance from axis.\r\n * * v direction is on a line of longitude between the latitude limits.\r\n */\r\n public maxIsoParametricDistance(): Vector2d {\r\n // approximate radius at equator .. if elliptic, this is not exact . . .\r\n const rX = this._localToWorld.matrix.columnXMagnitude();\r\n const rY = this._localToWorld.matrix.columnYMagnitude();\r\n const rZ = this._localToWorld.matrix.columnZMagnitude();\r\n const rMaxU = Math.max(rX, rY);\r\n let dMaxU = Math.PI * 2.0 * rMaxU;\r\n if (!this._latitudeSweep.isRadiansInSweep(0.0))\r\n dMaxU *= Math.max(Math.cos(Math.abs(this._latitudeSweep.startRadians)), Math.cos(Math.abs(this._latitudeSweep.endRadians)));\r\n const dMaxV = Math.max(rMaxU, rZ) * Math.abs(this._latitudeSweep.sweepRadians);\r\n\r\n return Vector2d.create(dMaxU, dMaxV);\r\n }\r\n}\r\n"]}
|