@itwin/core-geometry 4.0.0-dev.23 → 4.0.0-dev.28

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 (204) hide show
  1. package/CHANGELOG.md +7 -2
  2. package/lib/cjs/Geometry.d.ts +23 -0
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +25 -1
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurveOps.js +4 -5
  7. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  8. package/lib/cjs/bspline/InterpolationCurve3d.js +7 -10
  9. package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
  10. package/lib/cjs/clipping/ClipPrimitive.js +2 -2
  11. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  12. package/lib/cjs/clipping/ClipUtils.js +4 -4
  13. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  14. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js +2 -2
  15. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  16. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +1 -1
  17. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  18. package/lib/cjs/curve/CurveCollection.js +1 -1
  19. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  20. package/lib/cjs/curve/StrokeOptions.js +1 -2
  21. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  22. package/lib/cjs/curve/spiral/DirectSpiral3d.js +1 -2
  23. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  24. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +1 -2
  25. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  26. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +195 -8
  27. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  28. package/lib/cjs/geometry3d/BarycentricTriangle.js +459 -11
  29. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  30. package/lib/cjs/geometry3d/GrowableFloat64Array.js +2 -2
  31. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  32. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
  33. package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
  34. package/lib/cjs/geometry3d/GrowableXYArray.js +2 -2
  35. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  36. package/lib/cjs/geometry3d/GrowableXYZArray.js +1 -1
  37. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  38. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts +22 -7
  39. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  40. package/lib/cjs/geometry3d/IndexedXYCollection.js +41 -5
  41. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  42. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +58 -4
  43. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  44. package/lib/cjs/geometry3d/IndexedXYZCollection.js +102 -4
  45. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  46. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts +10 -0
  47. package/lib/cjs/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  48. package/lib/cjs/geometry3d/Point2dArrayCarrier.js +14 -0
  49. package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
  50. package/lib/cjs/geometry3d/Point2dVector2d.js +4 -6
  51. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  52. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts +0 -6
  53. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  54. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +0 -6
  55. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  56. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -1
  57. package/lib/cjs/geometry3d/Point3dVector3d.js +6 -8
  58. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  59. package/lib/cjs/geometry3d/PointHelpers.d.ts +14 -1
  60. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  61. package/lib/cjs/geometry3d/PointHelpers.js +33 -1
  62. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  63. package/lib/cjs/geometry3d/PolygonOps.d.ts +120 -10
  64. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  65. package/lib/cjs/geometry3d/PolygonOps.js +413 -13
  66. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  67. package/lib/cjs/geometry3d/Ray3d.js +1 -1
  68. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  69. package/lib/cjs/polyface/AuxData.js +1 -1
  70. package/lib/cjs/polyface/AuxData.js.map +1 -1
  71. package/lib/cjs/polyface/FacetLocationDetail.d.ts +264 -0
  72. package/lib/cjs/polyface/FacetLocationDetail.d.ts.map +1 -0
  73. package/lib/cjs/polyface/FacetLocationDetail.js +376 -0
  74. package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -0
  75. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +2 -5
  76. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  77. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +5 -2
  78. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  79. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +20 -14
  80. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  81. package/lib/cjs/polyface/PolyfaceBuilder.js +21 -17
  82. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  83. package/lib/cjs/polyface/PolyfaceClip.js +6 -7
  84. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  85. package/lib/cjs/polyface/PolyfaceData.d.ts +1 -1
  86. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  87. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  88. package/lib/cjs/polyface/PolyfaceQuery.d.ts +22 -1
  89. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  90. package/lib/cjs/polyface/PolyfaceQuery.js +52 -2
  91. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  92. package/lib/cjs/serialization/BGFBReader.js +4 -4
  93. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  94. package/lib/cjs/serialization/IModelJsonSchema.js +1 -2
  95. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  96. package/lib/cjs/solid/Sphere.d.ts +5 -5
  97. package/lib/cjs/solid/Sphere.js +5 -5
  98. package/lib/cjs/solid/Sphere.js.map +1 -1
  99. package/lib/cjs/solid/SweepContour.js +1 -1
  100. package/lib/cjs/solid/SweepContour.js.map +1 -1
  101. package/lib/cjs/topology/Triangulation.js +1 -1
  102. package/lib/cjs/topology/Triangulation.js.map +1 -1
  103. package/lib/esm/Geometry.d.ts +23 -0
  104. package/lib/esm/Geometry.d.ts.map +1 -1
  105. package/lib/esm/Geometry.js +24 -0
  106. package/lib/esm/Geometry.js.map +1 -1
  107. package/lib/esm/bspline/BSplineCurveOps.js +4 -5
  108. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  109. package/lib/esm/bspline/InterpolationCurve3d.js +7 -10
  110. package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
  111. package/lib/esm/clipping/ClipPrimitive.js +2 -2
  112. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  113. package/lib/esm/clipping/ClipUtils.js +4 -4
  114. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  115. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js +2 -2
  116. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  117. package/lib/esm/curve/CurveChainWithDistanceIndex.js +1 -1
  118. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  119. package/lib/esm/curve/CurveCollection.js +1 -1
  120. package/lib/esm/curve/CurveCollection.js.map +1 -1
  121. package/lib/esm/curve/StrokeOptions.js +1 -2
  122. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  123. package/lib/esm/curve/spiral/DirectSpiral3d.js +1 -2
  124. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  125. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +1 -2
  126. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  127. package/lib/esm/geometry3d/BarycentricTriangle.d.ts +195 -8
  128. package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  129. package/lib/esm/geometry3d/BarycentricTriangle.js +459 -12
  130. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  131. package/lib/esm/geometry3d/GrowableFloat64Array.js +2 -2
  132. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  133. package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
  134. package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
  135. package/lib/esm/geometry3d/GrowableXYArray.js +2 -2
  136. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  137. package/lib/esm/geometry3d/GrowableXYZArray.js +1 -1
  138. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  139. package/lib/esm/geometry3d/IndexedXYCollection.d.ts +22 -7
  140. package/lib/esm/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  141. package/lib/esm/geometry3d/IndexedXYCollection.js +41 -5
  142. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  143. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +58 -4
  144. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  145. package/lib/esm/geometry3d/IndexedXYZCollection.js +103 -5
  146. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  147. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts +10 -0
  148. package/lib/esm/geometry3d/Point2dArrayCarrier.d.ts.map +1 -1
  149. package/lib/esm/geometry3d/Point2dArrayCarrier.js +14 -0
  150. package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
  151. package/lib/esm/geometry3d/Point2dVector2d.js +4 -6
  152. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  153. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts +0 -6
  154. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  155. package/lib/esm/geometry3d/Point3dArrayCarrier.js +0 -6
  156. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  157. package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -1
  158. package/lib/esm/geometry3d/Point3dVector3d.js +6 -8
  159. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  160. package/lib/esm/geometry3d/PointHelpers.d.ts +14 -1
  161. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  162. package/lib/esm/geometry3d/PointHelpers.js +33 -1
  163. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  164. package/lib/esm/geometry3d/PolygonOps.d.ts +120 -10
  165. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  166. package/lib/esm/geometry3d/PolygonOps.js +412 -13
  167. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  168. package/lib/esm/geometry3d/Ray3d.js +1 -1
  169. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  170. package/lib/esm/polyface/AuxData.js +1 -1
  171. package/lib/esm/polyface/AuxData.js.map +1 -1
  172. package/lib/esm/polyface/FacetLocationDetail.d.ts +264 -0
  173. package/lib/esm/polyface/FacetLocationDetail.d.ts.map +1 -0
  174. package/lib/esm/polyface/FacetLocationDetail.js +369 -0
  175. package/lib/esm/polyface/FacetLocationDetail.js.map +1 -0
  176. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +2 -5
  177. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  178. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +5 -2
  179. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  180. package/lib/esm/polyface/PolyfaceBuilder.d.ts +20 -14
  181. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  182. package/lib/esm/polyface/PolyfaceBuilder.js +21 -17
  183. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  184. package/lib/esm/polyface/PolyfaceClip.js +6 -7
  185. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  186. package/lib/esm/polyface/PolyfaceData.d.ts +1 -1
  187. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  188. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  189. package/lib/esm/polyface/PolyfaceQuery.d.ts +22 -1
  190. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  191. package/lib/esm/polyface/PolyfaceQuery.js +52 -2
  192. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  193. package/lib/esm/serialization/BGFBReader.js +4 -4
  194. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  195. package/lib/esm/serialization/IModelJsonSchema.js +1 -2
  196. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  197. package/lib/esm/solid/Sphere.d.ts +5 -5
  198. package/lib/esm/solid/Sphere.js +5 -5
  199. package/lib/esm/solid/Sphere.js.map +1 -1
  200. package/lib/esm/solid/SweepContour.js +1 -1
  201. package/lib/esm/solid/SweepContour.js.map +1 -1
  202. package/lib/esm/topology/Triangulation.js +1 -1
  203. package/lib/esm/topology/Triangulation.js.map +1 -1
  204. package/package.json +4 -4
