@itwin/core-geometry 4.5.0-dev.9 → 4.5.0

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/Geometry.d.ts +15 -0
  4. package/lib/cjs/Geometry.d.ts.map +1 -1
  5. package/lib/cjs/Geometry.js +27 -0
  6. package/lib/cjs/Geometry.js.map +1 -1
  7. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +1 -1
  8. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  9. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js +1 -1
  10. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  11. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  12. package/lib/cjs/geometry3d/FrameBuilder.js +3 -0
  13. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  14. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +8 -2
  15. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  16. package/lib/cjs/geometry3d/GrowableXYZArray.js +11 -2
  17. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  18. package/lib/cjs/geometry3d/XYZProps.d.ts +16 -8
  19. package/lib/cjs/geometry3d/XYZProps.d.ts.map +1 -1
  20. package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
  21. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +42 -50
  22. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  23. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +81 -105
  24. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  25. package/lib/cjs/polyface/Polyface.d.ts +19 -10
  26. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  27. package/lib/cjs/polyface/Polyface.js +17 -10
  28. package/lib/cjs/polyface/Polyface.js.map +1 -1
  29. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +18 -10
  30. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  31. package/lib/cjs/polyface/PolyfaceBuilder.js +27 -21
  32. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  33. package/lib/cjs/polyface/PolyfaceData.d.ts +137 -86
  34. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  35. package/lib/cjs/polyface/PolyfaceData.js +300 -166
  36. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  37. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  38. package/lib/cjs/topology/Graph.d.ts +2 -8
  39. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  40. package/lib/cjs/topology/Graph.js +0 -3
  41. package/lib/cjs/topology/Graph.js.map +1 -1
  42. package/lib/cjs/topology/Triangulation.d.ts +18 -7
  43. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  44. package/lib/cjs/topology/Triangulation.js +50 -9
  45. package/lib/cjs/topology/Triangulation.js.map +1 -1
  46. package/lib/esm/Geometry.d.ts +15 -0
  47. package/lib/esm/Geometry.d.ts.map +1 -1
  48. package/lib/esm/Geometry.js +27 -0
  49. package/lib/esm/Geometry.js.map +1 -1
  50. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +1 -1
  51. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  52. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js +1 -1
  53. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  54. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  55. package/lib/esm/geometry3d/FrameBuilder.js +3 -0
  56. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  57. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +8 -2
  58. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  59. package/lib/esm/geometry3d/GrowableXYZArray.js +11 -2
  60. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  61. package/lib/esm/geometry3d/XYZProps.d.ts +16 -8
  62. package/lib/esm/geometry3d/XYZProps.d.ts.map +1 -1
  63. package/lib/esm/geometry3d/XYZProps.js.map +1 -1
  64. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +42 -50
  65. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  66. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +80 -103
  67. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  68. package/lib/esm/polyface/Polyface.d.ts +19 -10
  69. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  70. package/lib/esm/polyface/Polyface.js +17 -10
  71. package/lib/esm/polyface/Polyface.js.map +1 -1
  72. package/lib/esm/polyface/PolyfaceBuilder.d.ts +18 -10
  73. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  74. package/lib/esm/polyface/PolyfaceBuilder.js +27 -21
  75. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  76. package/lib/esm/polyface/PolyfaceData.d.ts +137 -86
  77. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  78. package/lib/esm/polyface/PolyfaceData.js +300 -166
  79. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  80. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  81. package/lib/esm/topology/Graph.d.ts +2 -8
  82. package/lib/esm/topology/Graph.d.ts.map +1 -1
  83. package/lib/esm/topology/Graph.js +0 -3
  84. package/lib/esm/topology/Graph.js.map +1 -1
  85. package/lib/esm/topology/Triangulation.d.ts +18 -7
  86. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  87. package/lib/esm/topology/Triangulation.js +50 -9
  88. package/lib/esm/topology/Triangulation.js.map +1 -1
  89. package/package.json +6 -4
