@itwin/ecschema-rpcinterface-tests 4.5.0-dev.21 → 4.5.0-dev.23

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.
@@ -22437,6 +22437,7 @@ var IModelStatus;
22437
22437
  IModelStatus[IModelStatus["NotRegistered"] = 65605] = "NotRegistered";
22438
22438
  IModelStatus[IModelStatus["FunctionNotFound"] = 65606] = "FunctionNotFound";
22439
22439
  IModelStatus[IModelStatus["NoActiveCommand"] = 65607] = "NoActiveCommand";
22440
+ IModelStatus[IModelStatus["Aborted"] = 65608] = "Aborted";
22440
22441
  })(IModelStatus || (IModelStatus = {}));
22441
22442
  /** Error statuses produced by various briefcase operations, typically encountered as the `errorNumber` of an [IModelError]($common).
22442
22443
  * @public
@@ -26807,7 +26808,10 @@ class StatusCategory {
26807
26808
  return category;
26808
26809
  }
26809
26810
  }
26810
- return lookupCategory(error);
26811
+ const errorNumber = error.errorNumber;
26812
+ if (typeof errorNumber === "number")
26813
+ return lookupHttpStatusCategory(errorNumber);
26814
+ return new UnknownError();
26811
26815
  }
26812
26816
  }
26813
26817
  StatusCategory.handlers = new Set();
@@ -27043,8 +27047,10 @@ class UnknownError extends HTTP.InternalServerError {
27043
27047
  }
27044
27048
  class NotImplemented extends HTTP.NotImplemented {
27045
27049
  }
27046
- function lookupCategory(error) {
27047
- switch (error.errorNumber) {
27050
+ class Aborted extends HTTP.BadRequest {
27051
+ }
27052
+ function lookupHttpStatusCategory(statusCode) {
27053
+ switch (statusCode) {
27048
27054
  case _BentleyError__WEBPACK_IMPORTED_MODULE_0__.BentleyStatus.SUCCESS: return new Success();
27049
27055
  case _BentleyError__WEBPACK_IMPORTED_MODULE_0__.BentleyStatus.ERROR: return new UnknownError();
27050
27056
  case _BentleyError__WEBPACK_IMPORTED_MODULE_0__.IModelStatus.Success: return new Success();
@@ -27118,6 +27124,7 @@ function lookupCategory(error) {
27118
27124
  case _BentleyError__WEBPACK_IMPORTED_MODULE_0__.IModelStatus.NotRegistered: return new NotImplemented();
27119
27125
  case _BentleyError__WEBPACK_IMPORTED_MODULE_0__.IModelStatus.FunctionNotFound: return new NotImplemented();
27120
27126
  case _BentleyError__WEBPACK_IMPORTED_MODULE_0__.IModelStatus.NoActiveCommand: return new StateViolation();
27127
+ case _BentleyError__WEBPACK_IMPORTED_MODULE_0__.IModelStatus.Aborted: return new Aborted();
27121
27128
  case _BentleyError__WEBPACK_IMPORTED_MODULE_0__.BriefcaseStatus.CannotAcquire: return new OperationFailed();
27122
27129
  case _BentleyError__WEBPACK_IMPORTED_MODULE_0__.BriefcaseStatus.CannotDownload: return new OperationFailed();
27123
27130
  case _BentleyError__WEBPACK_IMPORTED_MODULE_0__.BriefcaseStatus.CannotUpload: return new OperationFailed();
@@ -56435,7 +56442,7 @@ class RpcInvocation {
56435
56442
  status.responseValue = rawResult; // for ipc case
56436
56443
  fulfillment.rawResult = status;
56437
56444
  }
56438
- if (rawResult instanceof _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BentleyError) {
56445
+ if (rawResult instanceof Error) {
56439
56446
  fulfillment.status = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.StatusCategory["for"](rawResult).code;
56440
56447
  }
56441
56448
  }
@@ -89955,6 +89962,10 @@ class ViewManager {
89955
89962
  clearTimeout(this._idleWorkTimer);
89956
89963
  this._idleWorkTimer = undefined;
89957
89964
  }
89965
+ this._viewports.map((viewport) => {
89966
+ if (!viewport.isDisposed)
89967
+ this.dropViewport(viewport, true);
89968
+ });
89958
89969
  this._viewports.length = 0;
89959
89970
  this.decorators.length = 0;
89960
89971
  this.toolTipProviders.length = 0;
@@ -202287,7 +202298,7 @@ class MXCubicAlongArcEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_
202287
202298
  super.scaleInPlace(scaleFactor);
202288
202299
  }
202289
202300
  /** return a deep copy of the evaluator */
202290
- clone() { return new MXCubicAlongArcEvaluator(this.nominalLength1, this.nominalRadius1, super._axisLength, this.cubicM); }
202301
+ clone() { return new MXCubicAlongArcEvaluator(this.nominalLength1, this.nominalRadius1, this.axisLength, this.cubicM); }
202291
202302
  /** Member by member matchup ... */
202292
202303
  isAlmostEqual(other) {
202293
202304
  if (other instanceof MXCubicAlongArcEvaluator) {
@@ -202577,7 +202588,7 @@ class PolishCubicEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0__.
202577
202588
  super.scaleInPlace(scaleFactor);
202578
202589
  }
202579
202590
  /** return a deep copy of the evaluator */
202580
- clone() { return new PolishCubicEvaluator(this.nominalLength1, this.nominalRadius1, super._axisLength, this.cubicM); }
202591
+ clone() { return new PolishCubicEvaluator(this.nominalLength1, this.nominalRadius1, this.axisLength, this.cubicM); }
202581
202592
  /** Member by member matchup ... */
202582
202593
  isAlmostEqual(other) {
202583
202594
  if (other instanceof PolishCubicEvaluator) {
@@ -206590,6 +206601,9 @@ class FrameBuilder {
206590
206601
  break;
206591
206602
  }
206592
206603
  }
206604
+ else if (data.hasOwnProperty("x") && data.hasOwnProperty("y") && data.hasOwnProperty("z")) {
206605
+ this.announcePoint(_Point3dVector3d__WEBPACK_IMPORTED_MODULE_3__.Point3d.create(data.x, data.y, data.z));
206606
+ }
206593
206607
  }
206594
206608
  /**
206595
206609
  * Create a localToWorld frame for the given data.
@@ -208673,7 +208687,7 @@ class GrowableXYZArray extends _IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_0_
208673
208687
  this._xyzInUse = 0;
208674
208688
  }
208675
208689
  /**
208676
- * Get a point by index, strongly typed as a Point3d. This is unchecked. Use getPoint3dAtCheckedPointIndex to have validity test.
208690
+ * Get a point by index, strongly typed as a Point3d. This is unchecked. Use [[getPoint3dAtCheckedPointIndex]] to have validity test.
208677
208691
  * @param pointIndex index to access
208678
208692
  * @param result optional result
208679
208693
  */
@@ -208682,7 +208696,7 @@ class GrowableXYZArray extends _IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_0_
208682
208696
  return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Point3d.create(this._data[index], this._data[index + 1], this._data[index + 2], result);
208683
208697
  }
208684
208698
  /**
208685
- * Get a point by index, strongly typed as a Point2d. This is unchecked. Use getPoint2dAtCheckedPointIndex to have validity test.
208699
+ * Get a point by index, strongly typed as a Point2d. This is unchecked. Use [[getPoint2dAtCheckedPointIndex]] to have validity test.
208686
208700
  * @param pointIndex index to access
208687
208701
  * @param result optional result
208688
208702
  */
@@ -208690,6 +208704,15 @@ class GrowableXYZArray extends _IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_0_
208690
208704
  const index = 3 * pointIndex;
208691
208705
  return _Point2dVector2d__WEBPACK_IMPORTED_MODULE_3__.Point2d.create(this._data[index], this._data[index + 1], result);
208692
208706
  }
208707
+ /**
208708
+ * Get a vector by index, strongly typed as a Vector3d. This is unchecked. Use [[getVector3dAtCheckedVectorIndex]] to have validity test.
208709
+ * @param vectorIndex index to access
208710
+ * @param result optional result
208711
+ */
208712
+ getVector3dAtUncheckedVectorIndex(vectorIndex, result) {
208713
+ const index = 3 * vectorIndex;
208714
+ return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_2__.Vector3d.create(this._data[index], this._data[index + 1], this._data[index + 2], result);
208715
+ }
208693
208716
  /** copy xyz into strongly typed Point3d */