@@ -8,7 +8,6 @@ exports.PolyfaceQuery = exports.DuplicateFacetClusterSelector = exports.OffsetMe
8
8
  /** @packageDocumentation
9
9
  * @module Polyface
10
10
  */
11
- // import { Point2d } from "./Geometry2d";
12
11
  /* eslint-disable @typescript-eslint/naming-convention, no-empty */
13
12
  const PointHelpers_1 = require("../geometry3d/PointHelpers");
14
13
  const CurveCollection_1 = require("../curve/CurveCollection");
@@ -42,6 +41,8 @@ const RangeLengthData_1 = require("./RangeLengthData");
42
41
  const SpaceTriangulation_1 = require("../topology/SpaceTriangulation");
43
42
  const HalfEdgeGraphFromIndexedLoopsContext_1 = require("../topology/HalfEdgeGraphFromIndexedLoopsContext");
44
43
  const OffsetMeshContext_1 = require("./multiclip/OffsetMeshContext");
44
+ const FacetLocationDetail_1 = require("./FacetLocationDetail");
45
+ const BarycentricTriangle_1 = require("../geometry3d/BarycentricTriangle");
45
46
  /**
46
47
  * Options carrier for [[PolyfaceQuery.cloneOffset]].
47
48
  * * Default options are strongly recommended.
@@ -1315,7 +1316,7 @@ class PolyfaceQuery {
1315
1316
  * * Compute simple average of those normals
1316
1317
  * * Index to the averages
1317
1318
  * * For typical meshes, this correctly clusters adjacent normals.
1318
- * * One cam imagine a vertex with multiple "smooth cone-like" sets of incident facets such that averaging occurs among two nonadjacent cones. But this does not seem to be a problem in practice.
1319
+ * * One can imagine a vertex with multiple "smooth cone-like" sets of incident facets such that averaging occurs among two nonadjacent cones. But this does not seem to be a problem in practice.
1319
1320
  * @param polyface polyface to update.
1320
1321
  * @param toleranceAngle averaging is done between normals up to this angle.
1321
1322
  */
