@itwin/core-geometry 4.7.0-dev.0 → 4.7.0-dev.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +7 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +20 -4
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts +2 -0
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +4 -0
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +3 -3
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +4 -3
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts +7 -0
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +19 -0
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/polyface/AuxData.d.ts +18 -10
- package/lib/cjs/polyface/AuxData.d.ts.map +1 -1
- package/lib/cjs/polyface/AuxData.js +24 -12
- package/lib/cjs/polyface/AuxData.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +2 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +2 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +10 -2
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +29 -17
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +10 -9
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +17 -2
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +321 -270
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +405 -351
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.d.ts +18 -20
- package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js +119 -84
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.d.ts +1 -1
- package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js +10 -15
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +52 -7
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +26 -78
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.d.ts +17 -0
- package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.js +85 -0
- package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
- package/lib/cjs/solid/Sphere.d.ts +1 -0
- package/lib/cjs/solid/Sphere.d.ts.map +1 -1
- package/lib/cjs/solid/Sphere.js +4 -2
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +7 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +20 -4
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.d.ts +2 -0
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +4 -0
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +3 -3
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +4 -3
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts +7 -0
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +19 -0
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/polyface/AuxData.d.ts +18 -10
- package/lib/esm/polyface/AuxData.d.ts.map +1 -1
- package/lib/esm/polyface/AuxData.js +24 -12
- package/lib/esm/polyface/AuxData.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +2 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js +2 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +10 -2
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +29 -17
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +10 -9
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +17 -2
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +321 -270
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +405 -351
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.d.ts +18 -20
- package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBReader.js +119 -84
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.d.ts +1 -1
- package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js +10 -15
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +52 -7
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +26 -78
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.d.ts +17 -0
- package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.js +85 -0
- package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
- package/lib/esm/solid/Sphere.d.ts +1 -0
- package/lib/esm/solid/Sphere.d.ts.map +1 -1
- package/lib/esm/solid/Sphere.js +4 -2
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/package.json +5 -5
|
@@ -8,6 +8,7 @@ exports.IModelJson = void 0;
|
|
|
8
8
|
/** @packageDocumentation
|
|
9
9
|
* @module Serialization
|
|
10
10
|
*/
|
|
11
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
11
12
|
const AkimaCurve3d_1 = require("../bspline/AkimaCurve3d");
|
|
12
13
|
const BSplineCurve_1 = require("../bspline/BSplineCurve");
|
|
13
14
|
const BSplineCurve3dH_1 = require("../bspline/BSplineCurve3dH");
|
|
@@ -343,24 +344,6 @@ var IModelJson;
|
|
|
343
344
|
}
|
|
344
345
|
return undefined;
|
|
345
346
|
}
|
|
346
|
-
// For each nonzero index, Announce Math.abs (value) -1
|
|
347
|
-
static addZeroBasedIndicesFromSignedOneBased(data, numPerFace, f) {
|
|
348
|
-
if (data && Geometry_1.Geometry.isNumberArray(data)) {
|
|
349
|
-
if (numPerFace > 1) {
|
|
350
|
-
// all indices are used ...
|
|
351
|
-
for (const value of data) {
|
|
352
|
-
f(Math.abs(value) - 1);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
// ignore separator zeros ...
|
|
357
|
-
for (const value of data) {
|
|
358
|
-
if (value !== 0)
|
|
359
|
-
f(Math.abs(value) - 1);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
347
|
/** parse polyface aux data content to PolyfaceAuxData instance */
|
|
365
348
|
static parsePolyfaceAuxData(data = undefined, numPerFace = 0) {
|
|
366
349
|
if (!Array.isArray(data.channels) || !Array.isArray(data.indices))
|
|
@@ -377,7 +360,7 @@ var IModelJson;
|
|
|
377
360
|
}
|
|
378
361
|
}
|
|
379
362
|
const auxData = new AuxData_1.PolyfaceAuxData(outChannels, []);
|
|
380
|
-
|
|
363
|
+
SerializationHelpers_1.SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(data.indices, numPerFace, (x) => { auxData.indices.push(x); });
|
|
381
364
|
return auxData;
|
|
382
365
|
}
|
|
383
366
|
/** parse indexed mesh content to an IndexedPolyface instance */
|
|
@@ -387,74 +370,49 @@ var IModelJson;
|
|
|
387
370
|
if (data.hasOwnProperty("point") && Array.isArray(data.point)
|
|
388
371
|
&& data.hasOwnProperty("pointIndex") && Array.isArray(data.pointIndex)) {
|
|
389
372
|
const polyface = Polyface_1.IndexedPolyface.create();
|
|
390
|
-
|
|
391
|
-
// for normals, addNormal() is overeager to detect the (common) case of duplicate normals in sequence.
|
|
392
|
-
// use addNormalXYZ which always creates a new one.
|
|
393
|
-
// likewise for params
|
|
394
|
-
for (const uvw of data.normal) {
|
|
395
|
-
if (Geometry_1.Geometry.isNumberArray(uvw, 3))
|
|
396
|
-
polyface.addNormalXYZ(uvw[0], uvw[1], uvw[2]);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
373
|
+
const numPerFace = data.hasOwnProperty("numPerFace") ? data.numPerFace : 0;
|
|
399
374
|
if (data.hasOwnProperty("twoSided")) {
|
|
400
375
|
const q = data.twoSided;
|
|
401
376
|
if (q === true || q === false) {
|
|
402
377
|
polyface.twoSided = q;
|
|
403
378
|
}
|
|
404
379
|
}
|
|
405
|
-
const numPerFace = data.hasOwnProperty("numPerFace") ? data.numPerFace : 0;
|
|
406
380
|
if (data.hasOwnProperty("expectedClosure")) {
|
|
407
381
|
const q = data.expectedClosure;
|
|
408
382
|
if (Number.isFinite(q)) {
|
|
409
383
|
polyface.expectedClosure = q;
|
|
410
384
|
}
|
|
411
385
|
}
|
|
412
|
-
if (data.hasOwnProperty("
|
|
386
|
+
if (data.hasOwnProperty("normal") && Array.isArray(data.normal) && data.hasOwnProperty("normalIndex")) {
|
|
387
|
+
// For normals, addNormal() is overeager to detect the (common) case of duplicate normals in sequence.
|
|
388
|
+
// Use addNormalXYZ which always creates a new one. Likewise for params.
|
|
389
|
+
for (const uvw of data.normal) {
|
|
390
|
+
if (Geometry_1.Geometry.isNumberArray(uvw, 3))
|
|
391
|
+
polyface.addNormalXYZ(uvw[0], uvw[1], uvw[2]);
|
|
392
|
+
}
|
|
393
|
+
SerializationHelpers_1.SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(data.normalIndex, numPerFace, (x) => { polyface.addNormalIndex(x); });
|
|
394
|
+
}
|
|
395
|
+
if (data.hasOwnProperty("param") && Array.isArray(data.param) && data.hasOwnProperty("paramIndex")) {
|
|
413
396
|
for (const uv of data.param) {
|
|
414
397
|
if (Geometry_1.Geometry.isNumberArray(uv, 2))
|
|
415
398
|
polyface.addParamUV(uv[0], uv[1]);
|
|
416
399
|
}
|
|
400
|
+
SerializationHelpers_1.SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(data.paramIndex, numPerFace, (x) => { polyface.addParamIndex(x); });
|
|
417
401
|
}
|
|
418
|
-
if (data.hasOwnProperty("color") && Array.isArray(data.color)) {
|
|
419
|
-
for (const c of data.color)
|
|
402
|
+
if (data.hasOwnProperty("color") && Array.isArray(data.color) && data.hasOwnProperty("colorIndex")) {
|
|
403
|
+
for (const c of data.color)
|
|
420
404
|
polyface.addColor(c);
|
|
421
|
-
}
|
|
405
|
+
SerializationHelpers_1.SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(data.colorIndex, numPerFace, (x) => { polyface.addColorIndex(x); });
|
|
422
406
|
}
|
|
423
407
|
for (const p of data.point)
|
|
424
408
|
polyface.addPointXYZ(p[0], p[1], p[2]);
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
const p0 = Math.abs(p) - 1;
|
|
429
|
-
polyface.addPointIndex(p0, p > 0);
|
|
430
|
-
if ((i + 1) % numPerFace === 0)
|
|
431
|
-
polyface.terminateFacet(false);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
else {
|
|
435
|
-
for (const p of data.pointIndex) {
|
|
436
|
-
if (p === 0)
|
|
437
|
-
polyface.terminateFacet(false); // we are responsible for index checking !!!
|
|
438
|
-
else {
|
|
439
|
-
const p0 = Math.abs(p) - 1;
|
|
440
|
-
polyface.addPointIndex(p0, p > 0);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
if (data.hasOwnProperty("normalIndex")) {
|
|
445
|
-
Reader.addZeroBasedIndicesFromSignedOneBased(data.normalIndex, numPerFace, (x) => { polyface.addNormalIndex(x); });
|
|
446
|
-
}
|
|
447
|
-
if (data.hasOwnProperty("paramIndex")) {
|
|
448
|
-
Reader.addZeroBasedIndicesFromSignedOneBased(data.paramIndex, numPerFace, (x) => { polyface.addParamIndex(x); });
|
|
449
|
-
}
|
|
450
|
-
if (data.hasOwnProperty("colorIndex")) {
|
|
451
|
-
Reader.addZeroBasedIndicesFromSignedOneBased(data.colorIndex, numPerFace, (x) => { polyface.addColorIndex(x); });
|
|
452
|
-
}
|
|
409
|
+
SerializationHelpers_1.SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(data.pointIndex, numPerFace, (i, v) => { polyface.addPointIndex(i, v); }, () => { polyface.terminateFacet(false); });
|
|
410
|
+
if (!polyface.validateAllIndices())
|
|
411
|
+
return undefined;
|
|
453
412
|
if (data.hasOwnProperty("auxData"))
|
|
454
413
|
polyface.data.auxData = Reader.parsePolyfaceAuxData(data.auxData, numPerFace);
|
|
455
|
-
if (data.hasOwnProperty("tags"))
|
|
414
|
+
if (data.hasOwnProperty("tags"))
|
|
456
415
|
polyface.data.taggedNumericData = Reader.parseTaggedNumericProps(data.tags);
|
|
457
|
-
}
|
|
458
416
|
return polyface;
|
|
459
417
|
}
|
|
460
418
|
return undefined;
|
|
@@ -1110,28 +1068,18 @@ var IModelJson;
|
|
|
1110
1068
|
return out;
|
|
1111
1069
|
}
|
|
1112
1070
|
handlePolyfaceAuxData(auxData, pf) {
|
|
1113
|
-
|
|
1114
|
-
contents
|
|
1071
|
+
(0, core_bentley_1.assert)(auxData === pf.data.auxData);
|
|
1072
|
+
const contents = { indices: [], channels: [] };
|
|
1115
1073
|
const visitor = pf.createVisitor(0);
|
|
1116
|
-
if (!visitor.auxData)
|
|
1117
|
-
return;
|
|
1118
1074
|
while (visitor.moveToNextFacet()) {
|
|
1119
|
-
for (let i = 0; i < visitor.indexCount; i++)
|
|
1075
|
+
for (let i = 0; i < visitor.indexCount; i++)
|
|
1120
1076
|
contents.indices.push(visitor.auxData.indices[i] + 1);
|
|
1121
|
-
}
|
|
1122
1077
|
contents.indices.push(0); // facet terminator.
|
|
1123
1078
|
}
|
|
1124
|
-
contents.channels = [];
|
|
1125
1079
|
for (const inChannel of auxData.channels) {
|
|
1126
|
-
const outChannel = {};
|
|
1127
|
-
outChannel.dataType = inChannel.dataType;
|
|
1128
|
-
outChannel.name = inChannel.name;
|
|
1129
|
-
outChannel.inputName = inChannel.inputName;
|
|
1130
|
-
outChannel.data = [];
|
|
1080
|
+
const outChannel = { data: [], dataType: inChannel.dataType, name: inChannel.name, inputName: inChannel.inputName };
|
|
1131
1081
|
for (const inData of inChannel.data) {
|
|
1132
|
-
const outData = {};
|
|
1133
|
-
outData.input = inData.input;
|
|
1134
|
-
outData.values = inData.values.slice(0);
|
|
1082
|
+
const outData = { input: inData.input, values: inData.values.slice(0) };
|
|
1135
1083
|
outChannel.data.push(outData);
|
|
1136
1084
|
}
|
|
1137
1085
|
contents.channels.push(outChannel);
|