@itwin/core-geometry 4.1.0-dev.3 → 4.1.0-dev.30

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 (190) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/lib/cjs/curve/Arc3d.d.ts +71 -86
  3. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  4. package/lib/cjs/curve/Arc3d.js +110 -96
  5. package/lib/cjs/curve/Arc3d.js.map +1 -1
  6. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +61 -41
  7. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  8. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +69 -46
  9. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  10. package/lib/cjs/curve/CurveCollection.d.ts +73 -46
  11. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  12. package/lib/cjs/curve/CurveCollection.js +100 -64
  13. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  14. package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
  15. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  16. package/lib/cjs/curve/CurveLocationDetail.d.ts +45 -46
  17. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  18. package/lib/cjs/curve/CurveLocationDetail.js +39 -41
  19. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  20. package/lib/cjs/curve/CurvePrimitive.d.ts +138 -92
  21. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  22. package/lib/cjs/curve/CurvePrimitive.js +115 -75
  23. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  24. package/lib/cjs/curve/GeometryQuery.d.ts +26 -20
  25. package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
  26. package/lib/cjs/curve/GeometryQuery.js +11 -9
  27. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  28. package/lib/cjs/curve/LineSegment3d.d.ts +38 -27
  29. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  30. package/lib/cjs/curve/LineSegment3d.js +77 -39
  31. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  32. package/lib/cjs/curve/LineString3d.d.ts +70 -51
  33. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  34. package/lib/cjs/curve/LineString3d.js +120 -71
  35. package/lib/cjs/curve/LineString3d.js.map +1 -1
  36. package/lib/cjs/curve/Loop.d.ts +7 -5
  37. package/lib/cjs/curve/Loop.d.ts.map +1 -1
  38. package/lib/cjs/curve/Loop.js +18 -6
  39. package/lib/cjs/curve/Loop.js.map +1 -1
  40. package/lib/cjs/curve/ParityRegion.d.ts +7 -7
  41. package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
  42. package/lib/cjs/curve/ParityRegion.js +19 -11
  43. package/lib/cjs/curve/ParityRegion.js.map +1 -1
  44. package/lib/cjs/curve/Path.d.ts +6 -6
  45. package/lib/cjs/curve/Path.d.ts.map +1 -1
  46. package/lib/cjs/curve/Path.js +15 -9
  47. package/lib/cjs/curve/Path.js.map +1 -1
  48. package/lib/cjs/curve/ProxyCurve.d.ts +4 -6
  49. package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
  50. package/lib/cjs/curve/ProxyCurve.js +7 -7
  51. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  52. package/lib/cjs/curve/Query/StrokeCountMap.d.ts +14 -13
  53. package/lib/cjs/curve/Query/StrokeCountMap.d.ts.map +1 -1
  54. package/lib/cjs/curve/Query/StrokeCountMap.js +9 -8
  55. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  56. package/lib/cjs/curve/RegionOps.d.ts +69 -47
  57. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  58. package/lib/cjs/curve/RegionOps.js +70 -47
  59. package/lib/cjs/curve/RegionOps.js.map +1 -1
  60. package/lib/cjs/curve/StrokeOptions.d.ts +29 -21
  61. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  62. package/lib/cjs/curve/StrokeOptions.js +50 -24
  63. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  64. package/lib/cjs/curve/UnionRegion.d.ts +6 -5
  65. package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
  66. package/lib/cjs/curve/UnionRegion.js +17 -8
  67. package/lib/cjs/curve/UnionRegion.js.map +1 -1
  68. package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts +2 -1
  69. package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
  70. package/lib/cjs/curve/internalContexts/GapSearchContext.js +6 -2
  71. package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
  72. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
  73. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  74. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
  75. package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  76. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +56 -34
  77. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  78. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +152 -87
  79. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  80. package/lib/cjs/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
  81. package/lib/cjs/curve/internalContexts/SumLengthsContext.js +4 -1
  82. package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
  83. package/lib/cjs/geometry3d/Matrix3d.d.ts +2 -2
  84. package/lib/cjs/geometry3d/Matrix3d.js +2 -2
  85. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  86. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
  87. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  88. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +35 -32
  89. package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  90. package/lib/cjs/geometry3d/Range.d.ts +133 -93
  91. package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
  92. package/lib/cjs/geometry3d/Range.js +296 -144
  93. package/lib/cjs/geometry3d/Range.js.map +1 -1
  94. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  95. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  96. package/lib/esm/curve/Arc3d.d.ts +71 -86
  97. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  98. package/lib/esm/curve/Arc3d.js +110 -96
  99. package/lib/esm/curve/Arc3d.js.map +1 -1
  100. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +61 -41
  101. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  102. package/lib/esm/curve/CurveChainWithDistanceIndex.js +69 -46
  103. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  104. package/lib/esm/curve/CurveCollection.d.ts +73 -46
  105. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  106. package/lib/esm/curve/CurveCollection.js +100 -64
  107. package/lib/esm/curve/CurveCollection.js.map +1 -1
  108. package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
  109. package/lib/esm/curve/CurveCurve.js.map +1 -1
  110. package/lib/esm/curve/CurveLocationDetail.d.ts +45 -46
  111. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  112. package/lib/esm/curve/CurveLocationDetail.js +39 -41
  113. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  114. package/lib/esm/curve/CurvePrimitive.d.ts +138 -92
  115. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  116. package/lib/esm/curve/CurvePrimitive.js +115 -75
  117. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  118. package/lib/esm/curve/GeometryQuery.d.ts +26 -20
  119. package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
  120. package/lib/esm/curve/GeometryQuery.js +11 -9
  121. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  122. package/lib/esm/curve/LineSegment3d.d.ts +38 -27
  123. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  124. package/lib/esm/curve/LineSegment3d.js +77 -39
  125. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  126. package/lib/esm/curve/LineString3d.d.ts +70 -51
  127. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  128. package/lib/esm/curve/LineString3d.js +120 -71
  129. package/lib/esm/curve/LineString3d.js.map +1 -1
  130. package/lib/esm/curve/Loop.d.ts +7 -5
  131. package/lib/esm/curve/Loop.d.ts.map +1 -1
  132. package/lib/esm/curve/Loop.js +18 -6
  133. package/lib/esm/curve/Loop.js.map +1 -1
  134. package/lib/esm/curve/ParityRegion.d.ts +7 -7
  135. package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
  136. package/lib/esm/curve/ParityRegion.js +19 -11
  137. package/lib/esm/curve/ParityRegion.js.map +1 -1
  138. package/lib/esm/curve/Path.d.ts +6 -6
  139. package/lib/esm/curve/Path.d.ts.map +1 -1
  140. package/lib/esm/curve/Path.js +15 -9
  141. package/lib/esm/curve/Path.js.map +1 -1
  142. package/lib/esm/curve/ProxyCurve.d.ts +4 -6
  143. package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
  144. package/lib/esm/curve/ProxyCurve.js +7 -7
  145. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  146. package/lib/esm/curve/Query/StrokeCountMap.d.ts +14 -13
  147. package/lib/esm/curve/Query/StrokeCountMap.d.ts.map +1 -1
  148. package/lib/esm/curve/Query/StrokeCountMap.js +9 -8
  149. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  150. package/lib/esm/curve/RegionOps.d.ts +69 -47
  151. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  152. package/lib/esm/curve/RegionOps.js +70 -47
  153. package/lib/esm/curve/RegionOps.js.map +1 -1
  154. package/lib/esm/curve/StrokeOptions.d.ts +29 -21
  155. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  156. package/lib/esm/curve/StrokeOptions.js +50 -24
  157. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  158. package/lib/esm/curve/UnionRegion.d.ts +6 -5
  159. package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
  160. package/lib/esm/curve/UnionRegion.js +17 -8
  161. package/lib/esm/curve/UnionRegion.js.map +1 -1
  162. package/lib/esm/curve/internalContexts/GapSearchContext.d.ts +2 -1
  163. package/lib/esm/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
  164. package/lib/esm/curve/internalContexts/GapSearchContext.js +6 -2
  165. package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
  166. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
  167. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
  168. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
  169. package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
  170. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +56 -34
  171. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  172. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +152 -87
  173. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  174. package/lib/esm/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
  175. package/lib/esm/curve/internalContexts/SumLengthsContext.js +4 -1
  176. package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
  177. package/lib/esm/geometry3d/Matrix3d.d.ts +2 -2
  178. package/lib/esm/geometry3d/Matrix3d.js +2 -2
  179. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  180. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +36 -32
  181. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
  182. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +35 -32
  183. package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
  184. package/lib/esm/geometry3d/Range.d.ts +133 -93
  185. package/lib/esm/geometry3d/Range.d.ts.map +1 -1
  186. package/lib/esm/geometry3d/Range.js +296 -144
  187. package/lib/esm/geometry3d/Range.js.map +1 -1
  188. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  189. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  190. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"StrokeOptions.d.ts","sourceRoot":"","sources":["../../../src/curve/StrokeOptions.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,aAAa;IAExB,8CAA8C;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IACzB,qCAAqC;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC;IACxB,yCAAyC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IAC9B,qCAAqC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAClC,qCAAqC;IAC9B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACvC,qDAAqD;IAC9C,iBAAiB,EAAE,OAAO,CAAS;IAC1C,OAAO,CAAC,YAAY,CAAC,CAAU;IAC/B,OAAO,CAAC,aAAa,CAAC,CAAU;IAChC,OAAO,CAAC,WAAW,CAAC,CAAU;IAC9B,oCAAoC;IACpC,IAAW,UAAU,IAAI,OAAO,CAAsE;IACtG,IAAW,UAAU,CAAC,KAAK,EAAE,OAAO,EAA+B;IACnE,oCAAoC;IACpC,IAAW,WAAW,IAAI,OAAO,CAAwE;IACzG,IAAW,WAAW,CAAC,KAAK,EAAE,OAAO,EAAgC;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,IAAW,gBAAgB,IAAI,OAAO,CAErC;IACD,2BAA2B;IACpB,KAAK,IAAI,aAAa;IAe7B,yGAAyG;IAClG,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;IAOxE;;;;OAIG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,MAAM;IAGhG;;;OAGG;WACW,aAAa,CACzB,OAAO,EAAE,aAAa,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,MAAM,GACtG,MAAM;IAST;;;;;OAKG;WACW,kBAAkB,CAC9B,OAAO,EAAE,aAAa,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GACvE,MAAM;IAUT;;;OAGG;IACI,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,GAAE,MAAoB,GAAG,MAAM;IAQvF,4HAA4H;IACrH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM;IAQpF;;;OAGG;IACI,+BAA+B,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM;IAQtG,iGAAiG;IAC1F,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAM5D;;;;OAIG;WACW,eAAe,IAAI,aAAa;IAK9C;;;;OAIG;WACW,eAAe,IAAI,aAAa;CAK/C"}