@@ -85,8 +85,8 @@ class FacetSector {
85
85
  */
86
86
  loadIndexedPointAndDerivativeCoordinatesFromPackedArrays(i, packedXYZ, packedDerivatives, fractions, v) {
87
87
  packedXYZ.getPoint3dAtCheckedPointIndex(i, this.xyz);
88
- if (fractions && v !== undefined)
89
- this.uv = Point2d.create(fractions.atUncheckedIndex(i), v);
88
+ if (this.uv && fractions && v !== undefined)
89
+ this.uv.set(fractions.atUncheckedIndex(i), v);
90
90
  this.xyzIndex = -1;
91
91
  this.normalIndex = -1;
92
92
  this.uvIndex = -1;
@@ -771,8 +771,7 @@ class PolyfaceBuilder extends NullGeometryHandler {
771
771
  this.addIndexedTriangleNormalIndexes(sectorA0.normalIndex, sectorA1.normalIndex, sectorA2.normalIndex);
772
772
  if (this._options.needParams)
773
773
  this.addIndexedTriangleParamIndexes(sectorA0.uvIndex, sectorA1.uvIndex, sectorA2.uvIndex);
774
- this.addIndexedTrianglePointIndexes(sectorA0.xyzIndex, sectorA1.xyzIndex, sectorA2.xyzIndex);
775
- this._polyface.terminateFacet();
774
+ this.addIndexedTrianglePointIndexes(sectorA0.xyzIndex, sectorA1.xyzIndex, sectorA2.xyzIndex, true);
776
775
  }
777
776
  }
778
777
  addSectorQuadA01B01(sectorA0, sectorA1, sectorB0, sectorB1) {
@@ -788,8 +787,7 @@ class PolyfaceBuilder extends NullGeometryHandler {
788
787
  this.addIndexedQuadNormalIndexes(sectorA0.normalIndex, sectorA1.normalIndex, sectorB0.normalIndex, sectorB1.normalIndex);
789
788
  if (this._options.needParams)
790
789
  this.addIndexedQuadParamIndexes(sectorA0.uvIndex, sectorA1.uvIndex, sectorB0.uvIndex, sectorB1.uvIndex);
791
- this.addIndexedQuadPointIndexes(sectorA0.xyzIndex, sectorA1.xyzIndex, sectorB0.xyzIndex, sectorB1.xyzIndex);
792
- this._polyface.terminateFacet();
790
+ this.addIndexedQuadPointIndexes(sectorA0.xyzIndex, sectorA1.xyzIndex, sectorB0.xyzIndex, sectorB1.xyzIndex, true);
793
791
  }
794
792
  }
795
793
  /** Add facets between lineStrings with matched point counts.
@@ -861,14 +859,14 @@ class PolyfaceBuilder extends NullGeometryHandler {
861
859
  for (let i = 1; i < numPoints; i++) {
862
860
  if (this.options.shouldTriangulate) {
863
861
  if (distinctIndices(pointA.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i), pointB.atUncheckedIndex(i))) {
864
- this.addIndexedTrianglePointIndexes(pointA.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i), pointB.atUncheckedIndex(i));
862
+ this.addIndexedTrianglePointIndexes(pointA.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i), pointB.atUncheckedIndex(i), false);
865
863
  if (normalA && normalB)
866
864
  this.addIndexedTriangleNormalIndexes(normalA.atUncheckedIndex(i - 1), normalA.atUncheckedIndex(i), normalB.atUncheckedIndex(i - 1));
867
865
  if (paramA && paramB)
868
866
  this.addIndexedTriangleParamIndexes(paramA.atUncheckedIndex(i - 1), paramA.atUncheckedIndex(i), paramB.atUncheckedIndex(i - 1));
869
867
  }
870
868
  if (distinctIndices(pointB.atUncheckedIndex(i), pointB.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i - 1))) {
871
- this.addIndexedTrianglePointIndexes(pointA.atUncheckedIndex(i - 1), pointB.atUncheckedIndex(i), pointB.atUncheckedIndex(i - 1));
869
+ this.addIndexedTrianglePointIndexes(pointA.atUncheckedIndex(i - 1), pointB.atUncheckedIndex(i), pointB.atUncheckedIndex(i - 1), false);
872
870
  if (normalA && normalB)
873
871
  this.addIndexedTriangleNormalIndexes(normalA.atUncheckedIndex(i - 1), normalB.atUncheckedIndex(i), normalB.atUncheckedIndex(i - 1));
874
872
  if (paramA && paramB)
@@ -877,14 +875,14 @@ class PolyfaceBuilder extends NullGeometryHandler {
877
875
  }
878
876
  else {
879
877
  if (pointA.atUncheckedIndex(i - 1) !== pointA.atUncheckedIndex(i) || pointB.atUncheckedIndex(i - 1) !== pointB.atUncheckedIndex(i)) {
880
- this.addIndexedQuadPointIndexes(pointA.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i), pointB.atUncheckedIndex(i - 1), pointB.atUncheckedIndex(i));
878
+ this.addIndexedQuadPointIndexes(pointA.atUncheckedIndex(i - 1), pointA.atUncheckedIndex(i), pointB.atUncheckedIndex(i - 1), pointB.atUncheckedIndex(i), false);
881
879
  if (normalA && normalB)
882
880
  this.addIndexedQuadNormalIndexes(normalA.atUncheckedIndex(i - 1), normalA.atUncheckedIndex(i), normalB.atUncheckedIndex(i - 1), normalB.atUncheckedIndex(i));
883
881
  if (paramA && paramB)
884
882
  this.addIndexedQuadParamIndexes(paramA.atUncheckedIndex(i - 1), paramA.atUncheckedIndex(i), paramB.atUncheckedIndex(i - 1), paramB.atUncheckedIndex(i));
885
883
  }
886
- this._polyface.terminateFacet();
887
884
  }
885
+ this._polyface.terminateFacet();
888
886
  }
889
887
  }
890
888
  /** Add facets between lineStrings with matched point counts.
@@ -1528,11 +1526,14 @@ class PolyfaceBuilder extends NullGeometryHandler {
1528
1526
  /** add facets for a GeometryQuery object. This is double dispatch through `dispatchToGeometryHandler(this)` */
1529
1527
  addGeometryQuery(g) { g.dispatchToGeometryHandler(this); }
1530
1528
  /**
1531
- *
1532
- * * Visit all faces
1533
- * * Test each face with f(node) for any node on the face.
1534
- * * For each face that passes, pass its coordinates to the builder.
1535
- * * Rely on the builder's compress step to find common vertex coordinates
1529
+ * Add a graph to the builder.
1530
+ * * Visit one node per face
1531
+ * * If `acceptFaceFunction(node)` returns true, pass face coordinates to the builder
1532
+ * * Accepted face edge visibility is determined by `isEdgeVisibleFunction`.
1533
+ * * Rely on the builder's compress step to find common vertex coordinates.
1534
+ * @param graph faces to add as facets
1535
+ * @param acceptFaceFunction optional test for whether to add a given face. Default: ignore exterior faces
1536
+ * @param isEdgeVisibleFunction optional test for whether to hide an edge. Default: hide interior edges
1536
1537
  * @internal
1537
1538
  */
1538
1539
  addGraph(graph, acceptFaceFunction = (node) => HalfEdge.testNodeMaskNotExterior(node), isEdgeVisibleFunction = (node) => HalfEdge.testMateMaskExterior(node)) {
@@ -1571,7 +1572,7 @@ class PolyfaceBuilder extends NullGeometryHandler {
1571
1572
  * * terminate the facet
1572
1573
  * @internal
1573
1574
  */
1574
- addGraphFaces(_graph, faces) {
1575
+ addGraphFaces(faces) {
1575
1576
  let index = 0;
1576
1577
  for (const seed of faces) {
1577
1578
  let node = seed;
@@ -1583,21 +1584,26 @@ class PolyfaceBuilder extends NullGeometryHandler {
1583
1584
  this._polyface.terminateFacet();
1584
1585
  }
1585
1586
  }
1586
- /** Create a polyface containing the faces of a HalfEdgeGraph, with test function to filter faces.
1587
+ /**
1588
+ * Create a polyface containing the faces of a HalfEdgeGraph, with test functions to filter faces and hide edges.
1589
+ * * This is a static wrapper of [[addGraph]].
1590
+ * @param graph faces to add as facets
1591
+ * @param acceptFaceFunction optional test for whether to add a given face. Default: ignore exterior faces
1592
+ * @param isEdgeVisibleFunction optional test for whether to hide an edge. Default: hide interior edges
1587
1593
  * @internal
1588
1594
  */
1589
- static graphToPolyface(graph, options, acceptFaceFunction = (node) => HalfEdge.testNodeMaskNotExterior(node)) {
1595
+ static graphToPolyface(graph, options, acceptFaceFunction = (node) => HalfEdge.testNodeMaskNotExterior(node), isEdgeVisibleFunction = (node) => HalfEdge.testMateMaskExterior(node)) {
1590
1596
  const builder = PolyfaceBuilder.create(options);
1591
- builder.addGraph(graph, acceptFaceFunction);
1597
+ builder.addGraph(graph, acceptFaceFunction, isEdgeVisibleFunction);
1592
1598
  builder.endFace();
1593
1599
  return builder.claimPolyface();
1594
1600
  }
1595
1601
  /** Create a polyface containing the faces of a HalfEdgeGraph that are specified by the HalfEdge array.
1596
1602
  * @internal
1597
1603
  */
1598
- static graphFacesToPolyface(graph, faces) {
1604
+ static graphFacesToPolyface(faces) {
1599
1605
  const builder = PolyfaceBuilder.create();
1600
- builder.addGraphFaces(graph, faces);
1606
+ builder.addGraphFaces(faces);
1601
1607
  builder.endFace();
1602
1608
  return builder.claimPolyface();
1603
1609
  }