@itwin/rpcinterface-full-stack-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 +551 -232
- package/lib/dist/bundled-tests.js.map +1 -1
- package/package.json +14 -14
|
@@ -126139,26 +126139,65 @@ class Target extends _RenderTarget__WEBPACK_IMPORTED_MODULE_8__["RenderTarget"]
|
|
|
126139
126139
|
// 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
|
|
126140
126140
|
// to the pick buffers and others we don't want - such as non-pickable decorations - do.
|
|
126141
126141
|
// Render to an offscreen buffer so that we don't destroy the current color buffer.
|
|
126142
|
-
const
|
|
126143
|
-
if (
|
|
126142
|
+
const resources = this.createOrReuseReadPixelResources(rect);
|
|
126143
|
+
if (resources === undefined) {
|
|
126144
126144
|
receiver(undefined);
|
|
126145
126145
|
return;
|
|
126146
126146
|
}
|
|
126147
126147
|
let result;
|
|
126148
|
-
|
|
126149
|
-
|
|
126150
|
-
this.
|
|
126151
|
-
|
|
126152
|
-
|
|
126153
|
-
|
|
126154
|
-
});
|
|
126155
|
-
Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["dispose"])(fbo);
|
|
126156
|
-
}
|
|
126157
|
-
Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["dispose"])(texture);
|
|
126148
|
+
this.renderSystem.frameBufferStack.execute(resources.fbo, true, false, () => {
|
|
126149
|
+
this._drawNonLocatable = !excludeNonLocatable;
|
|
126150
|
+
result = this.readPixelsFromFbo(rect, selector);
|
|
126151
|
+
this._drawNonLocatable = true;
|
|
126152
|
+
});
|
|
126153
|
+
this.disposeOrReuseReadPixelResources(resources);
|
|
126158
126154
|
receiver(result);
|
|
126159
126155
|
// Reset the batch IDs in all batches drawn for this call.
|
|
126160
126156
|
this.uniforms.batch.resetBatchState();
|
|
126161
126157
|
}
|
|
126158
|
+
createOrReuseReadPixelResources(rect) {
|
|
126159
|
+
if (this._readPixelReusableResources !== undefined) {
|
|
126160
|
+
// To reuse a texture, we need it to be the same size or bigger than what we need
|
|
126161
|
+
if (this._readPixelReusableResources.texture.width >= rect.width && this._readPixelReusableResources.texture.height >= rect.height) {
|
|
126162
|
+
const resources = this._readPixelReusableResources;
|
|
126163
|
+
this._readPixelReusableResources = undefined;
|
|
126164
|
+
return resources;
|
|
126165
|
+
}
|
|
126166
|
+
}
|
|
126167
|
+
// Create a new texture/fbo
|
|
126168
|
+
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);
|
|
126169
|
+
if (texture === undefined)
|
|
126170
|
+
return undefined;
|
|
126171
|
+
const fbo = _FrameBuffer__WEBPACK_IMPORTED_MODULE_13__["FrameBuffer"].create([texture]);
|
|
126172
|
+
if (fbo === undefined) {
|
|
126173
|
+
Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["dispose"])(texture);
|
|
126174
|
+
return undefined;
|
|
126175
|
+
}
|
|
126176
|
+
return { texture, fbo };
|
|
126177
|
+
}
|
|
126178
|
+
disposeOrReuseReadPixelResources({ texture, fbo }) {
|
|
126179
|
+
const maxReusableTextureSize = 256;
|
|
126180
|
+
const isTooBigToReuse = texture.width > maxReusableTextureSize || texture.height > maxReusableTextureSize;
|
|
126181
|
+
let reuseResources = !isTooBigToReuse;
|
|
126182
|
+
if (reuseResources && this._readPixelReusableResources !== undefined) {
|
|
126183
|
+
// Keep the biggest texture
|
|
126184
|
+
if (this._readPixelReusableResources.texture.width > texture.width && this._readPixelReusableResources.texture.height > texture.height) {
|
|
126185
|
+
reuseResources = false; // The current resources being reused are better
|
|
126186
|
+
}
|
|
126187
|
+
else {
|
|
126188
|
+
// Free memory of the current reusable resources before replacing them
|
|
126189
|
+
Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["dispose"])(this._readPixelReusableResources.fbo);
|
|
126190
|
+
Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["dispose"])(this._readPixelReusableResources.texture);
|
|
126191
|
+
}
|
|
126192
|
+
}
|
|
126193
|
+
if (reuseResources) {
|
|
126194
|
+
this._readPixelReusableResources = { texture, fbo };
|
|
126195
|
+
}
|
|
126196
|
+
else {
|
|
126197
|
+
Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["dispose"])(fbo);
|
|
126198
|
+
Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["dispose"])(texture);
|
|
126199
|
+
}
|
|
126200
|
+
}
|
|
126162
126201
|
beginReadPixels(selector, cullingFrustum) {
|
|
126163
126202
|
this.beginPerfMetricRecord("Init Commands", true);
|
|
126164
126203
|
this._isReadPixelsInProgress = true;
|
|
@@ -163284,9 +163323,14 @@ class ToolAdmin {
|
|
|
163284
163323
|
clearMotionPromises() {
|
|
163285
163324
|
this._snapMotionPromise = this._toolMotionPromise = undefined;
|
|
163286
163325
|
}
|
|
163326
|
+
async forceOnMotionSnap(ev) {
|
|
163327
|
+
// Make sure that we fire the motion snap event correctly
|
|
163328
|
+
this._lastHandledMotionTime = undefined;
|
|
163329
|
+
return this.onMotionSnap(ev);
|
|
163330
|
+
}
|
|
163287
163331
|
async onMotionSnap(ev) {
|
|
163288
163332
|
try {
|
|
163289
|
-
await
|
|
163333
|
+
await this.onMotionSnapOrSkip(ev);
|
|
163290
163334
|
return true;
|
|
163291
163335
|
}
|
|
163292
163336
|
catch (error) {
|
|
@@ -163295,6 +163339,22 @@ class ToolAdmin {
|
|
|
163295
163339
|
throw error; // unknown error
|
|
163296
163340
|
}
|
|
163297
163341
|
}
|
|
163342
|
+
// Call accuSnap.onMotion
|
|
163343
|
+
async onMotionSnapOrSkip(ev) {
|
|
163344
|
+
if (this.shouldSkipOnMotionSnap())
|
|
163345
|
+
return;
|
|
163346
|
+
await _IModelApp__WEBPACK_IMPORTED_MODULE_5__["IModelApp"].accuSnap.onMotion(ev);
|
|
163347
|
+
this._lastHandledMotionTime = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["BeTimePoint"].now();
|
|
163348
|
+
}
|
|
163349
|
+
// Should the current onMotionSnap event be skipped to avoid unnecessary ReadPixel calls?
|
|
163350
|
+
shouldSkipOnMotionSnap() {
|
|
163351
|
+
if (this._lastHandledMotionTime === undefined)
|
|
163352
|
+
return false;
|
|
163353
|
+
const now = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["BeTimePoint"].now();
|
|
163354
|
+
const msSinceLastCall = now.milliseconds - this._lastHandledMotionTime.milliseconds;
|
|
163355
|
+
const delay = 1000 / _ToolSettings__WEBPACK_IMPORTED_MODULE_14__["ToolSettings"].maxOnMotionSnapCallPerSecond;
|
|
163356
|
+
return msSinceLastCall < delay;
|
|
163357
|
+
}
|
|
163298
163358
|
async onStartDrag(ev, tool) {
|
|
163299
163359
|
if (undefined !== tool && _Tool__WEBPACK_IMPORTED_MODULE_13__["EventHandled"].Yes === await tool.onMouseStartDrag(ev))
|
|
163300
163360
|
return _Tool__WEBPACK_IMPORTED_MODULE_13__["EventHandled"].Yes;
|
|
@@ -163308,6 +163368,10 @@ class ToolAdmin {
|
|
|
163308
163368
|
this.setIncompatibleViewportCursor(false);
|
|
163309
163369
|
return;
|
|
163310
163370
|
}
|
|
163371
|
+
// Detect when the motion stops by setting a timeout
|
|
163372
|
+
if (this._mouseMoveOverTimeout !== undefined)
|
|
163373
|
+
clearTimeout(this._mouseMoveOverTimeout); // If a previous timeout was up, it is cancelled: the movement is not over yet
|
|
163374
|
+
this._mouseMoveOverTimeout = setTimeout(async () => { await this.onMotionEnd(vp, pt2d, inputSource); }, 100);
|
|
163311
163375
|
const ev = new _Tool__WEBPACK_IMPORTED_MODULE_13__["BeButtonEvent"]();
|
|
163312
163376
|
current.fromPoint(vp, pt2d, inputSource);
|
|
163313
163377
|
current.toEvent(ev, false);
|
|
@@ -163353,6 +163417,14 @@ class ToolAdmin {
|
|
|
163353
163417
|
return processMotion();
|
|
163354
163418
|
}).catch((_) => { });
|
|
163355
163419
|
}
|
|
163420
|
+
// Called when we detect that the motion stopped
|
|
163421
|
+
async onMotionEnd(vp, pos, inputSource) {
|
|
163422
|
+
const current = this.currentInputState;
|
|
163423
|
+
const ev = new _Tool__WEBPACK_IMPORTED_MODULE_13__["BeButtonEvent"]();
|
|
163424
|
+
current.fromPoint(vp, pos, inputSource);
|
|
163425
|
+
current.toEvent(ev, false);
|
|
163426
|
+
await this.forceOnMotionSnap(ev);
|
|
163427
|
+
}
|
|
163356
163428
|
async onMouseMove(event) {
|
|
163357
163429
|
const vp = event.vp;
|
|
163358
163430
|
const pos = this.getMousePosition(event);
|
|
@@ -164420,6 +164492,8 @@ ToolSettings.viewingInertia = {
|
|
|
164420
164492
|
/** Maximum duration of the inertia operation. Important when frame rates are low. */
|
|
164421
164493
|
duration: _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["BeDuration"].fromMilliseconds(500),
|
|
164422
164494
|
};
|
|
164495
|
+
/** Maximum number of times in a second the accuSnap tool's onMotion function is called. */
|
|
164496
|
+
ToolSettings.maxOnMotionSnapCallPerSecond = 15;
|
|
164423
164497
|
|
|
164424
164498
|
|
|
164425
164499
|
/***/ }),
|
|
@@ -168274,7 +168348,7 @@ SetupWalkCameraTool.iconSpec = "icon-camera-location";
|
|
|
168274
168348
|
/*! exports provided: name, version, description, main, module, typings, license, scripts, repository, keywords, author, peerDependencies, //devDependencies, devDependencies, //dependencies, dependencies, nyc, eslintConfig, default */
|
|
168275
168349
|
/***/ (function(module) {
|
|
168276
168350
|
|
|
168277
|
-
module.exports = JSON.parse("{\"name\":\"@itwin/core-frontend\",\"version\":\"3.2.0-dev.
|
|
168351
|
+
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\"}}]}}");
|
|
168278
168352
|
|
|
168279
168353
|
/***/ }),
|
|
168280
168354
|
|
|
@@ -216949,13 +217023,14 @@ class ClusterableArray extends _geometry3d_GrowableBlockedArray__WEBPACK_IMPORTE
|
|
|
216949
217023
|
for (let i = 0; i < n; i++)
|
|
216950
217024
|
this._data[i0 + i] = data[i];
|
|
216951
217025
|
}
|
|
216952
|
-
/** add a block with
|
|
217026
|
+
/** add a block directly with 1 to 5 listed content parameters.
|
|
216953
217027
|
* This assumes numDataPerPoint is sufficient for the parameters provided.
|
|
216954
217028
|
*/
|
|
216955
217029
|
addDirect(x0, x1, x2, x3, x4) {
|
|
216956
217030
|
const i0 = this.newBlockIndex();
|
|
216957
217031
|
this._data[i0 + 1] = x0;
|
|
216958
|
-
|
|
217032
|
+
if (x1 !== undefined)
|
|
217033
|
+
this._data[i0 + 2] = x1;
|
|
216959
217034
|
if (x2 !== undefined)
|
|
216960
217035
|
this._data[i0 + 3] = x2;
|
|
216961
217036
|
if (x3 !== undefined)
|
|
@@ -217240,6 +217315,31 @@ class ClusterableArray extends _geometry3d_GrowableBlockedArray__WEBPACK_IMPORTE
|
|
|
217240
217315
|
});
|
|
217241
217316
|
return result;
|
|
217242
217317
|
}
|
|
217318
|
+
/**
|
|
217319
|
+
* Returns number array with indices mapping old to new.
|
|
217320
|
+
* @param data numbers to cluster.
|
|
217321
|
+
*/
|
|
217322
|
+
static clusterNumberArray(data, tolerance = _Geometry__WEBPACK_IMPORTED_MODULE_0__["Geometry"].smallMetricDistance) {
|
|
217323
|
+
const clusterArray = new ClusterableArray(1, 0, data.length);
|
|
217324
|
+
data.forEach((x) => { clusterArray.addDirect(x); });
|
|
217325
|
+
const order = clusterArray.clusterIndicesLexical(tolerance);
|
|
217326
|
+
const result = new PackedNumbersWithIndex(data.length);
|
|
217327
|
+
let currentClusterIndex = 0;
|
|
217328
|
+
let numThisCluster = 0;
|
|
217329
|
+
order.forEach((k) => {
|
|
217330
|
+
if (ClusterableArray.isClusterTerminator(k)) {
|
|
217331
|
+
currentClusterIndex++;
|
|
217332
|
+
numThisCluster = 0;
|
|
217333
|
+
}
|
|
217334
|
+
else {
|
|
217335
|
+
if (numThisCluster === 0)
|
|
217336
|
+
result.packedNumbers.push(data[k]);
|
|
217337
|
+
result.oldToNew[k] = currentClusterIndex;
|
|
217338
|
+
numThisCluster++;
|
|
217339
|
+
}
|
|
217340
|
+
});
|
|
217341
|
+
return result;
|
|
217342
|
+
}
|
|
217243
217343
|
/**
|
|
217244
217344
|
* Returns packed points with indices mapping old to new.
|
|
217245
217345
|
* @param data points to cluster.
|
|
@@ -217380,6 +217480,32 @@ class PackedPoint2dsWithIndex {
|
|
|
217380
217480
|
}
|
|
217381
217481
|
/** integer value for unknown index. */
|
|
217382
217482
|
PackedPoint2dsWithIndex.invalidIndex = 0xFFFFffff;
|
|
217483
|
+
/**
|
|
217484
|
+
* @internal
|
|
217485
|
+
*/
|
|
217486
|
+
class PackedNumbersWithIndex {
|
|
217487
|
+
/** construct a PackedNumbers object with
|
|
217488
|
+
* * empty packedNumbers array
|
|
217489
|
+
* * oldToNew indices all initialized to PackedNumbers.invalidIndex
|
|
217490
|
+
*/
|
|
217491
|
+
constructor(numOldIndexEntry) {
|
|
217492
|
+
this.packedNumbers = [];
|
|
217493
|
+
this.oldToNew = new Uint32Array(numOldIndexEntry);
|
|
217494
|
+
for (let i = 0; i < numOldIndexEntry; i++) {
|
|
217495
|
+
this.oldToNew[i] = PackedPointsWithIndex.invalidIndex;
|
|
217496
|
+
}
|
|
217497
|
+
}
|
|
217498
|
+
/**
|
|
217499
|
+
* Use the oldToNew array to update an array of "old" indices.
|
|
217500
|
+
* @param indices array of indices into prepacked array.
|
|
217501
|
+
* @returns true if all input indices were valid for the oldToNew array.
|
|
217502
|
+
*/
|
|
217503
|
+
updateIndices(indices) {
|
|
217504
|
+
return updateIndices(indices, this.oldToNew);
|
|
217505
|
+
}
|
|
217506
|
+
}
|
|
217507
|
+
/** integer value for unknown index. */
|
|
217508
|
+
PackedNumbersWithIndex.invalidIndex = 0xFFFFffff;
|
|
217383
217509
|
|
|
217384
217510
|
|
|
217385
217511
|
/***/ }),
|
|
@@ -222104,9 +222230,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
222104
222230
|
/** @packageDocumentation
|
|
222105
222231
|
* @module Polyface
|
|
222106
222232
|
*/
|
|
222107
|
-
// For boundary sorting, an edge exists as a (packed!) Float64Array.
|
|
222108
|
-
// Fixed entries are:
|
|
222109
|
-
// 0:
|
|
222110
222233
|
/**
|
|
222111
222234
|
* * For boundary sorting, an edge is a (packed!) Float64Array.
|
|
222112
222235
|
* * Fixed entry positions are:
|
|
@@ -222509,7 +222632,7 @@ class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
|
|
|
222509
222632
|
* * The activeFacetIndices array indicates all facets to be visited.
|
|
222510
222633
|
*/
|
|
222511
222634
|
static createSubsetVisitor(polyface, activeFacetIndices, numWrap) {
|
|
222512
|
-
return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices
|
|
222635
|
+
return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices, numWrap);
|
|
222513
222636
|
}
|
|
222514
222637
|
/** Advance the iterator to a particular facet in the client polyface */
|
|
222515
222638
|
moveToReadIndex(activeIndex) {
|
|
@@ -222559,14 +222682,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
222559
222682
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IndexedPolyface", function() { return IndexedPolyface; });
|
|
222560
222683
|
/* harmony import */ var _curve_GeometryQuery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../curve/GeometryQuery */ "../../core/geometry/lib/esm/curve/GeometryQuery.js");
|
|
222561
222684
|
/* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
|
|
222562
|
-
/* harmony import */ var
|
|
222563
|
-
/* harmony import */ var
|
|
222564
|
-
/* harmony import */ var
|
|
222565
|
-
/* harmony import */ var
|
|
222566
|
-
/* harmony import */ var
|
|
222567
|
-
/* harmony import */ var
|
|
222568
|
-
/* harmony import */ var
|
|
222569
|
-
/* harmony import */ var _PolyfaceData__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./PolyfaceData */ "../../core/geometry/lib/esm/polyface/PolyfaceData.js");
|
|
222685
|
+
/* harmony import */ var _geometry3d_GrowableXYArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../geometry3d/GrowableXYArray */ "../../core/geometry/lib/esm/geometry3d/GrowableXYArray.js");
|
|
222686
|
+
/* harmony import */ var _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geometry3d/GrowableXYZArray */ "../../core/geometry/lib/esm/geometry3d/GrowableXYZArray.js");
|
|
222687
|
+
/* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
|
|
222688
|
+
/* harmony import */ var _geometry3d_PointHelpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geometry3d/PointHelpers */ "../../core/geometry/lib/esm/geometry3d/PointHelpers.js");
|
|
222689
|
+
/* harmony import */ var _FacetFaceData__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./FacetFaceData */ "../../core/geometry/lib/esm/polyface/FacetFaceData.js");
|
|
222690
|
+
/* harmony import */ var _IndexedPolyfaceVisitor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./IndexedPolyfaceVisitor */ "../../core/geometry/lib/esm/polyface/IndexedPolyfaceVisitor.js");
|
|
222691
|
+
/* harmony import */ var _PolyfaceData__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./PolyfaceData */ "../../core/geometry/lib/esm/polyface/PolyfaceData.js");
|
|
222570
222692
|
/*---------------------------------------------------------------------------------------------
|
|
222571
222693
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
222572
222694
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -222574,7 +222696,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
222574
222696
|
/** @packageDocumentation
|
|
222575
222697
|
* @module Polyface
|
|
222576
222698
|
*/
|
|
222577
|
-
// import { Point2d } from "./Geometry2d";
|
|
222578
222699
|
/* eslint-disable @typescript-eslint/naming-convention, no-empty */
|
|
222579
222700
|
|
|
222580
222701
|
|
|
@@ -222585,12 +222706,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
222585
222706
|
|
|
222586
222707
|
|
|
222587
222708
|
|
|
222588
|
-
|
|
222589
|
-
function allDefined(valueA, valueB, valueC) {
|
|
222590
|
-
return valueA !== undefined && valueB !== undefined && valueC !== undefined;
|
|
222591
|
-
}
|
|
222592
222709
|
/**
|
|
222593
|
-
* A Polyface is
|
|
222710
|
+
* A Polyface is an abstract mesh structure (of unspecified implementation) that provides a PolyfaceVisitor
|
|
222594
222711
|
* to iterate over its facets.
|
|
222595
222712
|
* @public
|
|
222596
222713
|
*/
|
|
@@ -222661,8 +222778,8 @@ class IndexedPolyface extends Polyface {
|
|
|
222661
222778
|
/** Tests for equivalence between two IndexedPolyfaces. */
|
|
222662
222779
|
isAlmostEqual(other) {
|
|
222663
222780
|
if (other instanceof IndexedPolyface) {
|
|
222664
|
-
return this.data.isAlmostEqual(other.data) &&
|
|
222665
|
-
|
|
222781
|
+
return this.data.isAlmostEqual(other.data) && _geometry3d_PointHelpers__WEBPACK_IMPORTED_MODULE_5__["NumberArray"].isExactEqual(this._facetStart, other._facetStart) &&
|
|
222782
|
+
_geometry3d_PointHelpers__WEBPACK_IMPORTED_MODULE_5__["NumberArray"].isExactEqual(this._facetToFaceData, other._facetToFaceData);
|
|
222666
222783
|
}
|
|
222667
222784
|
return false;
|
|
222668
222785
|
}
|
|
@@ -222716,50 +222833,45 @@ class IndexedPolyface extends Polyface {
|
|
|
222716
222833
|
}
|
|
222717
222834
|
/**
|
|
222718
222835
|
* * Add facets from source to this polyface.
|
|
222719
|
-
* *
|
|
222720
|
-
* *
|
|
222721
|
-
* *
|
|
222836
|
+
* * Optionally reverse facet indices as per PolyfaceData.reverseIndicesSingleFacet() with preserveStart = false, and invert source normals.
|
|
222837
|
+
* * Optionally apply a transform to points and normals.
|
|
222838
|
+
* * Will only copy param, normal, color, and face data if we are already tracking them AND/OR the source contains them.
|
|
222722
222839
|
*/
|
|
222723
222840
|
addIndexedPolyface(source, reversed, transform) {
|
|
222724
|
-
const
|
|
222725
|
-
|
|
222726
|
-
//
|
|
222727
|
-
const
|
|
222728
|
-
|
|
222729
|
-
|
|
222730
|
-
|
|
222731
|
-
for (let i = 0, n = source.data.point.length; i < n; i++) {
|
|
222732
|
-
sourcePoints.getPoint3dAtUncheckedPointIndex(i, xyz);
|
|
222841
|
+
const numSourceFacets = source.facetCount;
|
|
222842
|
+
// Add point, point index, and edge visibility data
|
|
222843
|
+
// Note: there is no need to build an intermediate index map since all points are added
|
|
222844
|
+
const startOfNewPoints = this.data.point.length;
|
|
222845
|
+
const xyz = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_4__["Point3d"].create();
|
|
222846
|
+
for (let i = 0; i < source.data.point.length; i++) {
|
|
222847
|
+
source.data.point.getPoint3dAtUncheckedPointIndex(i, xyz);
|
|
222733
222848
|
if (transform) {
|
|
222734
222849
|
transform.multiplyPoint3d(xyz, xyz);
|
|
222735
|
-
|
|
222850
|
+
this.addPoint(xyz);
|
|
222736
222851
|
}
|
|
222737
222852
|
else
|
|
222738
|
-
|
|
222853
|
+
this.addPoint(xyz);
|
|
222739
222854
|
}
|
|
222740
|
-
// Add point index and facet data
|
|
222741
|
-
const numSourceFacets = source._facetStart.length - 1;
|
|
222742
222855
|
for (let i = 0; i < numSourceFacets; i++) {
|
|
222743
222856
|
const i0 = source._facetStart[i];
|
|
222744
222857
|
const i1 = source._facetStart[i + 1];
|
|
222745
222858
|
if (reversed) {
|
|
222746
|
-
for (let j = i1; j-- > i0;) {
|
|
222747
|
-
this.addPointIndex(
|
|
222859
|
+
for (let j = i1; j-- > i0;) { // visibility is transferred from far vertex, e.g., -abc-d => dc-b-a
|
|
222860
|
+
this.addPointIndex(startOfNewPoints + source.data.pointIndex[j], source.data.edgeVisible[j > i0 ? j - 1 : i1 - 1]);
|
|
222748
222861
|
}
|
|
222749
222862
|
}
|
|
222750
222863
|
else {
|
|
222751
222864
|
for (let j = i0; j < i1; j++) {
|
|
222752
|
-
this.addPointIndex(
|
|
222865
|
+
this.addPointIndex(startOfNewPoints + source.data.pointIndex[j], source.data.edgeVisible[j]);
|
|
222753
222866
|
}
|
|
222754
222867
|
}
|
|
222755
222868
|
this.terminateFacet(false);
|
|
222756
222869
|
}
|
|
222757
222870
|
// Add param and param index data
|
|
222758
|
-
if (
|
|
222759
|
-
const
|
|
222760
|
-
|
|
222761
|
-
|
|
222762
|
-
for (let i = 0; i < source._facetStart.length; i++) { // Expect facet start and ends for points to match normals
|
|
222871
|
+
if (undefined !== this.data.param && undefined !== source.data.param && undefined !== source.data.paramIndex) {
|
|
222872
|
+
const startOfNewParams = this.data.param.length;
|
|
222873
|
+
this.data.param.pushFromGrowableXYArray(source.data.param);
|
|
222874
|
+
for (let i = 0; i < numSourceFacets; i++) { // Expect facet start and ends for points to match normals
|
|
222763
222875
|
const i0 = source._facetStart[i];
|
|
222764
222876
|
const i1 = source._facetStart[i + 1];
|
|
222765
222877
|
if (reversed) {
|
|
@@ -222773,20 +222885,17 @@ class IndexedPolyface extends Polyface {
|
|
|
222773
222885
|
}
|
|
222774
222886
|
}
|
|
222775
222887
|
// Add normal and normal index data
|
|
222776
|
-
if (
|
|
222888
|
+
if (undefined !== this.data.normal && undefined !== source.data.normal && undefined !== source.data.normalIndex) {
|
|
222777
222889
|
const startOfNewNormals = this.data.normal.length;
|
|
222778
|
-
|
|
222779
|
-
for (let i = 0; i < numNewNormals; i++) {
|
|
222890
|
+
for (let i = 0; i < source.data.normal.length; i++) {
|
|
222780
222891
|
const sourceNormal = source.data.normal.getVector3dAtCheckedVectorIndex(i);
|
|
222781
|
-
if (transform)
|
|
222892
|
+
if (transform)
|
|
222782
222893
|
transform.multiplyVector(sourceNormal, sourceNormal);
|
|
222783
|
-
|
|
222784
|
-
|
|
222785
|
-
|
|
222786
|
-
this.addNormal(sourceNormal);
|
|
222787
|
-
}
|
|
222894
|
+
if (reversed)
|
|
222895
|
+
sourceNormal.scaleInPlace(-1.0);
|
|
222896
|
+
this.addNormal(sourceNormal);
|
|
222788
222897
|
}
|
|
222789
|
-
for (let i = 0; i <
|
|
222898
|
+
for (let i = 0; i < numSourceFacets; i++) { // Expect facet start and ends for points to match normals
|
|
222790
222899
|
const i0 = source._facetStart[i];
|
|
222791
222900
|
const i1 = source._facetStart[i + 1];
|
|
222792
222901
|
if (reversed) {
|
|
@@ -222800,17 +222909,16 @@ class IndexedPolyface extends Polyface {
|
|
|
222800
222909
|
}
|
|
222801
222910
|
}
|
|
222802
222911
|
// Add color and color index data
|
|
222803
|
-
if (this.data.color && source.data.color && source.data.colorIndex) {
|
|
222912
|
+
if (undefined !== this.data.color && undefined !== source.data.color && undefined !== source.data.colorIndex) {
|
|
222804
222913
|
const startOfNewColors = this.data.color.length;
|
|
222805
|
-
for (const sourceColor of source.data.color)
|
|
222914
|
+
for (const sourceColor of source.data.color)
|
|
222806
222915
|
this.addColor(sourceColor);
|
|
222807
|
-
|
|
222808
|
-
for (let i = 0; i < source._facetStart.length; i++) { // Expect facet start and ends for points to match colors
|
|
222916
|
+
for (let i = 0; i < numSourceFacets; i++) { // Expect facet start and ends for points to match colors
|
|
222809
222917
|
const i0 = source._facetStart[i];
|
|
222810
222918
|
const i1 = source._facetStart[i + 1];
|
|
222811
222919
|
if (reversed) {
|
|
222812
222920
|
for (let j = i1; j-- > i0;)
|
|
222813
|
-
this.addColorIndex(startOfNewColors + source.data.colorIndex[j
|
|
222921
|
+
this.addColorIndex(startOfNewColors + source.data.colorIndex[j]);
|
|
222814
222922
|
}
|
|
222815
222923
|
else {
|
|
222816
222924
|
for (let j = i0; j < i1; j++)
|
|
@@ -222843,7 +222951,7 @@ class IndexedPolyface extends Polyface {
|
|
|
222843
222951
|
* @param needColors true if colors will e constructed.
|
|
222844
222952
|
*/
|
|
222845
222953
|
static create(needNormals = false, needParams = false, needColors = false, twoSided = false) {
|
|
222846
|
-
return new IndexedPolyface(new
|
|
222954
|
+
return new IndexedPolyface(new _PolyfaceData__WEBPACK_IMPORTED_MODULE_8__["PolyfaceData"](needNormals, needParams, needColors, twoSided));
|
|
222847
222955
|
}
|
|
222848
222956
|
/** add (a clone of ) a point. return its 0 based index.
|
|
222849
222957
|
* @param point point coordinates
|
|
@@ -222868,7 +222976,7 @@ class IndexedPolyface extends Polyface {
|
|
|
222868
222976
|
*/
|
|
222869
222977
|
addParam(param) {
|
|
222870
222978
|
if (!this.data.param)
|
|
222871
|
-
this.data.param = new
|
|
222979
|
+
this.data.param = new _geometry3d_GrowableXYArray__WEBPACK_IMPORTED_MODULE_2__["GrowableXYArray"]();
|
|
222872
222980
|
this.data.param.push(param);
|
|
222873
222981
|
return this.data.param.length - 1;
|
|
222874
222982
|
}
|
|
@@ -222879,7 +222987,7 @@ class IndexedPolyface extends Polyface {
|
|
|
222879
222987
|
*/
|
|
222880
222988
|
addParamUV(u, v, priorIndexA, priorIndexB) {
|
|
222881
222989
|
if (!this.data.param)
|
|
222882
|
-
this.data.param = new
|
|
222990
|
+
this.data.param = new _geometry3d_GrowableXYArray__WEBPACK_IMPORTED_MODULE_2__["GrowableXYArray"]();
|
|
222883
222991
|
if (priorIndexA !== undefined && this.data.isAlmostEqualParamIndexUV(priorIndexA, u, v))
|
|
222884
222992
|
return priorIndexA;
|
|
222885
222993
|
if (priorIndexB !== undefined && this.data.isAlmostEqualParamIndexUV(priorIndexB, u, v))
|
|
@@ -222921,7 +223029,7 @@ class IndexedPolyface extends Polyface {
|
|
|
222921
223029
|
*/
|
|
222922
223030
|
addNormalXYZ(x, y, z) {
|
|
222923
223031
|
if (!this.data.normal)
|
|
222924
|
-
this.data.normal = new
|
|
223032
|
+
this.data.normal = new _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_3__["GrowableXYZArray"]();
|
|
222925
223033
|
this.data.normal.pushXYZ(x, y, z);
|
|
222926
223034
|
return this.data.normal.length - 1;
|
|
222927
223035
|
}
|
|
@@ -223023,7 +223131,7 @@ class IndexedPolyface extends Polyface {
|
|
|
223023
223131
|
/** ASSUME valid facet index . .. return its end index in index arrays. */
|
|
223024
223132
|
facetIndex1(index) { return this._facetStart[index + 1]; }
|
|
223025
223133
|
/** create a visitor for this polyface */
|
|
223026
|
-
createVisitor(numWrap = 0) { return
|
|
223134
|
+
createVisitor(numWrap = 0) { return _IndexedPolyfaceVisitor__WEBPACK_IMPORTED_MODULE_7__["IndexedPolyfaceVisitor"].create(this, numWrap); }
|
|
223027
223135
|
/** Return the range of (optionally transformed) points in this mesh. */
|
|
223028
223136
|
range(transform, result) { return this.data.range(result, transform); }
|
|
223029
223137
|
/** Extend `range` with coordinates from this mesh */
|
|
@@ -223042,8 +223150,8 @@ class IndexedPolyface extends Polyface {
|
|
|
223042
223150
|
return false;
|
|
223043
223151
|
if (0 === endFacetIndex) // The default for endFacetIndex is really the last facet
|
|
223044
223152
|
endFacetIndex = this._facetStart.length; // Last facetStart index corresponds to the next facet if we were to create one
|
|
223045
|
-
const faceData =
|
|
223046
|
-
const visitor =
|
|
223153
|
+
const faceData = _FacetFaceData__WEBPACK_IMPORTED_MODULE_6__["FacetFaceData"].createNull();
|
|
223154
|
+
const visitor = _IndexedPolyfaceVisitor__WEBPACK_IMPORTED_MODULE_7__["IndexedPolyfaceVisitor"].create(this, 0);
|
|
223047
223155
|
if (!visitor.moveToReadIndex(facetStart)) { // Move visitor to first facet of new face
|
|
223048
223156
|
return false;
|
|
223049
223157
|
}
|
|
@@ -223114,6 +223222,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
223114
223222
|
/* harmony import */ var _BoxTopology__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./BoxTopology */ "../../core/geometry/lib/esm/polyface/BoxTopology.js");
|
|
223115
223223
|
/* harmony import */ var _GreedyTriangulationBetweenLineStrings__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./GreedyTriangulationBetweenLineStrings */ "../../core/geometry/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js");
|
|
223116
223224
|
/* harmony import */ var _Polyface__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./Polyface */ "../../core/geometry/lib/esm/polyface/Polyface.js");
|
|
223225
|
+
/* harmony import */ var _PolyfaceQuery__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./PolyfaceQuery */ "../../core/geometry/lib/esm/polyface/PolyfaceQuery.js");
|
|
223226
|
+
/* harmony import */ var _geometry3d_Angle__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ../geometry3d/Angle */ "../../core/geometry/lib/esm/geometry3d/Angle.js");
|
|
223227
|
+
/* harmony import */ var _IndexedPolyfaceVisitor__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./IndexedPolyfaceVisitor */ "../../core/geometry/lib/esm/polyface/IndexedPolyfaceVisitor.js");
|
|
223228
|
+
/* harmony import */ var _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./IndexedEdgeMatcher */ "../../core/geometry/lib/esm/polyface/IndexedEdgeMatcher.js");
|
|
223117
223229
|
/*---------------------------------------------------------------------------------------------
|
|
223118
223230
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
223119
223231
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -223146,6 +223258,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
223146
223258
|
|
|
223147
223259
|
|
|
223148
223260
|
|
|
223261
|
+
|
|
223262
|
+
|
|
223263
|
+
|
|
223264
|
+
|
|
223149
223265
|
|
|
223150
223266
|
|
|
223151
223267
|
|
|
@@ -223276,14 +223392,12 @@ FacetSector._edgeVector = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_2
|
|
|
223276
223392
|
* * Low-level detail construction -- direct use of indices
|
|
223277
223393
|
* * Create a builder with `builder = PolyfaceBuilder.create()`
|
|
223278
223394
|
* * Add GeometryQuery objects
|
|
223279
|
-
* * `builder.
|
|
223395
|
+
* * `builder.addPoint(point)`
|
|
223280
223396
|
* * `builder.findOrAddPointInLineString (linestring, index)`
|
|
223281
|
-
* * `builder.
|
|
223282
|
-
* * `builder.
|
|
223283
|
-
* * `builder.
|
|
223284
|
-
|
|
223285
|
-
* * `builder.addOneBasedPointIndex (index)`
|
|
223286
|
-
* @public
|
|
223397
|
+
* * `builder.addPointXYZ(x,y,z)`
|
|
223398
|
+
* * `builder.addTriangleFacet (points)`
|
|
223399
|
+
* * `builder.addQuadFacet (points)`
|
|
223400
|
+
* @public
|
|
223287
223401
|
*/
|
|
223288
223402
|
class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODULE_13__["NullGeometryHandler"] {
|
|
223289
223403
|
constructor(options) {
|
|
@@ -223343,7 +223457,7 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
223343
223457
|
if (n > 2) {
|
|
223344
223458
|
if (toggle)
|
|
223345
223459
|
this.toggleReversedFacetFlag();
|
|
223346
|
-
const index0 = this.
|
|
223460
|
+
const index0 = this.addPoint(conePoint);
|
|
223347
223461
|
let index1 = this.findOrAddPointInLineString(ls, 0);
|
|
223348
223462
|
let index2 = 0;
|
|
223349
223463
|
for (let i = 1; i < n; i++) {
|
|
@@ -223381,8 +223495,8 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
223381
223495
|
let paramIndex1 = -1;
|
|
223382
223496
|
let paramIndex2 = -1;
|
|
223383
223497
|
if (packedUV) {
|
|
223384
|
-
paramIndex0 = this.
|
|
223385
|
-
paramIndex1 = this.
|
|
223498
|
+
paramIndex0 = this.addParamInGrowableXYArray(packedUV, 0);
|
|
223499
|
+
paramIndex1 = this.addParamInGrowableXYArray(packedUV, 1);
|
|
223386
223500
|
}
|
|
223387
223501
|
const pointIndex0 = this.findOrAddPointInLineString(ls, 0);
|
|
223388
223502
|
let pointIndex1 = this.findOrAddPointInLineString(ls, 1);
|
|
@@ -223396,7 +223510,7 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
223396
223510
|
if (normalIndex !== undefined)
|
|
223397
223511
|
this.addIndexedTriangleNormalIndexes(normalIndex, normalIndex, normalIndex);
|
|
223398
223512
|
if (packedUV) {
|
|
223399
|
-
paramIndex2 = this.
|
|
223513
|
+
paramIndex2 = this.addParamInGrowableXYArray(packedUV, i);
|
|
223400
223514
|
this.addIndexedTriangleParamIndexes(paramIndex0, paramIndex1, paramIndex2);
|
|
223401
223515
|
}
|
|
223402
223516
|
this._polyface.terminateFacet();
|
|
@@ -223406,17 +223520,31 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
223406
223520
|
}
|
|
223407
223521
|
}
|
|
223408
223522
|
/**
|
|
223409
|
-
* Announce point coordinates.
|
|
223523
|
+
* Announce point coordinates.
|
|
223410
223524
|
*/
|
|
223411
|
-
|
|
223525
|
+
addPoint(xyz) {
|
|
223412
223526
|
return this._polyface.addPoint(xyz);
|
|
223413
223527
|
}
|
|
223414
223528
|
/**
|
|
223415
|
-
* Announce point coordinates.
|
|
223529
|
+
* Announce point coordinates.
|
|
223530
|
+
* @deprecated Use addPoint instead.
|
|
223416
223531
|
*/
|
|
223417
|
-
|
|
223532
|
+
findOrAddPoint(xyz) {
|
|
223533
|
+
return this.addPoint(xyz);
|
|
223534
|
+
}
|
|
223535
|
+
/**
|
|
223536
|
+
* Announce uv parameter coordinates.
|
|
223537
|
+
*/
|
|
223538
|
+
addParamXY(x, y) {
|
|
223418
223539
|
return this._polyface.addParamUV(x, y);
|
|
223419
223540
|
}
|
|
223541
|
+
/**
|
|
223542
|
+
* Announce uv parameter coordinates.
|
|
223543
|
+
* @deprecated Use addParamXY instead.
|
|
223544
|
+
*/
|
|
223545
|
+
findOrAddParamXY(x, y) {
|
|
223546
|
+
return this.addParamXY(x, y);
|
|
223547
|
+
}
|
|
223420
223548
|
/**
|
|
223421
223549
|
* 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.
|
|
223422
223550
|
* @returns Returns the point index in the Polyface.
|
|
@@ -223460,19 +223588,26 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
223460
223588
|
return undefined;
|
|
223461
223589
|
}
|
|
223462
223590
|
/**
|
|
223463
|
-
* Announce
|
|
223464
|
-
* @returns Returns the
|
|
223591
|
+
* Announce uv parameter coordinates.
|
|
223592
|
+
* @returns Returns the uv parameter index in the Polyface.
|
|
223465
223593
|
* @param index Index of the param in the linestring.
|
|
223466
223594
|
*/
|
|
223467
|
-
|
|
223595
|
+
addParamInGrowableXYArray(data, index) {
|
|
223468
223596
|
if (!data)
|
|
223469
223597
|
return undefined;
|
|
223470
|
-
const q = data.
|
|
223598
|
+
const q = data.getPoint2dAtCheckedPointIndex(index, PolyfaceBuilder._workUVFindOrAdd);
|
|
223471
223599
|
if (q) {
|
|
223472
223600
|
return this._polyface.addParam(q);
|
|
223473
223601
|
}
|
|
223474
223602
|
return undefined;
|
|
223475
223603
|
}
|
|
223604
|
+
/**
|
|
223605
|
+
* Announce uv parameter coordinates.
|
|
223606
|
+
* @deprecated Use addParamInGrowableXYArray instead.
|
|
223607
|
+
*/
|
|
223608
|
+
findOrAddParamInGrowableXYArray(data, index) {
|
|
223609
|
+
return this.addParamInGrowableXYArray(data, index);
|
|
223610
|
+
}
|
|
223476
223611
|
/**
|
|
223477
223612
|
* 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.
|
|
223478
223613
|
* @returns Returns the point index in the Polyface.
|
|
@@ -223501,11 +223636,18 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
223501
223636
|
return undefined;
|
|
223502
223637
|
}
|
|
223503
223638
|
/**
|
|
223504
|
-
* Announce point coordinates.
|
|
223639
|
+
* Announce point coordinates.
|
|
223505
223640
|
*/
|
|
223506
|
-
|
|
223641
|
+
addPointXYZ(x, y, z) {
|
|
223507
223642
|
return this._polyface.addPointXYZ(x, y, z);
|
|
223508
223643
|
}
|
|
223644
|
+
/**
|
|
223645
|
+
* Announce point coordinates.
|
|
223646
|
+
* @deprecated Use addPointXYZ instead.
|
|
223647
|
+
*/
|
|
223648
|
+
findOrAddPointXYZ(x, y, z) {
|
|
223649
|
+
return this.addPointXYZ(x, y, z);
|
|
223650
|
+
}
|
|
223509
223651
|
/** Returns a transform who can be applied to points on a triangular facet in order to obtain UV parameters. */
|
|
223510
223652
|
getUVTransformForTriangleFacet(pointA, pointB, pointC) {
|
|
223511
223653
|
const vectorAB = pointA.vectorTo(pointB);
|
|
@@ -223525,17 +223667,21 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
223525
223667
|
// ###: Consider case where normals will be reversed and point through the other end of the facet
|
|
223526
223668
|
/**
|
|
223527
223669
|
* Add a quad to the polyface given its points in order around the edges.
|
|
223528
|
-
*
|
|
223529
|
-
*
|
|
223670
|
+
* @param points array of at least three vertices
|
|
223671
|
+
* @param params optional array of at least four uv parameters (if undefined, params are calculated without reference data)
|
|
223672
|
+
* @param normals optional array of at least four vectors (if undefined, the quad is assumed to be planar and its normal is calculated)
|
|
223673
|
+
* @param colors optional array of at least four colors
|
|
223530
223674
|
*/
|
|
223531
|
-
addQuadFacet(points, params, normals) {
|
|
223675
|
+
addQuadFacet(points, params, normals, colors) {
|
|
223532
223676
|
if (points instanceof _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_15__["GrowableXYZArray"])
|
|
223533
223677
|
points = points.getPoint3dArray();
|
|
223534
223678
|
// If params and/or normals are needed, calculate them first
|
|
223535
223679
|
const needParams = this.options.needParams;
|
|
223536
223680
|
const needNormals = this.options.needNormals;
|
|
223681
|
+
const needColors = this.options.needColors;
|
|
223537
223682
|
let param0, param1, param2, param3;
|
|
223538
223683
|
let normal0, normal1, normal2, normal3;
|
|
223684
|
+
let color0, color1, color2, color3;
|
|
223539
223685
|
if (needParams) {
|
|
223540
223686
|
if (params !== undefined && params.length > 3) {
|
|
223541
223687
|
param0 = params[0];
|
|
@@ -223570,18 +223716,26 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
223570
223716
|
normal3 = this.getNormalForTriangularFacet(points[0], points[1], points[2]);
|
|
223571
223717
|
}
|
|
223572
223718
|
}
|
|
223719
|
+
if (needColors) {
|
|
223720
|
+
if (colors !== undefined && colors.length > 3) {
|
|
223721
|
+
color0 = colors[0];
|
|
223722
|
+
color1 = colors[1];
|
|
223723
|
+
color2 = colors[2];
|
|
223724
|
+
color3 = colors[3];
|
|
223725
|
+
}
|
|
223726
|
+
}
|
|
223573
223727
|
if (this._options.shouldTriangulate) {
|
|
223574
223728
|
// Add as two triangles, with a diagonal along the shortest distance
|
|
223575
223729
|
const vectorAC = points[0].vectorTo(points[2]);
|
|
223576
223730
|
const vectorBD = points[1].vectorTo(points[3]);
|
|
223577
223731
|
// Note: We pass along any values for normals or params that we calculated
|
|
223578
223732
|
if (vectorAC.magnitude() >= vectorBD.magnitude()) {
|
|
223579
|
-
this.addTriangleFacet([points[0], points[1], points[2]], needParams ? [param0, param1, param2] : undefined, needNormals ? [normal0, normal1, normal2] : undefined);
|
|
223580
|
-
this.addTriangleFacet([points[0], points[2], points[3]], needParams ? [param0, param2, param3] : undefined, needNormals ? [normal0, normal2, normal3] : undefined);
|
|
223733
|
+
this.addTriangleFacet([points[0], points[1], points[2]], needParams ? [param0, param1, param2] : undefined, needNormals ? [normal0, normal1, normal2] : undefined, needColors ? [color0, color1, color2] : undefined);
|
|
223734
|
+
this.addTriangleFacet([points[0], points[2], points[3]], needParams ? [param0, param2, param3] : undefined, needNormals ? [normal0, normal2, normal3] : undefined, needColors ? [color0, color2, color3] : undefined);
|
|
223581
223735
|
}
|
|
223582
223736
|
else {
|
|
223583
|
-
this.addTriangleFacet([points[0], points[1], points[3]], needParams ? [param0, param1, param3] : undefined, needNormals ? [normal0, normal1, normal3] : undefined);
|
|
223584
|
-
this.addTriangleFacet([points[1], points[2], points[3]], needParams ? [param1, param2, param3] : undefined, needNormals ? [normal1, normal2, normal3] : undefined);
|
|
223737
|
+
this.addTriangleFacet([points[0], points[1], points[3]], needParams ? [param0, param1, param3] : undefined, needNormals ? [normal0, normal1, normal3] : undefined, needColors ? [color0, color1, color3] : undefined);
|
|
223738
|
+
this.addTriangleFacet([points[1], points[2], points[3]], needParams ? [param1, param2, param3] : undefined, needNormals ? [normal1, normal2, normal3] : undefined, needColors ? [color1, color2, color3] : undefined);
|
|
223585
223739
|
}
|
|
223586
223740
|
return;
|
|
223587
223741
|
}
|
|
@@ -223602,11 +223756,19 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
223602
223756
|
idx3 = this._polyface.addNormal(normal3);
|
|
223603
223757
|
this.addIndexedQuadNormalIndexes(idx0, idx1, idx3, idx2);
|
|
223604
223758
|
}
|
|
223759
|
+
// Add colors if needed
|
|
223760
|
+
if (needColors) {
|
|
223761
|
+
idx0 = this._polyface.addColor(color0);
|
|
223762
|
+
idx1 = this._polyface.addColor(color1);
|
|
223763
|
+
idx2 = this._polyface.addColor(color2);
|
|
223764
|
+
idx3 = this._polyface.addColor(color3);
|
|
223765
|
+
this.addIndexedQuadColorIndexes(idx0, idx1, idx3, idx2);
|
|
223766
|
+
}
|
|
223605
223767
|
// Add point and point indexes last (terminates the facet)
|
|
223606
|
-
idx0 = this.
|
|
223607
|
-
idx1 = this.
|
|
223608
|
-
idx2 = this.
|
|
223609
|
-
idx3 = this.
|
|
223768
|
+
idx0 = this.addPoint(points[0]);
|
|
223769
|
+
idx1 = this.addPoint(points[1]);
|
|
223770
|
+
idx2 = this.addPoint(points[2]);
|
|
223771
|
+
idx3 = this.addPoint(points[3]);
|
|
223610
223772
|
this.addIndexedQuadPointIndexes(idx0, idx1, idx3, idx2);
|
|
223611
223773
|
}
|
|
223612
223774
|
/** Announce a single quad facet's point indexes.
|
|
@@ -223661,12 +223823,30 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
223661
223823
|
this._polyface.addNormalIndex(indexB0);
|
|
223662
223824
|
}
|
|
223663
223825
|
}
|
|
223826
|
+
/** For a single quad facet, add the indexes of the corresponding colors. */
|
|
223827
|
+
addIndexedQuadColorIndexes(indexA0, indexA1, indexB0, indexB1) {
|
|
223828
|
+
if (this._reversed) {
|
|
223829
|
+
this._polyface.addColorIndex(indexA0);
|
|
223830
|
+
this._polyface.addColorIndex(indexB0);
|
|
223831
|
+
this._polyface.addColorIndex(indexB1);
|
|
223832
|
+
this._polyface.addColorIndex(indexA1);
|
|
223833
|
+
}
|
|
223834
|
+
else {
|
|
223835
|
+
this._polyface.addColorIndex(indexA0);
|
|
223836
|
+
this._polyface.addColorIndex(indexA1);
|
|
223837
|
+
this._polyface.addColorIndex(indexB1);
|
|
223838
|
+
this._polyface.addColorIndex(indexB0);
|
|
223839
|
+
}
|
|
223840
|
+
}
|
|
223664
223841
|
// ### TODO: Consider case where normals will be reversed and point through the other end of the facet
|
|
223665
223842
|
/**
|
|
223666
223843
|
* Add a triangle to the polyface given its points in order around the edges.
|
|
223667
|
-
*
|
|
223844
|
+
* @param points array of at least three vertices
|
|
223845
|
+
* @param params optional array of at least three uv parameters (if undefined, params are calculated without reference data)
|
|
223846
|
+
* @param normals optional array of at least three vectors (if undefined, the normal is calculated)
|
|
223847
|
+
* @param colors optional array of at least three colors
|
|
223668
223848
|
*/
|
|
223669
|
-
addTriangleFacet(points, params, normals) {
|
|
223849
|
+
addTriangleFacet(points, params, normals, colors) {
|
|
223670
223850
|
if (points.length < 3)
|
|
223671
223851
|
return;
|
|
223672
223852
|
let idx0;
|
|
@@ -223713,10 +223893,19 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
223713
223893
|
}
|
|
223714
223894
|
this.addIndexedTriangleNormalIndexes(idx0, idx1, idx2);
|
|
223715
223895
|
}
|
|
223896
|
+
// Add colors if needed and provided
|
|
223897
|
+
if (this._options.needColors) {
|
|
223898
|
+
if (colors !== undefined && colors.length > 2) {
|
|
223899
|
+
idx0 = this._polyface.addColor(colors[0]);
|
|
223900
|
+
idx1 = this._polyface.addColor(colors[1]);
|
|
223901
|
+
idx2 = this._polyface.addColor(colors[2]);
|
|
223902
|
+
this.addIndexedTriangleColorIndexes(idx0, idx1, idx2);
|
|
223903
|
+
}
|
|
223904
|
+
}
|
|
223716
223905
|
// Add point and point indexes last (terminates the facet)
|
|
223717
|
-
idx0 = this.
|
|
223718
|
-
idx1 = this.
|
|
223719
|
-
idx2 = this.
|
|
223906
|
+
idx0 = this.addPoint(point0);
|
|
223907
|
+
idx1 = this.addPoint(point1);
|
|
223908
|
+
idx2 = this.addPoint(point2);
|
|
223720
223909
|
this.addIndexedTrianglePointIndexes(idx0, idx1, idx2);
|
|
223721
223910
|
}
|
|
223722
223911
|
/** Announce a single triangle facet's point indexes.
|
|
@@ -223763,9 +223952,22 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
223763
223952
|
this._polyface.addNormalIndex(indexB);
|
|
223764
223953
|
}
|
|
223765
223954
|
}
|
|
223955
|
+
/** For a single triangle facet, add the indexes of the corresponding colors. */
|
|
223956
|
+
addIndexedTriangleColorIndexes(indexA, indexB, indexC) {
|
|
223957
|
+
if (!this._reversed) {
|
|
223958
|
+
this._polyface.addColorIndex(indexA);
|
|
223959
|
+
this._polyface.addColorIndex(indexB);
|
|
223960
|
+
this._polyface.addColorIndex(indexC);
|
|
223961
|
+
}
|
|
223962
|
+
else {
|
|
223963
|
+
this._polyface.addColorIndex(indexA);
|
|
223964
|
+
this._polyface.addColorIndex(indexC);
|
|
223965
|
+
this._polyface.addColorIndex(indexB);
|
|
223966
|
+
}
|
|
223967
|
+
}
|
|
223766
223968
|
/** Find or add xyzIndex and normalIndex for coordinates in the sector. */
|
|
223767
223969
|
setSectorIndices(sector) {
|
|
223768
|
-
sector.xyzIndex = this.
|
|
223970
|
+
sector.xyzIndex = this.addPoint(sector.xyz);
|
|
223769
223971
|
if (sector.normal)
|
|
223770
223972
|
sector.normalIndex = this._polyface.addNormal(sector.normal);
|
|
223771
223973
|
if (sector.uv)
|
|
@@ -224009,8 +224211,8 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
224009
224211
|
for (let i = 0; i < n; i++) {
|
|
224010
224212
|
pointA = contour.pointAt(i, pointA);
|
|
224011
224213
|
pointB = pointA.plus(vector, pointB);
|
|
224012
|
-
indexA1 = this.
|
|
224013
|
-
indexB1 = this.
|
|
224214
|
+
indexA1 = this.addPoint(pointA);
|
|
224215
|
+
indexB1 = this.addPoint(pointB);
|
|
224014
224216
|
if (i > 0) {
|
|
224015
224217
|
this.addIndexedQuadPointIndexes(indexA0, indexA1, indexB0, indexB1);
|
|
224016
224218
|
}
|
|
@@ -224304,13 +224506,13 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
224304
224506
|
let index = 0;
|
|
224305
224507
|
if (!this._reversed) {
|
|
224306
224508
|
for (let i = 0; i < numPointsToUse; i++) {
|
|
224307
|
-
index = this.
|
|
224509
|
+
index = this.addPoint(points[i]);
|
|
224308
224510
|
this._polyface.addPointIndex(index);
|
|
224309
224511
|
}
|
|
224310
224512
|
}
|
|
224311
224513
|
else {
|
|
224312
224514
|
for (let i = numPointsToUse; --i >= 0;) {
|
|
224313
|
-
index = this.
|
|
224515
|
+
index = this.addPoint(points[i]);
|
|
224314
224516
|
this._polyface.addPointIndex(index);
|
|
224315
224517
|
}
|
|
224316
224518
|
}
|
|
@@ -224386,7 +224588,7 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
224386
224588
|
this._polyface.addNormalIndex(index);
|
|
224387
224589
|
}
|
|
224388
224590
|
if (params) {
|
|
224389
|
-
index = this.
|
|
224591
|
+
index = this.addParamInGrowableXYArray(params, i);
|
|
224390
224592
|
this._polyface.addParamIndex(index);
|
|
224391
224593
|
}
|
|
224392
224594
|
if (colors) {
|
|
@@ -224404,7 +224606,7 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
224404
224606
|
this._polyface.addNormalIndex(index);
|
|
224405
224607
|
}
|
|
224406
224608
|
if (params) {
|
|
224407
|
-
index = this.
|
|
224609
|
+
index = this.addParamInGrowableXYArray(params, i);
|
|
224408
224610
|
this._polyface.addParamIndex(index);
|
|
224409
224611
|
}
|
|
224410
224612
|
if (colors) {
|
|
@@ -224467,10 +224669,10 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
224467
224669
|
if (acceptFaceFunction(seed) && seed.countEdgesAroundFace() > 2) {
|
|
224468
224670
|
let node = seed;
|
|
224469
224671
|
do {
|
|
224470
|
-
index = this.
|
|
224672
|
+
index = this.addPointXYZ(node.x, node.y, node.z);
|
|
224471
224673
|
this._polyface.addPointIndex(index, isEdgeVisibleFunction === undefined ? true : isEdgeVisibleFunction(node));
|
|
224472
224674
|
if (needParams) {
|
|
224473
|
-
index = this.
|
|
224675
|
+
index = this.addParamXY(node.x, node.y);
|
|
224474
224676
|
this._polyface.addParamIndex(index);
|
|
224475
224677
|
}
|
|
224476
224678
|
if (needNormals) {
|
|
@@ -224497,7 +224699,7 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
224497
224699
|
for (const seed of faces) {
|
|
224498
224700
|
let node = seed;
|
|
224499
224701
|
do {
|
|
224500
|
-
index = this.
|
|
224702
|
+
index = this.addPointXYZ(node.x, node.y, node.z);
|
|
224501
224703
|
this._polyface.addPointIndex(index);
|
|
224502
224704
|
node = node.faceSuccessor;
|
|
224503
224705
|
} while (node !== seed);
|
|
@@ -224742,6 +224944,104 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
|
|
|
224742
224944
|
this.addMiteredPipesFromPoints(linestring.packedPoints, sectionData, numFacetAround);
|
|
224743
224945
|
}
|
|
224744
224946
|
}
|
|
224947
|
+
/** Return the polyface index array indices corresponding to the given edge, or undefined if error. */
|
|
224948
|
+
getEdgeIndices(edge) {
|
|
224949
|
+
let indexA = -1;
|
|
224950
|
+
let indexB = -1;
|
|
224951
|
+
for (let i = this._polyface.facetIndex0(edge.facetIndex); i < this._polyface.facetIndex1(edge.facetIndex); ++i) {
|
|
224952
|
+
if (edge.vertexIndexA === this._polyface.data.pointIndex[i])
|
|
224953
|
+
indexA = i;
|
|
224954
|
+
else if (edge.vertexIndexB === this._polyface.data.pointIndex[i])
|
|
224955
|
+
indexB = i;
|
|
224956
|
+
}
|
|
224957
|
+
return (indexA < 0 || indexB < 0) ? undefined : { edgeIndexA: indexA, edgeIndexB: indexB };
|
|
224958
|
+
}
|
|
224959
|
+
/** Create a side face between base and swept facets along a base boundary edge.
|
|
224960
|
+
* * 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).
|
|
224961
|
+
*/
|
|
224962
|
+
addSweptFace(baseBoundaryEdge, numBaseFacets) {
|
|
224963
|
+
const edge = this.getEdgeIndices(baseBoundaryEdge);
|
|
224964
|
+
if (undefined === edge)
|
|
224965
|
+
return false;
|
|
224966
|
+
const sweptFacetIndex = numBaseFacets + baseBoundaryEdge.facetIndex;
|
|
224967
|
+
if (!this._polyface.isValidFacetIndex(sweptFacetIndex))
|
|
224968
|
+
return false;
|
|
224969
|
+
const numBaseFacetEdges = this._polyface.numEdgeInFacet(baseBoundaryEdge.facetIndex);
|
|
224970
|
+
if (numBaseFacetEdges !== this._polyface.numEdgeInFacet(sweptFacetIndex))
|
|
224971
|
+
return false;
|
|
224972
|
+
// generate indices into the polyface index arrays
|
|
224973
|
+
const baseFacetIndexStart = this._polyface.facetIndex0(baseBoundaryEdge.facetIndex);
|
|
224974
|
+
const sweptFacetIndexStart = this._polyface.facetIndex0(sweptFacetIndex);
|
|
224975
|
+
const edgeIndexOffsetInFaceLoopA = edge.edgeIndexA - baseFacetIndexStart;
|
|
224976
|
+
const edgeIndexOffsetInFaceLoopB = edge.edgeIndexB - baseFacetIndexStart;
|
|
224977
|
+
const sweptEdgeIndexOffsetInFaceLoopA = (numBaseFacetEdges - 1) - edgeIndexOffsetInFaceLoopA;
|
|
224978
|
+
const sweptEdgeIndexOffsetInFaceLoopB = (numBaseFacetEdges - 1) - edgeIndexOffsetInFaceLoopB;
|
|
224979
|
+
const indices = [edge.edgeIndexB, edge.edgeIndexA, sweptFacetIndexStart + sweptEdgeIndexOffsetInFaceLoopA, sweptFacetIndexStart + sweptEdgeIndexOffsetInFaceLoopB];
|
|
224980
|
+
const vertices = [];
|
|
224981
|
+
let colors; // try to re-use colors; missing normals and params will be computed if needed
|
|
224982
|
+
if (undefined !== this.options.needColors && undefined !== this._polyface.data.color && undefined !== this._polyface.data.colorIndex)
|
|
224983
|
+
colors = [];
|
|
224984
|
+
for (let i = 0; i < 4; ++i) {
|
|
224985
|
+
const xyz = this._polyface.data.getPoint(this._polyface.data.pointIndex[indices[i]]);
|
|
224986
|
+
if (undefined === xyz)
|
|
224987
|
+
return false;
|
|
224988
|
+
vertices.push(xyz);
|
|
224989
|
+
if (undefined !== colors) {
|
|
224990
|
+
const color = this._polyface.data.getColor(this._polyface.data.colorIndex[indices[i]]);
|
|
224991
|
+
if (undefined === color)
|
|
224992
|
+
return false;
|
|
224993
|
+
colors.push(color);
|
|
224994
|
+
}
|
|
224995
|
+
}
|
|
224996
|
+
this.addQuadFacet(vertices, undefined, undefined, colors);
|
|
224997
|
+
return true;
|
|
224998
|
+
}
|
|
224999
|
+
/**
|
|
225000
|
+
* 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.
|
|
225001
|
+
* @param source the surface mesh to sweep
|
|
225002
|
+
* @param sweepVector the direction and length to sweep the surface mesh
|
|
225003
|
+
* @param triangulateSides whether to triangulate side facets, or leave as quads
|
|
225004
|
+
* @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.
|
|
225005
|
+
*/
|
|
225006
|
+
addSweptIndexedPolyface(source, sweepVector, triangulateSides = false) {
|
|
225007
|
+
let isSimpleSweep = true;
|
|
225008
|
+
const totalProjectedArea = _PolyfaceQuery__WEBPACK_IMPORTED_MODULE_33__["PolyfaceQuery"].sumFacetAreas(source, sweepVector);
|
|
225009
|
+
if (_Geometry__WEBPACK_IMPORTED_MODULE_10__["Geometry"].isAlmostEqualNumber(0.0, totalProjectedArea))
|
|
225010
|
+
isSimpleSweep = false;
|
|
225011
|
+
const partitionedIndices = _PolyfaceQuery__WEBPACK_IMPORTED_MODULE_33__["PolyfaceQuery"].partitionFacetIndicesByVisibilityVector(source, sweepVector, _geometry3d_Angle__WEBPACK_IMPORTED_MODULE_34__["Angle"].createDegrees(1.0e-3));
|
|
225012
|
+
const numForwardFacets = partitionedIndices[0].length;
|
|
225013
|
+
const numBackwardFacets = partitionedIndices[1].length;
|
|
225014
|
+
const numSideFacets = partitionedIndices[2].length;
|
|
225015
|
+
if (numSideFacets > 0)
|
|
225016
|
+
isSimpleSweep = false;
|
|
225017
|
+
if (numForwardFacets > 0 && numBackwardFacets > 0)
|
|
225018
|
+
isSimpleSweep = false;
|
|
225019
|
+
// add base and swept facets with opposite orientations
|
|
225020
|
+
const reverseBase = numForwardFacets > 0;
|
|
225021
|
+
const firstBaseFacet = this._polyface.facetCount;
|
|
225022
|
+
this.addIndexedPolyface(source, reverseBase);
|
|
225023
|
+
const firstSweptFacet = this._polyface.facetCount;
|
|
225024
|
+
this.addIndexedPolyface(source, !reverseBase, _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_25__["Transform"].createTranslation(sweepVector));
|
|
225025
|
+
// collect base edges added to the builder, and extract boundary
|
|
225026
|
+
const numBaseFacets = firstSweptFacet - firstBaseFacet;
|
|
225027
|
+
const baseFacetIndices = Array.from({ length: numBaseFacets }, (_, i) => firstBaseFacet + i);
|
|
225028
|
+
const baseFacetVisitor = _IndexedPolyfaceVisitor__WEBPACK_IMPORTED_MODULE_35__["IndexedPolyfaceSubsetVisitor"].createSubsetVisitor(this._polyface, baseFacetIndices, 1);
|
|
225029
|
+
const baseEdges = _PolyfaceQuery__WEBPACK_IMPORTED_MODULE_33__["PolyfaceQuery"].createIndexedEdges(baseFacetVisitor);
|
|
225030
|
+
const baseBoundaryEdges = [];
|
|
225031
|
+
baseEdges.sortAndCollectClusters(undefined, baseBoundaryEdges, undefined, undefined);
|
|
225032
|
+
// add a side face per boundary edge
|
|
225033
|
+
const oldShouldTriangulate = this._options.shouldTriangulate;
|
|
225034
|
+
this._options.shouldTriangulate = triangulateSides;
|
|
225035
|
+
for (const edgeOrCluster of baseBoundaryEdges) {
|
|
225036
|
+
if (edgeOrCluster instanceof _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_36__["SortableEdge"])
|
|
225037
|
+
this.addSweptFace(edgeOrCluster, numBaseFacets);
|
|
225038
|
+
else if (Array.isArray(edgeOrCluster))
|
|
225039
|
+
for (const edge of edgeOrCluster)
|
|
225040
|
+
this.addSweptFace(edge, numBaseFacets);
|
|
225041
|
+
}
|
|
225042
|
+
this._options.shouldTriangulate = oldShouldTriangulate;
|
|
225043
|
+
return isSimpleSweep;
|
|
225044
|
+
}
|
|
224745
225045
|
}
|
|
224746
225046
|
PolyfaceBuilder._workPointFindOrAddA = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_21__["Point3d"].create();
|
|
224747
225047
|
PolyfaceBuilder._workVectorFindOrAdd = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_21__["Vector3d"].create();
|
|
@@ -225742,9 +226042,9 @@ class PolyfaceData {
|
|
|
225742
226042
|
return undefined === this.auxData || this.auxData.tryTransformInPlace(transform);
|
|
225743
226043
|
}
|
|
225744
226044
|
/**
|
|
225745
|
-
* * Search for
|
|
225746
|
-
* * compress the
|
|
225747
|
-
* * revise all indexing for the relocated
|
|
226045
|
+
* * Search for duplicates within points, normals, params, and colors.
|
|
226046
|
+
* * compress the data arrays.
|
|
226047
|
+
* * revise all indexing for the relocated data.
|
|
225748
226048
|
*/
|
|
225749
226049
|
compress() {
|
|
225750
226050
|
const packedPoints = _numerics_ClusterableArray__WEBPACK_IMPORTED_MODULE_7__["ClusterableArray"].clusterGrowablePoint3dArray(this.point);
|
|
@@ -225761,6 +226061,11 @@ class PolyfaceData {
|
|
|
225761
226061
|
this.param = packedParams.growablePackedPoints;
|
|
225762
226062
|
packedParams.updateIndices(this.paramIndex);
|
|
225763
226063
|
}
|
|
226064
|
+
if (this.colorIndex && this.color) {
|
|
226065
|
+
const packedColors = _numerics_ClusterableArray__WEBPACK_IMPORTED_MODULE_7__["ClusterableArray"].clusterNumberArray(this.color);
|
|
226066
|
+
this.color = packedColors.packedNumbers;
|
|
226067
|
+
packedColors.updateIndices(this.colorIndex);
|
|
226068
|
+
}
|
|
225764
226069
|
}
|
|
225765
226070
|
/**
|
|
225766
226071
|
* Test if facetStartIndex is (minimally!) valid:
|
|
@@ -225920,23 +226225,24 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
225920
226225
|
/* harmony import */ var _curve_LineString3d__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../curve/LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
|
|
225921
226226
|
/* harmony import */ var _curve_Loop__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../curve/Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
|
|
225922
226227
|
/* harmony import */ var _curve_StrokeOptions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../curve/StrokeOptions */ "../../core/geometry/lib/esm/curve/StrokeOptions.js");
|
|
225923
|
-
/* harmony import */ var
|
|
225924
|
-
/* harmony import */ var
|
|
225925
|
-
/* harmony import */ var
|
|
225926
|
-
/* harmony import */ var
|
|
225927
|
-
/* harmony import */ var
|
|
225928
|
-
/* harmony import */ var
|
|
225929
|
-
/* harmony import */ var
|
|
225930
|
-
/* harmony import */ var
|
|
225931
|
-
/* harmony import */ var
|
|
225932
|
-
/* harmony import */ var
|
|
225933
|
-
/* harmony import */ var
|
|
225934
|
-
/* harmony import */ var
|
|
225935
|
-
/* harmony import */ var
|
|
225936
|
-
/* harmony import */ var
|
|
225937
|
-
/* harmony import */ var
|
|
225938
|
-
/* harmony import */ var
|
|
225939
|
-
/* harmony import */ var
|
|
226228
|
+
/* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
|
|
226229
|
+
/* harmony import */ var _geometry3d_Angle__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geometry3d/Angle */ "../../core/geometry/lib/esm/geometry3d/Angle.js");
|
|
226230
|
+
/* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
|
|
226231
|
+
/* harmony import */ var _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geometry3d/PolygonOps */ "../../core/geometry/lib/esm/geometry3d/PolygonOps.js");
|
|
226232
|
+
/* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
|
|
226233
|
+
/* harmony import */ var _geometry4d_Matrix4d__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../geometry4d/Matrix4d */ "../../core/geometry/lib/esm/geometry4d/Matrix4d.js");
|
|
226234
|
+
/* harmony import */ var _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../geometry4d/MomentData */ "../../core/geometry/lib/esm/geometry4d/MomentData.js");
|
|
226235
|
+
/* harmony import */ var _numerics_UnionFind__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../numerics/UnionFind */ "../../core/geometry/lib/esm/numerics/UnionFind.js");
|
|
226236
|
+
/* harmony import */ var _topology_ChainMerge__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../topology/ChainMerge */ "../../core/geometry/lib/esm/topology/ChainMerge.js");
|
|
226237
|
+
/* harmony import */ var _FacetOrientation__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./FacetOrientation */ "../../core/geometry/lib/esm/polyface/FacetOrientation.js");
|
|
226238
|
+
/* harmony import */ var _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./IndexedEdgeMatcher */ "../../core/geometry/lib/esm/polyface/IndexedEdgeMatcher.js");
|
|
226239
|
+
/* harmony import */ var _IndexedPolyfaceVisitor__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./IndexedPolyfaceVisitor */ "../../core/geometry/lib/esm/polyface/IndexedPolyfaceVisitor.js");
|
|
226240
|
+
/* harmony import */ var _multiclip_BuildAverageNormalsContext__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./multiclip/BuildAverageNormalsContext */ "../../core/geometry/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js");
|
|
226241
|
+
/* harmony import */ var _multiclip_SweepLineStringToFacetContext__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./multiclip/SweepLineStringToFacetContext */ "../../core/geometry/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js");
|
|
226242
|
+
/* harmony import */ var _multiclip_XYPointBuckets__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./multiclip/XYPointBuckets */ "../../core/geometry/lib/esm/polyface/multiclip/XYPointBuckets.js");
|
|
226243
|
+
/* harmony import */ var _Polyface__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Polyface */ "../../core/geometry/lib/esm/polyface/Polyface.js");
|
|
226244
|
+
/* harmony import */ var _PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./PolyfaceBuilder */ "../../core/geometry/lib/esm/polyface/PolyfaceBuilder.js");
|
|
226245
|
+
/* harmony import */ var _RangeLengthData__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./RangeLengthData */ "../../core/geometry/lib/esm/polyface/RangeLengthData.js");
|
|
225940
226246
|
/*---------------------------------------------------------------------------------------------
|
|
225941
226247
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
225942
226248
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -225966,6 +226272,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
225966
226272
|
|
|
225967
226273
|
|
|
225968
226274
|
|
|
226275
|
+
|
|
225969
226276
|
|
|
225970
226277
|
|
|
225971
226278
|
/**
|
|
@@ -226002,15 +226309,27 @@ class PolyfaceQuery {
|
|
|
226002
226309
|
}
|
|
226003
226310
|
return result;
|
|
226004
226311
|
}
|
|
226005
|
-
/** Return the sum of all
|
|
226006
|
-
|
|
226312
|
+
/** Return the sum of all facet areas.
|
|
226313
|
+
* @param vectorToEye compute facet area projected to a view plane perpendicular to this vector
|
|
226314
|
+
*/
|
|
226315
|
+
static sumFacetAreas(source, vectorToEye) {
|
|
226007
226316
|
let s = 0;
|
|
226008
226317
|
if (source !== undefined) {
|
|
226009
|
-
if (source instanceof
|
|
226010
|
-
return PolyfaceQuery.sumFacetAreas(source.createVisitor(1));
|
|
226318
|
+
if (source instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"])
|
|
226319
|
+
return PolyfaceQuery.sumFacetAreas(source.createVisitor(1), vectorToEye);
|
|
226320
|
+
let unitVectorToEye;
|
|
226321
|
+
if (vectorToEye !== undefined)
|
|
226322
|
+
unitVectorToEye = vectorToEye.normalize();
|
|
226011
226323
|
source.reset();
|
|
226012
226324
|
while (source.moveToNextFacet()) {
|
|
226013
|
-
|
|
226325
|
+
const scaledNormal = _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_8__["PolygonOps"].areaNormal(source.point.getPoint3dArray());
|
|
226326
|
+
let area = scaledNormal.magnitude();
|
|
226327
|
+
if (unitVectorToEye !== undefined) {
|
|
226328
|
+
const scale = _Geometry__WEBPACK_IMPORTED_MODULE_5__["Geometry"].conditionalDivideCoordinate(1.0, area);
|
|
226329
|
+
if (scale !== undefined)
|
|
226330
|
+
area *= scaledNormal.dotProduct(unitVectorToEye) * scale;
|
|
226331
|
+
}
|
|
226332
|
+
s += area;
|
|
226014
226333
|
}
|
|
226015
226334
|
}
|
|
226016
226335
|
return s;
|
|
@@ -226023,12 +226342,12 @@ class PolyfaceQuery {
|
|
|
226023
226342
|
*/
|
|
226024
226343
|
static sumTetrahedralVolumes(source, origin) {
|
|
226025
226344
|
let s = 0;
|
|
226026
|
-
if (source instanceof
|
|
226345
|
+
if (source instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"])
|
|
226027
226346
|
return PolyfaceQuery.sumTetrahedralVolumes(source.createVisitor(0), origin);
|
|
226028
226347
|
let myOrigin = origin;
|
|
226029
|
-
const facetOrigin =
|
|
226030
|
-
const targetA =
|
|
226031
|
-
const targetB =
|
|
226348
|
+
const facetOrigin = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
226349
|
+
const targetA = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
226350
|
+
const targetB = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
226032
226351
|
source.reset();
|
|
226033
226352
|
while (source.moveToNextFacet()) {
|
|
226034
226353
|
if (myOrigin === undefined)
|
|
@@ -226049,20 +226368,20 @@ class PolyfaceQuery {
|
|
|
226049
226368
|
*
|
|
226050
226369
|
*/
|
|
226051
226370
|
static sumVolumeBetweenFacetsAndPlane(source, plane) {
|
|
226052
|
-
if (source instanceof
|
|
226371
|
+
if (source instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"])
|
|
226053
226372
|
return PolyfaceQuery.sumVolumeBetweenFacetsAndPlane(source.createVisitor(0), plane);
|
|
226054
|
-
const facetOrigin =
|
|
226055
|
-
const targetA =
|
|
226056
|
-
const targetB =
|
|
226057
|
-
const triangleNormal =
|
|
226373
|
+
const facetOrigin = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
226374
|
+
const targetA = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
226375
|
+
const targetB = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
226376
|
+
const triangleNormal = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Vector3d"].create();
|
|
226058
226377
|
const planeNormal = plane.getNormalRef();
|
|
226059
226378
|
let h0, hA, hB;
|
|
226060
226379
|
let signedVolumeSum = 0.0;
|
|
226061
226380
|
let signedTriangleArea;
|
|
226062
226381
|
let singleFacetArea;
|
|
226063
|
-
const positiveAreaMomentSums =
|
|
226064
|
-
const negativeAreaMomentSums =
|
|
226065
|
-
const singleFacetProducts =
|
|
226382
|
+
const positiveAreaMomentSums = _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_11__["MomentData"].create(undefined, true);
|
|
226383
|
+
const negativeAreaMomentSums = _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_11__["MomentData"].create(undefined, true);
|
|
226384
|
+
const singleFacetProducts = _geometry4d_Matrix4d__WEBPACK_IMPORTED_MODULE_10__["Matrix4d"].createZero();
|
|
226066
226385
|
const projectToPlane = plane.getProjectionToPlane();
|
|
226067
226386
|
source.reset();
|
|
226068
226387
|
// For each facet ..
|
|
@@ -226089,7 +226408,7 @@ class PolyfaceQuery {
|
|
|
226089
226408
|
}
|
|
226090
226409
|
singleFacetProducts.setZero();
|
|
226091
226410
|
source.point.multiplyTransformInPlace(projectToPlane);
|
|
226092
|
-
|
|
226411
|
+
_geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_8__["PolygonOps"].addSecondMomentAreaProducts(source.point, facetOrigin, singleFacetProducts);
|
|
226093
226412
|
if (singleFacetArea > 0) {
|
|
226094
226413
|
positiveAreaMomentSums.accumulateProductsFromOrigin(facetOrigin, singleFacetProducts, 1.0);
|
|
226095
226414
|
}
|
|
@@ -226099,8 +226418,8 @@ class PolyfaceQuery {
|
|
|
226099
226418
|
}
|
|
226100
226419
|
positiveAreaMomentSums.shiftOriginAndSumsToCentroidOfSums();
|
|
226101
226420
|
negativeAreaMomentSums.shiftOriginAndSumsToCentroidOfSums();
|
|
226102
|
-
const positiveAreaMoments =
|
|
226103
|
-
const negativeAreaMoments =
|
|
226421
|
+
const positiveAreaMoments = _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_11__["MomentData"].inertiaProductsToPrincipalAxes(positiveAreaMomentSums.origin, positiveAreaMomentSums.sums);
|
|
226422
|
+
const negativeAreaMoments = _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_11__["MomentData"].inertiaProductsToPrincipalAxes(negativeAreaMomentSums.origin, negativeAreaMomentSums.sums);
|
|
226104
226423
|
return {
|
|
226105
226424
|
volume: signedVolumeSum / 6.0,
|
|
226106
226425
|
positiveProjectedFacetAreaMoments: positiveAreaMoments,
|
|
@@ -226109,23 +226428,23 @@ class PolyfaceQuery {
|
|
|
226109
226428
|
}
|
|
226110
226429
|
/** Return the inertia products [xx,xy,xz,xw, yw, etc] integrated over all all facets, as viewed from origin. */
|
|
226111
226430
|
static sumFacetSecondAreaMomentProducts(source, origin) {
|
|
226112
|
-
if (source instanceof
|
|
226431
|
+
if (source instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"])
|
|
226113
226432
|
return PolyfaceQuery.sumFacetSecondAreaMomentProducts(source.createVisitor(0), origin);
|
|
226114
|
-
const products =
|
|
226433
|
+
const products = _geometry4d_Matrix4d__WEBPACK_IMPORTED_MODULE_10__["Matrix4d"].createZero();
|
|
226115
226434
|
source.reset();
|
|
226116
226435
|
while (source.moveToNextFacet()) {
|
|
226117
|
-
|
|
226436
|
+
_geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_8__["PolygonOps"].addSecondMomentAreaProducts(source.point, origin, products);
|
|
226118
226437
|
}
|
|
226119
226438
|
return products;
|
|
226120
226439
|
}
|
|
226121
226440
|
/** Return the inertia products [xx,xy,xz,xw, yw, etc] integrated over all tetrahedral volumes from origin */
|
|
226122
226441
|
static sumFacetSecondVolumeMomentProducts(source, origin) {
|
|
226123
|
-
if (source instanceof
|
|
226442
|
+
if (source instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"])
|
|
226124
226443
|
return PolyfaceQuery.sumFacetSecondVolumeMomentProducts(source.createVisitor(0), origin);
|
|
226125
|
-
const products =
|
|
226444
|
+
const products = _geometry4d_Matrix4d__WEBPACK_IMPORTED_MODULE_10__["Matrix4d"].createZero();
|
|
226126
226445
|
source.reset();
|
|
226127
226446
|
while (source.moveToNextFacet()) {
|
|
226128
|
-
|
|
226447
|
+
_geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_8__["PolygonOps"].addSecondMomentVolumeProducts(source.point, origin, products);
|
|
226129
226448
|
}
|
|
226130
226449
|
return products;
|
|
226131
226450
|
}
|
|
@@ -226139,7 +226458,7 @@ class PolyfaceQuery {
|
|
|
226139
226458
|
if (!origin)
|
|
226140
226459
|
return undefined;
|
|
226141
226460
|
const inertiaProducts = PolyfaceQuery.sumFacetSecondAreaMomentProducts(source, origin);
|
|
226142
|
-
return
|
|
226461
|
+
return _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_11__["MomentData"].inertiaProductsToPrincipalAxes(origin, inertiaProducts);
|
|
226143
226462
|
}
|
|
226144
226463
|
/** Compute area moments for the mesh. In the returned MomentData:
|
|
226145
226464
|
* * origin is the centroid.
|
|
@@ -226153,7 +226472,7 @@ class PolyfaceQuery {
|
|
|
226153
226472
|
if (!origin)
|
|
226154
226473
|
return undefined;
|
|
226155
226474
|
const inertiaProducts = PolyfaceQuery.sumFacetSecondVolumeMomentProducts(source, origin);
|
|
226156
|
-
return
|
|
226475
|
+
return _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_11__["MomentData"].inertiaProductsToPrincipalAxes(origin, inertiaProducts);
|
|
226157
226476
|
}
|
|
226158
226477
|
/**
|
|
226159
226478
|
* Test if the facets in `source` occur in perfectly mated pairs, as is required for a closed manifold volume.
|
|
@@ -226164,11 +226483,11 @@ class PolyfaceQuery {
|
|
|
226164
226483
|
/** Test edges pairing in `source` mesh.
|
|
226165
226484
|
* * for `allowSimpleBoundaries === false` true return means this is a closed 2-manifold surface
|
|
226166
226485
|
* * for `allowSimpleBoundaries === true` true means this is a 2-manifold surface which may have boundary, but is still properly matched internally.
|
|
226167
|
-
* * Any edge with 3
|
|
226486
|
+
* * Any edge with 3 or more incident facets triggers `false` return.
|
|
226168
226487
|
* * Any edge with 2 incident facets in the same direction triggers a `false` return.
|
|
226169
226488
|
*/
|
|
226170
226489
|
static isPolyfaceManifold(source, allowSimpleBoundaries = false) {
|
|
226171
|
-
const edges = new
|
|
226490
|
+
const edges = new _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__["IndexedEdgeMatcher"]();
|
|
226172
226491
|
const visitor = source.createVisitor(1);
|
|
226173
226492
|
visitor.reset();
|
|
226174
226493
|
while (visitor.moveToNextFacet()) {
|
|
@@ -226189,8 +226508,8 @@ class PolyfaceQuery {
|
|
|
226189
226508
|
static boundaryEdges(source, includeDanglers = true, includeMismatch = true, includeNull = true) {
|
|
226190
226509
|
if (source === undefined)
|
|
226191
226510
|
return undefined;
|
|
226192
|
-
const edges = new
|
|
226193
|
-
const visitor = source instanceof
|
|
226511
|
+
const edges = new _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__["IndexedEdgeMatcher"]();
|
|
226512
|
+
const visitor = source instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"] ? source.createVisitor(1) : source;
|
|
226194
226513
|
visitor.reset();
|
|
226195
226514
|
while (visitor.moveToNextFacet()) {
|
|
226196
226515
|
const numEdges = visitor.pointCount - 1;
|
|
@@ -226215,7 +226534,7 @@ class PolyfaceQuery {
|
|
|
226215
226534
|
const result = new _curve_CurveCollection__WEBPACK_IMPORTED_MODULE_0__["BagOfCurves"]();
|
|
226216
226535
|
for (const list of badList) {
|
|
226217
226536
|
for (const e of list) {
|
|
226218
|
-
const e1 = e instanceof
|
|
226537
|
+
const e1 = e instanceof _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__["SortableEdge"] ? e : e[0];
|
|
226219
226538
|
const indexA = e1.vertexIndexA;
|
|
226220
226539
|
const indexB = e1.vertexIndexB;
|
|
226221
226540
|
const pointA = sourcePolyface.data.getPoint(indexA);
|
|
@@ -226231,7 +226550,7 @@ class PolyfaceQuery {
|
|
|
226231
226550
|
* * Facets are ASSUMED to be convex and planar.
|
|
226232
226551
|
*/
|
|
226233
226552
|
static announceSweepLinestringToConvexPolyfaceXY(linestringPoints, polyface, announce) {
|
|
226234
|
-
const context =
|
|
226553
|
+
const context = _multiclip_SweepLineStringToFacetContext__WEBPACK_IMPORTED_MODULE_18__["SweepLineStringToFacetContext"].create(linestringPoints);
|
|
226235
226554
|
if (context) {
|
|
226236
226555
|
const visitor = polyface.createVisitor(0);
|
|
226237
226556
|
for (visitor.reset(); visitor.moveToNextFacet();) {
|
|
@@ -226240,7 +226559,7 @@ class PolyfaceQuery {
|
|
|
226240
226559
|
}
|
|
226241
226560
|
}
|
|
226242
226561
|
/** Execute context.projectToPolygon until its work estimates accumulate to workLimit */
|
|
226243
|
-
static async
|
|
226562
|
+
static async continueAnnounceSweepLinestringToConvexPolyfaceXY(context, visitor, announce) {
|
|
226244
226563
|
let workCount = 0;
|
|
226245
226564
|
while ((workCount < this.asyncWorkLimit) && visitor.moveToNextFacet()) {
|
|
226246
226565
|
workCount += context.projectToPolygon(visitor.point, announce, visitor.clientPolyface(), visitor.currentReadIndex());
|
|
@@ -226264,13 +226583,13 @@ class PolyfaceQuery {
|
|
|
226264
226583
|
* @internal
|
|
226265
226584
|
*/
|
|
226266
226585
|
static async asyncAnnounceSweepLinestringToConvexPolyfaceXY(linestringPoints, polyface, announce) {
|
|
226267
|
-
const context =
|
|
226586
|
+
const context = _multiclip_SweepLineStringToFacetContext__WEBPACK_IMPORTED_MODULE_18__["SweepLineStringToFacetContext"].create(linestringPoints);
|
|
226268
226587
|
this.awaitBlockCount = 0;
|
|
226269
226588
|
let workTotal = 0;
|
|
226270
226589
|
if (context) {
|
|
226271
226590
|
const visitor = polyface.createVisitor(0);
|
|
226272
226591
|
let workCount;
|
|
226273
|
-
while (0 < (workCount = await Promise.resolve(PolyfaceQuery.
|
|
226592
|
+
while (0 < (workCount = await Promise.resolve(PolyfaceQuery.continueAnnounceSweepLinestringToConvexPolyfaceXY(context, visitor, announce)))) {
|
|
226274
226593
|
workTotal += workCount;
|
|
226275
226594
|
this.awaitBlockCount++;
|
|
226276
226595
|
// console.log({ myWorkCount: workCount, myBlockCount: this.awaitBlockCount });
|
|
@@ -226284,11 +226603,11 @@ class PolyfaceQuery {
|
|
|
226284
226603
|
* * Return array of arrays of facet indices.
|
|
226285
226604
|
*/
|
|
226286
226605
|
static partitionFacetIndicesByVertexConnectedComponent(polyface) {
|
|
226287
|
-
if (polyface instanceof
|
|
226606
|
+
if (polyface instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"]) {
|
|
226288
226607
|
return this.partitionFacetIndicesByVertexConnectedComponent(polyface.createVisitor(0));
|
|
226289
226608
|
}
|
|
226290
226609
|
// The polyface is really a visitor !!!
|
|
226291
|
-
const context = new
|
|
226610
|
+
const context = new _numerics_UnionFind__WEBPACK_IMPORTED_MODULE_12__["UnionFindContext"](this.visitorClientPointCount(polyface));
|
|
226292
226611
|
for (polyface.reset(); polyface.moveToNextFacet();) {
|
|
226293
226612
|
const firstVertexIndexOnThisFacet = polyface.pointIndex[0];
|
|
226294
226613
|
for (const vertexIndex of polyface.pointIndex)
|
|
@@ -226321,7 +226640,7 @@ class PolyfaceQuery {
|
|
|
226321
226640
|
* * Return array of arrays of facet indices.
|
|
226322
226641
|
*/
|
|
226323
226642
|
static partitionFacetIndicesByVisibilityVector(polyface, vectorToEye, sideAngleTolerance) {
|
|
226324
|
-
if (polyface instanceof
|
|
226643
|
+
if (polyface instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"]) {
|
|
226325
226644
|
return this.partitionFacetIndicesByVisibilityVector(polyface.createVisitor(0), vectorToEye, sideAngleTolerance);
|
|
226326
226645
|
}
|
|
226327
226646
|
const facetsInComponent = [];
|
|
@@ -226333,7 +226652,7 @@ class PolyfaceQuery {
|
|
|
226333
226652
|
const sideComponent = facetsInComponent[2];
|
|
226334
226653
|
const radiansTol = Math.max(sideAngleTolerance.radians, 1.0e-8);
|
|
226335
226654
|
for (polyface.reset(); polyface.moveToNextFacet();) {
|
|
226336
|
-
const areaNormal =
|
|
226655
|
+
const areaNormal = _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_8__["PolygonOps"].areaNormalGo(polyface.point);
|
|
226337
226656
|
const index = polyface.currentReadIndex();
|
|
226338
226657
|
if (areaNormal) {
|
|
226339
226658
|
const angle = areaNormal.angleFromPerpendicular(vectorToEye);
|
|
@@ -226360,18 +226679,18 @@ class PolyfaceQuery {
|
|
|
226360
226679
|
* @param vectorToEye
|
|
226361
226680
|
* @param sideAngleTolerance
|
|
226362
226681
|
*/
|
|
226363
|
-
static boundaryOfVisibleSubset(polyface, visibilitySelect, vectorToEye, sideAngleTolerance =
|
|
226682
|
+
static boundaryOfVisibleSubset(polyface, visibilitySelect, vectorToEye, sideAngleTolerance = _geometry3d_Angle__WEBPACK_IMPORTED_MODULE_6__["Angle"].createDegrees(1.0e-3)) {
|
|
226364
226683
|
const partitionedIndices = this.partitionFacetIndicesByVisibilityVector(polyface, vectorToEye, sideAngleTolerance);
|
|
226365
226684
|
if (partitionedIndices[visibilitySelect].length === 0)
|
|
226366
226685
|
return undefined;
|
|
226367
|
-
const visitor =
|
|
226686
|
+
const visitor = _IndexedPolyfaceVisitor__WEBPACK_IMPORTED_MODULE_16__["IndexedPolyfaceSubsetVisitor"].createSubsetVisitor(polyface, partitionedIndices[visibilitySelect], 1);
|
|
226368
226687
|
return this.boundaryEdges(visitor, true, false, false);
|
|
226369
226688
|
}
|
|
226370
226689
|
/** Clone the facets in each partition to a separate polyface.
|
|
226371
226690
|
*
|
|
226372
226691
|
*/
|
|
226373
226692
|
static clonePartitions(polyface, partitions) {
|
|
226374
|
-
if (polyface instanceof
|
|
226693
|
+
if (polyface instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"]) {
|
|
226375
226694
|
return this.clonePartitions(polyface.createVisitor(0), partitions);
|
|
226376
226695
|
}
|
|
226377
226696
|
polyface.setNumWrap(0);
|
|
@@ -226382,7 +226701,7 @@ class PolyfaceQuery {
|
|
|
226382
226701
|
options.needColors = polyface.color !== undefined;
|
|
226383
226702
|
options.needTwoSided = polyface.twoSided;
|
|
226384
226703
|
for (const partition of partitions) {
|
|
226385
|
-
const builder =
|
|
226704
|
+
const builder = _PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_21__["PolyfaceBuilder"].create(options);
|
|
226386
226705
|
polyface.reset();
|
|
226387
226706
|
for (const facetIndex of partition) {
|
|
226388
226707
|
polyface.moveToReadIndex(facetIndex);
|
|
@@ -226395,7 +226714,7 @@ class PolyfaceQuery {
|
|
|
226395
226714
|
/** Clone facets that pass an filter function
|
|
226396
226715
|
*/
|
|
226397
226716
|
static cloneFiltered(source, filter) {
|
|
226398
|
-
if (source instanceof
|
|
226717
|
+
if (source instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"]) {
|
|
226399
226718
|
return this.cloneFiltered(source.createVisitor(0), filter);
|
|
226400
226719
|
}
|
|
226401
226720
|
source.setNumWrap(0);
|
|
@@ -226404,7 +226723,7 @@ class PolyfaceQuery {
|
|
|
226404
226723
|
options.needParams = source.param !== undefined;
|
|
226405
226724
|
options.needColors = source.color !== undefined;
|
|
226406
226725
|
options.needTwoSided = source.twoSided;
|
|
226407
|
-
const builder =
|
|
226726
|
+
const builder = _PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_21__["PolyfaceBuilder"].create(options);
|
|
226408
226727
|
source.reset();
|
|
226409
226728
|
for (; source.moveToNextFacet();) {
|
|
226410
226729
|
if (filter(source))
|
|
@@ -226432,11 +226751,11 @@ class PolyfaceQuery {
|
|
|
226432
226751
|
* * Return array of arrays of facet indices.
|
|
226433
226752
|
*/
|
|
226434
226753
|
static partitionFacetIndicesByEdgeConnectedComponent(polyface) {
|
|
226435
|
-
if (polyface instanceof
|
|
226754
|
+
if (polyface instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"]) {
|
|
226436
226755
|
return this.partitionFacetIndicesByEdgeConnectedComponent(polyface.createVisitor(0));
|
|
226437
226756
|
}
|
|
226438
226757
|
polyface.setNumWrap(1);
|
|
226439
|
-
const matcher = new
|
|
226758
|
+
const matcher = new _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__["IndexedEdgeMatcher"]();
|
|
226440
226759
|
polyface.reset();
|
|
226441
226760
|
let numFacets = 0;
|
|
226442
226761
|
while (polyface.moveToNextFacet()) {
|
|
@@ -226448,9 +226767,9 @@ class PolyfaceQuery {
|
|
|
226448
226767
|
}
|
|
226449
226768
|
const allEdges = [];
|
|
226450
226769
|
matcher.sortAndCollectClusters(allEdges, allEdges, allEdges, allEdges);
|
|
226451
|
-
const context = new
|
|
226770
|
+
const context = new _numerics_UnionFind__WEBPACK_IMPORTED_MODULE_12__["UnionFindContext"](numFacets);
|
|
226452
226771
|
for (const cluster of allEdges) {
|
|
226453
|
-
if (cluster instanceof
|
|
226772
|
+
if (cluster instanceof _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__["SortableEdge"]) {
|
|
226454
226773
|
// this edge does not connect anywhere. Ignore it!!
|
|
226455
226774
|
}
|
|
226456
226775
|
else {
|
|
@@ -226481,7 +226800,7 @@ class PolyfaceQuery {
|
|
|
226481
226800
|
* * Facets are ASSUMED to be convex and planar.
|
|
226482
226801
|
*/
|
|
226483
226802
|
static sweepLinestringToFacetsXYreturnSweptFacets(linestringPoints, polyface) {
|
|
226484
|
-
const builder =
|
|
226803
|
+
const builder = _PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_21__["PolyfaceBuilder"].create();
|
|
226485
226804
|
this.announceSweepLinestringToConvexPolyfaceXY(linestringPoints, polyface, (_linestring, _segmentIndex, _polyface, _facetIndex, points) => {
|
|
226486
226805
|
if (points.length === 4)
|
|
226487
226806
|
builder.addQuadFacet(points);
|
|
@@ -226504,7 +226823,7 @@ class PolyfaceQuery {
|
|
|
226504
226823
|
* * Return chains.
|
|
226505
226824
|
*/
|
|
226506
226825
|
static sweepLinestringToFacetsXYReturnChains(linestringPoints, polyface) {
|
|
226507
|
-
const chainContext =
|
|
226826
|
+
const chainContext = _topology_ChainMerge__WEBPACK_IMPORTED_MODULE_13__["ChainMergeContext"].create();
|
|
226508
226827
|
this.announceSweepLinestringToConvexPolyfaceXY(linestringPoints, polyface, (_linestring, _segmentIndex, _polyface, _facetIndex, points, indexA, indexB) => {
|
|
226509
226828
|
chainContext.addSegment(points[indexA], points[indexB]);
|
|
226510
226829
|
});
|
|
@@ -226518,7 +226837,7 @@ class PolyfaceQuery {
|
|
|
226518
226837
|
* * Return chains.
|
|
226519
226838
|
*/
|
|
226520
226839
|
static async asyncSweepLinestringToFacetsXYReturnChains(linestringPoints, polyface) {
|
|
226521
|
-
const chainContext =
|
|
226840
|
+
const chainContext = _topology_ChainMerge__WEBPACK_IMPORTED_MODULE_13__["ChainMergeContext"].create();
|
|
226522
226841
|
await Promise.resolve(this.asyncAnnounceSweepLinestringToConvexPolyfaceXY(linestringPoints, polyface, (_linestring, _segmentIndex, _polyface, _facetIndex, points, indexA, indexB) => {
|
|
226523
226842
|
chainContext.addSegment(points[indexA], points[indexB]);
|
|
226524
226843
|
}));
|
|
@@ -226531,10 +226850,10 @@ class PolyfaceQuery {
|
|
|
226531
226850
|
* * Return statistical summary of x,y,z ranges.
|
|
226532
226851
|
*/
|
|
226533
226852
|
static collectRangeLengthData(polyface) {
|
|
226534
|
-
if (polyface instanceof
|
|
226853
|
+
if (polyface instanceof _Polyface__WEBPACK_IMPORTED_MODULE_20__["Polyface"]) {
|
|
226535
226854
|
return this.collectRangeLengthData(polyface.createVisitor(0));
|
|
226536
226855
|
}
|
|
226537
|
-
const rangeData = new
|
|
226856
|
+
const rangeData = new _RangeLengthData__WEBPACK_IMPORTED_MODULE_22__["RangeLengthData"]();
|
|
226538
226857
|
// polyface is a visitor ...
|
|
226539
226858
|
for (polyface.reset(); polyface.moveToNextFacet();)
|
|
226540
226859
|
rangeData.accumulateGrowableXYZArrayRange(polyface.point);
|
|
@@ -226546,12 +226865,12 @@ class PolyfaceQuery {
|
|
|
226546
226865
|
static cloneWithTVertexFixup(polyface) {
|
|
226547
226866
|
const oldFacetVisitor = polyface.createVisitor(1); // This is to visit the existing facets.
|
|
226548
226867
|
const newFacetVisitor = polyface.createVisitor(0); // This is to build the new facets.
|
|
226549
|
-
const rangeSearcher =
|
|
226550
|
-
const builder =
|
|
226551
|
-
const edgeRange =
|
|
226552
|
-
const point0 =
|
|
226553
|
-
const point1 =
|
|
226554
|
-
const spacePoint =
|
|
226868
|
+
const rangeSearcher = _multiclip_XYPointBuckets__WEBPACK_IMPORTED_MODULE_19__["XYPointBuckets"].create(polyface.data.point, 30);
|
|
226869
|
+
const builder = _PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_21__["PolyfaceBuilder"].create();
|
|
226870
|
+
const edgeRange = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_9__["Range3d"].createNull();
|
|
226871
|
+
const point0 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
226872
|
+
const point1 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
226873
|
+
const spacePoint = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Point3d"].create();
|
|
226555
226874
|
const segment = _curve_LineSegment3d__WEBPACK_IMPORTED_MODULE_1__["LineSegment3d"].create(point0, point1);
|
|
226556
226875
|
for (oldFacetVisitor.reset(); oldFacetVisitor.moveToNextFacet();) {
|
|
226557
226876
|
newFacetVisitor.clearArrays();
|
|
@@ -226676,7 +226995,7 @@ class PolyfaceQuery {
|
|
|
226676
226995
|
* @param clusterSelector indicates whether duplicate clusters are to have 0, 1, or all facets included
|
|
226677
226996
|
*/
|
|
226678
226997
|
static cloneByFacetDuplication(source, includeSingletons, clusterSelector) {
|
|
226679
|
-
const builder =
|
|
226998
|
+
const builder = _PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_21__["PolyfaceBuilder"].create();
|
|
226680
226999
|
const visitor = source.createVisitor(0);
|
|
226681
227000
|
this.announceDuplicateFacetIndices(source, (clusterFacetIndices) => {
|
|
226682
227001
|
let numToSelect = 0;
|
|
@@ -226705,9 +227024,9 @@ class PolyfaceQuery {
|
|
|
226705
227024
|
static cloneWithColinearEdgeFixup(polyface) {
|
|
226706
227025
|
const oldFacetVisitor = polyface.createVisitor(2); // This is to visit the existing facets.
|
|
226707
227026
|
const newFacetVisitor = polyface.createVisitor(0); // This is to build the new facets.
|
|
226708
|
-
const builder =
|
|
226709
|
-
const vector01 =
|
|
226710
|
-
const vector12 =
|
|
227027
|
+
const builder = _PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_21__["PolyfaceBuilder"].create();
|
|
227028
|
+
const vector01 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Vector3d"].create();
|
|
227029
|
+
const vector12 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Vector3d"].create();
|
|
226711
227030
|
const numPoint = polyface.data.point.length;
|
|
226712
227031
|
const pointState = new Int32Array(numPoint);
|
|
226713
227032
|
// FIRST PASS -- in each sector of each facet, determine if the sector has colinear incoming and outgoing vectors.
|
|
@@ -226754,7 +227073,7 @@ class PolyfaceQuery {
|
|
|
226754
227073
|
*/
|
|
226755
227074
|
static setEdgeVisibility(polyface, clusters, value) {
|
|
226756
227075
|
for (const cluster of clusters) {
|
|
226757
|
-
if (cluster instanceof
|
|
227076
|
+
if (cluster instanceof _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__["SortableEdge"]) {
|
|
226758
227077
|
this.setSingleEdgeVisibility(polyface, cluster.facetIndex, cluster.vertexIndexA, value);
|
|
226759
227078
|
}
|
|
226760
227079
|
else if (Array.isArray(cluster)) {
|
|
@@ -226780,7 +227099,7 @@ class PolyfaceQuery {
|
|
|
226780
227099
|
}
|
|
226781
227100
|
/** Load all half edges from a mesh to an IndexedEdgeMatcher */
|
|
226782
227101
|
static createIndexedEdges(visitor) {
|
|
226783
|
-
const edges = new
|
|
227102
|
+
const edges = new _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_15__["IndexedEdgeMatcher"]();
|
|
226784
227103
|
visitor.reset();
|
|
226785
227104
|
while (visitor.moveToNextFacet()) {
|
|
226786
227105
|
const numEdges = visitor.pointCount - 1;
|
|
@@ -226808,8 +227127,8 @@ class PolyfaceQuery {
|
|
|
226808
227127
|
this.markAllEdgeVisibility(mesh, false);
|
|
226809
227128
|
this.setEdgeVisibility(mesh, boundaryEdges, true);
|
|
226810
227129
|
if (sharpEdgeAngle !== undefined) {
|
|
226811
|
-
const normal0 =
|
|
226812
|
-
const normal1 =
|
|
227130
|
+
const normal0 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Vector3d"].create();
|
|
227131
|
+
const normal1 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Vector3d"].create();
|
|
226813
227132
|
for (const pair of pairedEdges) {
|
|
226814
227133
|
if (Array.isArray(pair) && pair.length === 2) {
|
|
226815
227134
|
const e0 = pair[0];
|
|
@@ -226831,9 +227150,9 @@ class PolyfaceQuery {
|
|
|
226831
227150
|
*/
|
|
226832
227151
|
static computeFacetUnitNormal(visitor, facetIndex, result) {
|
|
226833
227152
|
if (!result)
|
|
226834
|
-
result =
|
|
227153
|
+
result = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__["Vector3d"].create();
|
|
226835
227154
|
if (visitor.moveToReadIndex(facetIndex)) {
|
|
226836
|
-
if (
|
|
227155
|
+
if (_geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_8__["PolygonOps"].unitNormal(visitor.point, result))
|
|
226837
227156
|
return result;
|
|
226838
227157
|
}
|
|
226839
227158
|
return undefined;
|
|
@@ -226854,14 +227173,14 @@ class PolyfaceQuery {
|
|
|
226854
227173
|
* @param mesh
|
|
226855
227174
|
*/
|
|
226856
227175
|
static reorientVertexOrderAroundFacetsForConsistentOrientation(mesh) {
|
|
226857
|
-
return
|
|
227176
|
+
return _FacetOrientation__WEBPACK_IMPORTED_MODULE_14__["FacetOrientationFixup"].doFixup(mesh);
|
|
226858
227177
|
}
|
|
226859
227178
|
/**
|
|
226860
227179
|
* Set up indexed normals with one normal in the plane of each facet of the mesh.
|
|
226861
227180
|
* @param polyface
|
|
226862
227181
|
*/
|
|
226863
227182
|
static buildPerFaceNormals(polyface) {
|
|
226864
|
-
|
|
227183
|
+
_multiclip_BuildAverageNormalsContext__WEBPACK_IMPORTED_MODULE_17__["BuildAverageNormalsContext"].buildPerFaceNormals(polyface);
|
|
226865
227184
|
}
|
|
226866
227185
|
/**
|
|
226867
227186
|
* * At each vertex of the mesh
|
|
@@ -226873,8 +227192,8 @@ class PolyfaceQuery {
|
|
|
226873
227192
|
* @param polyface polyface to update.
|
|
226874
227193
|
* @param toleranceAngle averaging is done between normals up to this angle.
|
|
226875
227194
|
*/
|
|
226876
|
-
static buildAverageNormals(polyface, toleranceAngle =
|
|
226877
|
-
|
|
227195
|
+
static buildAverageNormals(polyface, toleranceAngle = _geometry3d_Angle__WEBPACK_IMPORTED_MODULE_6__["Angle"].createDegrees(31.0)) {
|
|
227196
|
+
_multiclip_BuildAverageNormalsContext__WEBPACK_IMPORTED_MODULE_17__["BuildAverageNormalsContext"].buildFastAverageNormals(polyface, toleranceAngle);
|
|
226878
227197
|
}
|
|
226879
227198
|
}
|
|
226880
227199
|
// amount of computation to do per step of async methods.
|
|
@@ -232667,11 +232986,11 @@ var BGFBAccessors;
|
|
|
232667
232986
|
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
232668
232987
|
}
|
|
232669
232988
|
/**
|
|
232670
|
-
* @returns
|
|
232989
|
+
* @returns Uint32Array
|
|
232671
232990
|
*/
|
|
232672
232991
|
intColorArray() {
|
|
232673
232992
|
const offset = this.bb.__offset(this.bb_pos, 12);
|
|
232674
|
-
return offset ? new
|
|
232993
|
+
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;
|
|
232675
232994
|
}
|
|
232676
232995
|
/**
|
|
232677
232996
|
* @param number index
|
|
@@ -234099,7 +234418,6 @@ class BGFBReader {
|
|
|
234099
234418
|
const normalIndexI32 = nullToUndefined(polyfaceHeader.normalIndexArray());
|
|
234100
234419
|
const colorIndexI32 = nullToUndefined(polyfaceHeader.colorIndexArray());
|
|
234101
234420
|
const taggedNumericDataOffset = polyfaceHeader.taggedNumericData();
|
|
234102
|
-
// const colorIndexI32 = nullToUndefined<Int32Array>(offsetToPolyface.colorIndexArray());
|
|
234103
234421
|
if (meshStyle === 1 && pointF64 && pointIndexI32) {
|
|
234104
234422
|
const polyface = _polyface_Polyface__WEBPACK_IMPORTED_MODULE_6__["IndexedPolyface"].create(normalF64 !== undefined, paramF64 !== undefined, intColorU32 !== undefined, twoSided);
|
|
234105
234423
|
polyface.expectedClosure = expectedClosure;
|
|
@@ -236258,7 +236576,8 @@ class Sample {
|
|
|
236258
236576
|
mesh.addParamUV(i, j);
|
|
236259
236577
|
}
|
|
236260
236578
|
}
|
|
236261
|
-
let color =
|
|
236579
|
+
let color = 0xFF5CE51A; // arbitrary color so colorIndex is different from color.
|
|
236580
|
+
const colorDiff = 0x12345;
|
|
236262
236581
|
// Push elements to index array (vertices are calculated using i and j positioning for each point)
|
|
236263
236582
|
let thisColorIndex = 0;
|
|
236264
236583
|
for (let j = 0; j + 1 < numYVertices; j++) {
|
|
@@ -236274,7 +236593,7 @@ class Sample {
|
|
|
236274
236593
|
mesh.addPointIndex(vertex11, false);
|
|
236275
236594
|
// make color === faceIndex
|
|
236276
236595
|
if (createColors) {
|
|
236277
|
-
thisColorIndex = mesh.addColor(color
|
|
236596
|
+
thisColorIndex = mesh.addColor(color += colorDiff);
|
|
236278
236597
|
mesh.addColorIndex(thisColorIndex);
|
|
236279
236598
|
mesh.addColorIndex(thisColorIndex);
|
|
236280
236599
|
mesh.addColorIndex(thisColorIndex);
|
|
@@ -236322,7 +236641,7 @@ class Sample {
|
|
|
236322
236641
|
mesh.addPointIndex(vertex01, true);
|
|
236323
236642
|
// make color === faceIndex
|
|
236324
236643
|
if (createColors) {
|
|
236325
|
-
thisColorIndex = mesh.addColor(color
|
|
236644
|
+
thisColorIndex = mesh.addColor(color += colorDiff);
|
|
236326
236645
|
mesh.addColorIndex(thisColorIndex);
|
|
236327
236646
|
mesh.addColorIndex(thisColorIndex);
|
|
236328
236647
|
mesh.addColorIndex(thisColorIndex);
|
|
@@ -281376,7 +281695,7 @@ class TestContext {
|
|
|
281376
281695
|
this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
|
|
281377
281696
|
const iModelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${(_a = process.env.IMJS_URL_PREFIX) !== null && _a !== void 0 ? _a : ""}api.bentley.com/imodels` } });
|
|
281378
281697
|
await core_frontend_1.NoRenderApp.startup({
|
|
281379
|
-
applicationVersion: "3.2.0-dev.
|
|
281698
|
+
applicationVersion: "3.2.0-dev.45",
|
|
281380
281699
|
applicationId: this.settings.gprid,
|
|
281381
281700
|
authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.adminUserAccessToken),
|
|
281382
281701
|
hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
|