@@ -11,7 +11,8 @@ exports.StrokeOptions = void 0;
11
11
  const Geometry_1 = require("../Geometry");
12
12
  const Angle_1 = require("../geometry3d/Angle");
13
13
  /* eslint-disable @typescript-eslint/naming-convention, no-empty */
14
- /** tolerance blob for various stroking methods.
14
+ /**
15
+ * Tolerance blob for various stroking methods.
15
16
  *
16
17
  * * Across many applications, the critical concepts are: chordTol, angleTol, maxEdgeLength
17
18
  * * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.
@@ -34,26 +35,44 @@ const Angle_1 = require("../geometry3d/Angle");
34
35
  */
35
36
  class StrokeOptions {
36
37
  constructor() {
37
- /** whether or not to triangulate each added facet */
38
+ /** Whether or not to triangulate each added facet */
38
39
  this.shouldTriangulate = false;
39
- /** default number of strokes for a circle. */
40
+ /** Default number of strokes for a circle. */
40
41
  this.defaultCircleStrokes = 16;
41
42
  }
42
43
  /** Whether params are requested. */
43
- get needParams() { return this._needParams !== undefined ? this._needParams : false; }
44
- set needParams(value) { this._needParams = value; }
44
+ get needParams() {
45
+ return this._needParams !== undefined ? this._needParams : false;
46
+ }
47
+ set needParams(value) {
48
+ this._needParams = value;
49
+ }
45
50
  /** Whether normals are requested */
46
- get needNormals() { return this._needNormals !== undefined ? this._needNormals : false; }
47
- set needNormals(value) { this._needNormals = value; }
51
+ get needNormals() {
52
+ return this._needNormals !== undefined ? this._needNormals : false;
53
+ }
54
+ set needNormals(value) {
55
+ this._needNormals = value;
56
+ }
48
57
  /** Whether twoSided is requested. */
49
- get needTwoSided() { return this._needTwoSided !== undefined ? this._needTwoSided : false; }
50
- set needTwoSided(value) { this._needTwoSided = value; }
51
- /** ask if angleTol is specified */
52
- get hasAngleTol() { return this.angleTol !== undefined && Math.abs(this.angleTol.radians) > 0.0; }
53
- /** ask if chordTol is specified */
54
- get hasChordTol() { return this.chordTol !== undefined && this.chordTol > 0.0; }
55
- /** ask if maxEdgeLength is specified */
56
- get hasMaxEdgeLength() { return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0; }
58
+ get needTwoSided() {
59
+ return this._needTwoSided !== undefined ? this._needTwoSided : false;
60
+ }
61
+ set needTwoSided(value) {
62
+ this._needTwoSided = value;
63
+ }
64
+ /** Ask if angleTol is specified */
65
+ get hasAngleTol() {
66
+ return this.angleTol !== undefined && Math.abs(this.angleTol.radians) > 0.0;
67
+ }
68
+ /** Ask if chordTol is specified */
69
+ get hasChordTol() {
70
+ return this.chordTol !== undefined && this.chordTol > 0.0;
71
+ }
72
+ /** Ask if maxEdgeLength is specified */
73
+ get hasMaxEdgeLength() {
74
+ return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0;
75
+ }
57
76
  /** Return a deep clone */
58
77
  clone() {
59
78
  const options = new StrokeOptions();
@@ -70,7 +89,7 @@ class StrokeOptions {
70
89
  options.defaultCircleStrokes = this.defaultCircleStrokes;
71
90
  return options;
72
91
  }
73
- /** return stroke count which is the larger of the minCount or count needed for edge length condition. */
92
+ /** Return stroke count which is the larger of the minCount or count needed for edge length condition. */
74
93
  applyMaxEdgeLength(minCount, totalLength) {
75
94
  totalLength = Math.abs(totalLength);
76
95
  if (this.maxEdgeLength && this.maxEdgeLength > 0.0 && minCount * this.maxEdgeLength < totalLength) {
@@ -79,14 +98,16 @@ class StrokeOptions {
79
98
  return minCount;
80
99
  }
81
100
  /**
82
- * return stroke count which is the larger of the existing count or count needed for angle condition for given sweepRadians
101
+ * Return stroke count which is the larger of the existing count or count needed for angle condition for given
102
+ * sweepRadians.
83
103
  * * defaultStepRadians is assumed to be larger than zero.
84
104
  */
85
105
  applyAngleTol(minCount, sweepRadians, defaultStepRadians) {
86
106
  return StrokeOptions.applyAngleTol(this, minCount, sweepRadians, defaultStepRadians);
87
107
  }
88
108
  /**
89
- * return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance from the options.
109
+ * Return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance
110
+ * from the options.
90
111
  */
91
112
  static applyAngleTol(options, minCount, sweepRadians, defaultStepRadians) {
92
113
  sweepRadians = Math.abs(sweepRadians);
@@ -114,7 +135,8 @@ class StrokeOptions {
114
135
  return minCount;
115
136
  }
116
137
  /**
117
- * Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength, chord, and minimum stroke.
138
+ * Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength,
139
+ * chord, and minimum stroke.
118
140
  */
119
141
  applyTolerancesToArc(radius, sweepRadians = Math.PI * 2) {
120
142
  let numStrokes = 1;
@@ -124,7 +146,7 @@ class StrokeOptions {
124
146
  numStrokes = this.applyMinStrokesPerPrimitive(numStrokes);
125
147
  return numStrokes;
126
148
  }
127
- /** return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */
149
+ /** Return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */
128
150
  applyChordTol(minCount, radius, sweepRadians) {
129
151
  if (this.chordTol && this.chordTol > 0.0 && this.chordTol < radius) {
130
152
  const a = this.chordTol;
@@ -133,7 +155,9 @@ class StrokeOptions {
133
155
  }
134
156
  return minCount;
135
157
  }
136
- /** return stroke count which is the larger of existing count or count needed for circular arc chord tol with given arc length and radians
158
+ /**
159
+ * Return stroke count which is the larger of existing count or count needed for circular arc chord tol with given
160
+ * arc length and radians
137
161
  */
138
162
  applyChordTolToLengthAndRadians(minCount, length, sweepRadians) {
139
163
  if (this.chordTol && this.chordTol > 0.0) {
@@ -143,14 +167,15 @@ class StrokeOptions {
143
167
  }
144
168
  return minCount;
145
169
  }
146
- /** return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */
170
+ /** Return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */
147
171
  applyMinStrokesPerPrimitive(minCount) {
148
172
  if (this.minStrokesPerPrimitive !== undefined && Number.isFinite(this.minStrokesPerPrimitive)
149
173
  && this.minStrokesPerPrimitive > minCount)
150
174
  minCount = this.minStrokesPerPrimitive;
151
175
  return minCount;
152
176
  }
153
- /** create `StrokeOptions` with defaults appropriate for curves.
177
+ /**
178
+ * Create `StrokeOptions` with defaults appropriate for curves.
154
179
  * * angle tolerance of 15 degrees.
155
180
  * * all others inactive.
156
181
  */
@@ -159,7 +184,8 @@ class StrokeOptions {
159
184
  options.angleTol = Angle_1.Angle.createDegrees(15.0);
160
185
  return options;
161
186
  }
162
- /** create `StrokeOptions` with defaults appropriate for surfaces facets
187
+ /**
188
+ * Create `StrokeOptions` with defaults appropriate for surfaces facets
163
189
  * * angle tolerance of 22.5 degrees.
164
190
  * * all others inactive.
165
191
  */
@@ -1 +1 @@
1
- {"version":3,"file":"StrokeOptions.js","sourceRoot":"","sources":["../../../src/curve/StrokeOptions.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AACvC,+CAA4C;AAE5C,mEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,aAAa;IAA1B;QAYE,qDAAqD;QAC9C,sBAAiB,GAAY,KAAK,CAAC;QAe1C,8CAA8C;QACvC,yBAAoB,GAAG,EAAE,CAAC;IA+HnC,CAAC;IA3IC,oCAAoC;IACpC,IAAW,UAAU,KAAc,OAAO,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACtG,IAAW,UAAU,CAAC,KAAc,IAAI,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC;IACnE,oCAAoC;IACpC,IAAW,WAAW,KAAc,OAAO,IAAI,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACzG,IAAW,WAAW,CAAC,KAAc,IAAI,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC;IACrE,qCAAqC;IACrC,IAAW,YAAY,KAAc,OAAO,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5G,IAAW,YAAY,CAAC,KAAc,IAAI,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC;IAKvE,mCAAmC;IACnC,IAAW,WAAW,KAAc,OAAO,I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IACD;OACG;IACI,+BAA+B,CAAC,QAAgB,EAAE,MAAc,EAAE,YAAoB;QAC3F,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,GAAG,GAAG,EAAE;YACxC,MAAM,MAAM,GAAG,mBAAQ,CAAC,yBAAyB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YACxE,IAAI,MAAM,KAAK,SAAS;gBACtB,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;SAC7D;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,iGAAiG;IAC1F,2BAA2B,CAAC,QAAgB;QACjD,IAAI,IAAI,CAAC,sBAAsB,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC;eACxF,IAAI,CAAC,sBAAsB,GAAG,QAAQ;YACzC,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC;QACzC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,aAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,aAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA5JD,sCA4JC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n\r\n/** tolerance blob for various stroking methods.\r\n *\r\n * * Across many applications, the critical concepts are: chordTol, angleTol, maxEdgeLength\r\n * * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.\r\n * * angle is the angle between two contiguous strokes or across a facet edge.\r\n * * maxEdgeLength is the length of a stroke or a edge of a facet.\r\n *\r\n * It is rare for all three to be active at once:\r\n * * Nearly all stroke and facet use cases will apply an angle tolerance.\r\n * * * For curves, 15 degrees is typical\r\n * * * For facets, 22.5 degrees is typical.\r\n * * * Halving the angle tolerance will (roughly) make curves get twice as many strokes, and surfaces get 4 times as many facets.\r\n * * * The angle tolerance has the useful property that its effect is independent of scale of that data. If data is suddenly scaled into millimeters rather than meters, the facet counts remain the same.\r\n * * When creating output for devices such as 3D printing will want a chord tolerance.\r\n * * For graphics display, use an angle tolerance of around 15 degrees and an chord tolerance which is the size of several pixels.\r\n * * Analysis meshes (e.g. Finite Elements) commonly need to apply maxEdgeLength.\r\n * * * Using maxEdgeLength for graphics probably produces too many facets. For example, it causes long cylinders to get many nearly-square facets instead of the small number of long quads usually used for graphics.\r\n * * Facet tolerances are, as the Pirates' Code, guidelines, not absolute rules. Facet and stroke code may ignore tolerances in awkward situations.\r\n * * If multiple tolerances are in effect, the actual count will usually be based on the one that demands the most strokes or facets, unless it is so high that it violates some upper limit on the number of facets on an arc or a section of a curve.\r\n * @public\r\n */\r\nexport class StrokeOptions {\r\n\r\n /** distance from stroke to actual geometry */\r\n public chordTol?: number;\r\n /** turning angle between strokes. */\r\n public angleTol?: Angle;\r\n /** maximum length of a single stroke. */\r\n public maxEdgeLength?: number;\r\n /** caller expects convex facets. */\r\n public needConvexFacets?: boolean;\r\n /** minimum strokes on a primitive */\r\n public minStrokesPerPrimitive?: number;\r\n /** whether or not to triangulate each added facet */\r\n public shouldTriangulate: boolean = false;\r\n private _needNormals?: boolean;\r\n private _needTwoSided?: boolean;\r\n private _needParams?: boolean;\r\n /** Whether params are requested. */\r\n public get needParams(): boolean { return this._needParams !== undefined ? this._needParams : false; }\r\n public set needParams(value: boolean) { this._needParams = value; }\r\n /** Whether normals are requested */\r\n public get needNormals(): boolean { return this._needNormals !== undefined ? this._needNormals : false; }\r\n public set needNormals(value: boolean) { this._needNormals = value; }\r\n /** Whether twoSided is requested. */\r\n public get needTwoSided(): boolean { return this._needTwoSided !== undefined ? this._needTwoSided : false; }\r\n public set needTwoSided(value: boolean) { this._needTwoSided = value; }\r\n /** optional color request flag */\r\n public needColors?: boolean;\r\n /** default number of strokes for a circle. */\r\n public defaultCircleStrokes = 16;\r\n /** ask if angleTol is specified */\r\n public get hasAngleTol(): boolean { return this.angleTol !== undefined && Math.abs(this.angleTol.radians) > 0.0; }\r\n /** ask if chordTol is specified */\r\n public get hasChordTol(): boolean { return this.chordTol !== undefined && this.chordTol > 0.0; }\r\n /** ask if maxEdgeLength is specified */\r\n public get hasMaxEdgeLength(): boolean { return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0; }\r\n\r\n /** Return a deep clone */\r\n public clone(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.chordTol = this.chordTol;\r\n options.angleTol = this.angleTol?.clone();\r\n options.maxEdgeLength = this.maxEdgeLength;\r\n options.needConvexFacets = this.needConvexFacets;\r\n options.minStrokesPerPrimitive = this.minStrokesPerPrimitive;\r\n options.shouldTriangulate = this.shouldTriangulate;\r\n options._needNormals = this._needNormals;\r\n options._needTwoSided = this._needTwoSided;\r\n options._needParams = this._needParams;\r\n options.needColors = this.needColors;\r\n options.defaultCircleStrokes = this.defaultCircleStrokes;\r\n return options;\r\n }\r\n\r\n /** return stroke count which is the larger of the minCount or count needed for edge length condition. */\r\n public applyMaxEdgeLength(minCount: number, totalLength: number): number {\r\n totalLength = Math.abs(totalLength);\r\n if (this.maxEdgeLength && this.maxEdgeLength > 0.0 && minCount * this.maxEdgeLength < totalLength) {\r\n minCount = Geometry.stepCount(this.maxEdgeLength, totalLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n\r\n /**\r\n * return stroke count which is the larger of the existing count or count needed for angle condition for given sweepRadians\r\n * * defaultStepRadians is assumed to be larger than zero.\r\n */\r\n public applyAngleTol(minCount: number, sweepRadians: number, defaultStepRadians: number): number {\r\n return StrokeOptions.applyAngleTol(this, minCount, sweepRadians, defaultStepRadians);\r\n }\r\n /**\r\n * return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance from the options.\r\n */\r\n public static applyAngleTol(options: StrokeOptions | undefined, minCount: number, sweepRadians: number, defaultStepRadians?: number): number {\r\n sweepRadians = Math.abs(sweepRadians);\r\n let stepRadians = defaultStepRadians ? defaultStepRadians : Math.PI / 8.0;\r\n if (options && options.angleTol && options.angleTol.radians > 0.0)\r\n stepRadians = options.angleTol.radians;\r\n if (minCount * stepRadians < sweepRadians)\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n return minCount;\r\n }\r\n /**\r\n * Return the number of strokes needed for given edgeLength curve.\r\n * @param options\r\n * @param minCount smallest allowed count\r\n * @param edgeLength\r\n */\r\n public static applyMaxEdgeLength(options: StrokeOptions | undefined, minCount: number, edgeLength: number): number {\r\n if (edgeLength < 0)\r\n edgeLength = - edgeLength;\r\n if (minCount < 1)\r\n minCount = 1;\r\n if (options && options.maxEdgeLength && options.maxEdgeLength * minCount < edgeLength) {\r\n minCount = Geometry.stepCount(options.maxEdgeLength, edgeLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength, chord, and minimum stroke.\r\n */\r\n public applyTolerancesToArc(radius: number, sweepRadians: number = Math.PI * 2): number {\r\n let numStrokes = 1;\r\n numStrokes = this.applyAngleTol(numStrokes, sweepRadians, Math.PI * 0.25);\r\n numStrokes = this.applyMaxEdgeLength(numStrokes, sweepRadians * radius);\r\n numStrokes = this.applyChordTol(numStrokes, radius, sweepRadians);\r\n numStrokes = this.applyMinStrokesPerPrimitive(numStrokes);\r\n return numStrokes;\r\n }\r\n\r\n /** return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */\r\n public applyChordTol(minCount: number, radius: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0 && this.chordTol < radius) {\r\n const a = this.chordTol;\r\n const stepRadians = 2.0 * Math.acos((1.0 - a / radius));\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n }\r\n return minCount;\r\n }\r\n /** return stroke count which is the larger of existing count or count needed for circular arc chord tol with given arc length and radians\r\n */\r\n public applyChordTolToLengthAndRadians(minCount: number, length: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0) {\r\n const radius = Geometry.conditionalDivideFraction(length, sweepRadians);\r\n if (radius !== undefined)\r\n return this.applyChordTol(minCount, radius, sweepRadians);\r\n }\r\n return minCount;\r\n }\r\n\r\n /** return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */\r\n public applyMinStrokesPerPrimitive(minCount: number): number {\r\n if (this.minStrokesPerPrimitive !== undefined && Number.isFinite(this.minStrokesPerPrimitive)\r\n && this.minStrokesPerPrimitive > minCount)\r\n minCount = this.minStrokesPerPrimitive;\r\n return minCount;\r\n }\r\n\r\n /** create `StrokeOptions` with defaults appropriate for curves.\r\n * * angle tolerance of 15 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForCurves(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(15.0);\r\n return options;\r\n }\r\n /** create `StrokeOptions` with defaults appropriate for surfaces facets\r\n * * angle tolerance of 22.5 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForFacets(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(22.5);\r\n return options;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"StrokeOptions.js","sourceRoot":"","sources":["../../../src/curve/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MAAM,EAAE,YAAY,CAAC,CAAC;YACxE,IAAI,MAAM,KAAK,SAAS;gBACtB,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;SAC7D;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,iGAAiG;IAC1F,2BAA2B,CAAC,QAAgB;QACjD,IAAI,IAAI,CAAC,sBAAsB,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC;eACxF,IAAI,CAAC,sBAAsB,GAAG,QAAQ;YACzC,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC;QACzC,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,aAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,aAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAlLD,sCAkLC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n\r\n/**\r\n * Tolerance blob for various stroking methods.\r\n *\r\n * * Across many applications, the critical concepts are: chordTol, angleTol, maxEdgeLength\r\n * * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.\r\n * * angle is the angle between two contiguous strokes or across a facet edge.\r\n * * maxEdgeLength is the length of a stroke or a edge of a facet.\r\n *\r\n * It is rare for all three to be active at once:\r\n * * Nearly all stroke and facet use cases will apply an angle tolerance.\r\n * * * For curves, 15 degrees is typical\r\n * * * For facets, 22.5 degrees is typical.\r\n * * * Halving the angle tolerance will (roughly) make curves get twice as many strokes, and surfaces get 4 times as many facets.\r\n * * * The angle tolerance has the useful property that its effect is independent of scale of that data. If data is suddenly scaled into millimeters rather than meters, the facet counts remain the same.\r\n * * When creating output for devices such as 3D printing will want a chord tolerance.\r\n * * For graphics display, use an angle tolerance of around 15 degrees and an chord tolerance which is the size of several pixels.\r\n * * Analysis meshes (e.g. Finite Elements) commonly need to apply maxEdgeLength.\r\n * * * Using maxEdgeLength for graphics probably produces too many facets. For example, it causes long cylinders to get many nearly-square facets instead of the small number of long quads usually used for graphics.\r\n * * Facet tolerances are, as the Pirates' Code, guidelines, not absolute rules. Facet and stroke code may ignore tolerances in awkward situations.\r\n * * If multiple tolerances are in effect, the actual count will usually be based on the one that demands the most strokes or facets, unless it is so high that it violates some upper limit on the number of facets on an arc or a section of a curve.\r\n * @public\r\n */\r\nexport class StrokeOptions {\r\n /** Distance from stroke to actual geometry */\r\n public chordTol?: number;\r\n /** Turning angle between strokes. */\r\n public angleTol?: Angle;\r\n /** Maximum length of a single stroke. */\r\n public maxEdgeLength?: number;\r\n /** Caller expects convex facets. */\r\n public needConvexFacets?: boolean;\r\n /** Minimum strokes on a primitive */\r\n public minStrokesPerPrimitive?: number;\r\n /** Whether or not to triangulate each added facet */\r\n public shouldTriangulate: boolean = false;\r\n private _needNormals?: boolean;\r\n private _needTwoSided?: boolean;\r\n private _needParams?: boolean;\r\n /** Whether params are requested. */\r\n public get needParams(): boolean {\r\n return this._needParams !== undefined ? this._needParams : false;\r\n }\r\n public set needParams(value: boolean) {\r\n this._needParams = value;\r\n }\r\n /** Whether normals are requested */\r\n public get needNormals(): boolean {\r\n return this._needNormals !== undefined ? this._needNormals : false;\r\n }\r\n public set needNormals(value: boolean) {\r\n this._needNormals = value;\r\n }\r\n /** Whether twoSided is requested. */\r\n public get needTwoSided(): boolean {\r\n return this._needTwoSided !== undefined ? this._needTwoSided : false;\r\n }\r\n public set needTwoSided(value: boolean) {\r\n this._needTwoSided = value;\r\n }\r\n /** Optional color request flag */\r\n public needColors?: boolean;\r\n /** Default number of strokes for a circle. */\r\n public defaultCircleStrokes = 16;\r\n /** Ask if angleTol is specified */\r\n public get hasAngleTol(): boolean {\r\n return this.angleTol !== undefined && Math.abs(this.angleTol.radians) > 0.0;\r\n }\r\n /** Ask if chordTol is specified */\r\n public get hasChordTol(): boolean {\r\n return this.chordTol !== undefined && this.chordTol > 0.0;\r\n }\r\n /** Ask if maxEdgeLength is specified */\r\n public get hasMaxEdgeLength(): boolean {\r\n return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0;\r\n }\r\n /** Return a deep clone */\r\n public clone(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.chordTol = this.chordTol;\r\n options.angleTol = this.angleTol?.clone();\r\n options.maxEdgeLength = this.maxEdgeLength;\r\n options.needConvexFacets = this.needConvexFacets;\r\n options.minStrokesPerPrimitive = this.minStrokesPerPrimitive;\r\n options.shouldTriangulate = this.shouldTriangulate;\r\n options._needNormals = this._needNormals;\r\n options._needTwoSided = this._needTwoSided;\r\n options._needParams = this._needParams;\r\n options.needColors = this.needColors;\r\n options.defaultCircleStrokes = this.defaultCircleStrokes;\r\n return options;\r\n }\r\n /** Return stroke count which is the larger of the minCount or count needed for edge length condition. */\r\n public applyMaxEdgeLength(minCount: number, totalLength: number): number {\r\n totalLength = Math.abs(totalLength);\r\n if (this.maxEdgeLength && this.maxEdgeLength > 0.0 && minCount * this.maxEdgeLength < totalLength) {\r\n minCount = Geometry.stepCount(this.maxEdgeLength, totalLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Return stroke count which is the larger of the existing count or count needed for angle condition for given\r\n * sweepRadians.\r\n * * defaultStepRadians is assumed to be larger than zero.\r\n */\r\n public applyAngleTol(minCount: number, sweepRadians: number, defaultStepRadians: number): number {\r\n return StrokeOptions.applyAngleTol(this, minCount, sweepRadians, defaultStepRadians);\r\n }\r\n /**\r\n * Return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance\r\n * from the options.\r\n */\r\n public static applyAngleTol(\r\n options: StrokeOptions | undefined, minCount: number, sweepRadians: number, defaultStepRadians?: number\r\n ): number {\r\n sweepRadians = Math.abs(sweepRadians);\r\n let stepRadians = defaultStepRadians ? defaultStepRadians : Math.PI / 8.0;\r\n if (options && options.angleTol && options.angleTol.radians > 0.0)\r\n stepRadians = options.angleTol.radians;\r\n if (minCount * stepRadians < sweepRadians)\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n return minCount;\r\n }\r\n /**\r\n * Return the number of strokes needed for given edgeLength curve.\r\n * @param options\r\n * @param minCount smallest allowed count\r\n * @param edgeLength\r\n */\r\n public static applyMaxEdgeLength(\r\n options: StrokeOptions | undefined, minCount: number, edgeLength: number\r\n ): number {\r\n if (edgeLength < 0)\r\n edgeLength = - edgeLength;\r\n if (minCount < 1)\r\n minCount = 1;\r\n if (options && options.maxEdgeLength && options.maxEdgeLength * minCount < edgeLength) {\r\n minCount = Geometry.stepCount(options.maxEdgeLength, edgeLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength,\r\n * chord, and minimum stroke.\r\n */\r\n public applyTolerancesToArc(radius: number, sweepRadians: number = Math.PI * 2): number {\r\n let numStrokes = 1;\r\n numStrokes = this.applyAngleTol(numStrokes, sweepRadians, Math.PI * 0.25);\r\n numStrokes = this.applyMaxEdgeLength(numStrokes, sweepRadians * radius);\r\n numStrokes = this.applyChordTol(numStrokes, radius, sweepRadians);\r\n numStrokes = this.applyMinStrokesPerPrimitive(numStrokes);\r\n return numStrokes;\r\n }\r\n /** Return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */\r\n public applyChordTol(minCount: number, radius: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0 && this.chordTol < radius) {\r\n const a = this.chordTol;\r\n const stepRadians = 2.0 * Math.acos((1.0 - a / radius));\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Return stroke count which is the larger of existing count or count needed for circular arc chord tol with given\r\n * arc length and radians\r\n */\r\n public applyChordTolToLengthAndRadians(minCount: number, length: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0) {\r\n const radius = Geometry.conditionalDivideFraction(length, sweepRadians);\r\n if (radius !== undefined)\r\n return this.applyChordTol(minCount, radius, sweepRadians);\r\n }\r\n return minCount;\r\n }\r\n /** Return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */\r\n public applyMinStrokesPerPrimitive(minCount: number): number {\r\n if (this.minStrokesPerPrimitive !== undefined && Number.isFinite(this.minStrokesPerPrimitive)\r\n && this.minStrokesPerPrimitive > minCount)\r\n minCount = this.minStrokesPerPrimitive;\r\n return minCount;\r\n }\r\n /**\r\n * Create `StrokeOptions` with defaults appropriate for curves.\r\n * * angle tolerance of 15 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForCurves(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(15.0);\r\n return options;\r\n }\r\n /**\r\n * Create `StrokeOptions` with defaults appropriate for surfaces facets\r\n * * angle tolerance of 22.5 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForFacets(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(22.5);\r\n return options;\r\n }\r\n}\r\n"]}
@@ -19,9 +19,9 @@ import { StrokeOptions } from "./StrokeOptions";
19
19
  export declare class UnionRegion extends CurveCollection {
20
20
  /** String name for schema properties */
21
21
  readonly curveCollectionType = "unionRegion";
22
- /** test if `other` is a `UnionRegion` */
22
+ /** Test if `other` is a `UnionRegion` */
23
23
  isSameGeometryClass(other: GeometryQuery): boolean;
24
- /** collection of Loop and ParityRegion children. */
24
+ /** Collection of Loop and ParityRegion children. */
25
25
  protected _children: Array<ParityRegion | Loop>;
26
26
  /** Return the array of regions */
27
27
  get children(): Array<ParityRegion | Loop>;
@@ -29,15 +29,16 @@ export declare class UnionRegion extends CurveCollection {
29
29
  constructor();
30
30
  /** Create a `UnionRegion` with given region children */
31
31
  static create(...data: Array<ParityRegion | Loop>): UnionRegion;
32
- /** Return the boundary type (5) of a corresponding MicroStation CurveVector */
32
+ /** Return the boundary type (5) of a corresponding MicroStation CurveVector */
33
33
  dgnBoundaryType(): number;
34
- /** dispatch to more strongly typed `processor.announceUnionRegion(this, indexInParent)` */
34
+ /** Dispatch to more strongly typed `processor.announceUnionRegion(this, indexInParent)` */
35
35
  announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent?: number): void;
36
36
  /** Return structural clone with stroked primitives. */
37
37
  cloneStroked(options?: StrokeOptions): UnionRegion;
38
38
  /** Return new empty `UnionRegion` */
39
39
  cloneEmptyPeer(): UnionRegion;
40
- /** add a child.
40
+ /**
41
+ * Try to add a child.
41
42
  * * Returns false if the `AnyCurve` child is not a region type.
42
43
  */
43
44
  tryAddChild(child: AnyCurve): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"UnionRegion.d.ts","sourceRoot":"","sources":["../../../src/curve/UnionRegion.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC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AE,eAAe,GAAG,GAAG;CAGhE"}
@@ -16,10 +16,14 @@ const ParityRegion_1 = require("./ParityRegion");
16
16
  * @public
17
17
  */
18
18
  class UnionRegion extends CurveCollection_1.CurveCollection {
19
- /** test if `other` is a `UnionRegion` */
20
- isSameGeometryClass(other) { return other instanceof UnionRegion; }
19
+ /** Test if `other` is a `UnionRegion` */
20
+ isSameGeometryClass(other) {
21
+ return other instanceof UnionRegion;
22
+ }
21
23
  /** Return the array of regions */
22
- get children() { return this._children; }
24
+ get children() {
25
+ return this._children;
26
+ }
23
27
  /** Constructor -- initialize with no children */
24
28
  constructor() {
25
29
  super();
@@ -35,9 +39,11 @@ class UnionRegion extends CurveCollection_1.CurveCollection {
35
39
  }
36
40
  return result;
37
41
  }
38
- /** Return the boundary type (5) of a corresponding MicroStation CurveVector */
39
- dgnBoundaryType() { return 5; }
40
- /** dispatch to more strongly typed `processor.announceUnionRegion(this, indexInParent)` */
42
+ /** Return the boundary type (5) of a corresponding MicroStation CurveVector */
43
+ dgnBoundaryType() {
44
+ return 5;
45
+ }
46
+ /** Dispatch to more strongly typed `processor.announceUnionRegion(this, indexInParent)` */
41
47
  announceToCurveProcessor(processor, indexInParent = -1) {
42
48
  return processor.announceUnionRegion(this, indexInParent);
43
49
  }
@@ -53,8 +59,11 @@ class UnionRegion extends CurveCollection_1.CurveCollection {
53
59
  return clone;
54
60
  }
55
61
  /** Return new empty `UnionRegion` */
56
- cloneEmptyPeer() { return new UnionRegion(); }
57
- /** add a child.
62
+ cloneEmptyPeer() {
63
+ return new UnionRegion();
64
+ }
65
+ /**
66
+ * Try to add a child.
58
67
  * * Returns false if the `AnyCurve` child is not a region type.
59
68
  */
60
69
  tryAddChild(child) {
@@ -1 +1 @@
1
- {"version":3,"file":"UnionRegion.js","sourceRoot":"","sources":["../../../src/curve/UnionRegion.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,uDAAoD;AAGpD,iCAA8B;AAC9B,iDAA8C;AAG9C;;;;;;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AC;IAClE;;OAEG;IACI,WAAW,CAAC,KAAe;QAChC,IAAI,KAAK,IAAI,KAAK,YAAY,2BAAY,IAAI,KAAK,YAAY,WAAI,EAAE;YACnE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3B,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,0CAA0C;IACnC,QAAQ,CAAC,CAAS;QACvB,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM;YAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,8EAA8E;IACvE,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AA3DD,kCA2DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { AnyCurve } from \"./CurveChain\";\r\nimport { CurveCollection } from \"./CurveCollection\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { Loop } from \"./Loop\";\r\nimport { ParityRegion } from \"./ParityRegion\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * * A `UnionRegion` is a collection of other planar region types -- `Loop` and `ParityRegion`.\r\n * * The composite is the union of the contained regions.\r\n * * A point is \"in\" the composite if it is \"in\" one or more of the contained regions.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport class UnionRegion extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"unionRegion\";\r\n\r\n /** test if `other` is a `UnionRegion` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean { return other instanceof UnionRegion; }\r\n /** collection of Loop and ParityRegion children. */\r\n protected _children: Array<ParityRegion | Loop>;\r\n /** Return the array of regions */\r\n public override get children(): Array<ParityRegion | Loop> { return this._children; }\r\n /** Constructor -- initialize with no children */\r\n public constructor() { super(); this._children = []; }\r\n /** Create a `UnionRegion` with given region children */\r\n public static create(...data: Array<ParityRegion | Loop>): UnionRegion {\r\n const result = new UnionRegion();\r\n for (const child of data) {\r\n result.tryAddChild(child);\r\n }\r\n return result;\r\n }\r\n /** Return the boundary type (5) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number { return 5; }\r\n /** dispatch to more strongly typed `processor.announceUnionRegion(this, indexInParent)` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceUnionRegion(this, indexInParent);\r\n }\r\n /** Return structural clone with stroked primitives. */\r\n public cloneStroked(options?: StrokeOptions): UnionRegion {\r\n const clone = new UnionRegion();\r\n let child;\r\n for (child of this._children) {\r\n const childStrokes = child.cloneStroked(options) as ParityRegion | Loop;\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n return clone;\r\n }\r\n /** Return new empty `UnionRegion` */\r\n public cloneEmptyPeer(): UnionRegion { return new UnionRegion(); }\r\n /** add a child.\r\n * * Returns false if the `AnyCurve` child is not a region type.\r\n */\r\n public tryAddChild(child: AnyCurve): boolean {\r\n if (child && child instanceof ParityRegion || child instanceof Loop) {\r\n this._children.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child identified by index. */\r\n public getChild(i: number): Loop | ParityRegion | undefined {\r\n if (i < this._children.length)\r\n return this._children[i];\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleUnionRegion(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleUnionRegion(this);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ACd,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SACrC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,qCAAqC;IAC9B,cAAc;QACnB,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;IACD;;;OAGG;IACI,WAAW,CAAC,KAAe;QAChC,IAAI,KAAK,IAAI,KAAK,YAAY,2BAAY,IAAI,KAAK,YAAY,WAAI,EAAE;YACnE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3B,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,0CAA0C;IACnC,QAAQ,CAAC,CAAS;QACvB,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM;YAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,8EAA8E;IACvE,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AAtED,kCAsEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { AnyCurve } from \"./CurveChain\";\r\nimport { CurveCollection } from \"./CurveCollection\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { Loop } from \"./Loop\";\r\nimport { ParityRegion } from \"./ParityRegion\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * * A `UnionRegion` is a collection of other planar region types -- `Loop` and `ParityRegion`.\r\n * * The composite is the union of the contained regions.\r\n * * A point is \"in\" the composite if it is \"in\" one or more of the contained regions.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport class UnionRegion extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"unionRegion\";\r\n /** Test if `other` is a `UnionRegion` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof UnionRegion;\r\n }\r\n /** Collection of Loop and ParityRegion children. */\r\n protected _children: Array<ParityRegion | Loop>;\r\n /** Return the array of regions */\r\n public override get children(): Array<ParityRegion | Loop> {\r\n return this._children;\r\n }\r\n /** Constructor -- initialize with no children */\r\n public constructor() {\r\n super();\r\n this._children = [];\r\n }\r\n /** Create a `UnionRegion` with given region children */\r\n public static create(...data: Array<ParityRegion | Loop>): UnionRegion {\r\n const result = new UnionRegion();\r\n for (const child of data) {\r\n result.tryAddChild(child);\r\n }\r\n return result;\r\n }\r\n /** Return the boundary type (5) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 5;\r\n }\r\n /** Dispatch to more strongly typed `processor.announceUnionRegion(this, indexInParent)` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceUnionRegion(this, indexInParent);\r\n }\r\n /** Return structural clone with stroked primitives. */\r\n public cloneStroked(options?: StrokeOptions): UnionRegion {\r\n const clone = new UnionRegion();\r\n let child;\r\n for (child of this._children) {\r\n const childStrokes = child.cloneStroked(options) as ParityRegion | Loop;\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n return clone;\r\n }\r\n /** Return new empty `UnionRegion` */\r\n public cloneEmptyPeer(): UnionRegion {\r\n return new UnionRegion();\r\n }\r\n /**\r\n * Try to add a child.\r\n * * Returns false if the `AnyCurve` child is not a region type.\r\n */\r\n public tryAddChild(child: AnyCurve): boolean {\r\n if (child && child instanceof ParityRegion || child instanceof Loop) {\r\n this._children.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child identified by index. */\r\n public getChild(i: number): Loop | ParityRegion | undefined {\r\n if (i < this._children.length)\r\n return this._children[i];\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleUnionRegion(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleUnionRegion(this);\r\n }\r\n}\r\n"]}
@@ -4,7 +4,8 @@
4
4
  import { CurveCollection } from "../CurveCollection";
5
5
  import { CurvePrimitive } from "../CurvePrimitive";
6
6
  import { RecursiveCurveProcessorWithStack } from "../CurveProcessor";
7
- /** Algorithmic class: Accumulate maximum gap between adjacent primitives of CurveChain.
7
+ /**
8
+ * Algorithmic class: Accumulate maximum gap between adjacent primitives of CurveChain.
8
9
  * @internal
9
10
  */
10
11
  export declare class GapSearchContext extends RecursiveCurveProcessorWithStack {
@@ -1 +1 @@
1
- {"version":3,"file":"GapSearchContext.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/GapSearchContext.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAc,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAGrE;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,gCAAgC;IAC7D,MAAM,EAAE,MAAM,CAAC;;WAER,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM;IAKrC,sBAAsB,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI;CAY5F"}
1
+ {"version":3,"file":"GapSearchContext.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/GapSearchContext.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAc,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAGrE;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,gCAAgC;IAC7D,MAAM,EAAE,MAAM,CAAC;;WAKR,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM;IAKrC,sBAAsB,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI;CAY5F"}
@@ -11,11 +11,15 @@ exports.GapSearchContext = void 0;
11
11
  const CurveCollection_1 = require("../CurveCollection");
12
12
  const CurveProcessor_1 = require("../CurveProcessor");
13
13
  // import { SumLengthsContext, GapSearchContext, CountLinearPartsSearchContext, CloneCurvesContext, TransformInPlaceContext } from "./CurveSearches";
14
- /** Algorithmic class: Accumulate maximum gap between adjacent primitives of CurveChain.
14
+ /**
15
+ * Algorithmic class: Accumulate maximum gap between adjacent primitives of CurveChain.
15
16
  * @internal
16
17
  */
17
18
  class GapSearchContext extends CurveProcessor_1.RecursiveCurveProcessorWithStack {
18
- constructor() { super(); this.maxGap = 0.0; }
19
+ constructor() {
20
+ super();
21
+ this.maxGap = 0.0;
22
+ }
19
23
  static maxGap(target) {
20
24
  const context = new GapSearchContext();
21
25
  target.announceToCurveProcessor(context);
@@ -1 +1 @@
1
- {"version":3,"file":"GapSearchContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/GapSearchContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,wDAAiE;AAEjE,sDAAqE;AAErE,qJAAqJ;AACrJ;;GAEG;AACH,MAAa,gBAAiB,SAAQ,iDAAgC;IAEpE,gBAAgB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC;IACtC,MAAM,CAAC,MAAM,CAAC,MAAuB;QAC1C,MAAM,OAAO,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACvC,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC;IACe,sBAAsB,CAAC,KAAqB,EAAE,cAAsB;QAClF,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACnD,IAAI,MAAM,YAAY,4BAAU,EAAE;gBAChC,MAAM,KAAK,GAAG,MAAM,CAAC;gBACrB,MAAM,SAAS,GAAG,KAAK,CAAC,oBAAoB,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;gBACjE,IAAI,KAAK,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,EAAE;oBAClD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;iBACxF;aACF;SACF;IACH,CAAC;CACF;AApBD,4CAoBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { CurveChain, CurveCollection } from \"../CurveCollection\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { RecursiveCurveProcessorWithStack } from \"../CurveProcessor\";\r\n\r\n// import { SumLengthsContext, GapSearchContext, CountLinearPartsSearchContext, CloneCurvesContext, TransformInPlaceContext } from \"./CurveSearches\";\r\n/** Algorithmic class: Accumulate maximum gap between adjacent primitives of CurveChain.\r\n * @internal\r\n */\r\nexport class GapSearchContext extends RecursiveCurveProcessorWithStack {\r\n public maxGap: number;\r\n constructor() { super(); this.maxGap = 0.0; }\r\n public static maxGap(target: CurveCollection): number {\r\n const context = new GapSearchContext();\r\n target.announceToCurveProcessor(context);\r\n return context.maxGap;\r\n }\r\n public override announceCurvePrimitive(curve: CurvePrimitive, _indexInParent: number): void {\r\n if (this._stack.length > 0) {\r\n const parent = this._stack[this._stack.length - 1];\r\n if (parent instanceof CurveChain) {\r\n const chain = parent;\r\n const nextCurve = chain.cyclicCurvePrimitive(_indexInParent + 1);\r\n if (curve !== undefined && nextCurve !== undefined) {\r\n this.maxGap = Math.max(this.maxGap, curve.endPoint().distance(nextCurve.startPoint()));\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"GapSearchContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/GapSearchContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,wDAAiE;AAEjE,sDAAqE;AAErE,qJAAqJ;AACrJ;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,iDAAgC;IAEpE;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;IACpB,CAAC;IACM,MAAM,CAAC,MAAM,CAAC,MAAuB;QAC1C,MAAM,OAAO,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACvC,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC;IACe,sBAAsB,CAAC,KAAqB,EAAE,cAAsB;QAClF,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACnD,IAAI,MAAM,YAAY,4BAAU,EAAE;gBAChC,MAAM,KAAK,GAAG,MAAM,CAAC;gBACrB,MAAM,SAAS,GAAG,KAAK,CAAC,oBAAoB,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;gBACjE,IAAI,KAAK,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,EAAE;oBAClD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;iBACxF;aACF;SACF;IACH,CAAC;CACF;AAvBD,4CAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { CurveChain, CurveCollection } from \"../CurveCollection\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { RecursiveCurveProcessorWithStack } from \"../CurveProcessor\";\r\n\r\n// import { SumLengthsContext, GapSearchContext, CountLinearPartsSearchContext, CloneCurvesContext, TransformInPlaceContext } from \"./CurveSearches\";\r\n/**\r\n * Algorithmic class: Accumulate maximum gap between adjacent primitives of CurveChain.\r\n * @internal\r\n */\r\nexport class GapSearchContext extends RecursiveCurveProcessorWithStack {\r\n public maxGap: number;\r\n constructor() {\r\n super();\r\n this.maxGap = 0.0;\r\n }\r\n public static maxGap(target: CurveCollection): number {\r\n const context = new GapSearchContext();\r\n target.announceToCurveProcessor(context);\r\n return context.maxGap;\r\n }\r\n public override announceCurvePrimitive(curve: CurvePrimitive, _indexInParent: number): void {\r\n if (this._stack.length > 0) {\r\n const parent = this._stack[this._stack.length - 1];\r\n if (parent instanceof CurveChain) {\r\n const chain = parent;\r\n const nextCurve = chain.cyclicCurvePrimitive(_indexInParent + 1);\r\n if (curve !== undefined && nextCurve !== undefined) {\r\n this.maxGap = Math.max(this.maxGap, curve.endPoint().distance(nextCurve.startPoint()));\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -37,23 +37,29 @@ export declare class PlaneAltitudeRangeContext extends RecurseToCurvesGeometryHa
37
37
  private _workPoint?;
38
38
  handleArc3d(g: Arc3d): void;
39
39
  private static findExtremesInDirection;
40
- /** Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction,
41
- * and return points at min and max altitude, packed into a `LineSegment3d`.
40
+ /**
41
+ * Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction, and
42
+ * return points at min and max altitude, packed into a `LineSegment3d`.
42
43
  * @param geometry geometry to project
43
- * @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with zero origin.
44
+ * @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with
45
+ * zero origin.
44
46
  * @param lowHigh optional receiver for output
45
47
  */
46
48
  static findExtremePointsInDirection(geometry: GeometryQuery | GrowableXYZArray | Point3d[], direction: Vector3d | Ray3d, lowHigh?: LineSegment3d): LineSegment3d | undefined;
47
- /** Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction,
48
- * and return the min and max altitudes, packed into a Range1d.
49
+ /**
50
+ * Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction, and return
51
+ * the min and max altitudes, packed into a Range1d.
49
52
  * @param geometry geometry to project
50
- * @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with zero origin.
53
+ * @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with
54
+ * zero origin.
51
55
  * @param lowHigh optional receiver for output
52
56
  */
53
57
  static findExtremeAltitudesInDirection(geometry: GeometryQuery | GrowableXYZArray | Point3d[], direction: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined;
54
- /** Project geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.
58
+ /**
59
+ * Project geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.
55
60
  * @param geometry geometry to project
56
- * @param direction vector or ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.
61
+ * @param direction vector or ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with
62
+ * zero origin.
57
63
  * @param lowHigh optional receiver for output
58
64
  */
59
65
  static findExtremeFractionsAlongDirection(geometry: GeometryQuery | GrowableXYZArray | Point3d[], direction: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"PlaneAltitudeRangeContext.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PlaneAltitudeRangeContext.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAY,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C;;;GAGG;AACH,qBAAa,yBAA0B,SAAQ,8BAA8B;IACpE,KAAK,EAAE,sBAAsB,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,OAAO;IAOA,UAAU;IAIV,aAAa,CAAC,KAAK,EAAE,OAAO;IAQ5B,cAAc,CAAC,MAAM,EAAE,g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,uBAAuB;IAoBtC;;;;;;;MAOE;WACY,4BAA4B,CACxC,QAAQ,EAAE,aAAa,GAAG,gBAAgB,GAAG,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE,aAAa,GAC3G,aAAa,GAAG,SAAS;IAO5B;;;;;;;MAOE;WACY,+BAA+B,CAC3C,QAAQ,EAAE,aAAa,GAAG,gBAAgB,GAAG,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,GACrG,OAAO,GAAG,SAAS;IAOtB;;;;;;OAMG;WACW,kCAAkC,CAC9C,QAAQ,EAAE,aAAa,GAAG,gBAAgB,GAAG,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,GACrG,OAAO,GAAG,SAAS;CAavB"}
@@ -110,10 +110,12 @@ class PlaneAltitudeRangeContext extends GeometryHandler_1.RecurseToCurvesGeometr
110
110
  }
111
111
  return undefined;
112
112
  }
113
- /** Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction,
114
- * and return points at min and max altitude, packed into a `LineSegment3d`.
113
+ /**
114
+ * Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction, and
115
+ * return points at min and max altitude, packed into a `LineSegment3d`.
115
116
  * @param geometry geometry to project
116
- * @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with zero origin.
117
+ * @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with
118
+ * zero origin.
117
119
  * @param lowHigh optional receiver for output
118
120
  */
119
121
  static findExtremePointsInDirection(geometry, direction, lowHigh) {
@@ -122,10 +124,12 @@ class PlaneAltitudeRangeContext extends GeometryHandler_1.RecurseToCurvesGeometr
122
124
  return LineSegment3d_1.LineSegment3d.create(context.lowPoint, context.highPoint, lowHigh);
123
125
  return undefined;
124
126
  }
125
- /** Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction,
126
- * and return the min and max altitudes, packed into a Range1d.
127
+ /**
128
+ * Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction, and return
129
+ * the min and max altitudes, packed into a Range1d.
127
130
  * @param geometry geometry to project
128
- * @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with zero origin.
131
+ * @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with
132
+ * zero origin.
129
133
  * @param lowHigh optional receiver for output
130
134
  */
131
135
  static findExtremeAltitudesInDirection(geometry, direction, lowHigh) {
@@ -134,9 +138,11 @@ class PlaneAltitudeRangeContext extends GeometryHandler_1.RecurseToCurvesGeometr
134
138
  return Range_1.Range1d.createFrom(context.range, lowHigh);
135
139
  return undefined;
136
140
  }
137
- /** Project geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.
141
+ /**
142
+ * Project geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.
138
143
  * @param geometry geometry to project
139
- * @param direction vector or ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.
144
+ * @param direction vector or ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with
145
+ * zero origin.
140
146
  * @param lowHigh optional receiver for output
141
147
  */
142
148
  static findExtremeFractionsAlongDirection(geometry, direction, lowHigh) {
@@ -1 +1 @@
1
- {"version":3,"file":"PlaneAltitudeRangeContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PlaneAltitudeRangeContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,6CAAkE;AAClE,kDAA+C;AAC/C,sEAAkF;AAClF,wEAAqE;AACrE,gGAA6F;AAC7F,sEAAqE;AACrE,kDAAiD;AACjD,kDAA+C;AAG/C,oDAAiD;AACjD,oDAAiD;AACjD,kDAA+C;AAC/C,oDAAiD;AAEjD;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,gDAA8B;IAK3E,YAAoB,KAA6B;QAC/C,KAAK,EAAE,CAA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AAK,GAAG,IAAI,CAAC,+BAA+B,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACjF,IAAI,SAAS,KAAK,KAAK,EAAE;YACvB,MAAM,GAAG,GAAG,CAAC,SAAS,YAAY,0BAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;YACtG,MAAM,eAAe,GAAG,mBAAQ,CAAC,2BAA2B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YACvE,IAAI,SAAS,KAAK,eAAe,EAAE;gBACjC,KAAK,CAAC,GAAG,IAAI,eAAe,CAAC;gBAC7B,KAAK,CAAC,IAAI,IAAI,eAAe,CAAC;gBAC9B,OAAO,KAAK,CAAC;aACd;SACF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAjJD,8DAiJC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { BSplineCurve3d } from \"../../bspline/BSplineCurve\";\r\nimport { BSplineCurve3dH } from \"../../bspline/BSplineCurve3dH\";\r\nimport { Geometry, PlaneAltitudeEvaluator } from \"../../Geometry\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { RecurseToCurvesGeometryHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../../geometry3d/GrowableXYZArray\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Range1d } from \"../../geometry3d/Range\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { SineCosinePolynomial } from \"../../numerics/Polynomials\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { GeometryQuery } from \"../GeometryQuery\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\n\r\n/**\r\n * Accumulator context for searching for extrema of geometry along a plane.\r\n * @internal\r\n */\r\nexport class PlaneAltitudeRangeContext extends RecurseToCurvesGeometryHandler {\r\n public plane: PlaneAltitudeEvaluator;\r\n public range: Range1d;\r\n public lowPoint: Point3d | undefined;\r\n public highPoint: Point3d | undefined;\r\n private constructor(plane: PlaneAltitudeEvaluator) {\r\n super();\r\n this.plane = plane;\r\n this.range = Range1d.createNull();\r\n this.resetRange();\r\n }\r\n\r\n public resetRange() {\r\n this.range.setNull();\r\n }\r\n\r\n public announcePoint(point: Point3d) {\r\n const h = this.plane.altitude(point);\r\n if (this.range.extendLow(h))\r\n this.lowPoint = point.clone(this.lowPoint);\r\n if (this.range.extendHigh(h))\r\n this.highPoint = point.clone(this.highPoint);\r\n }\r\n\r\n public announcePoints(points: GrowableXYZArray) {\r\n for (let i = 0; i < points.length; i++) {\r\n const h = points.evaluateUncheckedIndexPlaneAltitude(i, this.plane);\r\n if (this.range.extendLow(h))\r\n this.lowPoint = points.getPoint3dAtUncheckedPointIndex(i, this.lowPoint);\r\n if (this.range.extendHigh(h))\r\n this.highPoint = points.getPoint3dAtUncheckedPointIndex(i, this.highPoint);\r\n }\r\n }\r\n\r\n public static createCapture(plane: PlaneAltitudeEvaluator): PlaneAltitudeRangeContext {\r\n const context = new PlaneAltitudeRangeContext(plane);\r\n return context;\r\n }\r\n\r\n public override handleLineSegment3d(segment: LineSegment3d) {\r\n this.announcePoint(segment.point0Ref);\r\n this.announcePoint(segment.point1Ref);\r\n }\r\n\r\n public override handleLineString3d(lineString: LineString3d) {\r\n this.announcePoints(lineString.packedPoints);\r\n }\r\n\r\n private _strokeOptions?: StrokeOptions;\r\n private initStrokeOptions() {\r\n // TODO: compute the exact extrema; until then stroke aggressively\r\n if (undefined === this._strokeOptions) {\r\n this._strokeOptions = new StrokeOptions();\r\n this._strokeOptions.angleTol = Angle.createDegrees(1);\r\n }\r\n }\r\n public override handleBSplineCurve3d(bcurve: BSplineCurve3d) {\r\n // ugh. The point MUST be on the curve -- usual excess-range of poles is not ok.\r\n this.initStrokeOptions();\r\n const ls = LineString3d.create();\r\n bcurve.emitStrokes(ls, this._strokeOptions);\r\n this.handleLineString3d(ls);\r\n }\r\n public override handleBSplineCurve3dH(bcurve: BSplineCurve3dH) {\r\n // ugh. The point MUST be on the curve -- usual excess-range of poles is not ok.\r\n this.initStrokeOptions();\r\n const ls = LineString3d.create();\r\n bcurve.emitStrokes(ls, this._strokeOptions);\r\n this.handleLineString3d(ls);\r\n }\r\n\r\n private _sineCosinePolynomial?: SineCosinePolynomial;\r\n private _workPoint?: Point3d;\r\n public override handleArc3d(g: Arc3d) {\r\n this._sineCosinePolynomial = g.getPlaneAltitudeSineCosinePolynomial(this.plane, this._sineCosinePolynomial);\r\n let radians = this._sineCosinePolynomial.referenceMinMaxRadians();\r\n if (g.sweep.isRadiansInSweep(radians))\r\n this.announcePoint((this._workPoint = g.radiansToPoint(radians, this._workPoint)));\r\n radians += Math.PI;\r\n if (g.sweep.isRadiansInSweep(radians))\r\n this.announcePoint((this._workPoint = g.radiansToPoint(radians, this._workPoint)));\r\n this.announcePoint((this._workPoint = g.startPoint(this._workPoint)));\r\n this.announcePoint((this._workPoint = g.endPoint(this._workPoint)));\r\n }\r\n\r\n private static findExtremesInDirection(geometry: GeometryQuery | GrowableXYZArray | Point3d[], direction: Vector3d | Ray3d): PlaneAltitudeRangeContext | undefined {\r\n const origin = direction instanceof Ray3d ? direction.origin : Point3d.createZero();\r\n const vector = direction instanceof Ray3d ? direction.direction : direction;\r\n const plane = Plane3dByOriginAndUnitNormal.create(origin, vector); // vector is normalized, so altitudes are distances\r\n if (plane) {\r\n const context = new PlaneAltitudeRangeContext(plane);\r\n if (geometry instanceof GeometryQuery) {\r\n geometry.dispatchToGeometryHandler(context);\r\n } else if (geometry instanceof GrowableXYZArray) {\r\n context.announcePoints(geometry);\r\n } else {\r\n for (const pt of geometry)\r\n context.announcePoint(pt);\r\n }\r\n return context;\r\n }\r\n return undefined;\r\n }\r\n /** Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction,\r\n * and return points at min and max altitude, packed into a `LineSegment3d`.\r\n * @param geometry geometry to project\r\n * @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n */\r\n public static findExtremePointsInDirection(geometry: GeometryQuery | GrowableXYZArray | Point3d[], direction: Vector3d | Ray3d, lowHigh?: LineSegment3d): LineSegment3d | undefined {\r\n const context = this.findExtremesInDirection(geometry, direction);\r\n if (context && context.highPoint && context.lowPoint)\r\n return LineSegment3d.create(context.lowPoint, context.highPoint, lowHigh);\r\n return undefined;\r\n }\r\n /** Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction,\r\n * and return the min and max altitudes, packed into a Range1d.\r\n * @param geometry geometry to project\r\n * @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n */\r\n public static findExtremeAltitudesInDirection(geometry: GeometryQuery | GrowableXYZArray | Point3d[], direction: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n const context = this.findExtremesInDirection(geometry, direction);\r\n if (context && !context.range.isNull)\r\n return Range1d.createFrom(context.range, lowHigh);\r\n return undefined;\r\n }\r\n /** Project geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.\r\n * @param geometry geometry to project\r\n * @param direction vector or ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n */\r\n public static findExtremeFractionsAlongDirection(geometry: GeometryQuery | GrowableXYZArray | Point3d[], direction: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n const range = this.findExtremeAltitudesInDirection(geometry, direction, lowHigh);\r\n if (undefined !== range) {\r\n const mag = (direction instanceof Vector3d) ? direction.magnitude() : direction.direction.magnitude();\r\n const scaleToFraction = Geometry.conditionalDivideCoordinate(1.0, mag);\r\n if (undefined !== scaleToFraction) {\r\n range.low *= scaleToFraction;\r\n range.high *= scaleToFraction;\r\n return range;\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PlaneAltitudeRangeContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PlaneAltitudeRangeContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,6CAAkE;AAClE,kDAA+C;AAC/C,sEAAkF;AAClF,wEAAqE;AACrE,gGAA6F;AAC7F,sEAAqE;AACrE,kDAAiD;AACjD,kDAA+C;AAG/C,oDAAiD;AACjD,oDAAiD;AACjD,kDAA+C;AAC/C,oDAAiD;AAEjD;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,gDAA8B;IAK3E,YAAoB,KAA6B;QAC/C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,eAAO,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAEM,UAAU;QACf,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;IAEM,aAAa,CAAC,KAAc;QACjC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;YACzB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7C,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;YAC1B,IAAI,CAA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AC;IACnB,CAAC;CACF;AAtKD,8DAsKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { BSplineCurve3d } from \"../../bspline/BSplineCurve\";\r\nimport { BSplineCurve3dH } from \"../../bspline/BSplineCurve3dH\";\r\nimport { Geometry, PlaneAltitudeEvaluator } from \"../../Geometry\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { RecurseToCurvesGeometryHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../../geometry3d/GrowableXYZArray\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Range1d } from \"../../geometry3d/Range\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { SineCosinePolynomial } from \"../../numerics/Polynomials\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { GeometryQuery } from \"../GeometryQuery\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\n\r\n/**\r\n * Accumulator context for searching for extrema of geometry along a plane.\r\n * @internal\r\n */\r\nexport class PlaneAltitudeRangeContext extends RecurseToCurvesGeometryHandler {\r\n public plane: PlaneAltitudeEvaluator;\r\n public range: Range1d;\r\n public lowPoint: Point3d | undefined;\r\n public highPoint: Point3d | undefined;\r\n private constructor(plane: PlaneAltitudeEvaluator) {\r\n super();\r\n this.plane = plane;\r\n this.range = Range1d.createNull();\r\n this.resetRange();\r\n }\r\n\r\n public resetRange() {\r\n this.range.setNull();\r\n }\r\n\r\n public announcePoint(point: Point3d) {\r\n const h = this.plane.altitude(point);\r\n if (this.range.extendLow(h))\r\n this.lowPoint = point.clone(this.lowPoint);\r\n if (this.range.extendHigh(h))\r\n this.highPoint = point.clone(this.highPoint);\r\n }\r\n\r\n public announcePoints(points: GrowableXYZArray) {\r\n for (let i = 0; i < points.length; i++) {\r\n const h = points.evaluateUncheckedIndexPlaneAltitude(i, this.plane);\r\n if (this.range.extendLow(h))\r\n this.lowPoint = points.getPoint3dAtUncheckedPointIndex(i, this.lowPoint);\r\n if (this.range.extendHigh(h))\r\n this.highPoint = points.getPoint3dAtUncheckedPointIndex(i, this.highPoint);\r\n }\r\n }\r\n\r\n public static createCapture(plane: PlaneAltitudeEvaluator): PlaneAltitudeRangeContext {\r\n const context = new PlaneAltitudeRangeContext(plane);\r\n return context;\r\n }\r\n\r\n public override handleLineSegment3d(segment: LineSegment3d) {\r\n this.announcePoint(segment.point0Ref);\r\n this.announcePoint(segment.point1Ref);\r\n }\r\n\r\n public override handleLineString3d(lineString: LineString3d) {\r\n this.announcePoints(lineString.packedPoints);\r\n }\r\n\r\n private _strokeOptions?: StrokeOptions;\r\n\r\n private initStrokeOptions() {\r\n // TODO: compute the exact extrema; until then stroke aggressively\r\n if (undefined === this._strokeOptions) {\r\n this._strokeOptions = new StrokeOptions();\r\n this._strokeOptions.angleTol = Angle.createDegrees(1);\r\n }\r\n }\r\n\r\n public override handleBSplineCurve3d(bcurve: BSplineCurve3d) {\r\n // ugh. The point MUST be on the curve -- usual excess-range of poles is not ok.\r\n this.initStrokeOptions();\r\n const ls = LineString3d.create();\r\n bcurve.emitStrokes(ls, this._strokeOptions);\r\n this.handleLineString3d(ls);\r\n }\r\n\r\n public override handleBSplineCurve3dH(bcurve: BSplineCurve3dH) {\r\n // ugh. The point MUST be on the curve -- usual excess-range of poles is not ok.\r\n this.initStrokeOptions();\r\n const ls = LineString3d.create();\r\n bcurve.emitStrokes(ls, this._strokeOptions);\r\n this.handleLineString3d(ls);\r\n }\r\n\r\n private _sineCosinePolynomial?: SineCosinePolynomial;\r\n\r\n private _workPoint?: Point3d;\r\n\r\n public override handleArc3d(g: Arc3d) {\r\n this._sineCosinePolynomial = g.getPlaneAltitudeSineCosinePolynomial(this.plane, this._sineCosinePolynomial);\r\n let radians = this._sineCosinePolynomial.referenceMinMaxRadians();\r\n if (g.sweep.isRadiansInSweep(radians))\r\n this.announcePoint((this._workPoint = g.radiansToPoint(radians, this._workPoint)));\r\n radians += Math.PI;\r\n if (g.sweep.isRadiansInSweep(radians))\r\n this.announcePoint((this._workPoint = g.radiansToPoint(radians, this._workPoint)));\r\n this.announcePoint((this._workPoint = g.startPoint(this._workPoint)));\r\n this.announcePoint((this._workPoint = g.endPoint(this._workPoint)));\r\n }\r\n\r\n private static findExtremesInDirection(\r\n geometry: GeometryQuery | GrowableXYZArray | Point3d[], direction: Vector3d | Ray3d\r\n ): PlaneAltitudeRangeContext | undefined {\r\n const origin = direction instanceof Ray3d ? direction.origin : Point3d.createZero();\r\n const vector = direction instanceof Ray3d ? direction.direction : direction;\r\n const plane = Plane3dByOriginAndUnitNormal.create(origin, vector); // vector is normalized, so altitudes are distances\r\n if (plane) {\r\n const context = new PlaneAltitudeRangeContext(plane);\r\n if (geometry instanceof GeometryQuery) {\r\n geometry.dispatchToGeometryHandler(context);\r\n } else if (geometry instanceof GrowableXYZArray) {\r\n context.announcePoints(geometry);\r\n } else {\r\n for (const pt of geometry)\r\n context.announcePoint(pt);\r\n }\r\n return context;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction, and\r\n * return points at min and max altitude, packed into a `LineSegment3d`.\r\n * @param geometry geometry to project\r\n * @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with\r\n * zero origin.\r\n * @param lowHigh optional receiver for output\r\n */\r\n public static findExtremePointsInDirection(\r\n geometry: GeometryQuery | GrowableXYZArray | Point3d[], direction: Vector3d | Ray3d, lowHigh?: LineSegment3d\r\n ): LineSegment3d | undefined {\r\n const context = this.findExtremesInDirection(geometry, direction);\r\n if (context && context.highPoint && context.lowPoint)\r\n return LineSegment3d.create(context.lowPoint, context.highPoint, lowHigh);\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction, and return\r\n * the min and max altitudes, packed into a Range1d.\r\n * @param geometry geometry to project\r\n * @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with\r\n * zero origin.\r\n * @param lowHigh optional receiver for output\r\n */\r\n public static findExtremeAltitudesInDirection(\r\n geometry: GeometryQuery | GrowableXYZArray | Point3d[], direction: Vector3d | Ray3d, lowHigh?: Range1d\r\n ): Range1d | undefined {\r\n const context = this.findExtremesInDirection(geometry, direction);\r\n if (context && !context.range.isNull)\r\n return Range1d.createFrom(context.range, lowHigh);\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Project geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.\r\n * @param geometry geometry to project\r\n * @param direction vector or ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with\r\n * zero origin.\r\n * @param lowHigh optional receiver for output\r\n */\r\n public static findExtremeFractionsAlongDirection(\r\n geometry: GeometryQuery | GrowableXYZArray | Point3d[], direction: Vector3d | Ray3d, lowHigh?: Range1d\r\n ): Range1d | undefined {\r\n const range = this.findExtremeAltitudesInDirection(geometry, direction, lowHigh);\r\n if (undefined !== range) {\r\n const mag = (direction instanceof Vector3d) ? direction.magnitude() : direction.direction.magnitude();\r\n const scaleToFraction = Geometry.conditionalDivideCoordinate(1.0, mag);\r\n if (undefined !== scaleToFraction) {\r\n range.low *= scaleToFraction;\r\n range.high *= scaleToFraction;\r\n return range;\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}