@itwin/ecschema-rpcinterface-tests 3.2.0-dev.44 → 3.2.0-dev.45
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/dist/bundled-tests.js +550 -231
- package/lib/dist/bundled-tests.js.map +1 -1
- package/package.json +15 -15
|
@@ -135376,26 +135376,65 @@ class Target extends _RenderTarget__WEBPACK_IMPORTED_MODULE_8__["RenderTarget"]
|
|
|
135376
135376
|
// We can't reuse the previous frame's data for a variety of reasons, chief among them that some types of geometry (surfaces, translucent stuff) don't write
|
|
135377
135377
|
// to the pick buffers and others we don't want - such as non-pickable decorations - do.
|
|
135378
135378
|
// Render to an offscreen buffer so that we don't destroy the current color buffer.
|
|
135379
|
-
const
|
|
135380
|
-
if (
|
|
135379
|
+
const resources = this.createOrReuseReadPixelResources(rect);
|
|
135380
|
+
if (resources === undefined) {
|
|
135381
135381
|
receiver(undefined);
|
|
135382
135382
|
return;
|
|
135383
135383
|
}
|
|
135384
135384
|
let result;
|
|
135385
|
-
|
|
135386
|
-
|
|
135387
|
-
this.
|
|
135388
|
-
|
|
135389
|
-
|
|
135390
|
-
|
|
135391
|
-
});
|
|
135392
|
-
Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["dispose"])(fbo);
|
|
135393
|
-
}
|
|
135394
|
-
Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["dispose"])(texture);
|
|
135385
|
+
this.renderSystem.frameBufferStack.execute(resources.fbo, true, false, () => {
|
|
135386
|
+
this._drawNonLocatable = !excludeNonLocatable;
|
|
135387
|
+
result = this.readPixelsFromFbo(rect, selector);
|
|
135388
|
+
this._drawNonLocatable = true;
|
|
135389
|
+
});
|
|
135390
|
+
this.disposeOrReuseReadPixelResources(resources);
|
|
135395
135391
|
receiver(result);
|
|
135396
135392
|
// Reset the batch IDs in all batches drawn for this call.
|
|
135397
135393
|
this.uniforms.batch.resetBatchState();
|
|
135398
135394
|
}
|
|
135395
|
+
createOrReuseReadPixelResources(rect) {
|
|
135396
|
+
if (this._readPixelReusableResources !== undefined) {
|
|
135397
|
+
// To reuse a texture, we need it to be the same size or bigger than what we need
|
|
135398
|
+
if (this._readPixelReusableResources.texture.width >= rect.width && this._readPixelReusableResources.texture.height >= rect.height) {
|
|
135399
|
+
const resources = this._readPixelReusableResources;
|
|
135400
|
+
this._readPixelReusableResources = undefined;
|
|
135401
|
+
return resources;
|
|
135402
|
+
}
|
|
135403
|
+
}
|
|
135404
|
+
// Create a new texture/fbo
|
|
135405
|
+
const texture = _Texture__WEBPACK_IMPORTED_MODULE_26__["TextureHandle"].createForAttachment(rect.width, rect.height, _GL__WEBPACK_IMPORTED_MODULE_14__["GL"].Texture.Format.Rgba, _GL__WEBPACK_IMPORTED_MODULE_14__["GL"].Texture.DataType.UnsignedByte);
|
|
135406
|
+
if (texture === undefined)
|
|
135407
|
+
return undefined;
|
|
135408
|
+
const fbo = _FrameBuffer__WEBPACK_IMPORTED_MODULE_13__["FrameBuffer"].create([texture]);
|
|
135409
|
+
if (fbo === undefined) {
|
|
135410
|
+
Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["dispose"])(texture);
|
|
135411
|
+
return undefined;
|
|
135412
|
+
}
|
|
135413
|
+
return { texture, fbo };
|
|
135414
|
+
}
|
|
135415
|
+
disposeOrReuseReadPixelResources({ texture, fbo }) {
|
|
135416
|
+
const maxReusableTextureSize = 256;
|
|
135417
|
+
const isTooBigToReuse = texture.width > maxReusableTextureSize || texture.height > maxReusableTextureSize;
|
|
135418
|
+
let reuseResources = !isTooBigToReuse;
|
|
135419
|
+
if (reuseResources && this._readPixelReusableResources !== undefined) {
|
|
135420
|
+
// Keep the biggest texture
|
|
135421
|
+
if (this._readPixelReusableResources.texture.width > texture.width && this._readPixelReusableResources.texture.height > texture.height) {
|
|
135422
|
+
reuseResources = false; // The current resources being reused are better
|
|
135423
|
+
}
|
|
135424
|
+
else {
|
|
135425
|
+
// Free memory of the current reusable resources before replacing them
|
|
135426
|
+
Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["dispose"])(this._readPixelReusableResources.fbo);
|
|
135427
|
+
Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["dispose"])(this._readPixelReusableResources.texture);
|
|
135428
|
+
}
|
|
135429
|
+
}
|
|
135430
|
+
if (reuseResources) {
|
|
135431
|
+
this._readPixelReusableResources = { texture, fbo };
|
|
135432
|
+
}
|
|
135433
|
+
else {
|
|
135434
|
+
Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["dispose"])(fbo);
|
|
135435
|
+
Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["dispose"])(texture);
|
|
135436
|
+
}
|
|
135437
|
+
}
|
|
135399
135438
|
beginReadPixels(selector, cullingFrustum) {
|
|
135400
135439
|
this.beginPerfMetricRecord("Init Commands", true);
|
|
135401
135440
|
this._isReadPixelsInProgress = true;
|
|
@@ -172521,9 +172560,14 @@ class ToolAdmin {
|
|
|
172521
172560
|
clearMotionPromises() {
|
|
172522
172561
|
this._snapMotionPromise = this._toolMotionPromise = undefined;
|
|
172523
172562
|
}
|
|
172563
|
+
async forceOnMotionSnap(ev) {
|
|
172564
|
+
// Make sure that we fire the motion snap event correctly
|
|
172565
|
+
this._lastHandledMotionTime = undefined;
|
|
172566
|
+
return this.onMotionSnap(ev);
|
|
172567
|
+
}
|
|
172524
172568
|
async onMotionSnap(ev) {
|
|
172525
172569
|
try {
|
|
172526
|
-
await
|
|
172570
|
+
await this.onMotionSnapOrSkip(ev);
|
|
172527
172571
|
return true;
|
|
172528
172572
|
}
|
|
172529
172573
|
catch (error) {
|
|
@@ -172532,6 +172576,22 @@ class ToolAdmin {
|
|
|
172532
172576
|
throw error; // unknown error
|
|
172533
172577
|
}
|
|
172534
172578
|
}
|
|
172579
|
+
// Call accuSnap.onMotion
|
|
172580
|
+
async onMotionSnapOrSkip(ev) {
|
|
172581
|
+
if (this.shouldSkipOnMotionSnap())
|
|
172582
|
+
return;
|
|
172583
|
+
await _IModelApp__WEBPACK_IMPORTED_MODULE_5__["IModelApp"].accuSnap.onMotion(ev);
|
|
172584
|
+
this._lastHandledMotionTime = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["BeTimePoint"].now();
|
|
172585
|
+
}
|
|
172586
|
+
// Should the current onMotionSnap event be skipped to avoid unnecessary ReadPixel calls?
|
|
172587
|
+
shouldSkipOnMotionSnap() {
|
|
172588
|
+
if (this._lastHandledMotionTime === undefined)
|
|
172589
|
+
return false;
|
|
172590
|
+
const now = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["BeTimePoint"].now();
|
|
172591
|
+
const msSinceLastCall = now.milliseconds - this._lastHandledMotionTime.milliseconds;
|
|
172592
|
+
const delay = 1000 / _ToolSettings__WEBPACK_IMPORTED_MODULE_14__["ToolSettings"].maxOnMotionSnapCallPerSecond;
|
|
172593
|
+
return msSinceLastCall < delay;
|
|
172594
|
+
}
|
|
172535
172595
|
async onStartDrag(ev, tool) {
|
|
172536
172596
|
if (undefined !== tool && _Tool__WEBPACK_IMPORTED_MODULE_13__["EventHandled"].Yes === await tool.onMouseStartDrag(ev))
|
|
172537
172597
|
return _Tool__WEBPACK_IMPORTED_MODULE_13__["EventHandled"].Yes;
|
|
@@ -172545,6 +172605,10 @@ class ToolAdmin {
|
|
|
172545
172605
|
this.setIncompatibleViewportCursor(false);
|
|
172546
172606
|
return;
|
|
172547
172607
|
}
|
|
172608
|
+
// Detect when the motion stops by setting a timeout
|
|
172609
|
+
if (this._mouseMoveOverTimeout !== undefined)
|
|
172610
|
+
clearTimeout(this._mouseMoveOverTimeout); // If a previous timeout was up, it is cancelled: the movement is not over yet
|
|
172611
|
+
this._mouseMoveOverTimeout = setTimeout(async () => { await this.onMotionEnd(vp, pt2d, inputSource); }, 100);
|
|
172548
172612
|
const ev = new _Tool__WEBPACK_IMPORTED_MODULE_13__["BeButtonEvent"]();
|
|
172549
172613
|
current.fromPoint(vp, pt2d, inputSource);
|
|
172550
172614
|
current.toEvent(ev, false);
|
|
@@ -172590,6 +172654,14 @@ class ToolAdmin {
|
|
|
172590
172654
|
return processMotion();
|
|
172591
172655
|
}).catch((_) => { });
|
|
172592
172656
|
}
|
|
172657
|
+
// Called when we detect that the motion stopped
|
|
172658
|
+
async onMotionEnd(vp, pos, inputSource) {
|
|
172659
|
+
const current = this.currentInputState;
|
|
172660
|
+
const ev = new _Tool__WEBPACK_IMPORTED_MODULE_13__["BeButtonEvent"]();
|
|
172661
|
+
current.fromPoint(vp, pos, inputSource);
|
|
172662
|
+
current.toEvent(ev, false);
|
|
172663
|
+
await this.forceOnMotionSnap(ev);
|
|
172664
|
+
}
|
|
172593
172665
|
async onMouseMove(event) {
|
|
172594
172666
|
const vp = event.vp;
|
|
172595
172667
|
const pos = this.getMousePosition(event);
|
|
@@ -173657,6 +173729,8 @@ ToolSettings.viewingInertia = {
|
|
|
173657
173729
|
/** Maximum duration of the inertia operation. Important when frame rates are low. */
|
|
173658
173730
|
duration: _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["BeDuration"].fromMilliseconds(500),
|
|
173659
173731
|
};
|
|
173732
|
+
/** Maximum number of times in a second the accuSnap tool's onMotion function is called. */
|
|
173733
|
+
ToolSettings.maxOnMotionSnapCallPerSecond = 15;
|
|
173660
173734
|
|
|
173661
173735
|
|
|
173662
173736
|
/***/ }),
|
|
@@ -177511,7 +177585,7 @@ SetupWalkCameraTool.iconSpec = "icon-camera-location";
|
|
|
177511
177585
|
/*! exports provided: name, version, description, main, module, typings, license, scripts, repository, keywords, author, peerDependencies, //devDependencies, devDependencies, //dependencies, dependencies, nyc, eslintConfig, default */
|
|
177512
177586
|
/***/ (function(module) {
|
|
177513
177587
|
|
|
177514
|
-
module.exports = JSON.parse("{\"name\":\"@itwin/core-frontend\",\"version\":\"3.2.0-dev.
|
|
177588
|
+
module.exports = JSON.parse("{\"name\":\"@itwin/core-frontend\",\"version\":\"3.2.0-dev.45\",\"description\":\"iTwin.js frontend components\",\"main\":\"lib/cjs/core-frontend.js\",\"module\":\"lib/esm/core-frontend.js\",\"typings\":\"lib/cjs/core-frontend\",\"license\":\"MIT\",\"scripts\":{\"build\":\"npm run -s copy:public && npm run -s build:cjs\",\"build:ci\":\"npm run -s build && npm run -s build:esm\",\"build:cjs\":\"tsc 1>&2 --outDir lib/cjs\",\"build:esm\":\"tsc 1>&2 --module ES2020 --outDir lib/esm\",\"clean\":\"rimraf lib .rush/temp/package-deps*.json\",\"copy:public\":\"cpx \\\"./src/public/**/*\\\" ./lib/public\",\"docs\":\"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/primitives,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts\",\"extract-api\":\"betools extract-api --entry=core-frontend && npm run extract-extension-api\",\"extract-extension-api\":\"eslint --no-eslintrc -c \\\"../../tools/eslint-plugin/dist/configs/extension-exports-config.js\\\" \\\"./src/**/*.ts\\\" 1>&2\",\"lint\":\"eslint -f visualstudio \\\"./src/**/*.ts\\\" 1>&2\",\"pseudolocalize\":\"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO\",\"test\":\"npm run -s webpackTests && certa -r chrome\",\"cover\":\"npm -s test\",\"test:debug\":\"certa -r chrome --debug\",\"webpackTests\":\"webpack --config ./src/test/utils/webpack.config.js 1>&2\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/iTwin/itwinjs-core/tree/master/core/frontend\"},\"keywords\":[\"Bentley\",\"BIM\",\"iModel\",\"digital-twin\",\"iTwin\"],\"author\":{\"name\":\"Bentley Systems, Inc.\",\"url\":\"http://www.bentley.com\"},\"peerDependencies\":{\"@itwin/appui-abstract\":\"workspace:^3.2.0-dev.45\",\"@itwin/core-bentley\":\"workspace:^3.2.0-dev.45\",\"@itwin/core-common\":\"workspace:^3.2.0-dev.45\",\"@itwin/core-geometry\":\"workspace:^3.2.0-dev.45\",\"@itwin/core-orbitgt\":\"workspace:^3.2.0-dev.45\",\"@itwin/core-quantity\":\"workspace:^3.2.0-dev.45\",\"@itwin/webgl-compatibility\":\"workspace:^3.2.0-dev.45\"},\"//devDependencies\":[\"NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install\",\"NOTE: All tools used by scripts in this package must be listed as devDependencies\"],\"devDependencies\":{\"@itwin/appui-abstract\":\"workspace:*\",\"@itwin/build-tools\":\"workspace:*\",\"@itwin/core-bentley\":\"workspace:*\",\"@itwin/core-common\":\"workspace:*\",\"@itwin/core-geometry\":\"workspace:*\",\"@itwin/core-orbitgt\":\"workspace:*\",\"@itwin/core-quantity\":\"workspace:*\",\"@itwin/certa\":\"workspace:*\",\"@itwin/eslint-plugin\":\"workspace:*\",\"@itwin/webgl-compatibility\":\"workspace:*\",\"@types/chai\":\"^4.1.4\",\"@types/chai-as-promised\":\"^7\",\"@types/deep-assign\":\"^0.1.0\",\"@types/lodash\":\"^4.14.0\",\"@types/mocha\":\"^8.2.2\",\"@types/node\":\"14.14.31\",\"@types/qs\":\"^6.5.0\",\"@types/semver\":\"^5.5.0\",\"@types/superagent\":\"^4.1.14\",\"@types/sinon\":\"^9.0.0\",\"chai\":\"^4.1.2\",\"chai-as-promised\":\"^7\",\"cpx2\":\"^3.0.0\",\"eslint\":\"^7.11.0\",\"glob\":\"^7.1.2\",\"mocha\":\"^8.3.2\",\"nyc\":\"^15.1.0\",\"rimraf\":\"^3.0.2\",\"sinon\":\"^9.0.2\",\"source-map-loader\":\"^1.0.0\",\"typescript\":\"~4.4.0\",\"webpack\":\"4.42.0\"},\"//dependencies\":[\"NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API\",\"NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed\"],\"dependencies\":{\"@itwin/core-i18n\":\"workspace:*\",\"@itwin/core-telemetry\":\"workspace:*\",\"@loaders.gl/core\":\"^3.1.6\",\"@loaders.gl/draco\":\"^3.1.6\",\"deep-assign\":\"^2.0.0\",\"fuse.js\":\"^3.3.0\",\"lodash\":\"^4.17.10\",\"qs\":\"^6.5.1\",\"semver\":\"^5.5.0\",\"superagent\":\"^7.0.1\",\"wms-capabilities\":\"0.4.0\",\"xml-js\":\"~1.6.11\"},\"nyc\":{\"extends\":\"./node_modules/@itwin/build-tools/.nycrc\"},\"eslintConfig\":{\"plugins\":[\"@itwin\"],\"extends\":\"plugin:@itwin/itwinjs-recommended\",\"rules\":{\"@itwin/no-internal-barrel-imports\":[\"error\",{\"required-barrel-modules\":[\"./src/tile/internal.ts\"]}],\"@itwin/public-extension-exports\":[\"error\",{\"releaseTags\":[\"public\",\"preview\"],\"outputApiFile\":false}]},\"overrides\":[{\"files\":[\"*.test.ts\",\"*.test.tsx\",\"**/test/**/*.ts\",\"**/test/**/*.tsx\"],\"rules\":{\"@itwin/no-internal-barrel-imports\":\"off\"}}]}}");
|
|
177515
177589
|
|
|
177516
177590
|
/***/ }),
|
|
177517
177591
|
|
|
@@ -226186,13 +226260,14 @@ class ClusterableArray extends _geometry3d_GrowableBlockedArray__WEBPACK_IMPORTE
|
|
|
226186
226260
|
for (let i = 0; i < n; i++)
|
|
226187
226261
|
this._data[i0 + i] = data[i];
|
|
226188
226262
|
}
|
|
226189
|
-
/** add a block with
|
|
226263
|
+
/** add a block directly with 1 to 5 listed content parameters.
|
|
226190
226264
|
* This assumes numDataPerPoint is sufficient for the parameters provided.
|
|
226191
226265
|
*/
|
|
226192
226266
|
addDirect(x0, x1, x2, x3, x4) {
|
|
226193
226267
|
const i0 = this.newBlockIndex();
|
|
226194
226268
|
this._data[i0 + 1] = x0;
|
|
226195
|
-
|
|
226269
|
+
if (x1 !== undefined)
|
|
226270
|
+
this._data[i0 + 2] = x1;
|
|
226196
226271
|
if (x2 !== undefined)
|
|
226197
226272
|
this._data[i0 + 3] = x2;
|
|
226198
226273
|
if (x3 !== undefined)
|
|
@@ -226477,6 +226552,31 @@ class ClusterableArray extends _geometry3d_GrowableBlockedArray__WEBPACK_IMPORTE
|
|
|
226477
226552
|
});
|
|
226478
226553
|
return result;
|
|
226479
226554
|
}
|
|
226555
|
+
/**
|
|
226556
|
+
* Returns number array with indices mapping old to new.
|
|
226557
|
+
* @param data numbers to cluster.
|
|
226558
|
+
*/
|
|
226559
|
+
static clusterNumberArray(data, tolerance = _Geometry__WEBPACK_IMPORTED_MODULE_0__["Geometry"].smallMetricDistance) {
|
|
226560
|
+
const clusterArray = new ClusterableArray(1, 0, data.length);
|
|
226561
|
+
data.forEach((x) => { clusterArray.addDirect(x); });
|
|
226562
|
+
const order = clusterArray.clusterIndicesLexical(tolerance);
|
|
226563
|
+
const result = new PackedNumbersWithIndex(data.length);
|
|
226564
|
+
let currentClusterIndex = 0;
|
|
226565
|
+
let numThisCluster = 0;
|
|
226566
|
+
order.forEach((k) => {
|
|
226567
|
+
if (ClusterableArray.isClusterTerminator(k)) {
|
|
226568
|
+
currentClusterIndex++;
|
|
226569
|
+
numThisCluster = 0;
|
|
226570
|
+
}
|
|
226571
|
+
else {
|
|
226572
|
+
if (numThisCluster === 0)
|
|
226573
|
+
result.packedNumbers.push(data[k]);
|
|
226574
|
+
result.oldToNew[k] = currentClusterIndex;
|
|
226575
|
+
numThisCluster++;
|
|
226576
|
+
}
|
|
226577
|
+
});
|
|
226578
|
+
return result;
|
|
226579
|
+
}
|
|
226480
226580
|
/**
|
|
226481
226581
|
* Returns packed points with indices mapping old to new.
|
|
226482
226582
|
* @param data points to cluster.
|
|
@@ -226617,6 +226717,32 @@ class PackedPoint2dsWithIndex {
|
|
|
226617
226717
|
}
|
|
226618
226718
|
/** integer value for unknown index. */
|
|
226619
226719
|
PackedPoint2dsWithIndex.invalidIndex = 0xFFFFffff;
|
|
226720
|
+
/**
|
|
226721
|
+
* @internal
|
|
226722
|
+
*/
|
|
226723
|
+
class PackedNumbersWithIndex {
|
|
226724
|
+
/** construct a PackedNumbers object with
|
|
226725
|
+
* * empty packedNumbers array
|
|
226726
|
+
* * oldToNew indices all initialized to PackedNumbers.invalidIndex
|
|
226727
|
+
*/
|
|
226728
|
+
constructor(numOldIndexEntry) {
|
|
226729
|
+
this.packedNumbers = [];
|
|
226730
|
+
this.oldToNew = new Uint32Array(numOldIndexEntry);
|
|
226731
|
+
for (let i = 0; i < numOldIndexEntry; i++) {
|
|
226732
|
+
this.oldToNew[i] = PackedPointsWithIndex.invalidIndex;
|
|
226733
|
+
}
|
|
226734
|
+
}
|
|
226735
|
+
/**
|
|
226736
|
+
* Use the oldToNew array to update an array of "old" indices.
|
|
226737
|
+
* @param indices array of indices into prepacked array.
|
|
226738
|
+
* @returns true if all input indices were valid for the oldToNew array.
|
|
226739
|
+
*/
|
|
226740
|
+
updateIndices(indices) {
|
|
226741
|
+
return updateIndices(indices, this.oldToNew);
|
|
226742
|
+
}
|
|
226743
|
+
}
|
|
226744
|
+
/** integer value for unknown index. */
|
|
226745
|
+
PackedNumbersWithIndex.invalidIndex = 0xFFFFffff;
|
|
226620
226746
|
|
|
226621
226747
|
|
|
226622
226748
|
/***/ }),
|
|
@@ -231341,9 +231467,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
231341
231467
|
/** @packageDocumentation
|
|
231342
231468
|
* @module Polyface
|
|
231343
231469
|
*/
|
|
231344
|
-
// For boundary sorting, an edge exists as a (packed!) Float64Array.
|
|
231345
|
-
// Fixed entries are:
|
|
231346
|
-
// 0:
|
|
231347
231470
|
/**
|
|
231348
231471
|
* * For boundary sorting, an edge is a (packed!) Float64Array.
|
|
231349
231472
|
* * Fixed entry positions are:
|
|
@@ -231746,7 +231869,7 @@ class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
|
|
|
231746
231869
|
* * The activeFacetIndices array indicates all facets to be visited.
|
|
231747
231870
|
*/
|
|
231748
231871
|
static createSubsetVisitor(polyface, activeFacetIndices, numWrap) {
|
|
231749
|
-
return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices
|
|
231872
|
+
return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices, numWrap);
|
|
231750
231873
|
}
|
|
231751
231874
|
/** Advance the iterator to a particular facet in the client polyface */
|
|
231752
231875
|
moveToReadIndex(activeIndex) {
|
|
@@ -231796,14 +231919,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
231796
231919
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IndexedPolyface", function() { return IndexedPolyface; });
|
|
231797
231920
|
/* harmony import */ var _curve_GeometryQuery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../curve/GeometryQuery */ "../../core/geometry/lib/esm/curve/GeometryQuery.js");
|
|
231798
231921
|
/* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
|
|
231799
|
-
/* harmony import */ var
|
|
231800
|
-
/* harmony import */ var
|
|
231801
|
-
/* harmony import */ var
|
|
231802
|
-
/* harmony import */ var
|
|
231803
|
-
/* harmony import */ var
|
|
231804
|
-
/* harmony import */ var
|
|
231805
|
-
/* harmony import */ var
|
|
231806
|
-
/* harmony import */ var _PolyfaceData__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./PolyfaceData */ "../../core/geometry/lib/esm/polyface/PolyfaceData.js");
|
|
231922
|
+
/* harmony import */ var _geometry3d_GrowableXYArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../geometry3d/GrowableXYArray */ "../../core/geometry/lib/esm/geometry3d/GrowableXYArray.js");
|
|
231923
|
+
/* harmony import */ var _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geometry3d/GrowableXYZArray */ "../../core/geometry/lib/esm/geometry3d/GrowableXYZArray.js");
|
|
231924
|
+
/* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
|
|
231925
|
+
/* harmony import */ var _geometry3d_PointHelpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geometry3d/PointHelpers */ "../../core/geometry/lib/esm/geometry3d/PointHelpers.js");
|
|
231926
|
+
/* harmony import */ var _FacetFaceData__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./FacetFaceData */ "../../core/geometry/lib/esm/polyface/FacetFaceData.js");
|
|
231927
|
+
/* harmony import */ var _IndexedPolyfaceVisitor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./IndexedPolyfaceVisitor */ "../../core/geometry/lib/esm/polyface/IndexedPolyfaceVisitor.js");
|
|
231928
|
+
/* harmony import */ var _PolyfaceData__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./PolyfaceData */ "../../core/geometry/lib/esm/polyface/PolyfaceData.js");
|
|
231807
231929
|
/*---------------------------------------------------------------------------------------------
|
|
231808
231930
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
231809
231931
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -231811,7 +231933,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
231811
231933
|
/** @packageDocumentation
|
|
231812
231934
|
* @module Polyface
|
|
231813
231935
|
*/
|
|
231814
|
-
// import { Point2d } from "./Geometry2d";
|
|
231815
231936
|
/* eslint-disable @typescript-eslint/naming-convention, no-empty */
|
|
231816
231937
|
|
|
231817
231938
|
|
|
@@ -231822,12 +231943,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
231822
231943
|
|
|
231823
231944
|
|
|
231824
231945
|
|
|
231825
|
-
|
|
231826
|
-
function allDefined(valueA, valueB, valueC) {
|
|
231827
|
-
return valueA !== undefined && valueB !== undefined && valueC !== undefined;
|
|
231828
|
-
}
|
|
231829
231946
|
/**
|
|
231830
|
-
* A Polyface is
|
|
231947
|
+
* A Polyface is an abstract mesh structure (of unspecified implementation) that provides a PolyfaceVisitor
|
|
231831
231948
|
* to iterate over its facets.
|
|
231832
231949
|
* @public
|
|
231833
231950
|
*/
|
|
@@ -231898,8 +232015,8 @@ class IndexedPolyface extends Polyface {
|
|
|
231898
232015
|
/** Tests for equivalence between two IndexedPolyfaces. */
|
|
231899
232016
|
isAlmostEqual(other) {
|
|
231900
232017
|
if (other instanceof IndexedPolyface) {
|
|
231901
|
-
return this.data.isAlmostEqual(other.data) &&
|
|
231902
|
-
|
|
232018
|
+
return this.data.isAlmostEqual(other.data) && _geometry3d_PointHelpers__WEBPACK_IMPORTED_MODULE_5__["NumberArray"].isExactEqual(this._facetStart, other._facetStart) &&
|
|
232019
|
+
_geometry3d_PointHelpers__WEBPACK_IMPORTED_MODULE_5__["NumberArray"].isExactEqual(this._facetToFaceData, other._facetToFaceData);
|
|
231903
232020
|
}
|
|
231904
232021
|
return false;
|
|
231905
232022
|
}
|
|
@@ -231953,50 +232070,45 @@ class IndexedPolyface extends Polyface {
|
|
|
231953
232070
|
}
|
|
231954
232071
|
/**
|
|
231955
232072
|
* * Add facets from source to this polyface.
|
|
231956
|
-
* *
|
|
231957
|
-
* *
|
|
231958
|
-
* *
|
|
232073
|
+
* * Optionally reverse facet indices as per PolyfaceData.reverseIndicesSingleFacet() with preserveStart = false, and invert source normals.
|
|
232074
|
+
* * Optionally apply a transform to points and normals.
|
|
232075
|
+
* * Will only copy param, normal, color, and face data if we are already tracking them AND/OR the source contains them.
|
|
231959
232076
|
*/
|
|
231960
232077
|
addIndexedPolyface(source, reversed, transform) {
|
|
231961
|
-
const
|
|
231962
|
-
|
|
231963
|
-
//
|
|
231964
|
-
const
|
|
231965
|
-
|
|
231966
|
-
|
|
231967
|
-
|
|
231968
|
-
for (let i = 0, n = source.data.point.length; i < n; i++) {
|
|
231969
|
-
sourcePoints.getPoint3dAtUncheckedPointIndex(i, xyz);
|
|
232078
|
+
const numSourceFacets = source.facetCount;
|
|
232079
|
+
// Add point, point index, and edge visibility data
|
|
232080
|
+
// Note: there is no need to build an intermediate index map since all points are added
|
|
232081
|
+
const startOfNewPoints = this.data.point.length;
|
|
232082
|
+
const xyz = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_4__["Point3d"].create();
|
|
232083
|
+
for (let i = 0; i < source.data.point.length; i++) {
|
|
232084
|
+
source.data.point.getPoint3dAtUncheckedPointIndex(i, xyz);
|
|
231970
232085
|
if (transform) {
|
|
231971
232086
|
transform.multiplyPoint3d(xyz, xyz);
|
|
231972
|
-
|
|
232087
|
+
this.addPoint(xyz);
|
|
231973
232088
|
}
|
|
231974
232089
|
else
|
|
231975
|
-
|
|
232090
|
+
this.addPoint(xyz);
|
|
231976
232091
|
}
|
|
231977
|
-
// Add point index and facet data
|
|
231978
|
-
const numSourceFacets = source._facetStart.length - 1;
|
|
231979
232092
|
for (let i = 0; i < numSourceFacets; i++) {
|
|
231980
232093
|
const i0 = source._facetStart[i];
|
|
231981
232094
|
const i1 = source._facetStart[i + 1];
|
|
231982
232095
|
if (reversed) {
|
|
231983
|
-
for (let j = i1; j-- > i0;) {
|
|
231984
|
-
this.addPointIndex(
|
|
232096
|
+
for (let j = i1; j-- > i0;) { // visibility is transferred from far vertex, e.g., -abc-d => dc-b-a
|
|
232097
|
+
this.addPointIndex(startOfNewPoints + source.data.pointIndex[j], source.data.edgeVisible[j > i0 ? j - 1 : i1 - 1]);
|
|
231985
232098
|
}
|
|
231986
232099
|
}
|
|
231987
232100
|
else {
|
|
231988
232101
|
for (let j = i0; j < i1; j++) {
|
|
231989
|
-
this.addPointIndex(
|
|
232102
|
+
this.addPointIndex(startOfNewPoints + source.data.pointIndex[j], source.data.edgeVisible[j]);
|
|
231990
232103
|
}
|
|
231991
232104
|
}
|
|
231992
232105
|
this.terminateFacet(false);
|
|
231993
232106
|
}
|
|
231994
232107
|
// Add param and param index data
|
|
231995
|
-
if (
|
|
231996
|
-
const
|
|
231997
|
-
|
|
231998
|
-
|
|
231999
|
-
for (let i = 0; i < source._facetStart.length; i++) { // Expect facet start and ends for points to match normals
|
|
232108
|
+
if (undefined !== this.data.param && undefined !== source.data.param && undefined !== source.data.paramIndex) {
|
|
232109
|
+
const startOfNewParams = this.data.param.length;
|
|
232110
|
+
this.data.param.pushFromGrowableXYArray(source.data.param);
|
|
232111
|
+
for (let i = 0; i < numSourceFacets; i++) { // Expect facet start and ends for points to match normals
|
|
232000
232112
|
const i0 = source._facetStart[i];
|
|
232001
232113
|
const i1 = source._facetStart[i + 1];
|
|
232002
232114
|
if (reversed) {
|
|
@@ -232010,20 +232122,17 @@ class IndexedPolyface extends Polyface {
|
|
|
232010
232122
|
}
|
|
232011
232123
|
}
|
|
232012
232124
|
// Add normal and normal index data
|
|
232013
|
-
if (
|
|
232125
|
+
if (undefined !== this.data.normal && undefined !== source.data.normal && undefined !== source.data.normalIndex) {
|
|
232014
232126
|
const startOfNewNormals = this.data.normal.length;
|
|
232015
|
-
|
|
232016
|
-
for (let i = 0; i < numNewNormals; i++) {
|
|
232127
|
+
for (let i = 0; i < source.data.normal.length; i++) {
|
|
232017
232128
|
const sourceNormal = source.data.normal.getVector3dAtCheckedVectorIndex(i);
|
|
232018
|
-
if (transform)
|
|
232129
|
+
if (transform)
|
|
232019
232130
|
transform.multiplyVector(sourceNormal, sourceNormal);
|
|
232020
|
-
|
|
232021
|
-
|
|
232022
|
-
|
|
232023
|
-
this.addNormal(sourceNormal);
|
|
232024
|
-
}
|
|
232131
|
+
if (reversed)
|
|
232132
|
+
sourceNormal.scaleInPlace(-1.0);
|
|
232133
|
+
this.addNormal(sourceNormal);
|
|
232025
232134
|
}
|
|
232026
|
-
for (let i = 0; i <
|
|
232135
|
+
for (let i = 0; i < numSourceFacets; i++) { // Expect facet start and ends for points to match normals
|
|
232027
232136
|
const i0 = source._facetStart[i];
|
|
232028
232137
|
const i1 = source._facetStart[i + 1];
|
|
232029
232138
|
if (reversed) {
|
|
@@ -232037,17 +232146,16 @@ class IndexedPolyface extends Polyface {
|
|
|
232037
232146
|
}
|
|
232038
232147
|
}
|
|
232039
232148
|
// Add color and color index data
|
|
232040
|
-
if (this.data.color && source.data.color && source.data.colorIndex) {
|
|
232149
|
+
if (undefined !== this.data.color && undefined !== source.data.color && undefined !== source.data.colorIndex) {
|
|
232041
232150
|
const startOfNewColors = this.data.color.length;
|
|
232042
|
-
for (const sourceColor of source.data.color)
|
|
232151
|
+
for (const sourceColor of source.data.color)
|
|
232043
232152
|
this.addColor(sourceColor);
|
|
232044
|
-
|
|
232045
|
-
for (let i = 0; i < source._facetStart.length; i++) { // Expect facet start and ends for points to match colors
|
|
232153
|
+
for (let i = 0; i < numSourceFacets; i++) { // Expect facet start and ends for points to match colors
|
|
232046
232154
|
const i0 = source._facetStart[i];
|
|
232047
232155
|
const i1 = source._facetStart[i + 1];
|
|
232048
232156
|
if (reversed) {
|
|
232049
232157
|
for (let j = i1; j-- > i0;)
|
|
232050
|
-
this.addColorIndex(startOfNewColors + source.data.colorIndex[j
|
|
232158
|
+
this.addColorIndex(startOfNewColors + source.data.colorIndex[j]);
|
|
232051
232159
|
}
|
|
232052
232160
|
else {
|
|
232053
232161
|
for (let j = i0; j < i1; j++)
|
|
@@ -232080,7 +232188,7 @@ class IndexedPolyface extends Polyface {
|
|
|
232080
232188
|
* @param needColors true if colors will e constructed.
|
|
232081
232189
|
*/
|
|
232082
232190
|
static create(needNormals = false, needParams = false, needColors = false, twoSided = false) {
|
|
232083
|
-
return new IndexedPolyface(new
|
|
232191
|
+
return new IndexedPolyface(new _PolyfaceData__WEBPACK_IMPORTED_MODULE_8__["PolyfaceData"](needNormals, needParams, needColors, twoSided));
|
|
232084
232192
|
}
|
|
232085
232193
|
/** add (a clone of ) a point. return its 0 based index.
|
|
232086
232194
|
* @param point point coordinates
|
|
@@ -232105,7 +232213,7 @@ class IndexedPolyface extends Polyface {
|
|
|
232105
232213
|
*/
|
|
232106
232214
|
addParam(param) {
|
|
232107
232215
|
if (!this.data.param)
|
|
232108
|
-
this.data.param = new
|
|
232216
|
+
this.data.param = new _geometry3d_GrowableXYArray__WEBPACK_IMPORTED_MODULE_2__["GrowableXYArray"]();
|
|
232109
232217
|
this.data.param.push(param);
|
|
232110
232218
|
return this.data.param.length - 1;
|
|
232111
232219
|
}
|
|
@@ -232116,7 +232224,7 @@ class IndexedPolyface extends Polyface {
|
|
|
232116
232224
|
*/
|
|
232117
232225
|
addParamUV(u, v, priorIndexA, priorIndexB) {
|
|
232118
232226
|
if (!this.data.param)
|
|
232119
|
-
this.data.param = new
|
|
232227
|
+
this.data.param = new _geometry3d_GrowableXYArray__WEBPACK_IMPORTED_MODULE_2__["GrowableXYArray"]();
|
|
232120
232228
|
if (priorIndexA !== undefined && this.data.isAlmostEqualParamIndexUV(priorIndexA, u, v))
|
|
232121
232229
|
return priorIndexA;
|
|
232122
232230
|
if (priorIndexB !== undefined && this.data.isAlmostEqualParamIndexUV(priorIndexB, u, v))
|
|
@@ -232158,7 +232266,7 @@ class IndexedPolyface extends Polyface {
|
|
|
232158
232266
|
*/
|
|
232159
232267
|
addNormalXYZ(x, y, z) {
|
|
232160
232268
|
if (!this.data.normal)
|
|
232161
|
-
this.data.normal = new
|
|
232269
|
+
this.data.normal = new _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_3__["GrowableXYZArray"]();
|
|
232162
232270
|
this.data.normal.pushXYZ(x, y, z);
|
|
232163
232271
|
return this.data.normal.length - 1;
|
|
232164
232272
|
}
|
|
@@ -232260,7 +232368,7 @@ class IndexedPolyface extends Polyface {
|
|
|
232260
232368
|
/** ASSUME valid facet index . .. return its end index in index arrays. */
|
|
232261
232369
|
facetIndex1(index) { return this._facetStart[index + 1]; }
|
|
232262
232370
|
/** create a visitor for this polyface */
|
|
232263
|
-
createVisitor(numWrap = 0) { return
|
|
232371
|
+
createVisitor(numWrap = 0) { return _IndexedPolyfaceVisitor__WEBPACK_IMPORTED_MODULE_7__["IndexedPolyfaceVisitor"].create(this, numWrap); }
|
|
232264
232372
|
/** Return the range of (optionally transformed) points in this mesh. */
|
|
232265
232373
|
range(transform, result) { return this.data.range(result, transform); }
|
|
232266
232374
|
/** Extend `range` with coordinates from this mesh */
|
|
@@ -232279,8 +232387,8 @@ class IndexedPolyface extends Polyface {
|
|
|
232279
232387
|
return false;
|
|
232280
232388
|
if (0 === endFacetIndex) // The default for endFacetIndex is really the last facet
|
|
232281
232389
|
endFacetIndex = this._facetStart.length; // Last facetStart index corresponds to the next facet if we were to create one
|
|
232282
|
-
const faceData =
|
|
232283
|
-
const visitor =
|
|
232390
|
+
const faceData = _FacetFaceData__WEBPACK_IMPORTED_MODULE_6__["FacetFaceData"].createNull();
|
|
232391
|
+
const visitor = _IndexedPolyfaceVisitor__WEBPACK_IMPORTED_MODULE_7__["IndexedPolyfaceVisitor"].create(this, 0);
|
|
232284
232392
|
if (!visitor.moveToReadIndex(facetStart)) { // Move visitor to first facet of new face
|
|
232285
232393
|
return false;
|
|
232286
232394
|
}
|
|
@@ -232351,6 +232459,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
232351
232459
|
/* harmony import */ var _BoxTopology__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./BoxTopology */ "../../core/geometry/lib/esm/polyface/BoxTopology.js");
|
|
232352
232460
|
/* harmony import */ var _GreedyTriangulationBetweenLineStrings__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./GreedyTriangulationBetweenLineStrings */ "../../core/geometry/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js");
|
|
232353
232461
|
/* harmony import */ var _Polyface__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./Polyface */ "../../core/geometry/lib/esm/polyface/Polyface.js");
|
|
232462
|
+
/* harmony import */ var _PolyfaceQuery__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./PolyfaceQuery */ "../../core/geometry/lib/esm/polyface/PolyfaceQuery.js");
|
|
232463
|
+
/* harmony import */ var _geometry3d_Angle__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ../geometry3d/Angle */ "../../core/geometry/lib/esm/geometry3d/Angle.js");
|
|
232464
|
+
/* harmony import */ var _IndexedPolyfaceVisitor__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./IndexedPolyfaceVisitor */ "../../core/geometry/lib/esm/polyface/IndexedPolyfaceVisitor.js");
|
|
232465
|
+
/* harmony import */ var _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./IndexedEdgeMatcher */ "../../core/geometry/lib/esm/polyface/IndexedEdgeMatcher.js");
|
|
232354
232466
|
/*---------------------------------------------------------------------------------------------
|
|
232355
232467
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
232356
232468
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -232383,6 +232495,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
232383
232495
|
|
|
232384
232496
|
|
|
232385
232497
|
|
|
232498
|
+
|
|
232499
|
+
|
|
232500
|
+
|
|
232501
|
+
|
|
232386
232502
|
|
|
232387
232503
|
|
|
232388
232504
|
|
|
@@ -232513,14 +232629,12 @@ FacetSector._edgeVector = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_2
|
|
|
232513
232629
|
* * Low-level detail construction -- direct use of indices
|
|
232514
232630
|
* * Create a builder with `builder = PolyfaceBuilder.create()`
|
|
232515
232631
|
* * Add GeometryQuery objects
|
|
232516
|
-
* * `builder.
|
|
232632
|
+
* * `builder.addPoint(point)`
|
|
232517
232633
|
* * `builder.findOrAddPointInLineString (linestring, index)`
|
|
232518
|
-
* * `builder.
|
|
232519
|
-
* * `builder.
|
|
232520
|
-
* * `builder.
|
|
232521
|
-
|
|
232522
|
-
* * `builder.addOneBasedPointIndex (index)`
|
|
232523
|
-
* @public
|
|
232634
|
+
* * `builder.addPointXYZ(x,y,z)`
|
|
232635
|
+
* * `builder.addTriangleFacet (points)`
|
|
232636
|
+
* * `builder.addQuadFacet (points)`
|
|
232637
|
+
* @public
|
|
232524
232638
|
*/
|
|
232525
232639
|
class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODULE_13__["NullGeometryHandler"] {
|
|
232526
232640
|
constructor(options) {
|
|
@@ -232580,7 +232694,7 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
232580
232694
|
if (n > 2) {
|
|
232581
232695
|
if (toggle)
|
|
232582
232696
|
this.toggleReversedFacetFlag();
|
|
232583
|
-
const index0 = this.
|
|
232697
|
+
const index0 = this.addPoint(conePoint);
|
|
232584
232698
|
let index1 = this.findOrAddPointInLineString(ls, 0);
|
|
232585
232699
|
let index2 = 0;
|
|
232586
232700
|
for (let i = 1; i < n; i++) {
|
|
@@ -232618,8 +232732,8 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
232618
232732
|
let paramIndex1 = -1;
|
|
232619
232733
|
let paramIndex2 = -1;
|
|
232620
232734
|
if (packedUV) {
|
|
232621
|
-
paramIndex0 = this.
|
|
232622
|
-
paramIndex1 = this.
|
|
232735
|
+
paramIndex0 = this.addParamInGrowableXYArray(packedUV, 0);
|
|
232736
|
+
paramIndex1 = this.addParamInGrowableXYArray(packedUV, 1);
|
|
232623
232737
|
}
|
|
232624
232738
|
const pointIndex0 = this.findOrAddPointInLineString(ls, 0);
|
|
232625
232739
|
let pointIndex1 = this.findOrAddPointInLineString(ls, 1);
|
|
@@ -232633,7 +232747,7 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
232633
232747
|
if (normalIndex !== undefined)
|
|
232634
232748
|
this.addIndexedTriangleNormalIndexes(normalIndex, normalIndex, normalIndex);
|
|
232635
232749
|
if (packedUV) {
|
|
232636
|
-
paramIndex2 = this.
|
|
232750
|
+
paramIndex2 = this.addParamInGrowableXYArray(packedUV, i);
|
|
232637
232751
|
this.addIndexedTriangleParamIndexes(paramIndex0, paramIndex1, paramIndex2);
|
|
232638
232752
|
}
|
|
232639
232753
|
this._polyface.terminateFacet();
|
|
@@ -232643,17 +232757,31 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
232643
232757
|
}
|
|
232644
232758
|
}
|
|
232645
232759
|
/**
|
|
232646
|
-
* Announce point coordinates.
|
|
232760
|
+
* Announce point coordinates.
|
|
232647
232761
|
*/
|
|
232648
|
-
|
|
232762
|
+
addPoint(xyz) {
|
|
232649
232763
|
return this._polyface.addPoint(xyz);
|
|
232650
232764
|
}
|
|
232651
232765
|
/**
|
|
232652
|
-
* Announce point coordinates.
|
|
232766
|
+
* Announce point coordinates.
|
|
232767
|
+
* @deprecated Use addPoint instead.
|
|
232653
232768
|
*/
|
|
232654
|
-
|
|
232769
|
+
findOrAddPoint(xyz) {
|
|
232770
|
+
return this.addPoint(xyz);
|
|
232771
|
+
}
|
|
232772
|
+
/**
|
|
232773
|
+
* Announce uv parameter coordinates.
|
|
232774
|
+
*/
|
|
232775
|
+
addParamXY(x, y) {
|
|
232655
232776
|
return this._polyface.addParamUV(x, y);
|
|
232656
232777
|
}
|
|
232778
|
+
/**
|
|
232779
|
+
* Announce uv parameter coordinates.
|
|
232780
|
+
* @deprecated Use addParamXY instead.
|
|
232781
|
+
*/
|
|
232782
|
+
findOrAddParamXY(x, y) {
|
|
232783
|
+
return this.addParamXY(x, y);
|
|
232784
|
+
}
|
|
232657
232785
|
/**
|
|
232658
232786
|
* Announce point coordinates. The implementation is free to either create a new point or (if known) return index of a prior point with the same coordinates.
|
|
232659
232787
|
* @returns Returns the point index in the Polyface.
|
|
@@ -232697,19 +232825,26 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
232697
232825
|
return undefined;
|
|
232698
232826
|
}
|
|
232699
232827
|
/**
|
|
232700
|
-
* Announce
|
|
232701
|
-
* @returns Returns the
|
|
232828
|
+
* Announce uv parameter coordinates.
|
|
232829
|
+
* @returns Returns the uv parameter index in the Polyface.
|
|
232702
232830
|
* @param index Index of the param in the linestring.
|
|
232703
232831
|
*/
|
|
232704
|
-
|
|
232832
|
+
addParamInGrowableXYArray(data, index) {
|
|
232705
232833
|
if (!data)
|
|
232706
232834
|
return undefined;
|
|
232707
|
-
const q = data.
|
|
232835
|
+
const q = data.getPoint2dAtCheckedPointIndex(index, PolyfaceBuilder._workUVFindOrAdd);
|
|
232708
232836
|
if (q) {
|
|
232709
232837
|
return this._polyface.addParam(q);
|
|
232710
232838
|
}
|
|
232711
232839
|
return undefined;
|
|
232712
232840
|
}
|
|
232841
|
+
/**
|
|
232842
|
+
* Announce uv parameter coordinates.
|
|
232843
|
+
* @deprecated Use addParamInGrowableXYArray instead.
|
|
232844
|
+
*/
|
|
232845
|
+
findOrAddParamInGrowableXYArray(data, index) {
|
|
232846
|
+
return this.addParamInGrowableXYArray(data, index);
|
|
232847
|
+
}
|
|
232713
232848
|
/**
|
|
232714
232849
|
* Announce param coordinates, taking u from ls.fractions and v from parameter. The implementation is free to either create a new param or (if known) return index of a prior point with the same coordinates.
|
|
232715
232850
|
* @returns Returns the point index in the Polyface.
|
|
@@ -232738,11 +232873,18 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
232738
232873
|
return undefined;
|
|
232739
232874
|
}
|
|
232740
232875
|
/**
|
|
232741
|
-
* Announce point coordinates.
|
|
232876
|
+
* Announce point coordinates.
|
|
232742
232877
|
*/
|
|
232743
|
-
|
|
232878
|
+
addPointXYZ(x, y, z) {
|
|
232744
232879
|
return this._polyface.addPointXYZ(x, y, z);
|
|
232745
232880
|
}
|
|
232881
|
+
/**
|
|
232882
|
+
* Announce point coordinates.
|
|
232883
|
+
* @deprecated Use addPointXYZ instead.
|
|
232884
|
+
*/
|
|
232885
|
+
findOrAddPointXYZ(x, y, z) {
|
|
232886
|
+
return this.addPointXYZ(x, y, z);
|
|
232887
|
+
}
|
|
232746
232888
|
/** Returns a transform who can be applied to points on a triangular facet in order to obtain UV parameters. */
|
|
232747
232889
|
getUVTransformForTriangleFacet(pointA, pointB, pointC) {
|
|
232748
232890
|
const vectorAB = pointA.vectorTo(pointB);
|
|
@@ -232762,17 +232904,21 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
232762
232904
|
// ###: Consider case where normals will be reversed and point through the other end of the facet
|
|
232763
232905
|
/**
|
|
232764
232906
|
* Add a quad to the polyface given its points in order around the edges.
|
|
232765
|
-
*
|
|
232766
|
-
*
|
|
232907
|
+
* @param points array of at least three vertices
|
|
232908
|
+
* @param params optional array of at least four uv parameters (if undefined, params are calculated without reference data)
|
|
232909
|
+
* @param normals optional array of at least four vectors (if undefined, the quad is assumed to be planar and its normal is calculated)
|
|
232910
|
+
* @param colors optional array of at least four colors
|
|
232767
232911
|
*/
|
|
232768
|
-
addQuadFacet(points, params, normals) {
|
|
232912
|
+
addQuadFacet(points, params, normals, colors) {
|
|
232769
232913
|
if (points instanceof _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_15__["GrowableXYZArray"])
|
|
232770
232914
|
points = points.getPoint3dArray();
|
|
232771
232915
|
// If params and/or normals are needed, calculate them first
|
|
232772
232916
|
const needParams = this.options.needParams;
|
|
232773
232917
|
const needNormals = this.options.needNormals;
|
|
232918
|
+
const needColors = this.options.needColors;
|
|
232774
232919
|
let param0, param1, param2, param3;
|
|
232775
232920
|
let normal0, normal1, normal2, normal3;
|
|
232921
|
+
let color0, color1, color2, color3;
|
|
232776
232922
|
if (needParams) {
|
|
232777
232923
|
if (params !== undefined && params.length > 3) {
|
|
232778
232924
|
param0 = params[0];
|
|
@@ -232807,18 +232953,26 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
232807
232953
|
normal3 = this.getNormalForTriangularFacet(points[0], points[1], points[2]);
|
|
232808
232954
|
}
|
|
232809
232955
|
}
|
|
232956
|
+
if (needColors) {
|
|
232957
|
+
if (colors !== undefined && colors.length > 3) {
|
|
232958
|
+
color0 = colors[0];
|
|
232959
|
+
color1 = colors[1];
|
|
232960
|
+
color2 = colors[2];
|
|
232961
|
+
color3 = colors[3];
|
|
232962
|
+
}
|
|
232963
|
+
}
|
|
232810
232964
|
if (this._options.shouldTriangulate) {
|
|
232811
232965
|
// Add as two triangles, with a diagonal along the shortest distance
|
|
232812
232966
|
const vectorAC = points[0].vectorTo(points[2]);
|
|
232813
232967
|
const vectorBD = points[1].vectorTo(points[3]);
|
|
232814
232968
|
// Note: We pass along any values for normals or params that we calculated
|
|
232815
232969
|
if (vectorAC.magnitude() >= vectorBD.magnitude()) {
|
|
232816
|
-
this.addTriangleFacet([points[0], points[1], points[2]], needParams ? [param0, param1, param2] : undefined, needNormals ? [normal0, normal1, normal2] : undefined);
|
|
232817
|
-
this.addTriangleFacet([points[0], points[2], points[3]], needParams ? [param0, param2, param3] : undefined, needNormals ? [normal0, normal2, normal3] : undefined);
|
|
232970
|
+
this.addTriangleFacet([points[0], points[1], points[2]], needParams ? [param0, param1, param2] : undefined, needNormals ? [normal0, normal1, normal2] : undefined, needColors ? [color0, color1, color2] : undefined);
|
|
232971
|
+
this.addTriangleFacet([points[0], points[2], points[3]], needParams ? [param0, param2, param3] : undefined, needNormals ? [normal0, normal2, normal3] : undefined, needColors ? [color0, color2, color3] : undefined);
|
|
232818
232972
|
}
|
|
232819
232973
|
else {
|
|
232820
|
-
this.addTriangleFacet([points[0], points[1], points[3]], needParams ? [param0, param1, param3] : undefined, needNormals ? [normal0, normal1, normal3] : undefined);
|
|
232821
|
-
this.addTriangleFacet([points[1], points[2], points[3]], needParams ? [param1, param2, param3] : undefined, needNormals ? [normal1, normal2, normal3] : undefined);
|
|
232974
|
+
this.addTriangleFacet([points[0], points[1], points[3]], needParams ? [param0, param1, param3] : undefined, needNormals ? [normal0, normal1, normal3] : undefined, needColors ? [color0, color1, color3] : undefined);
|
|
232975
|
+
this.addTriangleFacet([points[1], points[2], points[3]], needParams ? [param1, param2, param3] : undefined, needNormals ? [normal1, normal2, normal3] : undefined, needColors ? [color1, color2, color3] : undefined);
|
|
232822
232976
|
}
|
|
232823
232977
|
return;
|
|
232824
232978
|
}
|
|
@@ -232839,11 +232993,19 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
232839
232993
|
idx3 = this._polyface.addNormal(normal3);
|
|
232840
232994
|
this.addIndexedQuadNormalIndexes(idx0, idx1, idx3, idx2);
|
|
232841
232995
|
}
|
|
232996
|
+
// Add colors if needed
|
|
232997
|
+
if (needColors) {
|
|
232998
|
+
idx0 = this._polyface.addColor(color0);
|
|
232999
|
+
idx1 = this._polyface.addColor(color1);
|
|
233000
|
+
idx2 = this._polyface.addColor(color2);
|
|
233001
|
+
idx3 = this._polyface.addColor(color3);
|
|
233002
|
+
this.addIndexedQuadColorIndexes(idx0, idx1, idx3, idx2);
|
|
233003
|
+
}
|
|
232842
233004
|
// Add point and point indexes last (terminates the facet)
|
|
232843
|
-
idx0 = this.
|
|
232844
|
-
idx1 = this.
|
|
232845
|
-
idx2 = this.
|
|
232846
|
-
idx3 = this.
|
|
233005
|
+
idx0 = this.addPoint(points[0]);
|
|
233006
|
+
idx1 = this.addPoint(points[1]);
|
|
233007
|
+
idx2 = this.addPoint(points[2]);
|
|
233008
|
+
idx3 = this.addPoint(points[3]);
|
|
232847
233009
|
this.addIndexedQuadPointIndexes(idx0, idx1, idx3, idx2);
|
|
232848
233010
|
}
|
|
232849
233011
|
/** Announce a single quad facet's point indexes.
|
|
@@ -232898,12 +233060,30 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
232898
233060
|
this._polyface.addNormalIndex(indexB0);
|
|
232899
233061
|
}
|
|
232900
233062
|
}
|
|
233063
|
+
/** For a single quad facet, add the indexes of the corresponding colors. */
|
|
233064
|
+
addIndexedQuadColorIndexes(indexA0, indexA1, indexB0, indexB1) {
|
|
233065
|
+
if (this._reversed) {
|
|
233066
|
+
this._polyface.addColorIndex(indexA0);
|
|
233067
|
+
this._polyface.addColorIndex(indexB0);
|
|
233068
|
+
this._polyface.addColorIndex(indexB1);
|
|
233069
|
+
this._polyface.addColorIndex(indexA1);
|
|
233070
|
+
}
|
|
233071
|
+
else {
|
|
233072
|
+
this._polyface.addColorIndex(indexA0);
|
|
233073
|
+
this._polyface.addColorIndex(indexA1);
|
|
233074
|
+
this._polyface.addColorIndex(indexB1);
|
|
233075
|
+
this._polyface.addColorIndex(indexB0);
|
|
233076
|
+
}
|
|
233077
|
+
}
|
|
232901
233078
|
// ### TODO: Consider case where normals will be reversed and point through the other end of the facet
|
|
232902
233079
|
/**
|
|
232903
233080
|
* Add a triangle to the polyface given its points in order around the edges.
|
|
232904
|
-
*
|
|
233081
|
+
* @param points array of at least three vertices
|
|
233082
|
+
* @param params optional array of at least three uv parameters (if undefined, params are calculated without reference data)
|
|
233083
|
+
* @param normals optional array of at least three vectors (if undefined, the normal is calculated)
|
|
233084
|
+
* @param colors optional array of at least three colors
|
|
232905
233085
|
*/
|
|
232906
|
-
addTriangleFacet(points, params, normals) {
|
|
233086
|
+
addTriangleFacet(points, params, normals, colors) {
|
|
232907
233087
|
if (points.length < 3)
|
|
232908
233088
|
return;
|
|
232909
233089
|
let idx0;
|
|
@@ -232950,10 +233130,19 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
232950
233130
|
}
|
|
232951
233131
|
this.addIndexedTriangleNormalIndexes(idx0, idx1, idx2);
|
|
232952
233132
|
}
|
|
233133
|
+
// Add colors if needed and provided
|
|
233134
|
+
if (this._options.needColors) {
|
|
233135
|
+
if (colors !== undefined && colors.length > 2) {
|
|
233136
|
+
idx0 = this._polyface.addColor(colors[0]);
|
|
233137
|
+
idx1 = this._polyface.addColor(colors[1]);
|
|
233138
|
+
idx2 = this._polyface.addColor(colors[2]);
|
|
233139
|
+
this.addIndexedTriangleColorIndexes(idx0, idx1, idx2);
|
|
233140
|
+
}
|
|
233141
|
+
}
|
|
232953
233142
|
// Add point and point indexes last (terminates the facet)
|
|
232954
|
-
idx0 = this.
|
|
232955
|
-
idx1 = this.
|
|
232956
|
-
idx2 = this.
|
|
233143
|
+
idx0 = this.addPoint(point0);
|
|
233144
|
+
idx1 = this.addPoint(point1);
|
|
233145
|
+
idx2 = this.addPoint(point2);
|
|
232957
233146
|
this.addIndexedTrianglePointIndexes(idx0, idx1, idx2);
|
|
232958
233147
|
}
|
|
232959
233148
|
/** Announce a single triangle facet's point indexes.
|
|
@@ -233000,9 +233189,22 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
233000
233189
|
this._polyface.addNormalIndex(indexB);
|
|
233001
233190
|
}
|
|
233002
233191
|
}
|
|
233192
|
+
/** For a single triangle facet, add the indexes of the corresponding colors. */
|
|
233193
|
+
addIndexedTriangleColorIndexes(indexA, indexB, indexC) {
|
|
233194
|
+
if (!this._reversed) {
|
|
233195
|
+
this._polyface.addColorIndex(indexA);
|
|
233196
|
+
this._polyface.addColorIndex(indexB);
|
|
233197
|
+
this._polyface.addColorIndex(indexC);
|
|
233198
|
+
}
|
|
233199
|
+
else {
|
|
233200
|
+
this._polyface.addColorIndex(indexA);
|
|
233201
|
+
this._polyface.addColorIndex(indexC);
|
|
233202
|
+
this._polyface.addColorIndex(indexB);
|
|
233203
|
+
}
|
|
233204
|
+
}
|
|
233003
233205
|
/** Find or add xyzIndex and normalIndex for coordinates in the sector. */
|
|
233004
233206
|
setSectorIndices(sector) {
|
|
233005
|
-
sector.xyzIndex = this.
|
|
233207
|
+
sector.xyzIndex = this.addPoint(sector.xyz);
|
|
233006
233208
|
if (sector.normal)
|
|
233007
233209
|
sector.normalIndex = this._polyface.addNormal(sector.normal);
|
|
233008
233210
|
if (sector.uv)
|
|
@@ -233246,8 +233448,8 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
233246
233448
|
for (let i = 0; i < n; i++) {
|
|
233247
233449
|
pointA = contour.pointAt(i, pointA);
|
|
233248
233450
|
pointB = pointA.plus(vector, pointB);
|
|
233249
|
-
indexA1 = this.
|
|
233250
|
-
indexB1 = this.
|
|
233451
|
+
indexA1 = this.addPoint(pointA);
|
|
233452
|
+
indexB1 = this.addPoint(pointB);
|
|
233251
233453
|
if (i > 0) {
|
|
233252
233454
|
this.addIndexedQuadPointIndexes(indexA0, indexA1, indexB0, indexB1);
|
|
233253
233455
|
}
|
|
@@ -233541,13 +233743,13 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
233541
233743
|
let index = 0;
|
|
233542
233744
|
if (!this._reversed) {
|
|
233543
233745
|
for (let i = 0; i < numPointsToUse; i++) {
|
|
233544
|
-
index = this.
|
|
233746
|
+
index = this.addPoint(points[i]);
|
|
233545
233747
|
this._polyface.addPointIndex(index);
|
|
233546
233748
|
}
|
|
233547
233749
|
}
|
|
233548
233750
|
else {
|
|
233549
233751
|
for (let i = numPointsToUse; --i >= 0;) {
|
|
233550
|
-
index = this.
|
|
233752
|
+
index = this.addPoint(points[i]);
|
|
233551
233753
|
this._polyface.addPointIndex(index);
|
|
233552
233754
|
}
|
|
233553
233755
|
}
|
|
@@ -233623,7 +233825,7 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
233623
233825
|
this._polyface.addNormalIndex(index);
|
|
233624
233826
|
}
|
|
233625
233827
|
if (params) {
|
|
233626
|
-
index = this.
|
|
233828
|
+
index = this.addParamInGrowableXYArray(params, i);
|
|
233627
233829
|
this._polyface.addParamIndex(index);
|
|
233628
233830
|
}
|
|
233629
233831
|
if (colors) {
|
|
@@ -233641,7 +233843,7 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
233641
233843
|
this._polyface.addNormalIndex(index);
|
|
233642
233844
|
}
|
|
233643
233845
|
if (params) {
|
|
233644
|
-
index = this.
|
|
233846
|
+
index = this.addParamInGrowableXYArray(params, i);
|
|
233645
233847
|
this._polyface.addParamIndex(index);
|
|
233646
233848
|
}
|
|
233647
233849
|
if (colors) {
|
|
@@ -233704,10 +233906,10 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
233704
233906
|
if (acceptFaceFunction(seed) && seed.countEdgesAroundFace() > 2) {
|
|
233705
233907
|
let node = seed;
|
|
233706
233908
|
do {
|
|
233707
|
-
index = this.
|
|
233909
|
+
index = this.addPointXYZ(node.x, node.y, node.z);
|
|
233708
233910
|
this._polyface.addPointIndex(index, isEdgeVisibleFunction === undefined ? true : isEdgeVisibleFunction(node));
|
|
233709
233911
|
if (needParams) {
|
|
233710
|
-
index = this.
|
|
233912
|
+
index = this.addParamXY(node.x, node.y);
|
|
233711
233913
|
this._polyface.addParamIndex(index);
|
|
233712
233914
|
}
|
|
233713
233915
|
if (needNormals) {
|
|
@@ -233734,7 +233936,7 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
233734
233936
|
for (const seed of faces) {
|
|
233735
233937
|
let node = seed;
|
|
233736
233938
|
do {
|
|
233737
|
-
index = this.
|
|
233939
|
+
index = this.addPointXYZ(node.x, node.y, node.z);
|
|
233738
233940
|
this._polyface.addPointIndex(index);
|
|
233739
233941
|
node = node.faceSuccessor;
|
|
233740
233942
|
} while (node !== seed);
|
|
@@ -233979,6 +234181,104 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
233979
234181
|
this.addMiteredPipesFromPoints(linestring.packedPoints, sectionData, numFacetAround);
|
|
233980
234182
|
}
|
|
233981
234183
|
}
|
|
234184
|
+
/** Return the polyface index array indices corresponding to the given edge, or undefined if error. */
|
|
234185
|
+
getEdgeIndices(edge) {
|
|
234186
|
+
let indexA = -1;
|
|
234187
|
+
let indexB = -1;
|
|
234188
|
+
for (let i = this._polyface.facetIndex0(edge.facetIndex); i < this._polyface.facetIndex1(edge.facetIndex); ++i) {
|
|
234189
|
+
if (edge.vertexIndexA === this._polyface.data.pointIndex[i])
|
|
234190
|
+
indexA = i;
|
|
234191
|
+
else if (edge.vertexIndexB === this._polyface.data.pointIndex[i])
|
|
234192
|
+
indexB = i;
|
|
234193
|
+
}
|
|
234194
|
+
return (indexA < 0 || indexB < 0) ? undefined : { edgeIndexA: indexA, edgeIndexB: indexB };
|
|
234195
|
+
}
|
|
234196
|
+
/** Create a side face between base and swept facets along a base boundary edge.
|
|
234197
|
+
* * Assumes numBaseFacets base facets were added to this builder, immediately followed by the same number of swept facets with opposite orientation (first index not preserved).
|
|
234198
|
+
*/
|
|
234199
|
+
addSweptFace(baseBoundaryEdge, numBaseFacets) {
|
|
234200
|
+
const edge = this.getEdgeIndices(baseBoundaryEdge);
|
|
234201
|
+
if (undefined === edge)
|
|
234202
|
+
return false;
|
|
234203
|
+
const sweptFacetIndex = numBaseFacets + baseBoundaryEdge.facetIndex;
|
|
234204
|
+
if (!this._polyface.isValidFacetIndex(sweptFacetIndex))
|
|
234205
|
+
return false;
|
|
234206
|
+
const numBaseFacetEdges = this._polyface.numEdgeInFacet(baseBoundaryEdge.facetIndex);
|
|
234207
|
+
if (numBaseFacetEdges !== this._polyface.numEdgeInFacet(sweptFacetIndex))
|
|
234208
|
+
return false;
|
|
234209
|
+
// generate indices into the polyface index arrays
|
|
234210
|
+
const baseFacetIndexStart = this._polyface.facetIndex0(baseBoundaryEdge.facetIndex);
|
|
234211
|
+
const sweptFacetIndexStart = this._polyface.facetIndex0(sweptFacetIndex);
|
|
234212
|
+
const edgeIndexOffsetInFaceLoopA = edge.edgeIndexA - baseFacetIndexStart;
|
|
234213
|
+
const edgeIndexOffsetInFaceLoopB = edge.edgeIndexB - baseFacetIndexStart;
|
|
234214
|
+
const sweptEdgeIndexOffsetInFaceLoopA = (numBaseFacetEdges - 1) - edgeIndexOffsetInFaceLoopA;
|
|
234215
|
+
const sweptEdgeIndexOffsetInFaceLoopB = (numBaseFacetEdges - 1) - edgeIndexOffsetInFaceLoopB;
|
|
234216
|
+
const indices = [edge.edgeIndexB, edge.edgeIndexA, sweptFacetIndexStart + sweptEdgeIndexOffsetInFaceLoopA, sweptFacetIndexStart + sweptEdgeIndexOffsetInFaceLoopB];
|
|
234217
|
+
const vertices = [];
|
|
234218
|
+
let colors; // try to re-use colors; missing normals and params will be computed if needed
|
|
234219
|
+
if (undefined !== this.options.needColors && undefined !== this._polyface.data.color && undefined !== this._polyface.data.colorIndex)
|
|
234220
|
+
colors = [];
|
|
234221
|
+
for (let i = 0; i < 4; ++i) {
|
|
234222
|
+
const xyz = this._polyface.data.getPoint(this._polyface.data.pointIndex[indices[i]]);
|
|
234223
|
+
if (undefined === xyz)
|
|
234224
|
+
return false;
|
|
234225
|
+
vertices.push(xyz);
|
|
234226
|
+
if (undefined !== colors) {
|
|
234227
|
+
const color = this._polyface.data.getColor(this._polyface.data.colorIndex[indices[i]]);
|
|
234228
|
+
if (undefined === color)
|
|
234229
|
+
return false;
|
|
234230
|
+
colors.push(color);
|
|
234231
|
+
}
|
|
234232
|
+
}
|
|
234233
|
+
this.addQuadFacet(vertices, undefined, undefined, colors);
|
|
234234
|
+
return true;
|
|
234235
|
+
}
|
|
234236
|
+
/**
|
|
234237
|
+
* Add facets from the source polyface, from its translation along the vector, and from its swept boundary edges, to form a polyface that encloses a volume.
|
|
234238
|
+
* @param source the surface mesh to sweep
|
|
234239
|
+
* @param sweepVector the direction and length to sweep the surface mesh
|
|
234240
|
+
* @param triangulateSides whether to triangulate side facets, or leave as quads
|
|
234241
|
+
* @returns whether the added facets comprise a simple sweep. If false, the resulting mesh may have self-intersections, be non-manifold, have inconsistently oriented facets, etc.
|
|
234242
|
+
*/
|
|
234243
|
+
addSweptIndexedPolyface(source, sweepVector, triangulateSides = false) {
|
|
234244
|
+
let isSimpleSweep = true;
|
|
234245
|
+
const totalProjectedArea = _PolyfaceQuery__WEBPACK_IMPORTED_MODULE_33__["PolyfaceQuery"].sumFacetAreas(source, sweepVector);
|
|
234246
|
+
if (_Geometry__WEBPACK_IMPORTED_MODULE_10__["Geometry"].isAlmostEqualNumber(0.0, totalProjectedArea))
|
|
234247
|
+
isSimpleSweep = false;
|
|
234248
|
+
const partitionedIndices = _PolyfaceQuery__WEBPACK_IMPORTED_MODULE_33__["PolyfaceQuery"].partitionFacetIndicesByVisibilityVector(source, sweepVector, _geometry3d_Angle__WEBPACK_IMPORTED_MODULE_34__["Angle"].createDegrees(1.0e-3));
|
|
234249
|
+
const numForwardFacets = partitionedIndices[0].length;
|
|
234250
|
+
const numBackwardFacets = partitionedIndices[1].length;
|
|
234251
|
+
const numSideFacets = partitionedIndices[2].length;
|
|
234252
|
+
if (numSideFacets > 0)
|
|
234253
|
+
isSimpleSweep = false;
|
|
234254
|
+
if (numForwardFacets > 0 && numBackwardFacets > 0)
|
|
234255
|
+
isSimpleSweep = false;
|
|
234256
|
+
// add base and swept facets with opposite orientations
|
|
234257
|
+
const reverseBase = numForwardFacets > 0;
|
|
234258
|
+
const firstBaseFacet = this._polyface.facetCount;
|
|
234259
|
+
this.addIndexedPolyface(source, reverseBase);
|
|
234260
|
+
const firstSweptFacet = this._polyface.facetCount;
|
|
234261
|
+
this.addIndexedPolyface(source, !reverseBase, _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_25__["Transform"].createTranslation(sweepVector));
|
|
234262
|
+
// collect base edges added to the builder, and extract boundary
|
|
234263
|
+
const numBaseFacets = firstSweptFacet - firstBaseFacet;
|
|
234264
|
+
const baseFacetIndices = Array.from({ length: numBaseFacets }, (_, i) => firstBaseFacet + i);
|
|
234265
|
+
const baseFacetVisitor = _IndexedPolyfaceVisitor__WEBPACK_IMPORTED_MODULE_35__["IndexedPolyfaceSubsetVisitor"].createSubsetVisitor(this._polyface, baseFacetIndices, 1);
|
|
234266
|
+
const baseEdges = _PolyfaceQuery__WEBPACK_IMPORTED_MODULE_33__["PolyfaceQuery"].createIndexedEdges(baseFacetVisitor);
|
|
234267
|
+
const baseBoundaryEdges = [];
|
|
234268
|
+
baseEdges.sortAndCollectClusters(undefined, baseBoundaryEdges, undefined, undefined);
|
|
234269
|
+
// add a side face per boundary edge
|
|
234270
|
+
const oldShouldTriangulate = this._options.shouldTriangulate;
|
|
234271
|
+
this._options.shouldTriangulate = triangulateSides;
|
|
234272
|
+
for (const edgeOrCluster of baseBoundaryEdges) {
|
|
234273
|
+
if (edgeOrCluster instanceof _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_36__["SortableEdge"])
|
|
234274
|
+
this.addSweptFace(edgeOrCluster, numBaseFacets);
|
|
234275
|
+
else if (Array.isArray(edgeOrCluster))
|
|
234276
|
+
for (const edge of edgeOrCluster)
|
|
234277
|
+
this.addSweptFace(edge, numBaseFacets);
|
|
234278
|
+
}
|
|
234279
|
+
this._options.shouldTriangulate = oldShouldTriangulate;
|
|
234280
|
+
return isSimpleSweep;
|
|
234281
|
+
}
|
|
233982
234282
|
}
|
|
233983
234283
|
PolyfaceBuilder._workPointFindOrAddA = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_21__["Point3d"].create();
|
|
233984
234284
|
PolyfaceBuilder._workVectorFindOrAdd = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_21__["Vector3d"].create();
|
|
@@ -234979,9 +235279,9 @@ class PolyfaceData {
|
|
|
234979
235279
|
return undefined === this.auxData || this.auxData.tryTransformInPlace(transform);
|
|
234980
235280
|
}
|
|
234981
235281
|
/**
|
|
234982
|
-
* * Search for
|
|
234983
|
-
* * compress the
|
|
234984
|
-
* * revise all indexing for the relocated
|
|
235282
|
+
* * Search for duplicates within points, normals, params, and colors.
|
|
235283
|
+
* * compress the data arrays.
|
|
235284
|
+
* * revise all indexing for the relocated data.
|
|
234985
235285
|
*/
|
|
234986
235286
|
compress() {
|
|
234987
235287
|
const packedPoints = _numerics_ClusterableArray__WEBPACK_IMPORTED_MODULE_7__["ClusterableArray"].clusterGrowablePoint3dArray(this.point);
|
|
@@ -234998,6 +235298,11 @@ class PolyfaceData {
|
|
|
234998
235298
|
this.param = packedParams.growablePackedPoints;
|
|
234999
235299
|
packedParams.updateIndices(this.paramIndex);
|
|
235000
235300
|
}
|
|
235301
|
+
if (this.colorIndex && this.color) {
|
|
235302
|
+
const packedColors = _numerics_ClusterableArray__WEBPACK_IMPORTED_MODULE_7__["ClusterableArray"].clusterNumberArray(this.color);
|
|
235303
|
+
this.color = packedColors.packedNumbers;
|
|
235304
|
+
packedColors.updateIndices(this.colorIndex);
|
|
235305
|
+
}
|
|
235001
235306
|
}
|
|
235002
235307
|
/**
|
|
235003
235308
|
* Test if facetStartIndex is (minimally!) valid:
|
|
@@ -235157,23 +235462,24 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
235157
235462
|
/* harmony import */ var _curve_LineString3d__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../curve/LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
|
|
235158
235463
|
/* harmony import */ var _curve_Loop__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../curve/Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
|
|
235159
235464
|
/* harmony import */ var _curve_StrokeOptions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../curve/StrokeOptions */ "../../core/geometry/lib/esm/curve/StrokeOptions.js");
|
|
235160
|
-
/* harmony import */ var
|
|
235161
|
-
/* harmony import */ var
|
|
235162
|
-
/* harmony import */ var
|
|
235163
|
-
/* harmony import */ var
|
|
235164
|
-
/* harmony import */ var
|
|
235165
|
-
/* harmony import */ var
|
|
235166
|
-
/* harmony import */ var
|
|
235167
|
-
/* harmony import */ var
|
|
235168
|
-
/* harmony import */ var
|
|
235169
|
-
/* harmony import */ var
|
|
235170
|
-
/* harmony import */ var
|
|
235171
|
-
/* harmony import */ var
|
|
235172
|
-
/* harmony import */ var
|
|
235173
|
-
/* harmony import */ var
|
|
235174
|
-
/* harmony import */ var
|
|
235175
|
-
/* harmony import */ var
|
|
235176
|
-
/* harmony import */ var
|
|
235465
|
+
/* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
|
|
235466
|
+
/* harmony import */ var _geometry3d_Angle__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geometry3d/Angle */ "../../core/geometry/lib/esm/geometry3d/Angle.js");
|
|
235467
|
+
/* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
|
|
235468
|
+
/* harmony import */ var _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geometry3d/PolygonOps */ "../../core/geometry/lib/esm/geometry3d/PolygonOps.js");
|
|
235469
|
+
/* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
|
|
235470
|
+
/* harmony import */ var _geometry4d_Matrix4d__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../geometry4d/Matrix4d */ "../../core/geometry/lib/esm/geometry4d/Matrix4d.js");
|
|
235471
|
+
/* harmony import */ var _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../geometry4d/MomentData */ "../../core/geometry/lib/esm/geometry4d/MomentData.js");
|
|
235472
|
+
/* harmony import */ var _numerics_UnionFind__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../numerics/UnionFind */ "../../core/geometry/lib/esm/numerics/UnionFind.js");
|
|
235473
|
+
/* harmony import */ var _topology_ChainMerge__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../topology/ChainMerge */ "../../core/geometry/lib/esm/topology/ChainMerge.js");
|
|
235474
|
+
/* harmony import */ var _FacetOrientation__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./FacetOrientation */ "../../core/geometry/lib/esm/polyface/FacetOrientation.js");
|
|
235475
|
+
/* harmony import */ var _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./IndexedEdgeMatcher */ "../../core/geometry/lib/esm/polyface/IndexedEdgeMatcher.js");
|
|
235476
|
+
/* harmony import */ var _IndexedPolyfaceVisitor__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./IndexedPolyfaceVisitor */ "../../core/geometry/lib/esm/polyface/IndexedPolyfaceVisitor.js");
|
|
235477
|
+
/* harmony import */ var _multiclip_BuildAverageNormalsContext__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./multiclip/BuildAverageNormalsContext */ "../../core/geometry/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js");
|
|
235478
|
+
/* harmony import */ var _multiclip_SweepLineStringToFacetContext__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./multiclip/SweepLineStringToFacetContext */ "../../core/geometry/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js");
|
|
235479
|
+
/* harmony import */ var _multiclip_XYPointBuckets__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./multiclip/XYPointBuckets */ "../../core/geometry/lib/esm/polyface/multiclip/XYPointBuckets.js");
|
|
235480
|
+
/* harmony import */ var _Polyface__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Polyface */ "../../core/geometry/lib/esm/polyface/Polyface.js");
|
|
235481
|
+
/* harmony import */ var _PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./PolyfaceBuilder */ "../../core/geometry/lib/esm/polyface/PolyfaceBuilder.js");
|
|
235482
|
+
/* harmony import */ var _RangeLengthData__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./RangeLengthData */ "../../core/geometry/lib/esm/polyface/RangeLengthData.js");
|
|
235177
235483
|
/*---------------------------------------------------------------------------------------------
|
|
235178
235484
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
235179
235485
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -235203,6 +235509,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
235203
235509
|
|
|
235204
235510
|
|
|
235205
235511
|
|
|
235512
|
+
|
|
235206
235513
|
|
|
235207
235514
|
|
|
235208
235515
|
/**
|
|
@@ -235239,15 +235546,27 @@ class PolyfaceQuery {
|
|
|
235239
235546
|
}
|
|
235240
235547
|
return result;
|
|
235241
235548
|
}
|
|
235242
|
-
/** Return the sum of all
|
|
235243
|
-
|
|
235549
|
+
/** Return the sum of all facet areas.
|
|
235550
|
+
* @param vectorToEye compute facet area projected to a view plane perpendicular to this vector
|
|
235551
|
+
*/
|
|
235552
|
+
static sumFacetAreas(source, vectorToEye) {
|
|
235244
235553
|
let s = 0;
|
|
235245
235554
|
if (source !== undefined) {
|
|
235246
|
-
if (source instanceof
|
|
235247
|
-
return PolyfaceQuery.sumFacetAreas(source.createVisitor(1));
|
|
235555
|
+
if (source instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"])
|
|
235556
|
+
return PolyfaceQuery.sumFacetAreas(source.createVisitor(1), vectorToEye);
|
|
235557
|
+
let unitVectorToEye;
|
|
235558
|
+
if (vectorToEye !== undefined)
|
|
235559
|
+
unitVectorToEye = vectorToEye.normalize();
|
|
235248
235560
|
source.reset();
|
|
235249
235561
|
while (source.moveToNextFacet()) {
|
|
235250
|
-
|
|
235562
|
+
const scaledNormal = _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_8__["PolygonOps"].areaNormal(source.point.getPoint3dArray());
|
|
235563
|
+
let area = scaledNormal.magnitude();
|
|
235564
|
+
if (unitVectorToEye !== undefined) {
|
|
235565
|
+
const scale = _Geometry__WEBPACK_IMPORTED_MODULE_5__["Geometry"].conditionalDivideCoordinate(1.0, area);
|
|
235566
|
+
if (scale !== undefined)
|
|
235567
|
+
area *= scaledNormal.dotProduct(unitVectorToEye) * scale;
|
|
235568
|
+
}
|
|
235569
|
+
s += area;
|
|
235251
235570
|
}
|
|
235252
235571
|
}
|
|
235253
235572
|
return s;
|
|
@@ -235260,12 +235579,12 @@ class PolyfaceQuery {
|
|
|
235260
235579
|
*/
|
|
235261
235580
|
static sumTetrahedralVolumes(source, origin) {
|
|
235262
235581
|
let s = 0;
|
|
235263
|
-
if (source instanceof
|
|
235582
|
+
if (source instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"])
|
|
235264
235583
|
return PolyfaceQuery.sumTetrahedralVolumes(source.createVisitor(0), origin);
|
|
235265
235584
|
let myOrigin = origin;
|
|
235266
|
-
const facetOrigin =
|
|
235267
|
-
const targetA =
|
|
235268
|
-
const targetB =
|
|
235585
|
+
const facetOrigin = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
235586
|
+
const targetA = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
235587
|
+
const targetB = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
235269
235588
|
source.reset();
|
|
235270
235589
|
while (source.moveToNextFacet()) {
|
|
235271
235590
|
if (myOrigin === undefined)
|
|
@@ -235286,20 +235605,20 @@ class PolyfaceQuery {
|
|
|
235286
235605
|
*
|
|
235287
235606
|
*/
|
|
235288
235607
|
static sumVolumeBetweenFacetsAndPlane(source, plane) {
|
|
235289
|
-
if (source instanceof
|
|
235608
|
+
if (source instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"])
|
|
235290
235609
|
return PolyfaceQuery.sumVolumeBetweenFacetsAndPlane(source.createVisitor(0), plane);
|
|
235291
|
-
const facetOrigin =
|
|
235292
|
-
const targetA =
|
|
235293
|
-
const targetB =
|
|
235294
|
-
const triangleNormal =
|
|
235610
|
+
const facetOrigin = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
235611
|
+
const targetA = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
235612
|
+
const targetB = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
235613
|
+
const triangleNormal = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Vector3d"].create();
|
|
235295
235614
|
const planeNormal = plane.getNormalRef();
|
|
235296
235615
|
let h0, hA, hB;
|
|
235297
235616
|
let signedVolumeSum = 0.0;
|
|
235298
235617
|
let signedTriangleArea;
|
|
235299
235618
|
let singleFacetArea;
|
|
235300
|
-
const positiveAreaMomentSums =
|
|
235301
|
-
const negativeAreaMomentSums =
|
|
235302
|
-
const singleFacetProducts =
|
|
235619
|
+
const positiveAreaMomentSums = _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_11__["MomentData"].create(undefined, true);
|
|
235620
|
+
const negativeAreaMomentSums = _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_11__["MomentData"].create(undefined, true);
|
|
235621
|
+
const singleFacetProducts = _geometry4d_Matrix4d__WEBPACK_IMPORTED_MODULE_10__["Matrix4d"].createZero();
|
|
235303
235622
|
const projectToPlane = plane.getProjectionToPlane();
|
|
235304
235623
|
source.reset();
|
|
235305
235624
|
// For each facet ..
|
|
@@ -235326,7 +235645,7 @@ class PolyfaceQuery {
|
|
|
235326
235645
|
}
|
|
235327
235646
|
singleFacetProducts.setZero();
|
|
235328
235647
|
source.point.multiplyTransformInPlace(projectToPlane);
|
|
235329
|
-
|
|
235648
|
+
_geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_8__["PolygonOps"].addSecondMomentAreaProducts(source.point, facetOrigin, singleFacetProducts);
|
|
235330
235649
|
if (singleFacetArea > 0) {
|
|
235331
235650
|
positiveAreaMomentSums.accumulateProductsFromOrigin(facetOrigin, singleFacetProducts, 1.0);
|
|
235332
235651
|
}
|
|
@@ -235336,8 +235655,8 @@ class PolyfaceQuery {
|
|
|
235336
235655
|
}
|
|
235337
235656
|
positiveAreaMomentSums.shiftOriginAndSumsToCentroidOfSums();
|
|
235338
235657
|
negativeAreaMomentSums.shiftOriginAndSumsToCentroidOfSums();
|
|
235339
|
-
const positiveAreaMoments =
|
|
235340
|
-
const negativeAreaMoments =
|
|
235658
|
+
const positiveAreaMoments = _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_11__["MomentData"].inertiaProductsToPrincipalAxes(positiveAreaMomentSums.origin, positiveAreaMomentSums.sums);
|
|
235659
|
+
const negativeAreaMoments = _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_11__["MomentData"].inertiaProductsToPrincipalAxes(negativeAreaMomentSums.origin, negativeAreaMomentSums.sums);
|
|
235341
235660
|
return {
|
|
235342
235661
|
volume: signedVolumeSum / 6.0,
|
|
235343
235662
|
positiveProjectedFacetAreaMoments: positiveAreaMoments,
|
|
@@ -235346,23 +235665,23 @@ class PolyfaceQuery {
|
|
|
235346
235665
|
}
|
|
235347
235666
|
/** Return the inertia products [xx,xy,xz,xw, yw, etc] integrated over all all facets, as viewed from origin. */
|
|
235348
235667
|
static sumFacetSecondAreaMomentProducts(source, origin) {
|
|
235349
|
-
if (source instanceof
|
|
235668
|
+
if (source instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"])
|
|
235350
235669
|
return PolyfaceQuery.sumFacetSecondAreaMomentProducts(source.createVisitor(0), origin);
|
|
235351
|
-
const products =
|
|
235670
|
+
const products = _geometry4d_Matrix4d__WEBPACK_IMPORTED_MODULE_10__["Matrix4d"].createZero();
|
|
235352
235671
|
source.reset();
|
|
235353
235672
|
while (source.moveToNextFacet()) {
|
|
235354
|
-
|
|
235673
|
+
_geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_8__["PolygonOps"].addSecondMomentAreaProducts(source.point, origin, products);
|
|
235355
235674
|
}
|
|
235356
235675
|
return products;
|
|
235357
235676
|
}
|
|
235358
235677
|
/** Return the inertia products [xx,xy,xz,xw, yw, etc] integrated over all tetrahedral volumes from origin */
|
|
235359
235678
|
static sumFacetSecondVolumeMomentProducts(source, origin) {
|
|
235360
|
-
if (source instanceof
|
|
235679
|
+
if (source instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"])
|
|
235361
235680
|
return PolyfaceQuery.sumFacetSecondVolumeMomentProducts(source.createVisitor(0), origin);
|
|
235362
|
-
const products =
|
|
235681
|
+
const products = _geometry4d_Matrix4d__WEBPACK_IMPORTED_MODULE_10__["Matrix4d"].createZero();
|
|
235363
235682
|
source.reset();
|
|
235364
235683
|
while (source.moveToNextFacet()) {
|
|
235365
|
-
|
|
235684
|
+
_geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_8__["PolygonOps"].addSecondMomentVolumeProducts(source.point, origin, products);
|
|
235366
235685
|
}
|
|
235367
235686
|
return products;
|
|
235368
235687
|
}
|
|
@@ -235376,7 +235695,7 @@ class PolyfaceQuery {
|
|
|
235376
235695
|
if (!origin)
|
|
235377
235696
|
return undefined;
|
|
235378
235697
|
const inertiaProducts = PolyfaceQuery.sumFacetSecondAreaMomentProducts(source, origin);
|
|
235379
|
-
return
|
|
235698
|
+
return _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_11__["MomentData"].inertiaProductsToPrincipalAxes(origin, inertiaProducts);
|
|
235380
235699
|
}
|
|
235381
235700
|
/** Compute area moments for the mesh. In the returned MomentData:
|
|
235382
235701
|
* * origin is the centroid.
|
|
@@ -235390,7 +235709,7 @@ class PolyfaceQuery {
|
|
|
235390
235709
|
if (!origin)
|
|
235391
235710
|
return undefined;
|
|
235392
235711
|
const inertiaProducts = PolyfaceQuery.sumFacetSecondVolumeMomentProducts(source, origin);
|
|
235393
|
-
return
|
|
235712
|
+
return _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_11__["MomentData"].inertiaProductsToPrincipalAxes(origin, inertiaProducts);
|
|
235394
235713
|
}
|
|
235395
235714
|
/**
|
|
235396
235715
|
* Test if the facets in `source` occur in perfectly mated pairs, as is required for a closed manifold volume.
|
|
@@ -235401,11 +235720,11 @@ class PolyfaceQuery {
|
|
|
235401
235720
|
/** Test edges pairing in `source` mesh.
|
|
235402
235721
|
* * for `allowSimpleBoundaries === false` true return means this is a closed 2-manifold surface
|
|
235403
235722
|
* * for `allowSimpleBoundaries === true` true means this is a 2-manifold surface which may have boundary, but is still properly matched internally.
|
|
235404
|
-
* * Any edge with 3
|
|
235723
|
+
* * Any edge with 3 or more incident facets triggers `false` return.
|
|
235405
235724
|
* * Any edge with 2 incident facets in the same direction triggers a `false` return.
|
|
235406
235725
|
*/
|
|
235407
235726
|
static isPolyfaceManifold(source, allowSimpleBoundaries = false) {
|
|
235408
|
-
const edges = new
|
|
235727
|
+
const edges = new _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__["IndexedEdgeMatcher"]();
|
|
235409
235728
|
const visitor = source.createVisitor(1);
|
|
235410
235729
|
visitor.reset();
|
|
235411
235730
|
while (visitor.moveToNextFacet()) {
|
|
@@ -235426,8 +235745,8 @@ class PolyfaceQuery {
|
|
|
235426
235745
|
static boundaryEdges(source, includeDanglers = true, includeMismatch = true, includeNull = true) {
|
|
235427
235746
|
if (source === undefined)
|
|
235428
235747
|
return undefined;
|
|
235429
|
-
const edges = new
|
|
235430
|
-
const visitor = source instanceof
|
|
235748
|
+
const edges = new _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__["IndexedEdgeMatcher"]();
|
|
235749
|
+
const visitor = source instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"] ? source.createVisitor(1) : source;
|
|
235431
235750
|
visitor.reset();
|
|
235432
235751
|
while (visitor.moveToNextFacet()) {
|
|
235433
235752
|
const numEdges = visitor.pointCount - 1;
|
|
@@ -235452,7 +235771,7 @@ class PolyfaceQuery {
|
|
|
235452
235771
|
const result = new _curve_CurveCollection__WEBPACK_IMPORTED_MODULE_0__["BagOfCurves"]();
|
|
235453
235772
|
for (const list of badList) {
|
|
235454
235773
|
for (const e of list) {
|
|
235455
|
-
const e1 = e instanceof
|
|
235774
|
+
const e1 = e instanceof _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__["SortableEdge"] ? e : e[0];
|
|
235456
235775
|
const indexA = e1.vertexIndexA;
|
|
235457
235776
|
const indexB = e1.vertexIndexB;
|
|
235458
235777
|
const pointA = sourcePolyface.data.getPoint(indexA);
|
|
@@ -235468,7 +235787,7 @@ class PolyfaceQuery {
|
|
|
235468
235787
|
* * Facets are ASSUMED to be convex and planar.
|
|
235469
235788
|
*/
|
|
235470
235789
|
static announceSweepLinestringToConvexPolyfaceXY(linestringPoints, polyface, announce) {
|
|
235471
|
-
const context =
|
|
235790
|
+
const context = _multiclip_SweepLineStringToFacetContext__WEBPACK_IMPORTED_MODULE_18__["SweepLineStringToFacetContext"].create(linestringPoints);
|
|
235472
235791
|
if (context) {
|
|
235473
235792
|
const visitor = polyface.createVisitor(0);
|
|
235474
235793
|
for (visitor.reset(); visitor.moveToNextFacet();) {
|
|
@@ -235477,7 +235796,7 @@ class PolyfaceQuery {
|
|
|
235477
235796
|
}
|
|
235478
235797
|
}
|
|
235479
235798
|
/** Execute context.projectToPolygon until its work estimates accumulate to workLimit */
|
|
235480
|
-
static async
|
|
235799
|
+
static async continueAnnounceSweepLinestringToConvexPolyfaceXY(context, visitor, announce) {
|
|
235481
235800
|
let workCount = 0;
|
|
235482
235801
|
while ((workCount < this.asyncWorkLimit) && visitor.moveToNextFacet()) {
|
|
235483
235802
|
workCount += context.projectToPolygon(visitor.point, announce, visitor.clientPolyface(), visitor.currentReadIndex());
|
|
@@ -235501,13 +235820,13 @@ class PolyfaceQuery {
|
|
|
235501
235820
|
* @internal
|
|
235502
235821
|
*/
|
|
235503
235822
|
static async asyncAnnounceSweepLinestringToConvexPolyfaceXY(linestringPoints, polyface, announce) {
|
|
235504
|
-
const context =
|
|
235823
|
+
const context = _multiclip_SweepLineStringToFacetContext__WEBPACK_IMPORTED_MODULE_18__["SweepLineStringToFacetContext"].create(linestringPoints);
|
|
235505
235824
|
this.awaitBlockCount = 0;
|
|
235506
235825
|
let workTotal = 0;
|
|
235507
235826
|
if (context) {
|
|
235508
235827
|
const visitor = polyface.createVisitor(0);
|
|
235509
235828
|
let workCount;
|
|
235510
|
-
while (0 < (workCount = await Promise.resolve(PolyfaceQuery.
|
|
235829
|
+
while (0 < (workCount = await Promise.resolve(PolyfaceQuery.continueAnnounceSweepLinestringToConvexPolyfaceXY(context, visitor, announce)))) {
|
|
235511
235830
|
workTotal += workCount;
|
|
235512
235831
|
this.awaitBlockCount++;
|
|
235513
235832
|
// console.log({ myWorkCount: workCount, myBlockCount: this.awaitBlockCount });
|
|
@@ -235521,11 +235840,11 @@ class PolyfaceQuery {
|
|
|
235521
235840
|
* * Return array of arrays of facet indices.
|
|
235522
235841
|
*/
|
|
235523
235842
|
static partitionFacetIndicesByVertexConnectedComponent(polyface) {
|
|
235524
|
-
if (polyface instanceof
|
|
235843
|
+
if (polyface instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"]) {
|
|
235525
235844
|
return this.partitionFacetIndicesByVertexConnectedComponent(polyface.createVisitor(0));
|
|
235526
235845
|
}
|
|
235527
235846
|
// The polyface is really a visitor !!!
|
|
235528
|
-
const context = new
|
|
235847
|
+
const context = new _numerics_UnionFind__WEBPACK_IMPORTED_MODULE_12__["UnionFindContext"](this.visitorClientPointCount(polyface));
|
|
235529
235848
|
for (polyface.reset(); polyface.moveToNextFacet();) {
|
|
235530
235849
|
const firstVertexIndexOnThisFacet = polyface.pointIndex[0];
|
|
235531
235850
|
for (const vertexIndex of polyface.pointIndex)
|
|
@@ -235558,7 +235877,7 @@ class PolyfaceQuery {
|
|
|
235558
235877
|
* * Return array of arrays of facet indices.
|
|
235559
235878
|
*/
|
|
235560
235879
|
static partitionFacetIndicesByVisibilityVector(polyface, vectorToEye, sideAngleTolerance) {
|
|
235561
|
-
if (polyface instanceof
|
|
235880
|
+
if (polyface instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"]) {
|
|
235562
235881
|
return this.partitionFacetIndicesByVisibilityVector(polyface.createVisitor(0), vectorToEye, sideAngleTolerance);
|
|
235563
235882
|
}
|
|
235564
235883
|
const facetsInComponent = [];
|
|
@@ -235570,7 +235889,7 @@ class PolyfaceQuery {
|
|
|
235570
235889
|
const sideComponent = facetsInComponent[2];
|
|
235571
235890
|
const radiansTol = Math.max(sideAngleTolerance.radians, 1.0e-8);
|
|
235572
235891
|
for (polyface.reset(); polyface.moveToNextFacet();) {
|
|
235573
|
-
const areaNormal =
|
|
235892
|
+
const areaNormal = _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_8__["PolygonOps"].areaNormalGo(polyface.point);
|
|
235574
235893
|
const index = polyface.currentReadIndex();
|
|
235575
235894
|
if (areaNormal) {
|
|
235576
235895
|
const angle = areaNormal.angleFromPerpendicular(vectorToEye);
|
|
@@ -235597,18 +235916,18 @@ class PolyfaceQuery {
|
|
|
235597
235916
|
* @param vectorToEye
|
|
235598
235917
|
* @param sideAngleTolerance
|
|
235599
235918
|
*/
|
|
235600
|
-
static boundaryOfVisibleSubset(polyface, visibilitySelect, vectorToEye, sideAngleTolerance =
|
|
235919
|
+
static boundaryOfVisibleSubset(polyface, visibilitySelect, vectorToEye, sideAngleTolerance = _geometry3d_Angle__WEBPACK_IMPORTED_MODULE_6__["Angle"].createDegrees(1.0e-3)) {
|
|
235601
235920
|
const partitionedIndices = this.partitionFacetIndicesByVisibilityVector(polyface, vectorToEye, sideAngleTolerance);
|
|
235602
235921
|
if (partitionedIndices[visibilitySelect].length === 0)
|
|
235603
235922
|
return undefined;
|
|
235604
|
-
const visitor =
|
|
235923
|
+
const visitor = _IndexedPolyfaceVisitor__WEBPACK_IMPORTED_MODULE_16__["IndexedPolyfaceSubsetVisitor"].createSubsetVisitor(polyface, partitionedIndices[visibilitySelect], 1);
|
|
235605
235924
|
return this.boundaryEdges(visitor, true, false, false);
|
|
235606
235925
|
}
|
|
235607
235926
|
/** Clone the facets in each partition to a separate polyface.
|
|
235608
235927
|
*
|
|
235609
235928
|
*/
|
|
235610
235929
|
static clonePartitions(polyface, partitions) {
|
|
235611
|
-
if (polyface instanceof
|
|
235930
|
+
if (polyface instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"]) {
|
|
235612
235931
|
return this.clonePartitions(polyface.createVisitor(0), partitions);
|
|
235613
235932
|
}
|
|
235614
235933
|
polyface.setNumWrap(0);
|
|
@@ -235619,7 +235938,7 @@ class PolyfaceQuery {
|
|
|
235619
235938
|
options.needColors = polyface.color !== undefined;
|
|
235620
235939
|
options.needTwoSided = polyface.twoSided;
|
|
235621
235940
|
for (const partition of partitions) {
|
|
235622
|
-
const builder =
|
|
235941
|
+
const builder = _PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_21__["PolyfaceBuilder"].create(options);
|
|
235623
235942
|
polyface.reset();
|
|
235624
235943
|
for (const facetIndex of partition) {
|
|
235625
235944
|
polyface.moveToReadIndex(facetIndex);
|
|
@@ -235632,7 +235951,7 @@ class PolyfaceQuery {
|
|
|
235632
235951
|
/** Clone facets that pass an filter function
|
|
235633
235952
|
*/
|
|
235634
235953
|
static cloneFiltered(source, filter) {
|
|
235635
|
-
if (source instanceof
|
|
235954
|
+
if (source instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"]) {
|
|
235636
235955
|
return this.cloneFiltered(source.createVisitor(0), filter);
|
|
235637
235956
|
}
|
|
235638
235957
|
source.setNumWrap(0);
|
|
@@ -235641,7 +235960,7 @@ class PolyfaceQuery {
|
|
|
235641
235960
|
options.needParams = source.param !== undefined;
|
|
235642
235961
|
options.needColors = source.color !== undefined;
|
|
235643
235962
|
options.needTwoSided = source.twoSided;
|
|
235644
|
-
const builder =
|
|
235963
|
+
const builder = _PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_21__["PolyfaceBuilder"].create(options);
|
|
235645
235964
|
source.reset();
|
|
235646
235965
|
for (; source.moveToNextFacet();) {
|
|
235647
235966
|
if (filter(source))
|
|
@@ -235669,11 +235988,11 @@ class PolyfaceQuery {
|
|
|
235669
235988
|
* * Return array of arrays of facet indices.
|
|
235670
235989
|
*/
|
|
235671
235990
|
static partitionFacetIndicesByEdgeConnectedComponent(polyface) {
|
|
235672
|
-
if (polyface instanceof
|
|
235991
|
+
if (polyface instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"]) {
|
|
235673
235992
|
return this.partitionFacetIndicesByEdgeConnectedComponent(polyface.createVisitor(0));
|
|
235674
235993
|
}
|
|
235675
235994
|
polyface.setNumWrap(1);
|
|
235676
|
-
const matcher = new
|
|
235995
|
+
const matcher = new _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__["IndexedEdgeMatcher"]();
|
|
235677
235996
|
polyface.reset();
|
|
235678
235997
|
let numFacets = 0;
|
|
235679
235998
|
while (polyface.moveToNextFacet()) {
|
|
@@ -235685,9 +236004,9 @@ class PolyfaceQuery {
|
|
|
235685
236004
|
}
|
|
235686
236005
|
const allEdges = [];
|
|
235687
236006
|
matcher.sortAndCollectClusters(allEdges, allEdges, allEdges, allEdges);
|
|
235688
|
-
const context = new
|
|
236007
|
+
const context = new _numerics_UnionFind__WEBPACK_IMPORTED_MODULE_12__["UnionFindContext"](numFacets);
|
|
235689
236008
|
for (const cluster of allEdges) {
|
|
235690
|
-
if (cluster instanceof
|
|
236009
|
+
if (cluster instanceof _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__["SortableEdge"]) {
|
|
235691
236010
|
// this edge does not connect anywhere. Ignore it!!
|
|
235692
236011
|
}
|
|
235693
236012
|
else {
|
|
@@ -235718,7 +236037,7 @@ class PolyfaceQuery {
|
|
|
235718
236037
|
* * Facets are ASSUMED to be convex and planar.
|
|
235719
236038
|
*/
|
|
235720
236039
|
static sweepLinestringToFacetsXYreturnSweptFacets(linestringPoints, polyface) {
|
|
235721
|
-
const builder =
|
|
236040
|
+
const builder = _PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_21__["PolyfaceBuilder"].create();
|
|
235722
236041
|
this.announceSweepLinestringToConvexPolyfaceXY(linestringPoints, polyface, (_linestring, _segmentIndex, _polyface, _facetIndex, points) => {
|
|
235723
236042
|
if (points.length === 4)
|
|
235724
236043
|
builder.addQuadFacet(points);
|
|
@@ -235741,7 +236060,7 @@ class PolyfaceQuery {
|
|
|
235741
236060
|
* * Return chains.
|
|
235742
236061
|
*/
|
|
235743
236062
|
static sweepLinestringToFacetsXYReturnChains(linestringPoints, polyface) {
|
|
235744
|
-
const chainContext =
|
|
236063
|
+
const chainContext = _topology_ChainMerge__WEBPACK_IMPORTED_MODULE_13__["ChainMergeContext"].create();
|
|
235745
236064
|
this.announceSweepLinestringToConvexPolyfaceXY(linestringPoints, polyface, (_linestring, _segmentIndex, _polyface, _facetIndex, points, indexA, indexB) => {
|
|
235746
236065
|
chainContext.addSegment(points[indexA], points[indexB]);
|
|
235747
236066
|
});
|
|
@@ -235755,7 +236074,7 @@ class PolyfaceQuery {
|
|
|
235755
236074
|
* * Return chains.
|
|
235756
236075
|
*/
|
|
235757
236076
|
static async asyncSweepLinestringToFacetsXYReturnChains(linestringPoints, polyface) {
|
|
235758
|
-
const chainContext =
|
|
236077
|
+
const chainContext = _topology_ChainMerge__WEBPACK_IMPORTED_MODULE_13__["ChainMergeContext"].create();
|
|
235759
236078
|
await Promise.resolve(this.asyncAnnounceSweepLinestringToConvexPolyfaceXY(linestringPoints, polyface, (_linestring, _segmentIndex, _polyface, _facetIndex, points, indexA, indexB) => {
|
|
235760
236079
|
chainContext.addSegment(points[indexA], points[indexB]);
|
|
235761
236080
|
}));
|
|
@@ -235768,10 +236087,10 @@ class PolyfaceQuery {
|
|
|
235768
236087
|
* * Return statistical summary of x,y,z ranges.
|
|
235769
236088
|
*/
|
|
235770
236089
|
static collectRangeLengthData(polyface) {
|
|
235771
|
-
if (polyface instanceof
|
|
236090
|
+
if (polyface instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"]) {
|
|
235772
236091
|
return this.collectRangeLengthData(polyface.createVisitor(0));
|
|
235773
236092
|
}
|
|
235774
|
-
const rangeData = new
|
|
236093
|
+
const rangeData = new _RangeLengthData__WEBPACK_IMPORTED_MODULE_22__["RangeLengthData"]();
|
|
235775
236094
|
// polyface is a visitor ...
|
|
235776
236095
|
for (polyface.reset(); polyface.moveToNextFacet();)
|
|
235777
236096
|
rangeData.accumulateGrowableXYZArrayRange(polyface.point);
|
|
@@ -235783,12 +236102,12 @@ class PolyfaceQuery {
|
|
|
235783
236102
|
static cloneWithTVertexFixup(polyface) {
|
|
235784
236103
|
const oldFacetVisitor = polyface.createVisitor(1); // This is to visit the existing facets.
|
|
235785
236104
|
const newFacetVisitor = polyface.createVisitor(0); // This is to build the new facets.
|
|
235786
|
-
const rangeSearcher =
|
|
235787
|
-
const builder =
|
|
235788
|
-
const edgeRange =
|
|
235789
|
-
const point0 =
|
|
235790
|
-
const point1 =
|
|
235791
|
-
const spacePoint =
|
|
236105
|
+
const rangeSearcher = _multiclip_XYPointBuckets__WEBPACK_IMPORTED_MODULE_19__["XYPointBuckets"].create(polyface.data.point, 30);
|
|
236106
|
+
const builder = _PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_21__["PolyfaceBuilder"].create();
|
|
236107
|
+
const edgeRange = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_9__["Range3d"].createNull();
|
|
236108
|
+
const point0 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
236109
|
+
const point1 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
236110
|
+
const spacePoint = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
235792
236111
|
const segment = _curve_LineSegment3d__WEBPACK_IMPORTED_MODULE_1__["LineSegment3d"].create(point0, point1);
|
|
235793
236112
|
for (oldFacetVisitor.reset(); oldFacetVisitor.moveToNextFacet();) {
|
|
235794
236113
|
newFacetVisitor.clearArrays();
|
|
@@ -235913,7 +236232,7 @@ class PolyfaceQuery {
|
|
|
235913
236232
|
* @param clusterSelector indicates whether duplicate clusters are to have 0, 1, or all facets included
|
|
235914
236233
|
*/
|
|
235915
236234
|
static cloneByFacetDuplication(source, includeSingletons, clusterSelector) {
|
|
235916
|
-
const builder =
|
|
236235
|
+
const builder = _PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_21__["PolyfaceBuilder"].create();
|
|
235917
236236
|
const visitor = source.createVisitor(0);
|
|
235918
236237
|
this.announceDuplicateFacetIndices(source, (clusterFacetIndices) => {
|
|
235919
236238
|
let numToSelect = 0;
|
|
@@ -235942,9 +236261,9 @@ class PolyfaceQuery {
|
|
|
235942
236261
|
static cloneWithColinearEdgeFixup(polyface) {
|
|
235943
236262
|
const oldFacetVisitor = polyface.createVisitor(2); // This is to visit the existing facets.
|
|
235944
236263
|
const newFacetVisitor = polyface.createVisitor(0); // This is to build the new facets.
|
|
235945
|
-
const builder =
|
|
235946
|
-
const vector01 =
|
|
235947
|
-
const vector12 =
|
|
236264
|
+
const builder = _PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_21__["PolyfaceBuilder"].create();
|
|
236265
|
+
const vector01 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Vector3d"].create();
|
|
236266
|
+
const vector12 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Vector3d"].create();
|
|
235948
236267
|
const numPoint = polyface.data.point.length;
|
|
235949
236268
|
const pointState = new Int32Array(numPoint);
|
|
235950
236269
|
// FIRST PASS -- in each sector of each facet, determine if the sector has colinear incoming and outgoing vectors.
|
|
@@ -235991,7 +236310,7 @@ class PolyfaceQuery {
|
|
|
235991
236310
|
*/
|
|
235992
236311
|
static setEdgeVisibility(polyface, clusters, value) {
|
|
235993
236312
|
for (const cluster of clusters) {
|
|
235994
|
-
if (cluster instanceof
|
|
236313
|
+
if (cluster instanceof _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__["SortableEdge"]) {
|
|
235995
236314
|
this.setSingleEdgeVisibility(polyface, cluster.facetIndex, cluster.vertexIndexA, value);
|
|
235996
236315
|
}
|
|
235997
236316
|
else if (Array.isArray(cluster)) {
|
|
@@ -236017,7 +236336,7 @@ class PolyfaceQuery {
|
|
|
236017
236336
|
}
|
|
236018
236337
|
/** Load all half edges from a mesh to an IndexedEdgeMatcher */
|
|
236019
236338
|
static createIndexedEdges(visitor) {
|
|
236020
|
-
const edges = new
|
|
236339
|
+
const edges = new _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__["IndexedEdgeMatcher"]();
|
|
236021
236340
|
visitor.reset();
|
|
236022
236341
|
while (visitor.moveToNextFacet()) {
|
|
236023
236342
|
const numEdges = visitor.pointCount - 1;
|
|
@@ -236045,8 +236364,8 @@ class PolyfaceQuery {
|
|
|
236045
236364
|
this.markAllEdgeVisibility(mesh, false);
|
|
236046
236365
|
this.setEdgeVisibility(mesh, boundaryEdges, true);
|
|
236047
236366
|
if (sharpEdgeAngle !== undefined) {
|
|
236048
|
-
const normal0 =
|
|
236049
|
-
const normal1 =
|
|
236367
|
+
const normal0 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Vector3d"].create();
|
|
236368
|
+
const normal1 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Vector3d"].create();
|
|
236050
236369
|
for (const pair of pairedEdges) {
|
|
236051
236370
|
if (Array.isArray(pair) && pair.length === 2) {
|
|
236052
236371
|
const e0 = pair[0];
|
|
@@ -236068,9 +236387,9 @@ class PolyfaceQuery {
|
|
|
236068
236387
|
*/
|
|
236069
236388
|
static computeFacetUnitNormal(visitor, facetIndex, result) {
|
|
236070
236389
|
if (!result)
|
|
236071
|
-
result =
|
|
236390
|
+
result = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Vector3d"].create();
|
|
236072
236391
|
if (visitor.moveToReadIndex(facetIndex)) {
|
|
236073
|
-
if (
|
|
236392
|
+
if (_geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_8__["PolygonOps"].unitNormal(visitor.point, result))
|
|
236074
236393
|
return result;
|
|
236075
236394
|
}
|
|
236076
236395
|
return undefined;
|
|
@@ -236091,14 +236410,14 @@ class PolyfaceQuery {
|
|
|
236091
236410
|
* @param mesh
|
|
236092
236411
|
*/
|
|
236093
236412
|
static reorientVertexOrderAroundFacetsForConsistentOrientation(mesh) {
|
|
236094
|
-
return
|
|
236413
|
+
return _FacetOrientation__WEBPACK_IMPORTED_MODULE_14__["FacetOrientationFixup"].doFixup(mesh);
|
|
236095
236414
|
}
|
|
236096
236415
|
/**
|
|
236097
236416
|
* Set up indexed normals with one normal in the plane of each facet of the mesh.
|
|
236098
236417
|
* @param polyface
|
|
236099
236418
|
*/
|
|
236100
236419
|
static buildPerFaceNormals(polyface) {
|
|
236101
|
-
|
|
236420
|
+
_multiclip_BuildAverageNormalsContext__WEBPACK_IMPORTED_MODULE_17__["BuildAverageNormalsContext"].buildPerFaceNormals(polyface);
|
|
236102
236421
|
}
|
|
236103
236422
|
/**
|
|
236104
236423
|
* * At each vertex of the mesh
|
|
@@ -236110,8 +236429,8 @@ class PolyfaceQuery {
|
|
|
236110
236429
|
* @param polyface polyface to update.
|
|
236111
236430
|
* @param toleranceAngle averaging is done between normals up to this angle.
|
|
236112
236431
|
*/
|
|
236113
|
-
static buildAverageNormals(polyface, toleranceAngle =
|
|
236114
|
-
|
|
236432
|
+
static buildAverageNormals(polyface, toleranceAngle = _geometry3d_Angle__WEBPACK_IMPORTED_MODULE_6__["Angle"].createDegrees(31.0)) {
|
|
236433
|
+
_multiclip_BuildAverageNormalsContext__WEBPACK_IMPORTED_MODULE_17__["BuildAverageNormalsContext"].buildFastAverageNormals(polyface, toleranceAngle);
|
|
236115
236434
|
}
|
|
236116
236435
|
}
|
|
236117
236436
|
// amount of computation to do per step of async methods.
|
|
@@ -241904,11 +242223,11 @@ var BGFBAccessors;
|
|
|
241904
242223
|
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
241905
242224
|
}
|
|
241906
242225
|
/**
|
|
241907
|
-
* @returns
|
|
242226
|
+
* @returns Uint32Array
|
|
241908
242227
|
*/
|
|
241909
242228
|
intColorArray() {
|
|
241910
242229
|
const offset = this.bb.__offset(this.bb_pos, 12);
|
|
241911
|
-
return offset ? new
|
|
242230
|
+
return offset ? new Uint32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
|
|
241912
242231
|
}
|
|
241913
242232
|
/**
|
|
241914
242233
|
* @param number index
|
|
@@ -243336,7 +243655,6 @@ class BGFBReader {
|
|
|
243336
243655
|
const normalIndexI32 = nullToUndefined(polyfaceHeader.normalIndexArray());
|
|
243337
243656
|
const colorIndexI32 = nullToUndefined(polyfaceHeader.colorIndexArray());
|
|
243338
243657
|
const taggedNumericDataOffset = polyfaceHeader.taggedNumericData();
|
|
243339
|
-
// const colorIndexI32 = nullToUndefined<Int32Array>(offsetToPolyface.colorIndexArray());
|
|
243340
243658
|
if (meshStyle === 1 && pointF64 && pointIndexI32) {
|
|
243341
243659
|
const polyface = _polyface_Polyface__WEBPACK_IMPORTED_MODULE_6__["IndexedPolyface"].create(normalF64 !== undefined, paramF64 !== undefined, intColorU32 !== undefined, twoSided);
|
|
243342
243660
|
polyface.expectedClosure = expectedClosure;
|
|
@@ -245495,7 +245813,8 @@ class Sample {
|
|
|
245495
245813
|
mesh.addParamUV(i, j);
|
|
245496
245814
|
}
|
|
245497
245815
|
}
|
|
245498
|
-
let color =
|
|
245816
|
+
let color = 0xFF5CE51A; // arbitrary color so colorIndex is different from color.
|
|
245817
|
+
const colorDiff = 0x12345;
|
|
245499
245818
|
// Push elements to index array (vertices are calculated using i and j positioning for each point)
|
|
245500
245819
|
let thisColorIndex = 0;
|
|
245501
245820
|
for (let j = 0; j + 1 < numYVertices; j++) {
|
|
@@ -245511,7 +245830,7 @@ class Sample {
|
|
|
245511
245830
|
mesh.addPointIndex(vertex11, false);
|
|
245512
245831
|
// make color === faceIndex
|
|
245513
245832
|
if (createColors) {
|
|
245514
|
-
thisColorIndex = mesh.addColor(color
|
|
245833
|
+
thisColorIndex = mesh.addColor(color += colorDiff);
|
|
245515
245834
|
mesh.addColorIndex(thisColorIndex);
|
|
245516
245835
|
mesh.addColorIndex(thisColorIndex);
|
|
245517
245836
|
mesh.addColorIndex(thisColorIndex);
|
|
@@ -245559,7 +245878,7 @@ class Sample {
|
|
|
245559
245878
|
mesh.addPointIndex(vertex01, true);
|
|
245560
245879
|
// make color === faceIndex
|
|
245561
245880
|
if (createColors) {
|
|
245562
|
-
thisColorIndex = mesh.addColor(color
|
|
245881
|
+
thisColorIndex = mesh.addColor(color += colorDiff);
|
|
245563
245882
|
mesh.addColorIndex(thisColorIndex);
|
|
245564
245883
|
mesh.addColorIndex(thisColorIndex);
|
|
245565
245884
|
mesh.addColorIndex(thisColorIndex);
|