208694
208717
  getPoint3dAtCheckedPointIndex(pointIndex, result) {
208695
208718
  if (this.isIndexValid(pointIndex)) {
@@ -233760,7 +233783,7 @@ class IndexedPolyfaceVisitor extends _PolyfaceData__WEBPACK_IMPORTED_MODULE_0__.
233760
233783
  this._currentFacetIndex = facetIndex;
233761
233784
  this._nextFacetIndex = facetIndex + 1;
233762
233785
  this._numEdges = this._polyface.numEdgeInFacet(facetIndex);
233763
- this.resizeAllDataArrays(this._numEdges + this._numWrap);
233786
+ this.resizeAllArrays(this._numEdges + this._numWrap);
233764
233787
  this.gatherIndexedData(this._polyface.data, this._polyface.facetIndex0(this._currentFacetIndex), this._polyface.facetIndex1(this._currentFacetIndex), this._numWrap);
233765
233788
  return true;
233766
233789
  }
@@ -233980,6 +234003,7 @@ __webpack_require__.r(__webpack_exports__);
233980
234003
  * @module Polyface
233981
234004
  */
233982
234005
  /* eslint-disable @typescript-eslint/naming-convention, no-empty */
234006
+ // cspell:word internaldocs
233983
234007
 
233984
234008
 
233985
234009
 
@@ -234269,10 +234293,10 @@ class IndexedPolyface extends Polyface {
234269
234293
  }
234270
234294
  /**
234271
234295
  * Create an empty facet set with coordinate and index data to be supplied later.
234272
- * @param needNormals true if normals will be constructed.
234273
- * @param needParams true if uv parameters will be constructed.
234274
- * @param needColors true if colors will be constructed.
234275
- * @param twoSided true if the facets are to be considered viewable from the back.
234296
+ * @param needNormals `true` to allocate empty normal data and index arrays; `false` (default) to leave undefined.
234297
+ * @param needParams `true` to allocate empty uv parameter data and index arrays; `false` (default) to leave undefined.
234298
+ * @param needColors `true` to allocate empty color data and index arrays; `false` (default) to leave undefined.
234299
+ * @param twoSided `true` if the facets are to be considered viewable from the back; `false` (default) if not.
234276
234300
  */
234277
234301
  static create(needNormals = false, needParams = false, needColors = false, twoSided = false) {
234278
234302
  return new IndexedPolyface(new _PolyfaceData__WEBPACK_IMPORTED_MODULE_3__.PolyfaceData(needNormals, needParams, needColors, twoSided));
@@ -234341,19 +234365,19 @@ class IndexedPolyface extends Polyface {
234341
234365
  */
234342
234366
  addNormal(normal, priorIndexA, priorIndexB) {
234343
234367
  // check if `normal` is duplicate of `dataNormal` at index `i`
234344
- const normalIsDuplicate = (dataNormal, i) => {
234345
- const distance = dataNormal.distanceIndexToPoint(i, normal);
234368
+ const normalIsDuplicate = (i) => {
234369
+ const distance = this.data.normal.distanceIndexToPoint(i, normal);
234346
234370
  return distance !== undefined && _Geometry__WEBPACK_IMPORTED_MODULE_4__.Geometry.isSmallMetricDistance(distance);
234347
234371
  };
234348
234372
  if (this.data.normal !== undefined) {
234349
- if (priorIndexA !== undefined && normalIsDuplicate(this.data.normal, priorIndexA))
234373
+ if (priorIndexA !== undefined && normalIsDuplicate(priorIndexA))
234350
234374
  return priorIndexA;
234351
- if (priorIndexB !== undefined && normalIsDuplicate(this.data.normal, priorIndexB))
234375
+ if (priorIndexB !== undefined && normalIsDuplicate(priorIndexB))
234352
234376
  return priorIndexB;
234353
234377
  // check the tail index for possible duplicate
234354
234378
  if (priorIndexA !== undefined || priorIndexB !== undefined) {
234355
234379
  const tailIndex = this.data.normal.length - 1;
234356
- if (normalIsDuplicate(this.data.normal, tailIndex))
234380
+ if (normalIsDuplicate(tailIndex))
234357
234381
  return tailIndex;
234358
234382
  }
234359
234383
  }
@@ -234440,10 +234464,16 @@ class IndexedPolyface extends Polyface {
234440
234464
  messages.push("colorIndex count must equal pointIndex count");
234441
234465
  if (this.data.edgeVisible.length !== lengthB)
234442
234466
  messages.push("visibleIndex count must equal pointIndex count");
234467
+ if (!Polyface.areIndicesValid(this.data.pointIndex, lengthA, lengthB, this.data.point, this.data.point ? this.data.point.length : 0))
234468
+ messages.push("invalid point indices in the last facet");
234443
234469
  if (!Polyface.areIndicesValid(this.data.normalIndex, lengthA, lengthB, this.data.normal, this.data.normal ? this.data.normal.length : 0))
234444
234470
  messages.push("invalid normal indices in the last facet");
234471
+ if (!Polyface.areIndicesValid(this.data.paramIndex, lengthA, lengthB, this.data.param, this.data.param ? this.data.param.length : 0))
234472
+ messages.push("invalid param indices in the last facet");
234473
+ if (!Polyface.areIndicesValid(this.data.colorIndex, lengthA, lengthB, this.data.color, this.data.color ? this.data.color.length : 0))
234474
+ messages.push("invalid color indices in the last facet");
234445
234475
  if (messages.length > 0) {
234446
- this.data.trimAllIndexArrays(lengthB);
234476
+ this.data.trimAllIndexArrays(lengthA);
234447
234477
  return messages;
234448
234478
  }
234449
234479
  }
@@ -234687,8 +234717,8 @@ class FacetSector {
234687
234717
  */
234688
234718
  loadIndexedPointAndDerivativeCoordinatesFromPackedArrays(i, packedXYZ, packedDerivatives, fractions, v) {
234689
234719
  packedXYZ.getPoint3dAtCheckedPointIndex(i, this.xyz);
234690
- if (fractions && v !== undefined)
234691
- this.uv = _geometry3d_Point2dVector2d__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(fractions.atUncheckedIndex(i), v);
234720
+ if (this.uv && fractions && v !== undefined)
234721
+ this.uv.set(fractions.atUncheckedIndex(i), v);
234692
234722
  this.xyzIndex = -1;
234693
234723
  this.normalIndex = -1;
234694
234724
  this.uvIndex = -1;
@@ -235373,8 +235403,7 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
235373
235403
  this.addIndexedTriangleNormalIndexes(sectorA0.normalIndex, sectorA1.normalIndex, sectorA2.normalIndex);
235374
235404
  if (this._options.needParams)
235375
235405
  this.addIndexedTriangleParamIndexes(sectorA0.uvIndex, sectorA1.uvIndex, sectorA2.uvIndex);
235376
- this.addIndexedTrianglePointIndexes(sectorA0.xyzIndex, sectorA1.xyzIndex, sectorA2.xyzIndex);
235377
- this._polyface.terminateFacet();
235406
+ this.addIndexedTrianglePointIndexes(sectorA0.xyzIndex, sectorA1.xyzIndex, sectorA2.xyzIndex, true);
235378
235407
  }
235379
235408
  }
235380
235409
  addSectorQuadA01B01(sectorA0, sectorA1, sectorB0, sectorB1) {
@@ -235390,8 +235419,7 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
235390
235419
  this.addIndexedQuadNormalIndexes(sectorA0.normalIndex, sectorA1.normalIndex, sectorB0.normalIndex, sectorB1.normalIndex);
235391
235420
  if (this._options.needParams)
235392
235421
  this.addIndexedQuadParamIndexes(sectorA0.uvIndex, sectorA1.uvIndex, sectorB0.uvIndex, sectorB1.uvIndex);
235393
- this.addIndexedQuadPointIndexes(sectorA0.xyzIndex, sectorA1.xyzIndex, sectorB0.xyzIndex, sectorB1.xyzIndex);
235394
- this._polyface.terminateFacet();
235422
+ this.addIndexedQuadPointIndexes(sectorA0.xyzIndex, sectorA1.xyzIndex, sectorB0.xyzIndex, sectorB1.xyzIndex, true);
235395
235423
  }
235396
235424
  }
235397
235425
  /** Add facets between lineStrings with matched point counts.
@@ -235463,14 +235491,14 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
235463
235491
  for (let i = 1; i < numPoints; i++) {
235464
235492
  if (this.options.shouldTriangulate) {
235465
235493
  if (distinctIndices(pointA.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i), pointB.atUncheckedIndex(i))) {
235466
- this.addIndexedTrianglePointIndexes(pointA.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i), pointB.atUncheckedIndex(i));
235494
+ this.addIndexedTrianglePointIndexes(pointA.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i), pointB.atUncheckedIndex(i), false);
235467
235495
  if (normalA && normalB)
235468
235496
  this.addIndexedTriangleNormalIndexes(normalA.atUncheckedIndex(i - 1), normalA.atUncheckedIndex(i), normalB.atUncheckedIndex(i - 1));
235469
235497
  if (paramA && paramB)
235470
235498
  this.addIndexedTriangleParamIndexes(paramA.atUncheckedIndex(i - 1), paramA.atUncheckedIndex(i), paramB.atUncheckedIndex(i - 1));
235471
235499
  }
235472
235500
  if (distinctIndices(pointB.atUncheckedIndex(i), pointB.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i - 1))) {
235473
- this.addIndexedTrianglePointIndexes(pointA.atUncheckedIndex(i - 1), pointB.atUncheckedIndex(i), pointB.atUncheckedIndex(i - 1));
235501
+ this.addIndexedTrianglePointIndexes(pointA.atUncheckedIndex(i - 1), pointB.atUncheckedIndex(i), pointB.atUncheckedIndex(i - 1), false);
235474
235502
  if (normalA && normalB)
235475
235503
  this.addIndexedTriangleNormalIndexes(normalA.atUncheckedIndex(i - 1), normalB.atUncheckedIndex(i), normalB.atUncheckedIndex(i - 1));
235476
235504
  if (paramA && paramB)
@@ -235479,14 +235507,14 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
235479
235507
  }
235480
235508
  else {
235481
235509
  if (pointA.atUncheckedIndex(i - 1) !== pointA.atUncheckedIndex(i) || pointB.atUncheckedIndex(i - 1) !== pointB.atUncheckedIndex(i)) {
235482
- this.addIndexedQuadPointIndexes(pointA.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i), pointB.atUncheckedIndex(i - 1), pointB.atUncheckedIndex(i));
235510
+ this.addIndexedQuadPointIndexes(pointA.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i), pointB.atUncheckedIndex(i - 1), pointB.atUncheckedIndex(i), false);
235483
235511
  if (normalA && normalB)
235484
235512
  this.addIndexedQuadNormalIndexes(normalA.atUncheckedIndex(i - 1), normalA.atUncheckedIndex(i), normalB.atUncheckedIndex(i - 1), normalB.atUncheckedIndex(i));
235485
235513
  if (paramA && paramB)
235486
235514
  this.addIndexedQuadParamIndexes(paramA.atUncheckedIndex(i - 1), paramA.atUncheckedIndex(i), paramB.atUncheckedIndex(i - 1), paramB.atUncheckedIndex(i));
235487
235515
  }
235488
- this._polyface.terminateFacet();
235489
235516
  }
235517
+ this._polyface.terminateFacet();
235490
235518
  }
235491
235519
  }
235492
235520
  /** Add facets between lineStrings with matched point counts.
@@ -236130,11 +236158,14 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
236130
236158
  /** add facets for a GeometryQuery object. This is double dispatch through `dispatchToGeometryHandler(this)` */
236131
236159
  addGeometryQuery(g) { g.dispatchToGeometryHandler(this); }
236132
236160
  /**
236133
- *
236134
- * * Visit all faces
236135
- * * Test each face with f(node) for any node on the face.
236136
- * * For each face that passes, pass its coordinates to the builder.
236137
- * * Rely on the builder's compress step to find common vertex coordinates
236161
+ * Add a graph to the builder.
236162
+ * * Visit one node per face
236163
+ * * If `acceptFaceFunction(node)` returns true, pass face coordinates to the builder
236164
+ * * Accepted face edge visibility is determined by `isEdgeVisibleFunction`.
236165
+ * * Rely on the builder's compress step to find common vertex coordinates.
236166
+ * @param graph faces to add as facets
236167
+ * @param acceptFaceFunction optional test for whether to add a given face. Default: ignore exterior faces
236168
+ * @param isEdgeVisibleFunction optional test for whether to hide an edge. Default: hide interior edges
236138
236169
  * @internal
236139
236170
  */
236140
236171
  addGraph(graph, acceptFaceFunction = (node) => _topology_Graph__WEBPACK_IMPORTED_MODULE_23__.HalfEdge.testNodeMaskNotExterior(node), isEdgeVisibleFunction = (node) => _topology_Graph__WEBPACK_IMPORTED_MODULE_23__.HalfEdge.testMateMaskExterior(node)) {
@@ -236173,7 +236204,7 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
236173
236204
  * * terminate the facet
236174
236205
  * @internal
236175
236206
  */
236176
- addGraphFaces(_graph, faces) {
236207
+ addGraphFaces(faces) {
236177
236208
  let index = 0;
236178
236209
  for (const seed of faces) {
236179
236210
  let node = seed;
@@ -236185,21 +236216,26 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
236185
236216
  this._polyface.terminateFacet();
236186
236217
  }
236187
236218
  }
236188
- /** Create a polyface containing the faces of a HalfEdgeGraph, with test function to filter faces.
236219
+ /**
236220
+ * Create a polyface containing the faces of a HalfEdgeGraph, with test functions to filter faces and hide edges.
236221
+ * * This is a static wrapper of [[addGraph]].
236222
+ * @param graph faces to add as facets
236223
+ * @param acceptFaceFunction optional test for whether to add a given face. Default: ignore exterior faces
236224
+ * @param isEdgeVisibleFunction optional test for whether to hide an edge. Default: hide interior edges
236189
236225
  * @internal
236190
236226
  */
236191
- static graphToPolyface(graph, options, acceptFaceFunction = (node) => _topology_Graph__WEBPACK_IMPORTED_MODULE_23__.HalfEdge.testNodeMaskNotExterior(node)) {
236227
+ static graphToPolyface(graph, options, acceptFaceFunction = (node) => _topology_Graph__WEBPACK_IMPORTED_MODULE_23__.HalfEdge.testNodeMaskNotExterior(node), isEdgeVisibleFunction = (node) => _topology_Graph__WEBPACK_IMPORTED_MODULE_23__.HalfEdge.testMateMaskExterior(node)) {
236192
236228
  const builder = PolyfaceBuilder.create(options);
236193
- builder.addGraph(graph, acceptFaceFunction);
236229
+ builder.addGraph(graph, acceptFaceFunction, isEdgeVisibleFunction);
236194
236230
  builder.endFace();
236195
236231
  return builder.claimPolyface();
236196
236232
  }
236197
236233
  /** Create a polyface containing the faces of a HalfEdgeGraph that are specified by the HalfEdge array.
236198
236234
  * @internal
236199
236235
  */
236200
- static graphFacesToPolyface(graph, faces) {
236236
+ static graphFacesToPolyface(faces) {
236201
236237
  const builder = PolyfaceBuilder.create();
236202
- builder.addGraphFaces(graph, faces);
236238
+ builder.addGraphFaces(faces);
236203
236239
  builder.endFace();
236204
236240
  return builder.claimPolyface();
236205
236241
  }
@@ -237212,39 +237248,28 @@ __webpack_require__.r(__webpack_exports__);
237212
237248
 
237213
237249
 
237214
237250
 
237251
+ // cspell:word internaldocs
237215
237252
  /**
237216
- * PolyfaceData carries data arrays for point, normal, param, color and their indices.
237217
- *
237218
- * * IndexedPolyface carries a PolyfaceData as a member. (NOT as a base class -- it already has GeometryQuery as base)
237219
- * * IndexedPolyfaceVisitor uses PolyfaceData as a base class. In this use there is only a single facet in the polyfaceData.
237220
- * * PolyfaceData does not know (!!!) what indices range constitute a facet. That is managed by derived class or carrier class.
237253
+ * `PolyfaceData` carries data arrays for point, normal, uv-parameters, and color, and index arrays for each.
237254
+ * * Normal, uv-parameter, and color data are optional.
237255
+ * * A given data array is defined if and only if its corresponding index array is defined.
237256
+ * * All defined index arrays have parallel face loop order and structure, and thus the same length.
237257
+ * * `IndexedPolyface` carries a PolyfaceData as a member (NOT as a base class; it already has `GeometryQuery` as base).
237258
+ * * `IndexedPolyfaceVisitor` uses PolyfaceData as a base class. In this use, there is only a single facet in `PolyfaceData`.
237259
+ * * `PolyfaceData` does not know what index range constitutes a given facet. This is managed by a derived/carrier class.
237221
237260
  * @public
237222
237261
  */
237223
237262
  class PolyfaceData {
237224
- /** boolean tag indicating if the facets are to be considered viewable from the back */
237225
- get twoSided() { return this._twoSided; }
237226
- set twoSided(value) { this._twoSided = value; }
237227
- /** set the `taggedNumericData` member */
237228
- setTaggedNumericData(data) {
237229
- this.taggedNumericData = data;
237230
- }
237231
237263
  /**
237232
- * Flag indicating if the mesh closure is unknown (0), open sheet (1), closed solid (2).
237233
- * * A boundary edge of a mesh is defined as an edge with only one connected facet.
237234
- * * Closed solid is a mesh with no boundary edge. Open sheet is a mesh that has boundary edge(s).
237235
- */
237236
- get expectedClosure() { return this._expectedClosure; }
237237
- set expectedClosure(value) { this._expectedClosure = value; }
237238
- /** Constructor for facets.
237239
- * * The various params control whether respective arrays are to be allocated.
237240
- * * If arrayData is provided, all other params are IGNORED.
237241
- * *
237264
+ * Constructor for facets.
237265
+ * @param needNormals `true` to allocate empty normal data and index arrays; `false` (default) to leave undefined.
237266
+ * @param needParams `true` to allocate empty uv parameter data and index arrays; `false` (default) to leave undefined.
237267
+ * @param needColors `true` to allocate empty color data and index arrays; `false` (default) to leave undefined.
237268
+ * @param twoSided `true` if the facets are to be considered viewable from the back; `false` (default) if not.
237242
237269
  */
237243
237270
  constructor(needNormals = false, needParams = false, needColors = false, twoSided = false) {
237244
- this.face = [];
237245
237271
  this.point = new _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_0__.GrowableXYZArray();
237246
237272
  this.pointIndex = [];
237247
- this.edgeVisible = [];
237248
237273
  if (needNormals) {
237249
237274
  this.normal = new _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_0__.GrowableXYZArray();
237250
237275
  this.normalIndex = [];
@@ -237257,6 +237282,8 @@ class PolyfaceData {
237257
237282
  this.color = [];
237258
237283
  this.colorIndex = [];
237259
237284
  }
237285
+ this.face = [];
237286
+ this.edgeVisible = [];
237260
237287
  this._twoSided = twoSided;
237261
237288
  this._expectedClosure = 0;
237262
237289
  }
@@ -237265,30 +237292,29 @@ class PolyfaceData {
237265
237292
  const result = new PolyfaceData();
237266
237293
  result.point = this.point.clone();
237267
237294
  result.pointIndex = this.pointIndex.slice();
237268
- result.edgeVisible = this.edgeVisible.slice();
237269
- result.face = this.face.slice();
237270
- result.twoSided = this.twoSided;
237271
- result.expectedClosure = this.expectedClosure;
237272
237295
  if (this.normal)
237273
237296
  result.normal = this.normal.clone();
237274
- if (this.param)
237275
- result.param = this.param.clone();
237276
- if (this.color)
237277
- result.color = this.color.slice();
237278
237297
  if (this.normalIndex)
237279
237298
  result.normalIndex = this.normalIndex.slice();
237299
+ if (this.param)
237300
+ result.param = this.param.clone();
237280
237301
  if (this.paramIndex)
237281
237302
  result.paramIndex = this.paramIndex.slice();
237303
+ if (this.color)
237304
+ result.color = this.color.slice();
237282
237305
  if (this.colorIndex)
237283
237306
  result.colorIndex = this.colorIndex.slice();
237307
+ result.face = this.face.slice();
237284
237308
  if (this.auxData)
237285
237309
  result.auxData = this.auxData.clone();
237286
- if (this.taggedNumericData) {
237310
+ if (this.taggedNumericData)
237287
237311
  result.taggedNumericData = this.taggedNumericData.clone();
237288
- }
237312
+ result.edgeVisible = this.edgeVisible.slice();
237313
+ result.twoSided = this.twoSided;
237314
+ result.expectedClosure = this.expectedClosure;
237289
237315
  return result;
237290
237316
  }
237291
- /** Test for equal indices and nearly equal coordinates */
237317
+ /** Test for equal indices and nearly equal coordinates. */
237292
237318
  isAlmostEqual(other) {
237293
237319
  if (!_geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_0__.GrowableXYZArray.isAlmostEqual(this.point, other.point))
237294
237320
  return false;
@@ -237306,77 +237332,133 @@ class PolyfaceData {
237306
237332
  return false;
237307
237333
  if (!_geometry3d_PointHelpers__WEBPACK_IMPORTED_MODULE_2__.NumberArray.isExactEqual(this.colorIndex, other.colorIndex))
237308
237334
  return false;
237309
- if (!_geometry3d_PointHelpers__WEBPACK_IMPORTED_MODULE_2__.NumberArray.isExactEqual(this.edgeVisible, other.edgeVisible))
237310
- return false;
237311
237335
  if (!_AuxData__WEBPACK_IMPORTED_MODULE_3__.PolyfaceAuxData.isAlmostEqual(this.auxData, other.auxData))
237312
237336
  return false;
237337
+ if (!_TaggedNumericData__WEBPACK_IMPORTED_MODULE_4__.TaggedNumericData.areAlmostEqual(this.taggedNumericData, other.taggedNumericData))
237338
+ return false;
237339
+ if (!_geometry3d_PointHelpers__WEBPACK_IMPORTED_MODULE_2__.NumberArray.isExactEqual(this.edgeVisible, other.edgeVisible))
237340
+ return false;
237313
237341
  if (this.twoSided !== other.twoSided)
237314
237342
  return false;
237315
237343
  if (this.expectedClosure !== other.expectedClosure)
237316
237344
  return false;
237317
- if (!_TaggedNumericData__WEBPACK_IMPORTED_MODULE_4__.TaggedNumericData.areAlmostEqual(this.taggedNumericData, other.taggedNumericData))
237318
- return false;
237319
237345
  return true;
237320
237346
  }
237321
237347
  /** Ask if normals are required in this mesh. */
237322
- get requireNormals() { return undefined !== this.normal; }
237348
+ get requireNormals() {
237349
+ return undefined !== this.normal;
237350
+ }
237351
+ /** Ask if params are required in this mesh. */
237352
+ get requireParams() {
237353
+ return undefined !== this.param;
237354
+ }
237355
+ /** Ask if colors are required in this mesh. */
237356
+ get requireColors() {
237357
+ return undefined !== this.color;
237358
+ }
237323
237359
  /** Get the point count */
237324
- get pointCount() { return this.point.length; }
237360
+ get pointCount() {
237361
+ return this.point.length;
237362
+ }
237325
237363
  /** Get the normal count */
237326
- get normalCount() { return this.normal ? this.normal.length : 0; }
237364
+ get normalCount() {
237365
+ return this.normal ? this.normal.length : 0;
237366
+ }
237327
237367
  /** Get the param count */
237328
- get paramCount() { return this.param ? this.param.length : 0; }
237368
+ get paramCount() {
237369
+ return this.param ? this.param.length : 0;
237370
+ }
237329
237371
  /** Get the color count */
237330
- get colorCount() { return this.color ? this.color.length : 0; }
237331
- /** Get the index count. Note that there is one count, and all index arrays (point, normal, param, color) must match */
237332
- get indexCount() { return this.pointIndex.length; } // ALWAYS INDEXED ... all index vectors must have same length.
237333
- /** Get the number of faces.
237372
+ get colorCount() {
237373
+ return this.color ? this.color.length : 0;
237374
+ }
237375
+ /** Get the index count. Note that the point array is always indexed, and index arrays all have the same length. */
237376
+ get indexCount() {
237377
+ return this.pointIndex.length;
237378
+ }
237379
+ /**
237380
+ * Get the number of faces.
237334
237381
  * * Note that a "face" is not a facet.
237335
- * * A "face" is a subset of facets grouped for application purposes.
237336
- */
237337
- get faceCount() { return this.face.length; }
237338
- /** return indexed point. This is a copy of the coordinates, not a reference. */
237339
- getPoint(i, out) {
237340
- return this.point.getPoint3dAtCheckedPointIndex(i, out);
237341
- }
237342
- /** return indexed normal. This is the COPY to the normal, not a reference. */
237343
- getNormal(i) { return this.normal ? this.normal.getVector3dAtCheckedVectorIndex(i) : undefined; }
237344
- /** return indexed param. This is the COPY of the coordinates, not a reference. */
237345
- getParam(i) { return this.param ? this.param.getPoint2dAtCheckedPointIndex(i) : undefined; }
237346
- /** return indexed color */
237347
- getColor(i) { return this.color ? this.color[i] : 0; }
237348
- /** return indexed visibility */
237349
- getEdgeVisible(i) { return this.edgeVisible[i]; }
237350
- /** Copy the contents (not pointer) of point[i] into dest. */
237351
- copyPointTo(i, dest) { this.point.getPoint3dAtUncheckedPointIndex(i, dest); }
237352
- /** Copy the contents (not pointer) of normal[i] into dest. */
237353
- copyNormalTo(i, dest) { if (this.normal)
237354
- this.normal.getVector3dAtCheckedVectorIndex(i, dest); }
237355
- /** Copy the contents (not pointer) of param[i] into dest. */
237356
- copyParamTo(i, dest) { if (this.param)
237357
- this.param.getPoint2dAtCheckedPointIndex(i, dest); }
237358
- /** test if normal at a specified index matches uv */
237359
- isAlmostEqualParamIndexUV(index, u, v) {
237360
- if (this.param !== undefined && index >= 0 && index < this.param.length)
237361
- return _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.isSameCoordinate(u, this.param.getXAtUncheckedPointIndex(index))
237362
- && _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.isSameCoordinate(v, this.param.getYAtUncheckedPointIndex(index));
237382
+ * * A face is a subset of the Polyface's facets grouped for application purposes.
237383
+ */
237384
+ get faceCount() {
237385
+ return this.face.length;
237386
+ }
237387
+ /** Return indexed point at index `i`. This is a COPY of the coordinates, not a reference. */
237388
+ getPoint(i, result) {
237389
+ return this.point.getPoint3dAtCheckedPointIndex(i, result);
237390
+ }
237391
+ /** Return indexed normal at index `i`. This is a COPY of the normal, not a reference. */
237392
+ getNormal(i, result) {
237393
+ return this.normal ? this.normal.getVector3dAtCheckedVectorIndex(i, result) : undefined;
237394
+ }
237395
+ /** Return indexed param at index `i`. This is a COPY of the coordinates, not a reference. */
237396
+ getParam(i, result) {
237397
+ return this.param ? this.param.getPoint2dAtCheckedPointIndex(i, result) : undefined;
237398
+ }
237399
+ /** Return indexed color at index `i`. Index `i` is not checked for validity. */
237400
+ getColor(i) {
237401
+ return this.color ? this.color[i] : 0;
237402
+ }
237403
+ /** Return indexed visibility. at index `i`. Index `i` is not checked for validity. */
237404
+ getEdgeVisible(i) {
237405
+ return this.edgeVisible[i];
237406
+ }
237407
+ /** Get boolean tag indicating if the facets are to be considered viewable from the back. */
237408
+ get twoSided() {
237409
+ return this._twoSided;
237410
+ }
237411
+ set twoSided(value) {
237412
+ this._twoSided = value;
237413
+ }
237414
+ /** Get flag indicating if the mesh closure is unknown (0), open sheet (1), closed solid (2). */
237415
+ get expectedClosure() {
237416
+ return this._expectedClosure;
237417
+ }
237418
+ set expectedClosure(value) {
237419
+ this._expectedClosure = value;
237420
+ }
237421
+ /** Set the tagged geometry data. */
237422
+ setTaggedNumericData(data) {
237423
+ this.taggedNumericData = data;
237424
+ }
237425
+ /** Copy the contents (not pointer) of `point[i]` into `dest`. Index `i` is not checked for validity. */
237426
+ copyPointTo(i, dest) {
237427
+ this.point.getPoint3dAtUncheckedPointIndex(i, dest);
237428
+ }
237429
+ /** Copy the contents (not pointer) of `normal[i]` into `dest`. Index `i` is not checked for validity. */
237430
+ copyNormalTo(i, dest) {
237431
+ if (this.normal)
237432
+ this.normal.getVector3dAtUncheckedVectorIndex(i, dest);
237433
+ }
237434
+ /** Copy the contents (not pointer) of `param[i]` into `dest`. Index `i` is not checked for validity. */
237435
+ copyParamTo(i, dest) {
237436
+ if (this.param)
237437
+ this.param.getPoint2dAtUncheckedPointIndex(i, dest);
237438
+ }
237439
+ /** Test if param at a index `i` matches the given uv */
237440
+ isAlmostEqualParamIndexUV(i, u, v) {
237441
+ if (this.param !== undefined && i >= 0 && i < this.param.length)
237442
+ return _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.isSameCoordinate(u, this.param.getXAtUncheckedPointIndex(i))
237443
+ && _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.isSameCoordinate(v, this.param.getYAtUncheckedPointIndex(i));
237363
237444
  return false;
237364
237445
  }
237365
237446
  /**
237366
- * * Copy data from other to this.
237447
+ * Copy data from `other` to `this`.
237367
237448
  * * This is the essence of transferring coordinates spread throughout a large polyface into a visitor's single facet.
237368
- * * "other" is the large polyface
237369
- * * "this" is the visitor
237370
- * * does NOT copy face data - visitors reference the FacetFaceData array for the whole polyface!!
237449
+ * * Common usage: "other" is a Polyface, "this" is a PolyfaceVisitor to receive data from a single facet of the Polyface.
237450
+ * * Does NOT copy face data - visitors reference the FacetFaceData array for the whole polyface.
237371
237451
  * @param other polyface data being mined.
237372
- * @param index0 start index in other's index arrays
237373
- * @param index1 end index (one beyond last data accessed0 in other's index arrays
237452
+ * @param index0 start index in other's index arrays.
237453
+ * @param index1 end index (one beyond last data accessed) in other's index arrays.
237374
237454
  * @param numWrap number of points to replicate as wraparound.
237375
237455
  */
237376
237456
  gatherIndexedData(other, index0, index1, numWrap) {
237377
237457
  const numEdge = index1 - index0;
237458
+ if (numWrap > numEdge)
237459
+ numWrap = numEdge;
237378
237460
  const numTotal = numEdge + numWrap;
237379
- this.resizeAllDataArrays(numTotal);
237461
+ this.resizeAllArrays(numTotal);
237380
237462
  // copy wrapped points
237381
237463
  for (let i = 0; i < numEdge; i++)
237382
237464
  this.point.transferFromGrowableXYZArray(i, other.point, other.pointIndex[index0 + i]);
@@ -237387,41 +237469,48 @@ class PolyfaceData {
237387
237469
  this.pointIndex[i] = other.pointIndex[index0 + i];
237388
237470
  for (let i = 0; i < numWrap; i++)
237389
237471
  this.pointIndex[numEdge + i] = this.pointIndex[i];
237390
- // copy wrapped edge visibility
237391
- for (let i = 0; i < numEdge; i++)
237392
- this.edgeVisible[i] = other.edgeVisible[index0 + i];
237393
- for (let i = 0; i < numWrap; i++)
237394
- this.edgeVisible[numEdge + i] = this.edgeVisible[i];
237472
+ // copy wrapped normals
237395
237473
  if (this.normal && this.normalIndex && other.normal && other.normalIndex) {
237396
237474
  for (let i = 0; i < numEdge; i++)
237397
237475
  this.normal.transferFromGrowableXYZArray(i, other.normal, other.normalIndex[index0 + i]);
237398
237476
  for (let i = 0; i < numWrap; i++)
237399
237477
  this.normal.transferFromGrowableXYZArray(numEdge + i, this.normal, i);
237478
+ // copy wrapped normalIndex
237400
237479
  for (let i = 0; i < numEdge; i++)
237401
237480
  this.normalIndex[i] = other.normalIndex[index0 + i];
237402
237481
  for (let i = 0; i < numWrap; i++)
237403
237482
  this.normalIndex[numEdge + i] = this.normalIndex[i];
237404
237483
  }
237484
+ // copy wrapped params
237405
237485
  if (this.param && this.paramIndex && other.param && other.paramIndex) {
237406
237486
  for (let i = 0; i < numEdge; i++)
237407
237487
  this.param.transferFromGrowableXYArray(i, other.param, other.paramIndex[index0 + i]);
237408
237488
  for (let i = 0; i < numWrap; i++)
237409
237489
  this.param.transferFromGrowableXYArray(numEdge + i, this.param, i);
237490
+ // copy wrapped paramIndex
237410
237491
  for (let i = 0; i < numEdge; i++)
237411
237492
  this.paramIndex[i] = other.paramIndex[index0 + i];
237412
237493
  for (let i = 0; i < numWrap; i++)
237413
237494
  this.paramIndex[numEdge + i] = this.paramIndex[i];
237414
237495
  }
237496
+ // copy wrapped colors
237415
237497
  if (this.color && this.colorIndex && other.color && other.colorIndex) {
237416
237498
  for (let i = 0; i < numEdge; i++)
237417
237499
  this.color[i] = other.color[other.colorIndex[index0 + i]];
237418
237500
  for (let i = 0; i < numWrap; i++)
237419
237501
  this.color[numEdge + i] = this.color[i];
237502
+ // copy wrapped colorIndex
237420
237503
  for (let i = 0; i < numEdge; i++)
237421
237504
  this.colorIndex[i] = other.colorIndex[index0 + i];
237422
237505
  for (let i = 0; i < numWrap; i++)
237423
237506
  this.colorIndex[numEdge + i] = this.colorIndex[i];
237424
237507
  }
237508
+ // copy wrapped edge visibility
237509
+ for (let i = 0; i < numEdge; i++)
237510
+ this.edgeVisible[i] = other.edgeVisible[index0 + i];
237511
+ for (let i = 0; i < numWrap; i++)
237512
+ this.edgeVisible[numEdge + i] = this.edgeVisible[i];
237513
+ // copy wrapped auxData
237425
237514
  if (this.auxData && other.auxData && this.auxData.channels.length === other.auxData.channels.length) {
237426
237515
  for (let iChannel = 0; iChannel < this.auxData.channels.length; iChannel++) {
237427
237516
  const thisChannel = this.auxData.channels[iChannel];
@@ -237438,19 +237527,21 @@ class PolyfaceData {
237438
237527
  }
237439
237528
  }
237440
237529
  }
237530
+ // copy wrapped auxData index
237441
237531
  for (let i = 0; i < numEdge; i++)
237442
237532
  this.auxData.indices[i] = other.auxData.indices[index0 + i];
237443
237533
  for (let i = 0; i < numWrap; i++)
237444
237534
  this.auxData.indices[numEdge + i] = this.auxData.indices[i];
237445
237535
  }
237446
237536
  }
237537
+ /** Trim the `data` arrays to the stated `length`. */
237447
237538
  static trimArray(data, length) {
237448
237539
  if (data && length < data.length)
237449
237540
  data.length = length;
237450
237541
  }
237451
237542
  /**
237452
- * Trim all index arrays to the stated length.
237453
- * This is called by PolyfaceBuilder to clean up after an aborted construction sequence.
237543
+ * Trim all index arrays to the stated `length`.
237544
+ * * This is called by PolyfaceBuilder to clean up after an aborted construction sequence.
237454
237545
  */
237455
237546
  trimAllIndexArrays(length) {
237456
237547
  PolyfaceData.trimArray(this.pointIndex, length);
@@ -237466,7 +237557,78 @@ class PolyfaceData {
237466
237557
  }
237467
237558
  }
237468
237559
  }
237469
- /** Resize all data arrays to specified length */
237560
+ /**
237561
+ * Resize all data and index arrays to the specified `length`.
237562
+ * * This is used by visitors, whose data and index arrays are all parallel.
237563
+ */
237564
+ resizeAllArrays(length) {
237565
+ if (length > this.point.length) {
237566
+ while (this.point.length < length)
237567
+ this.point.push(_geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_6__.Point3d.create());
237568
+ while (this.pointIndex.length < length)
237569
+ this.pointIndex.push(-1);
237570
+ if (this.normal)
237571
+ while (this.normal.length < length)
237572
+ this.normal.push(_geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_6__.Vector3d.create());
237573
+ if (this.normalIndex)
237574
+ while (this.normalIndex.length < length)
237575
+ this.normalIndex.push(-1);
237576
+ if (this.param)
237577
+ while (this.param.length < length)
237578
+ this.param.push(_geometry3d_Point2dVector2d__WEBPACK_IMPORTED_MODULE_7__.Point2d.create());
237579
+ if (this.paramIndex)
237580
+ while (this.paramIndex.length < length)
237581
+ this.paramIndex.push(-1);
237582
+ if (this.color)
237583
+ while (this.color.length < length)
237584
+ this.color.push(0);
237585
+ if (this.colorIndex)
237586
+ while (this.colorIndex.length < length)
237587
+ this.colorIndex.push(-1);
237588
+ while (this.edgeVisible.length < length)
237589
+ this.edgeVisible.push(false);
237590
+ if (this.auxData) {
237591
+ for (const channel of this.auxData.channels) {
237592
+ for (const channelData of channel.data) {
237593
+ while (channelData.values.length < length * channel.entriesPerValue)
237594
+ channelData.values.push(0);
237595
+ }
237596
+ }
237597
+ if (this.auxData.indices)
237598
+ this.auxData.indices.push(-1);
237599
+ }
237600
+ }
237601
+ else if (length < this.point.length) {
237602
+ this.point.resize(length);
237603
+ this.pointIndex.length = length;
237604
+ if (this.normal)
237605
+ this.normal.resize(length);
237606
+ if (this.normalIndex)
237607
+ this.normalIndex.length = length;
237608
+ if (this.param)
237609
+ this.param.resize(length);
237610
+ if (this.paramIndex)
237611
+ this.paramIndex.length = length;
237612
+ if (this.color)
237613
+ this.color.length = length;
237614
+ if (this.colorIndex)
237615
+ this.colorIndex.length = length;
237616
+ this.edgeVisible.length = length;
237617
+ if (this.auxData) {
237618
+ for (const channel of this.auxData.channels) {
237619
+ for (const channelData of channel.data) {
237620
+ channelData.values.length = length * channel.entriesPerValue;
237621
+ }
237622
+ }
237623
+ if (this.auxData.indices)
237624
+ this.auxData.indices.length = length;
237625
+ }
237626
+ }
237627
+ }
237628
+ /**
237629
+ * Resize all data arrays to the specified `length`.
237630
+ * @deprecated in 4.x because name is misleading. Call [[PolyfaceData.resizeAllArrays]] instead.
237631
+ */
237470
237632
  resizeAllDataArrays(length) {
237471
237633
  if (length > this.point.length) {
237472
237634
  while (this.point.length < length)
@@ -237512,19 +237674,21 @@ class PolyfaceData {
237512
237674
  }
237513
237675
  }
237514
237676
  }
237515
- /** Return the range of the point array (optionally transformed) */
237677
+ /** Return the range of the point array (optionally transformed). */
237516
237678
  range(result, transform) {
237517
237679
  result = result ? result : _geometry3d_Range__WEBPACK_IMPORTED_MODULE_8__.Range3d.createNull();
237518
237680
  result.extendArray(this.point, transform);
237519
237681
  return result;
237520
237682
  }
237521
- /** reverse indices facet-by-facet, with the given facetStartIndex array delimiting faces.
237522
- *
237523
- * * facetStartIndex[0] == 0 always -- start of facet zero.
237524
- * * facet k has indices from facetStartIndex[k] <= i < facetStartIndex[k+1]
237525
- * * hence for "internal" k, facetStartIndex[k] is both the upper limit of facet k-1 and the start of facet k.
237526
- * *
237527
- */
237683
+ /**
237684
+ * Reverse the indices for the specified facets in the index arrays (pointIndex, normalIndex, paramIndex, colorIndex,
237685
+ * and edgeVisible).
237686
+ * @param facetStartIndex start indices of *consecutive* facets to be reversed.
237687
+ * * Consecutive indices in this array define where a given facet is represented in each of the parallel index arrays.
237688
+ * * The indices for facet k are `facetStartIndex[k]` up to (but not including) `facetStartIndex[k + 1]`.
237689
+ * * This implies `facetStartIndex[k + 1]` is both the upper limit of facet k's indices, and the start index of facet k+1.
237690
+ * * For example, passing an IndexedPolyface's _facetStart array into this method reverses every facet.
237691
+ */
237528
237692
  reverseIndices(facetStartIndex) {
237529
237693
  if (facetStartIndex && PolyfaceData.isValidFacetStartIndexArray(facetStartIndex)) {
237530
237694
  PolyfaceData.reverseIndices(facetStartIndex, this.pointIndex, true);
@@ -237537,31 +237701,33 @@ class PolyfaceData {
237537
237701
  PolyfaceData.reverseIndices(facetStartIndex, this.edgeVisible, false);
237538
237702
  }
237539
237703
  }
237540
- /** reverse indices facet-by-facet, with the given facetStartIndex array delimiting faces.
237541
- *
237542
- * * facetStartIndex[0] == 0 always -- start of facet zero.
237543
- * * facet k has indices from facetStartIndex[k] <= i < facetStartIndex[k+1]
237544
- * * hence for "internal" k, facetStartIndex[k] is both the upper limit of facet k-1 and the start of facet k.
237545
- * *
237704
+ /**
237705
+ * Reverse the indices for the specified facet in the index arrays (pointIndex, normalIndex, paramIndex, colorIndex,
237706
+ * and edgeVisible).
237707
+ * @param facetIndex index of the facet to reverse. The entries of each index array to be reversed are found at
237708
+ * `facetStartIndex[facetIndex] <= i < facetStartIndex[facetIndex + 1]`.
237709
+ * @param facetStartIndex start indices of *consecutive* facets, e.g., an IndexedPolyface's _facetStart array.
237710
+ * See [[reverseIndices]].
237546
237711
  */
237547
- reverseIndicesSingleFacet(facetId, facetStartIndex) {
237548
- PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.pointIndex, true);
237712
+ reverseIndicesSingleFacet(facetIndex, facetStartIndex) {
237713
+ PolyfaceData.reverseIndicesSingleFacet(facetIndex, facetStartIndex, this.pointIndex, true);
237549
237714
  if (this.normalIndex !== this.pointIndex)
237550
- PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.normalIndex, true);
237715
+ PolyfaceData.reverseIndicesSingleFacet(facetIndex, facetStartIndex, this.normalIndex, true);
237551
237716
  if (this.paramIndex !== this.pointIndex)
237552
- PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.paramIndex, true);
237717
+ PolyfaceData.reverseIndicesSingleFacet(facetIndex, facetStartIndex, this.paramIndex, true);
237553
237718
  if (this.colorIndex !== this.pointIndex)
237554
- PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.colorIndex, true);
237555
- PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.edgeVisible, false);
237719
+ PolyfaceData.reverseIndicesSingleFacet(facetIndex, facetStartIndex, this.colorIndex, true);
237720
+ PolyfaceData.reverseIndicesSingleFacet(facetIndex, facetStartIndex, this.edgeVisible, false);
237556
237721
  }
237557
- /** Scale all the normals by -1 */
237722
+ /** Scale all the normals by -1. */
237558
237723
  reverseNormals() {
237559
237724
  if (this.normal)
237560
237725
  this.normal.scaleInPlace(-1.0);
237561
237726
  }
237562
- /** Apply `transform` to point and normal arrays and to auxData.
237563
- * * IMPORTANT This base class is just a data carrier. It does not know if the index order and normal directions have special meaning.
237564
- * * i.e. caller must separately reverse index order and normal direction if needed.
237727
+ /**
237728
+ * Apply `transform` to point and normal arrays and to auxData.
237729
+ * * IMPORTANT This base class is just a data carrier. It does not know if the index order and normal directions
237730
+ * have special meaning, i.e., caller must separately reverse index order and normal direction if needed.
237565
237731
  */
237566
237732
  tryTransformInPlace(transform) {
237567
237733
  this.point.multiplyTransformInPlace(transform);
@@ -237574,13 +237740,14 @@ class PolyfaceData {
237574
237740
  * * Search for duplicates within points, normals, params, and colors.
237575
237741
  * * Compress each data array.
237576
237742
  * * Revise all indexing for the relocated data.
237577
- * @param tolerance optional tolerance for clustering mesh vertices. Default is [[Geometry.smallMetricDistance]].
237743
+ * @param tolerance (optional) tolerance for clustering mesh vertices. Default is [[Geometry.smallMetricDistance]].
237578
237744
  */
237579
237745
  compress(tolerance = _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.smallMetricDistance) {
237746
+ // more info can be found at geometry/internaldocs/Polyface.md
237580
237747
  const packedPoints = _numerics_ClusterableArray__WEBPACK_IMPORTED_MODULE_9__.ClusterableArray.clusterGrowablePoint3dArray(this.point, tolerance);
237581
237748
  this.point = packedPoints.growablePackedPoints;
237582
237749
  packedPoints.updateIndices(this.pointIndex);
237583
- // for now, normals, params, and colors use the default tolerance for clustering...
237750
+ // for now, normals, params, and colors use the default tolerance for clustering
237584
237751
  if (this.normalIndex && this.normal) {
237585
237752
  const packedNormals = _numerics_ClusterableArray__WEBPACK_IMPORTED_MODULE_9__.ClusterableArray.clusterGrowablePoint3dArray(this.normal);
237586
237753
  this.normal = packedNormals.growablePackedPoints;
@@ -237598,10 +237765,11 @@ class PolyfaceData {
237598
237765
  }
237599
237766
  }
237600
237767
  /**
237601
- * Test if facetStartIndex is (minimally!) valid:
237602
- * * length must be nonzero (recall that for "no facets" the facetStartIndexArray still must contain a 0)
237768
+ * Test if `facetStartIndex` is (minimally) valid.
237769
+ * * Length must be nonzero (recall that for "no facets", the `facetStartIndex` array still must contain a 0).
237603
237770
  * * Each entry must be strictly smaller than the one that follows.
237604
- * @param facetStartIndex array of facetStart data. facet `i` has indices at `facetsStartIndex[i]` to (one before) `facetStartIndex[i+1]`
237771
+ * @param facetStartIndex start indices of all facets. Facet k starts at facetStartIndex[k] up to (but not including)
237772
+ * `facetStartIndex[k + 1]`
237605
237773
  */
237606
237774
  static isValidFacetStartIndexArray(facetStartIndex) {
237607
237775
  // facetStartIndex for empty facets has a single entry "0" -- empty array is not allowed
@@ -237612,8 +237780,14 @@ class PolyfaceData {
237612
237780
  return false;
237613
237781
  return true;
237614
237782
  }
237615
- /** Reverse data in entire facet indexing arrays.
237616
- * * parameterized over type T so non-number data -- e.g. boolean visibility flags -- can be reversed.
237783
+ /**
237784
+ * Reverse the indices for the specified facets in the given index array.
237785
+ * * Parameterized over type T so non-number data (e.g., boolean visibility flags) can be reversed.
237786
+ * @param facetStartIndex start indices of *consecutive* facets to be reversed, e.g., an IndexedPolyface's _facetStart
237787
+ * array. See the non-static [[reverseIndices]].
237788
+ * @param indices the index array, e.g., pointIndex, normalIndex, etc.
237789
+ * @param preserveStart `true` to preserve the start index of each facet (e.g., facet [1,2,3,4] becomes [1,4,3,2]);
237790
+ * `false` to reverse all indices (e.g., facet [1,2,3,4] becomes [4,3,2,1]).
237617
237791
  */
237618
237792
  static reverseIndices(facetStartIndex, indices, preserveStart) {
237619
237793
  if (!indices || indices.length === 0)
@@ -237623,8 +237797,7 @@ class PolyfaceData {
237623
237797
  for (let i = 0; i + 1 < facetStartIndex.length; i++) {
237624
237798
  let index0 = facetStartIndex[i];
237625
237799
  let index1 = facetStartIndex[i + 1];
237626
- if (preserveStart) {
237627
- // leave [index0] as is so reversed facet starts at same vertex
237800
+ if (preserveStart) { // leave "index0" as is so reversed facet starts at same vertex
237628
237801
  while (index1 > index0 + 2) {
237629
237802
  index1--;
237630
237803
  index0++;
@@ -237633,8 +237806,7 @@ class PolyfaceData {
237633
237806
  indices[index1] = a;
237634
237807
  }
237635
237808
  }
237636
- else {
237637
- // reverse all
237809
+ else { // reverse all
237638
237810
  while (index1 > index0 + 1) {
237639
237811
  index1--;
237640
237812
  const a = indices[index0];
@@ -237649,19 +237821,26 @@ class PolyfaceData {
237649
237821
  }
237650
237822
  return false;
237651
237823
  }
237652
- /** Reverse data in entire facet indexing arrays.
237653
- * * parameterized over type T so non-number data -- e.g. boolean visibility flags -- can be reversed.
237824
+ /**
237825
+ * Reverse the indices for the specified facet in the specified index array.
237826
+ * * Parameterized over type T so non-number data (e.g., boolean visibility flags) can be reversed.
237827
+ * @param facetIndex index of the facet to reverse. The entries of `indices` to be reversed are found at
237828
+ * `facetStartIndex[facetIndex] <= i < facetStartIndex[facetIndex + 1]`.
237829
+ * @param facetStartIndex start indices of *consecutive* facets, e.g., an IndexedPolyface's _facetStart array.
237830
+ * See [[reverseIndices]].
237831
+ * @param indices the index array, e.g., pointIndex, normalIndex, etc.
237832
+ * @param preserveStart `true` to preserve the start index of each facet (e.g., facet [1,2,3,4] becomes [1,4,3,2]);
237833
+ * `false` to reverse all indices (e.g., facet [1,2,3,4] becomes [4,3,2,1]).
237654
237834
  */
237655
- static reverseIndicesSingleFacet(facetId, facetStartIndex, indices, preserveStart) {
237835
+ static reverseIndicesSingleFacet(facetIndex, facetStartIndex, indices, preserveStart) {
237656
237836
  if (!indices || indices.length === 0)
237657
237837
  return true; // empty case
237658
237838
  if (indices.length > 0) {
237659
237839
  if (facetStartIndex[facetStartIndex.length - 1] === indices.length
237660
- && facetId >= 0 && facetId + 1 < facetStartIndex.length) {
237661
- let index0 = facetStartIndex[facetId];
237662
- let index1 = facetStartIndex[facetId + 1];
237663
- if (preserveStart) {
237664
- // leave [index0] as is so reversed facet starts at same vertex
237840
+ && facetIndex >= 0 && facetIndex + 1 < facetStartIndex.length) {
237841
+ let index0 = facetStartIndex[facetIndex];
237842
+ let index1 = facetStartIndex[facetIndex + 1];
237843
+ if (preserveStart) { // leave "index0" as is so reversed facet starts at same vertex
237665
237844
  while (index1 > index0 + 2) {
237666
237845
  index1--;
237667
237846
  index0++;
@@ -237670,8 +237849,7 @@ class PolyfaceData {
237670
237849
  indices[index1] = a;
237671
237850
  }
237672
237851
  }
237673
- else {
237674
- // reverse all
237852
+ else { // reverse all
237675
237853
  while (index1 > index0 + 1) {
237676
237854
  index1--;
237677
237855
  const a = indices[index0];
@@ -237686,18 +237864,10 @@ class PolyfaceData {
237686
237864
  return false;
237687
237865
  }
237688
237866
  }
237689
- // <ul
237690
- // <li>optional arrays (normal, uv, color) must be indicated at constructor time.
237691
- // <li>all arrays are (independently) indexed.
237692
- // <li>with regret, the point, param, normal, and color arrays are exposed publicly.
237693
- // <li>getX methods are "trusting" -- no bounds check
237694
- // <li>getX methods return references to X.
237695
- // <li> EXCEPT -- for optional arrays, the return 000.
237696
- // <li>copyX methods move data to caller-supplied result..
237697
- // </ul>
237698
- /** Relative tolerance used in tests for planar facets
237867
+ /**
237868
+ * Relative tolerance used in tests for planar facets.
237699
237869
  * @internal
237700
- */
237870
+ */
237701
237871
  PolyfaceData.planarityLocalRelTol = 1.0e-13;
237702
237872
 
237703
237873
 
@@ -258672,7 +258842,6 @@ class HalfEdgeGraph {
258672
258842
  }
258673
258843
  /** Returns the number of vertex loops in a graph structure. */
258674
258844
  countVertexLoops() {
258675
- this.clearMask(HalfEdgeMask.VISITED);
258676
258845
  let count = 0;
258677
258846
  this.announceVertexLoops((_graph, _seed) => {
258678
258847
  count++;
@@ -258682,7 +258851,6 @@ class HalfEdgeGraph {
258682
258851
  }
258683
258852
  /** Returns the number of face loops in a graph structure. */
258684
258853
  countFaceLoops() {
258685
- this.clearMask(HalfEdgeMask.VISITED);
258686
258854
  let count = 0;
258687
258855
  this.announceFaceLoops((_graph, _seed) => {
258688
258856
  count++;
@@ -258692,7 +258860,6 @@ class HalfEdgeGraph {
258692
258860
  }
258693
258861
  /** Returns the number of face loops satisfying a filter function with mask argument. */
258694
258862
  countFaceLoopsWithMaskFilter(filter, mask) {
258695
- this.clearMask(HalfEdgeMask.VISITED);
258696
258863
  let count = 0;
258697
258864
  this.announceFaceLoops((_graph, seed) => {
258698
258865
  if (filter(seed, mask))
@@ -262031,14 +262198,15 @@ __webpack_require__.r(__webpack_exports__);
262031
262198
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
262032
262199
  /* harmony export */ "Triangulator": () => (/* binding */ Triangulator)
262033
262200
  /* harmony export */ });
262034
- /* harmony import */ var _clipping_ClipUtils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../clipping/ClipUtils */ "../../core/geometry/lib/esm/clipping/ClipUtils.js");
262201
+ /* harmony import */ var _clipping_ClipUtils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../clipping/ClipUtils */ "../../core/geometry/lib/esm/clipping/ClipUtils.js");
262035
262202
  /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
262036
- /* harmony import */ var _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geometry3d/IndexedXYZCollection */ "../../core/geometry/lib/esm/geometry3d/IndexedXYZCollection.js");
262037
- /* harmony import */ var _geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geometry3d/Plane3dByOriginAndUnitNormal */ "../../core/geometry/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js");
262038
- /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
262203
+ /* harmony import */ var _geometry3d_FrameBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geometry3d/FrameBuilder */ "../../core/geometry/lib/esm/geometry3d/FrameBuilder.js");
262204
+ /* harmony import */ var _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geometry3d/IndexedXYZCollection */ "../../core/geometry/lib/esm/geometry3d/IndexedXYZCollection.js");
262205
+ /* harmony import */ var _geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geometry3d/Plane3dByOriginAndUnitNormal */ "../../core/geometry/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js");
262206
+ /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
262039
262207
  /* harmony import */ var _geometry3d_PointHelpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geometry3d/PointHelpers */ "../../core/geometry/lib/esm/geometry3d/PointHelpers.js");
262040
- /* harmony import */ var _geometry3d_PointStreaming__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geometry3d/PointStreaming */ "../../core/geometry/lib/esm/geometry3d/PointStreaming.js");
262041
- /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
262208
+ /* harmony import */ var _geometry3d_PointStreaming__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geometry3d/PointStreaming */ "../../core/geometry/lib/esm/geometry3d/PointStreaming.js");
262209
+ /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
262042
262210
  /* harmony import */ var _Graph__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Graph */ "../../core/geometry/lib/esm/topology/Graph.js");
262043
262211
  /* harmony import */ var _HalfEdgeMarkSet__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./HalfEdgeMarkSet */ "../../core/geometry/lib/esm/topology/HalfEdgeMarkSet.js");
262044
262212
  /* harmony import */ var _InsertAndRetriangulateContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./InsertAndRetriangulateContext */ "../../core/geometry/lib/esm/topology/InsertAndRetriangulateContext.js");
@@ -262060,6 +262228,7 @@ __webpack_require__.r(__webpack_exports__);
262060
262228
 
262061
262229
 
262062
262230
 
262231
+
262063
262232
  /**
262064
262233
  * (static) methods for triangulating polygons
262065
262234
  * * @internal
@@ -262272,7 +262441,10 @@ class Triangulator {
262272
262441
  return undefined;
262273
262442
  }
262274
262443
  /**
262275
- * Triangulate all positive area faces of a graph.
262444
+ * Triangulate all positive area faces of a (planar) graph.
262445
+ * * Area is computed using `HalfEdge.signedFaceArea`, which ignores z-coordinates.
262446
+ * @returns whether all indicated faces were triangulated successfully
262447
+ * @see [[triangulateAllInteriorFaces]]
262276
262448
  */
262277
262449
  static triangulateAllPositiveAreaFaces(graph) {
262278
262450
  const seeds = graph.collectFaceLoops();
@@ -262287,6 +262459,44 @@ class Triangulator {
262287
262459
  }
262288
262460
  return numFail === 0;
262289
262461
  }
262462
+ /**
262463
+ * Triangulate all interior faces of a graph.
262464
+ * * A random node is checked for each face; if it has the `HalfEdgeMask.EXTERIOR` mask, the face is ignored.
262465
+ * @param useLocalCoords whether to transform each face into local coords before triangulating.
262466
+ * This is useful if the graph has z-coordinates.
262467
+ * @returns whether all indicated faces were triangulated successfully
262468
+ * @see [[triangulateAllPositiveAreaFaces]]
262469
+ */
262470
+ static triangulateAllInteriorFaces(graph, useLocalCoords) {
262471
+ const seeds = graph.collectFaceLoops();
262472
+ const visited = useLocalCoords ? graph.grabMask() : _Graph__WEBPACK_IMPORTED_MODULE_0__.HalfEdgeMask.NULL_MASK;
262473
+ let localToWorld;
262474
+ let nodes;
262475
+ let nodeCount = 0;
262476
+ let numFail = 0;
262477
+ for (const face of seeds) {
262478
+ if (face.countEdgesAroundFace() > 3) {
262479
+ if (face.getMask(_Graph__WEBPACK_IMPORTED_MODULE_0__.HalfEdgeMask.EXTERIOR))
262480
+ continue;
262481
+ if (useLocalCoords) {
262482
+ nodeCount = graph.countNodes();
262483
+ nodes = face.collectAroundFace();
262484
+ localToWorld = this._workTransform = _geometry3d_FrameBuilder__WEBPACK_IMPORTED_MODULE_5__.FrameBuilder.createRightHandedLocalToWorld(nodes, this._workTransform);
262485
+ localToWorld?.multiplyInversePoint3dArrayInPlace(nodes);
262486
+ }
262487
+ // don't flip triangles if using local coords; an edge of this face can be flipped out of plane if the neighboring triangle is non-coplanar.
262488
+ if (!Triangulator.triangulateSingleFace(graph, face, useLocalCoords))
262489
+ numFail++;
262490
+ if (localToWorld && nodes) {
262491
+ for (let iNewNode = nodeCount; iNewNode < graph.countNodes(); ++iNewNode)
262492
+ nodes.push(graph.allHalfEdges[iNewNode]);
262493
+ localToWorld.multiplyPoint3dArrayInPlace(nodes);
262494
+ }
262495
+ }
262496
+ }
262497
+ graph.dropMask(visited);
262498
+ return numFail === 0;
262499
+ }
262290
262500
  /**
262291
262501
  * Triangulate the polygon made up of by a series of points.
262292
262502
  * * The loop may be either CCW or CW -- CCW order will be used for triangles.
@@ -262335,7 +262545,7 @@ class Triangulator {
262335
262545
  let n = data.length;
262336
262546
  let x0, y0, x1, y1;
262337
262547
  while (n > 1) {
262338
- if (data instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_5__.IndexedXYZCollection) {
262548
+ if (data instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__.IndexedXYZCollection) {
262339
262549
  x0 = data.getXAtUncheckedPointIndex(0);
262340
262550
  y0 = data.getYAtUncheckedPointIndex(0);
262341
262551
  x1 = data.getXAtUncheckedPointIndex(n - 1);
@@ -262367,8 +262577,8 @@ class Triangulator {
262367
262577
  static directCreateFaceLoopFromCoordinates(graph, data) {
262368
262578
  const n = this.getUnwrappedLength(data); // open it up to allow starting at a bridge edge
262369
262579
  let baseNode;
262370
- if (data instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_5__.IndexedXYZCollection) {
262371
- const xyz = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_6__.Point3d.create();
262580
+ if (data instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__.IndexedXYZCollection) {
262581
+ const xyz = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__.Point3d.create();
262372
262582
  for (let i = 0; i < n; i++) {
262373
262583
  data.getPoint3dAtCheckedPointIndex(i, xyz);
262374
262584
  baseNode = Triangulator.interiorEdgeSplit(graph, baseNode, xyz);
@@ -262389,7 +262599,7 @@ class Triangulator {
262389
262599
  */
262390
262600
  static directCreateChainsFromCoordinates(graph, data, id = 0) {
262391
262601
  const assembler = new AssembleXYZXYZChains(graph, id);
262392
- _geometry3d_PointStreaming__WEBPACK_IMPORTED_MODULE_7__.VariantPointDataStream.streamXYZ(data, assembler);
262602
+ _geometry3d_PointStreaming__WEBPACK_IMPORTED_MODULE_8__.VariantPointDataStream.streamXYZ(data, assembler);
262393
262603
  return assembler.claimSeeds();
262394
262604
  }
262395
262605
  /**
@@ -262515,14 +262725,12 @@ class Triangulator {
262515
262725
  return b0;
262516
262726
  }
262517
262727
  /**
262518
- * main ear slicing loop which triangulates a polygon (given as a linked list)
262519
- * While there still exists ear nodes that have not yet been triangulated...
262520
- *
262521
- * * Check if the ear is hashed, and can easily be split off. If so, "join" that ear.
262522
- * * If not hashed, move on to a separate ear.
262523
- * * If no ears are currently hashed, attempt to cure self intersections or split the polygon into two before continuing
262728
+ * Main ear slicing loop which triangulates the face starting at `ear`.
262729
+ * @param graph containing graph to receive new edges
262730
+ * @param ear sector at which to start triangulation of the containing face.
262731
+ * @param noFlips if false (default) perform edge-flipping after each ear cut for better aspect ratio. Pass true if your graph isn't planar.
262524
262732
  */
262525
- static triangulateSingleFace(graph, ear) {
262733
+ static triangulateSingleFace(graph, ear, noFlips = false) {
262526
262734
  if (!ear) {
262527
262735
  Triangulator.setDebugGraph(graph);
262528
262736
  return false;
@@ -262573,7 +262781,8 @@ class Triangulator {
262573
262781
  // If we already have a separated triangle, do not join
262574
262782
  if (ear.faceSuccessor.faceSuccessor !== ear.facePredecessor) {
262575
262783
  Triangulator.joinNeighborsOfEar(graph, ear);
262576
- ear = Triangulator.doPostCutFlips(ear);
262784
+ if (!noFlips)
262785
+ ear = Triangulator.doPostCutFlips(ear);
262577
262786
  ear = ear.faceSuccessor.edgeMate.faceSuccessor;
262578
262787
  // another step? Nate's 2017 code went one more.
262579
262788
  }
@@ -262637,15 +262846,15 @@ class Triangulator {
262637
262846
  if (area <= 0)
262638
262847
  return false; // reflex, can't be an ear
262639
262848
  const planes = this._planes;
262640
- if (!_geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_8__.Plane3dByOriginAndUnitNormal.createOriginAndTargetXY(a, b, planes[0])
262641
- || !_geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_8__.Plane3dByOriginAndUnitNormal.createOriginAndTargetXY(b, c, planes[1])
262642
- || !_geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_8__.Plane3dByOriginAndUnitNormal.createOriginAndTargetXY(c, a, planes[2]))
262849
+ if (!_geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_9__.Plane3dByOriginAndUnitNormal.createOriginAndTargetXY(a, b, planes[0])
262850
+ || !_geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_9__.Plane3dByOriginAndUnitNormal.createOriginAndTargetXY(b, c, planes[1])
262851
+ || !_geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_9__.Plane3dByOriginAndUnitNormal.createOriginAndTargetXY(c, a, planes[2]))
262643
262852
  return false;
262644
262853
  // now make sure we don't have other points inside the potential ear, or edges crossing.
262645
262854
  const earRange = this._earRange;
262646
262855
  const edgeRange = this._edgeRange;
262647
262856
  const edgeInterval = this._edgeInterval;
262648
- _geometry3d_Range__WEBPACK_IMPORTED_MODULE_9__.Range2d.createXYXYXY(a.x, a.y, b.x, b.y, c.x, c.y, earRange);
262857
+ _geometry3d_Range__WEBPACK_IMPORTED_MODULE_10__.Range2d.createXYXYXY(a.x, a.y, b.x, b.y, c.x, c.y, earRange);
262649
262858
  earRange.expandInPlace(_Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.smallMetricDistance);
262650
262859
  let p = c;
262651
262860
  const zeroPlus = 1.0e-8;
@@ -262655,11 +262864,11 @@ class Triangulator {
262655
262864
  const clipTolerance = 1.0e-10 * area;
262656
262865
  while (p !== a) {
262657
262866
  const q = p.faceSuccessor;
262658
- _geometry3d_Range__WEBPACK_IMPORTED_MODULE_9__.Range2d.createXYXY(p.x, p.y, q.x, q.y, edgeRange);
262867
+ _geometry3d_Range__WEBPACK_IMPORTED_MODULE_10__.Range2d.createXYXY(p.x, p.y, q.x, q.y, edgeRange);
262659
262868
  if (earRange.intersectsRange(edgeRange)) {
262660
262869
  // Does pq impinge on the triangle abc?
262661
- _geometry3d_Range__WEBPACK_IMPORTED_MODULE_9__.Range1d.createXX(zeroMinus, onePlus, edgeInterval);
262662
- _clipping_ClipUtils__WEBPACK_IMPORTED_MODULE_10__.ClipUtilities.clipSegmentBelowPlanesXY(planes, p, q, edgeInterval, clipTolerance);
262870
+ _geometry3d_Range__WEBPACK_IMPORTED_MODULE_10__.Range1d.createXX(zeroMinus, onePlus, edgeInterval);
262871
+ _clipping_ClipUtils__WEBPACK_IMPORTED_MODULE_11__.ClipUtilities.clipSegmentBelowPlanesXY(planes, p, q, edgeInterval, clipTolerance);
262663
262872
  if (!edgeInterval.isNull) {
262664
262873
  if (edgeInterval.low > oneMinus) {
262665
262874
  // only q touches triangle abc, so b might still be an ear if q lies at a vertex
@@ -262987,20 +263196,20 @@ class Triangulator {
262987
263196
  /** @internal */
262988
263197
  Triangulator.sEnableDebugGraphCapture = false;
262989
263198
  // for reuse over all calls to isEar ....
262990
- Triangulator._edgeInterval = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_9__.Range1d.createNull();
262991
- Triangulator._earRange = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_9__.Range2d.createNull();
262992
- Triangulator._edgeRange = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_9__.Range2d.createNull();
263199
+ Triangulator._edgeInterval = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_10__.Range1d.createNull();
263200
+ Triangulator._earRange = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_10__.Range2d.createNull();
263201
+ Triangulator._edgeRange = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_10__.Range2d.createNull();
262993
263202
  Triangulator._planes = [
262994
- _geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_8__.Plane3dByOriginAndUnitNormal.createXYPlane(),
262995
- _geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_8__.Plane3dByOriginAndUnitNormal.createXYPlane(),
262996
- _geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_8__.Plane3dByOriginAndUnitNormal.createXYPlane(),
263203
+ _geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_9__.Plane3dByOriginAndUnitNormal.createXYPlane(),
263204
+ _geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_9__.Plane3dByOriginAndUnitNormal.createXYPlane(),
263205
+ _geometry3d_Plane3dByOriginAndUnitNormal__WEBPACK_IMPORTED_MODULE_9__.Plane3dByOriginAndUnitNormal.createXYPlane(),
262997
263206
  ];
262998
263207
 
262999
263208
  /**
263000
263209
  * Internal class for assembling chains
263001
263210
  * @internal
263002
263211
  */
263003
- class AssembleXYZXYZChains extends _geometry3d_PointStreaming__WEBPACK_IMPORTED_MODULE_7__.PointStreamXYZXYZHandlerBase {
263212
+ class AssembleXYZXYZChains extends _geometry3d_PointStreaming__WEBPACK_IMPORTED_MODULE_8__.PointStreamXYZXYZHandlerBase {
263004
263213
  constructor(graph, id) {
263005
263214
  super();
263006
263215
  this._graph = graph;
@@ -292899,7 +293108,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
292899
293108
  /***/ ((module) => {
292900
293109
 
292901
293110
  "use strict";
292902
- module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.5.0-dev.21","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 && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2020 --outDir lib/esm","clean":"rimraf lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","docs":"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/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 -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -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 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:^4.5.0-dev.21","@itwin/core-bentley":"workspace:^4.5.0-dev.21","@itwin/core-common":"workspace:^4.5.0-dev.21","@itwin/core-geometry":"workspace:^4.5.0-dev.21","@itwin/core-orbitgt":"workspace:^4.5.0-dev.21","@itwin/core-quantity":"workspace:^4.5.0-dev.21"},"//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":"4.0.0-dev.44","@types/chai":"4.3.1","@types/chai-as-promised":"^7","@types/mocha":"^10.0.6","@types/sinon":"^17.0.2","babel-loader":"~8.2.5","babel-plugin-istanbul":"~6.1.1","chai":"^4.3.10","chai-as-promised":"^7.1.1","cpx2":"^3.0.0","eslint":"^8.44.0","glob":"^7.1.2","mocha":"^10.2.0","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^17.0.1","source-map-loader":"^4.0.0","typescript":"~5.0.2","typemoq":"^2.1.0","webpack":"^5.76.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/cloud-agnostic-core":"^2.1.0","@itwin/object-storage-core":"^2.2.2","@itwin/core-i18n":"workspace:*","@itwin/core-telemetry":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"},"nyc":{"extends":"./node_modules/@itwin/build-tools/.nycrc"}}');
293111
+ module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.5.0-dev.23","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 && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2020 --outDir lib/esm","clean":"rimraf lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","docs":"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/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 -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -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 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:^4.5.0-dev.23","@itwin/core-bentley":"workspace:^4.5.0-dev.23","@itwin/core-common":"workspace:^4.5.0-dev.23","@itwin/core-geometry":"workspace:^4.5.0-dev.23","@itwin/core-orbitgt":"workspace:^4.5.0-dev.23","@itwin/core-quantity":"workspace:^4.5.0-dev.23"},"//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":"4.0.0-dev.44","@types/chai":"4.3.1","@types/chai-as-promised":"^7","@types/mocha":"^10.0.6","@types/sinon":"^17.0.2","babel-loader":"~8.2.5","babel-plugin-istanbul":"~6.1.1","chai":"^4.3.10","chai-as-promised":"^7.1.1","cpx2":"^3.0.0","eslint":"^8.44.0","glob":"^7.1.2","mocha":"^10.2.0","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^17.0.1","source-map-loader":"^4.0.0","typescript":"~5.0.2","typemoq":"^2.1.0","webpack":"^5.76.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/cloud-agnostic-core":"^2.1.0","@itwin/object-storage-core":"^2.2.2","@itwin/core-i18n":"workspace:*","@itwin/core-telemetry":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"},"nyc":{"extends":"./node_modules/@itwin/build-tools/.nycrc"}}');
292903
293112
 
292904
293113
  /***/ })
292905
293114