@@ -1335,6 +1336,55 @@ class PolyfaceQuery {
1335
1336
  OffsetMeshContext_1.OffsetMeshContext.buildOffsetMeshWithEdgeChamfers(source, offsetBuilder, signedOffsetDistance, offsetOptions);
1336
1337
  return offsetBuilder.claimPolyface();
1337
1338
  }
1339
+ /** Search facets for the first one that intersects the infinite line.
1340
+ * * To process _all_ intersections, callers can supply an `options.acceptIntersection` callback that always returns false.
1341
+ * In this case, `intersectRay3d` will return undefined, but the callback will be invoked for each intersection.
1342
+ * * Example callback logic:
1343
+ * * Accept the first found facet that intersects the half-line specified by the ray: `return detail.a >= 0.0;`
1344
+ * * Collect all intersections: `myIntersections.push(detail.clone()); return false;` Then after `intersectRay3d` returns, sort along `ray` with `myIntersections.sort((d0, d1) => d0.a - d1.a);`
1345
+ * @param visitor facet iterator
1346
+ * @param ray infinite line parameterized as a ray. The returned `detail.a` is the intersection parameter on the ray, e.g., zero at `ray.origin` and increasing in `ray.direction`.
1347
+ * @param options options for computing and populating an intersection detail, and an optional callback for accepting one
1348
+ * @return detail for the (accepted) intersection with `detail.IsInsideOrOn === true`, or `undefined` if no (accepted) intersection
1349
+ * @see PolygonOps.intersectRay3d
1350
+ */
1351
+ static intersectRay3d(visitor, ray, options) {
1352
+ if (visitor instanceof Polyface_1.Polyface)
1353
+ return PolyfaceQuery.intersectRay3d(visitor.createVisitor(0), ray, options);
1354
+ let detail;
1355
+ visitor.setNumWrap(0);
1356
+ while (visitor.moveToNextFacet()) {
1357
+ const numEdges = visitor.pointCount; // #vertices = #edges since numWrap is zero
1358
+ const vertices = visitor.point;
1359
+ if (3 === numEdges) {
1360
+ const tri = this._workTriangle = BarycentricTriangle_1.BarycentricTriangle.create(vertices.getPoint3dAtUncheckedPointIndex(0), vertices.getPoint3dAtUncheckedPointIndex(1), vertices.getPoint3dAtUncheckedPointIndex(2), this._workTriangle);
1361
+ const detail3 = this._workTriDetail = tri.intersectRay3d(ray, this._workTriDetail);
1362
+ tri.snapLocationToEdge(detail3, options?.distanceTolerance, options?.parameterTolerance);
1363
+ detail = this._workFacetDetail3 = FacetLocationDetail_1.TriangularFacetLocationDetail.create(visitor.currentReadIndex(), detail3, this._workFacetDetail3);
1364
+ }
1365
+ else {
1366
+ const detailN = this._workPolyDetail = PolygonOps_1.PolygonOps.intersectRay3d(vertices, ray, options?.distanceTolerance, this._workPolyDetail);
1367
+ if (PolygonOps_1.PolygonOps.isConvex(vertices))
1368
+ detail = this._workFacetDetailC = FacetLocationDetail_1.ConvexFacetLocationDetail.create(visitor.currentReadIndex(), numEdges, detailN, this._workFacetDetailC);
1369
+ else
1370
+ detail = this._workFacetDetailNC = FacetLocationDetail_1.NonConvexFacetLocationDetail.create(visitor.currentReadIndex(), numEdges, detailN, this._workFacetDetailNC);
1371
+ }
1372
+ if (detail.isInsideOrOn) { // set optional caches, process the intersection
1373
+ if (options?.needNormal && visitor.normal)
1374
+ detail.getNormal(visitor.normal, vertices, options?.distanceTolerance);
1375
+ if (options?.needParam && visitor.param)
1376
+ detail.getParam(visitor.param, vertices, options?.distanceTolerance);
1377
+ if (options?.needColor && visitor.color)
1378
+ detail.getColor(visitor.color, vertices, options?.distanceTolerance);
1379
+ if (options?.needBarycentricCoordinates)
1380
+ detail.getBarycentricCoordinates(vertices, options?.distanceTolerance);
1381
+ if (options?.acceptIntersection && !options.acceptIntersection(detail, visitor))
1382
+ continue;
1383
+ return detail;
1384
+ }
1385
+ }
1386
+ return undefined; // no intersection
1387
+ }
1338
1388
  }
1339
1389
  exports.PolyfaceQuery = PolyfaceQuery;
1340
1390
  // amount of computation to do per step of async methods.