@itwin/core-geometry 3.1.0-dev.7 → 3.2.0-dev.1

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 (176) hide show
  1. package/CHANGELOG.md +43 -3
  2. package/lib/cjs/bspline/BSplineCurve.d.ts +8 -0
  3. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  4. package/lib/cjs/bspline/BSplineCurve.js +14 -0
  5. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  6. package/lib/cjs/bspline/BezierCurveBase.d.ts +8 -0
  7. package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
  8. package/lib/cjs/bspline/BezierCurveBase.js +16 -1
  9. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  10. package/lib/cjs/curve/Arc3d.d.ts +6 -0
  11. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  12. package/lib/cjs/curve/Arc3d.js +31 -0
  13. package/lib/cjs/curve/Arc3d.js.map +1 -1
  14. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +8 -1
  15. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  16. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +22 -2
  17. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  18. package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +1 -1
  19. package/lib/cjs/curve/CurveCurveIntersectXY.js +3 -1
  20. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
  21. package/lib/cjs/curve/CurveFactory.d.ts +7 -3
  22. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  23. package/lib/cjs/curve/CurveFactory.js +30 -15
  24. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  25. package/lib/cjs/curve/CurvePrimitive.d.ts +23 -9
  26. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  27. package/lib/cjs/curve/CurvePrimitive.js +18 -0
  28. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  29. package/lib/cjs/curve/LineSegment3d.d.ts +6 -0
  30. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  31. package/lib/cjs/curve/LineSegment3d.js +14 -0
  32. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  33. package/lib/cjs/curve/LineString3d.d.ts +7 -0
  34. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  35. package/lib/cjs/curve/LineString3d.js +20 -0
  36. package/lib/cjs/curve/LineString3d.js.map +1 -1
  37. package/lib/cjs/curve/ProxyCurve.d.ts +6 -2
  38. package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
  39. package/lib/cjs/curve/ProxyCurve.js +5 -0
  40. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  41. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +11 -0
  42. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  43. package/lib/cjs/curve/Query/PlanarSubdivision.js +26 -17
  44. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  45. package/lib/cjs/curve/RegionOps.d.ts +15 -16
  46. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  47. package/lib/cjs/curve/RegionOps.js +14 -16
  48. package/lib/cjs/curve/RegionOps.js.map +1 -1
  49. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  50. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +3 -1
  51. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  52. package/lib/cjs/curve/StrokeOptions.d.ts +6 -0
  53. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  54. package/lib/cjs/curve/StrokeOptions.js +20 -0
  55. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  56. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.d.ts +36 -0
  57. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.d.ts.map +1 -0
  58. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js +73 -0
  59. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -0
  60. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +48 -24
  61. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  62. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +113 -112
  63. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  64. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  65. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +33 -7
  66. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  67. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +8 -0
  68. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  69. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +14 -0
  70. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  71. package/lib/cjs/geometry3d/Matrix3d.d.ts +4 -4
  72. package/lib/cjs/geometry3d/Matrix3d.js +4 -4
  73. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  74. package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
  75. package/lib/cjs/geometry4d/Matrix4d.js +21 -8
  76. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  77. package/lib/cjs/numerics/ClusterableArray.d.ts +1 -1
  78. package/lib/cjs/numerics/ClusterableArray.d.ts.map +1 -1
  79. package/lib/cjs/numerics/ClusterableArray.js +2 -2
  80. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  81. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +15 -1
  82. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  83. package/lib/cjs/polyface/PolyfaceBuilder.js +17 -11
  84. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  85. package/lib/cjs/topology/Merging.d.ts +22 -3
  86. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  87. package/lib/cjs/topology/Merging.js +97 -1
  88. package/lib/cjs/topology/Merging.js.map +1 -1
  89. package/lib/esm/bspline/BSplineCurve.d.ts +8 -0
  90. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  91. package/lib/esm/bspline/BSplineCurve.js +14 -0
  92. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  93. package/lib/esm/bspline/BezierCurveBase.d.ts +8 -0
  94. package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
  95. package/lib/esm/bspline/BezierCurveBase.js +16 -1
  96. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  97. package/lib/esm/curve/Arc3d.d.ts +6 -0
  98. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  99. package/lib/esm/curve/Arc3d.js +31 -0
  100. package/lib/esm/curve/Arc3d.js.map +1 -1
  101. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +8 -1
  102. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  103. package/lib/esm/curve/CurveChainWithDistanceIndex.js +22 -2
  104. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  105. package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +1 -1
  106. package/lib/esm/curve/CurveCurveIntersectXY.js +3 -1
  107. package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
  108. package/lib/esm/curve/CurveFactory.d.ts +7 -3
  109. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  110. package/lib/esm/curve/CurveFactory.js +30 -15
  111. package/lib/esm/curve/CurveFactory.js.map +1 -1
  112. package/lib/esm/curve/CurvePrimitive.d.ts +23 -9
  113. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  114. package/lib/esm/curve/CurvePrimitive.js +18 -0
  115. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  116. package/lib/esm/curve/LineSegment3d.d.ts +6 -0
  117. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  118. package/lib/esm/curve/LineSegment3d.js +15 -1
  119. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  120. package/lib/esm/curve/LineString3d.d.ts +7 -0
  121. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  122. package/lib/esm/curve/LineString3d.js +20 -0
  123. package/lib/esm/curve/LineString3d.js.map +1 -1
  124. package/lib/esm/curve/ProxyCurve.d.ts +6 -2
  125. package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
  126. package/lib/esm/curve/ProxyCurve.js +5 -0
  127. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  128. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +11 -0
  129. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  130. package/lib/esm/curve/Query/PlanarSubdivision.js +26 -17
  131. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  132. package/lib/esm/curve/RegionOps.d.ts +15 -16
  133. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  134. package/lib/esm/curve/RegionOps.js +15 -17
  135. package/lib/esm/curve/RegionOps.js.map +1 -1
  136. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  137. package/lib/esm/curve/RegionOpsClassificationSweeps.js +3 -1
  138. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  139. package/lib/esm/curve/StrokeOptions.d.ts +6 -0
  140. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  141. package/lib/esm/curve/StrokeOptions.js +20 -0
  142. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  143. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.d.ts +36 -0
  144. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.d.ts.map +1 -0
  145. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js +69 -0
  146. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -0
  147. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +48 -24
  148. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  149. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +111 -111
  150. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  151. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  152. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +33 -7
  153. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  154. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +8 -0
  155. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  156. package/lib/esm/curve/spiral/TransitionSpiral3d.js +14 -0
  157. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  158. package/lib/esm/geometry3d/Matrix3d.d.ts +4 -4
  159. package/lib/esm/geometry3d/Matrix3d.js +4 -4
  160. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  161. package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
  162. package/lib/esm/geometry4d/Matrix4d.js +21 -8
  163. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  164. package/lib/esm/numerics/ClusterableArray.d.ts +1 -1
  165. package/lib/esm/numerics/ClusterableArray.d.ts.map +1 -1
  166. package/lib/esm/numerics/ClusterableArray.js +2 -2
  167. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  168. package/lib/esm/polyface/PolyfaceBuilder.d.ts +15 -1
  169. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  170. package/lib/esm/polyface/PolyfaceBuilder.js +17 -11
  171. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  172. package/lib/esm/topology/Merging.d.ts +22 -3
  173. package/lib/esm/topology/Merging.d.ts.map +1 -1
  174. package/lib/esm/topology/Merging.js +95 -0
  175. package/lib/esm/topology/Merging.js.map +1 -1
  176. package/package.json +7 -5
@@ -45,8 +45,28 @@ export class StrokeOptions {
45
45
  /** Whether twoSided is requested. */
46
46
  get needTwoSided() { return this._needTwoSided !== undefined ? this._needTwoSided : false; }
47
47
  set needTwoSided(value) { this._needTwoSided = value; }
48
+ /** ask if angleTol is specified */
49
+ get hasAngleTol() { return this.angleTol !== undefined && Math.abs(this.angleTol.radians) > 0.0; }
50
+ /** ask if chordTol is specified */
51
+ get hasChordTol() { return this.chordTol !== undefined && this.chordTol > 0.0; }
48
52
  /** ask if maxEdgeLength is specified */
49
53
  get hasMaxEdgeLength() { return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0; }
54
+ /** Return a deep clone */
55
+ clone() {
56
+ const options = new StrokeOptions();
57
+ options.chordTol = this.chordTol;
58
+ options.angleTol = this.angleTol;
59
+ options.maxEdgeLength = this.maxEdgeLength;
60
+ options.needConvexFacets = this.needConvexFacets;
61
+ options.minStrokesPerPrimitive = this.minStrokesPerPrimitive;
62
+ options.shouldTriangulate = this.shouldTriangulate;
63
+ options._needNormals = this._needNormals;
64
+ options._needTwoSided = this._needTwoSided;
65
+ options._needParams = this._needParams;
66
+ options.needColors = this.needColors;
67
+ options.defaultCircleStrokes = this.defaultCircleStrokes;
68
+ return options;
69
+ }
50
70
  /** return stroke count which is the larger of the minCount or count needed for edge length condition. */
51
71
  applyMaxEdgeLength(minCount, totalLength) {
52
72
  totalLength = Math.abs(totalLength);
@@ -1 +1 @@
1
- {"version":3,"file":"StrokeOptions.js","sourceRoot":"","sources":["../../../src/curve/StrokeOptions.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,mEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,aAAa;IAA1B;QAYE,qDAAqD;QAC9C,sBAAiB,GAAY,KAAK,CAAC;Q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AK,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,KAAK,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,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","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 maxEdgeLength is specified */\r\n public get hasMaxEdgeLength(): boolean { return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0; }\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/StrokeOptions.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,mEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,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,GA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Q,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","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;\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"]}
@@ -0,0 +1,36 @@
1
+ /** @packageDocumentation
2
+ * @module Curve
3
+ */
4
+ import { Point3d, Vector3d } from "../../geometry3d/Point3dVector3d";
5
+ import { CurvePrimitive } from "../CurvePrimitive";
6
+ import { IStrokeHandler } from "../../geometry3d/GeometryHandler";
7
+ import { BSplineCurve3d } from "../../bspline/BSplineCurve";
8
+ /**
9
+ * Context for constructing the xy-offset of a CurvePrimitive by interpolating the xy-offsets of computed strokes.
10
+ * @internal
11
+ */
12
+ export declare class CurveOffsetXYHandler implements IStrokeHandler {
13
+ private _offsetDistance;
14
+ private _fitOptions;
15
+ private _p0;
16
+ private _p1;
17
+ private _v0;
18
+ private _v1;
19
+ private _r0;
20
+ constructor(cp: CurvePrimitive, offsetDistance: number);
21
+ private pushOffsetPoint;
22
+ needPrimaryGeometryForStrokes(): boolean;
23
+ startParentCurvePrimitive(_cp: CurvePrimitive): void;
24
+ startCurvePrimitive(_cp: CurvePrimitive): void;
25
+ endCurvePrimitive(_cp: CurvePrimitive): void;
26
+ endParentCurvePrimitive(_cp: CurvePrimitive): void;
27
+ announceIntervalForUniformStepStrokes(cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number): void;
28
+ announceSegmentInterval(_cp: CurvePrimitive, point0: Point3d, point1: Point3d, numStrokes: number, _fraction0: number, _fraction1: number): void;
29
+ announcePointTangent(xyz: Point3d, _fraction: number, tangent: Vector3d): void;
30
+ /**
31
+ * Construct a C2 cubic interpolating B-spline curve through the collected xy-offset points.
32
+ * @returns the xy-offset curve
33
+ */
34
+ claimResult(): BSplineCurve3d | undefined;
35
+ }
36
+ //# sourceMappingURL=CurveOffsetXYHand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MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI;IAGrF;;;OAGG;IACI,WAAW,IAAI,cAAc,GAAG,SAAS;CAGjD"}
@@ -0,0 +1,69 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Curve
7
+ */
8
+ import { Geometry } from "../../Geometry";
9
+ import { Point3d, Vector3d } from "../../geometry3d/Point3dVector3d";
10
+ import { Ray3d } from "../../geometry3d/Ray3d";
11
+ import { InterpolationCurve3dOptions } from "../../bspline/InterpolationCurve3d";
12
+ import { BSplineCurveOps } from "../../bspline/BSplineCurveOps";
13
+ /**
14
+ * Context for constructing the xy-offset of a CurvePrimitive by interpolating the xy-offsets of computed strokes.
15
+ * @internal
16
+ */
17
+ export class CurveOffsetXYHandler {
18
+ constructor(cp, offsetDistance) {
19
+ // temporary workspace
20
+ this._p0 = Point3d.createZero();
21
+ this._p1 = Point3d.createZero();
22
+ this._v0 = Vector3d.createZero();
23
+ this._v1 = Vector3d.createZero();
24
+ this._r0 = Ray3d.createZero();
25
+ this._offsetDistance = offsetDistance;
26
+ this._fitOptions = new InterpolationCurve3dOptions();
27
+ const startTangent = cp.fractionToPointAndUnitTangent(0.0, this._r0).direction.clone();
28
+ const endTangent = cp.fractionToPointAndUnitTangent(1.0, this._r0).direction.negate(); // points into curve
29
+ this._fitOptions.startTangent = startTangent;
30
+ this._fitOptions.endTangent = endTangent;
31
+ if (this._fitOptions.closed = (cp.startPoint(this._p0).isAlmostEqual(cp.endPoint(this._p1)) && startTangent.isParallelTo(endTangent, true)))
32
+ this._fitOptions.isChordLenKnots = 1;
33
+ }
34
+ pushOffsetPoint(xyz, tangent) {
35
+ if (!Geometry.isSmallMetricDistance(tangent.x) || !Geometry.isSmallMetricDistance(tangent.y))
36
+ this._fitOptions.fitPoints.push(xyz.plusScaled(tangent.unitPerpendicularXY(this._v0), this._offsetDistance));
37
+ }
38
+ needPrimaryGeometryForStrokes() { return true; }
39
+ startParentCurvePrimitive(_cp) { }
40
+ startCurvePrimitive(_cp) { }
41
+ endCurvePrimitive(_cp) { }
42
+ endParentCurvePrimitive(_cp) { }
43
+ announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
44
+ for (let i = 0; i <= numStrokes; ++i) { // announce both start and end; adjacent duplicates will be filtered by c2 cubic fit logic
45
+ const fraction = Geometry.interpolate(fraction0, i / numStrokes, fraction1);
46
+ const ray = cp.fractionToPointAndDerivative(fraction, this._r0);
47
+ this.pushOffsetPoint(ray.origin, ray.direction);
48
+ }
49
+ }
50
+ announceSegmentInterval(_cp, point0, point1, numStrokes, _fraction0, _fraction1) {
51
+ if (numStrokes > 0) {
52
+ const tangent = Vector3d.createStartEnd(point0, point1, this._v1);
53
+ for (let i = 0; i <= numStrokes; ++i) { // announce both start and end; adjacent duplicates will be filtered by c2 cubic fit logic
54
+ this.pushOffsetPoint(point0.interpolate(i / numStrokes, point1, this._p0), tangent);
55
+ }
56
+ }
57
+ }
58
+ announcePointTangent(xyz, _fraction, tangent) {
59
+ this.pushOffsetPoint(xyz, tangent);
60
+ }
61
+ /**
62
+ * Construct a C2 cubic interpolating B-spline curve through the collected xy-offset points.
63
+ * @returns the xy-offset curve
64
+ */
65
+ claimResult() {
66
+ return BSplineCurveOps.createThroughPointsC2Cubic(this._fitOptions);
67
+ }
68
+ }
69
+ //# sourceMappingURL=CurveOffsetXYHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurveOffsetXYHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CurveOffsetXYHandler.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAA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,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAClE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE,0FAA0F;gBAChI,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;aACrF;SACF;IACH,CAAC;IACM,oBAAoB,CAAC,GAAY,EAAE,SAAiB,EAAE,OAAiB;QAC5E,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IACD;;;OAGG;IACI,WAAW;QAChB,OAAO,eAAe,CAAC,0BAA0B,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtE,CAAC;CACF","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/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { BSplineCurve3d } from \"../../bspline/BSplineCurve\";\r\nimport { InterpolationCurve3dOptions } from \"../../bspline/InterpolationCurve3d\";\r\nimport { BSplineCurveOps } from \"../../bspline/BSplineCurveOps\";\r\n\r\n/**\r\n * Context for constructing the xy-offset of a CurvePrimitive by interpolating the xy-offsets of computed strokes.\r\n * @internal\r\n */\r\n export class CurveOffsetXYHandler implements IStrokeHandler {\r\n private _offsetDistance: number;\r\n private _fitOptions: InterpolationCurve3dOptions;\r\n\r\n // temporary workspace\r\n private _p0 = Point3d.createZero();\r\n private _p1 = Point3d.createZero();\r\n private _v0 = Vector3d.createZero();\r\n private _v1 = Vector3d.createZero();\r\n private _r0 = Ray3d.createZero();\r\n\r\n public constructor(cp: CurvePrimitive, offsetDistance: number) {\r\n this._offsetDistance = offsetDistance;\r\n this._fitOptions = new InterpolationCurve3dOptions();\r\n const startTangent = cp.fractionToPointAndUnitTangent(0.0, this._r0).direction.clone();\r\n const endTangent = cp.fractionToPointAndUnitTangent(1.0, this._r0).direction.negate(); // points into curve\r\n this._fitOptions.startTangent = startTangent;\r\n this._fitOptions.endTangent = endTangent;\r\n if (this._fitOptions.closed = (cp.startPoint(this._p0).isAlmostEqual(cp.endPoint(this._p1)) && startTangent.isParallelTo(endTangent, true)))\r\n this._fitOptions.isChordLenKnots = 1;\r\n }\r\n private pushOffsetPoint(xyz: Point3d, tangent: Vector3d) {\r\n if (!Geometry.isSmallMetricDistance(tangent.x) || !Geometry.isSmallMetricDistance(tangent.y))\r\n this._fitOptions.fitPoints.push(xyz.plusScaled(tangent.unitPerpendicularXY(this._v0), this._offsetDistance));\r\n }\r\n public needPrimaryGeometryForStrokes() { return true; }\r\n public startParentCurvePrimitive(_cp: CurvePrimitive) { }\r\n public startCurvePrimitive(_cp: CurvePrimitive) { }\r\n public endCurvePrimitive(_cp: CurvePrimitive) { }\r\n public endParentCurvePrimitive(_cp: CurvePrimitive) { }\r\n public announceIntervalForUniformStepStrokes(cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number): void {\r\n for (let i = 0; i <= numStrokes; ++i) { // announce both start and end; adjacent duplicates will be filtered by c2 cubic fit logic\r\n const fraction = Geometry.interpolate(fraction0, i / numStrokes, fraction1);\r\n const ray = cp.fractionToPointAndDerivative(fraction, this._r0);\r\n this.pushOffsetPoint(ray.origin, ray.direction);\r\n }\r\n }\r\n public announceSegmentInterval(_cp: CurvePrimitive, point0: Point3d, point1: Point3d, numStrokes: number, _fraction0: number, _fraction1: number): void {\r\n if (numStrokes > 0) {\r\n const tangent = Vector3d.createStartEnd(point0, point1, this._v1);\r\n for (let i = 0; i <= numStrokes; ++i) { // announce both start and end; adjacent duplicates will be filtered by c2 cubic fit logic\r\n this.pushOffsetPoint(point0.interpolate(i / numStrokes, point1, this._p0), tangent);\r\n }\r\n }\r\n }\r\n public announcePointTangent(xyz: Point3d, _fraction: number, tangent: Vector3d): void {\r\n this.pushOffsetPoint(xyz, tangent);\r\n }\r\n /**\r\n * Construct a C2 cubic interpolating B-spline curve through the collected xy-offset points.\r\n * @returns the xy-offset curve\r\n */\r\n public claimResult(): BSplineCurve3d | undefined {\r\n return BSplineCurveOps.createThroughPointsC2Cubic(this._fitOptions);\r\n }\r\n}\r\n"]}
@@ -7,8 +7,9 @@ import { CurveCollection } from "../CurveCollection";
7
7
  import { CurvePrimitive } from "../CurvePrimitive";
8
8
  import { Loop } from "../Loop";
9
9
  import { Path } from "../Path";
10
+ import { StrokeOptions } from "../StrokeOptions";
10
11
  /**
11
- * * control parameters for joint construction.
12
+ * * Control parameters for joint construction.
12
13
  * * Decision order is:
13
14
  * * if turn angle is greater than minArcDegrees, make an arc.
14
15
  * * if turn angle is less than or equal maxChamferTurnDegrees, extend curves along tangent to single intersection point.
@@ -23,15 +24,22 @@ export declare class JointOptions {
23
24
  */
24
25
  minArcDegrees: number;
25
26
  maxChamferTurnDegrees: number;
27
+ /** Offset distance, positive to left of base curve. */
26
28
  leftOffsetDistance: number;
29
+ /** Whether to offset elliptical arcs as elliptical arcs (true) or as B-spline curves (false, default). */
30
+ preserveEllipticalArcs: boolean;
27
31
  /** Construct JointOptions.
28
32
  * * leftOffsetDistance is required
29
33
  * * minArcDegrees and maxChamferDegrees are optional.
30
34
  */
31
- constructor(leftOffsetDistance: number, minArcDegrees?: number, maxChamferDegrees?: number);
35
+ constructor(leftOffsetDistance: number, minArcDegrees?: number, maxChamferDegrees?: number, preserveEllipticalArcs?: boolean);
36
+ /** Return a deep clone. */
37
+ clone(): JointOptions;
38
+ /** Copy values of input options */
39
+ setFrom(other: JointOptions): void;
32
40
  /**
33
- * Parse a number of JointOptions up to JointOptions:
34
- * * If leftOffsetDistanceOptions is a number, create a JointOptions with default arc and chamfer values.
41
+ * Parse a number or JointOptions up to JointOptions:
42
+ * * If leftOffsetDistanceOptions is a number, create a JointOptions with other options set to default values.
35
43
  * * If leftOffsetDistanceOrOptions is a JointOptions, return it unchanged.
36
44
  * @param leftOffsetDistanceOrOptions
37
45
  */
@@ -41,6 +49,34 @@ export declare class JointOptions {
41
49
  /** Test if turn by theta should be output as single point. */
42
50
  numChamferPoints(theta: Angle): number;
43
51
  }
52
+ /**
53
+ * Options for offsetting a curve.
54
+ * @public
55
+ */
56
+ export declare class OffsetOptions {
57
+ /** Options for offsetting and joining CurvePrimitives */
58
+ jointOptions: JointOptions;
59
+ /** Options for generating a B-spline curve offset */
60
+ strokeOptions: StrokeOptions;
61
+ /** Options that are provided are captured. */
62
+ constructor(offsetDistanceOrOptions: number | JointOptions, strokeOptions?: StrokeOptions);
63
+ get minArcDegrees(): number;
64
+ set minArcDegrees(value: number);
65
+ get maxChamferTurnDegrees(): number;
66
+ set maxChamferTurnDegrees(value: number);
67
+ get leftOffsetDistance(): number;
68
+ set leftOffsetDistance(value: number);
69
+ get preserveEllipticalArcs(): boolean;
70
+ set preserveEllipticalArcs(value: boolean);
71
+ /** Convert variant input into OffsetOptions.
72
+ * * If a JointOptions is provided, it is captured.
73
+ * * If an OffsetOptions is provided, a reference to it is returned. */
74
+ static create(offsetDistanceOrOptions: number | JointOptions | OffsetOptions): OffsetOptions;
75
+ /** Convert variant input into offset distance */
76
+ static getOffsetDistance(offsetDistanceOrOptions: number | JointOptions | OffsetOptions): number;
77
+ /** Return a deep clone. */
78
+ clone(): OffsetOptions;
79
+ }
44
80
  /**
45
81
  * Context for building a wire offset.
46
82
  * @internal
@@ -69,11 +105,6 @@ export declare class PolygonWireOffsetContext {
69
105
  export declare class CurveChainWireOffsetContext {
70
106
  /** construct a context. */
71
107
  constructor();
72
- private static _unitAlong;
73
- private static _unitPerp;
74
- private static _offsetA;
75
- private static _offsetB;
76
- private static createOffsetSegment;
77
108
  /**
78
109
  * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.
79
110
  * * return cp
@@ -88,30 +119,23 @@ export declare class CurveChainWireOffsetContext {
88
119
  * * `(primitive as any).baseCurveStart: Point3d`
89
120
  * * `(primitive as any).baseCurveEnd: Point3d`
90
121
  * @param g primitive to offset
91
- * @param distanceLeft
122
+ * @param offsetDistanceOrOptions offset distance (positive to left of g), or options object
92
123
  */
93
- static createSingleOffsetPrimitiveXY(g: CurvePrimitive, distanceLeft: number): CurvePrimitive | CurvePrimitive[] | undefined;
124
+ static createSingleOffsetPrimitiveXY(g: CurvePrimitive, offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined;
94
125
  /**
95
- * Construct curves that are offset from a Path or Loop
126
+ * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).
96
127
  * * The construction will remove "some" local effects of features smaller than the offset distance, but will not detect self intersection among widely separated edges.
97
- * * Offset distance is defined as positive to the left.
98
- * * If offsetDistanceOrOptions is given as a number, default options are applied.
128
+ * * If offsetDistance is given as a number, default OffsetOptions are applied.
99
129
  * * When the offset needs to do an "outside" turn, the first applicable construction is applied:
100
130
  * * If the turn is larger than `options.minArcDegrees`, a circular arc is constructed.
101
- * * if the turn is larger than `options.maxChamferDegrees`, the turn is constructed as a sequence of straight lines that are
131
+ * * If the turn is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to single intersection point.
132
+ * * If the turn is larger than `options.maxChamferDegrees`, the turn is constructed as a sequence of straight lines that are:
102
133
  * * outside the arc
103
134
  * * have uniform turn angle less than `options.maxChamferDegrees`
104
135
  * * each line segment (except first and last) touches the arc at its midpoint.
105
- * * Otherwise the prior and successor curves are extended to simple intersection.
106
- * @param curves input curves
107
- * @param offsetDistanceOrOptions offset controls.
108
- */
109
- private static constructCurveXYOffsetGo;
110
- /**
111
- * Construct offset curves as viewed in xy.
112
136
  * @param curves base curves.
113
- * @param offsetDistanceOrOptions distance (positive left, negative right) or options.
137
+ * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.
114
138
  */
115
- static constructCurveXYOffset(curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions): CurveCollection | undefined;
139
+ static constructCurveXYOffset(curves: Path | Loop, offsetDistanceOrOptions: number | JointOptions | OffsetOptions): CurveCollection | undefined;
116
140
  }
117
141
  //# sourceMappingURL=PolygonOffsetContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PolygonOffsetContext.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PolygonOffsetContext.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAG/C,OAAO,EAAE,OAAO,EAAY,MAAM,kCAAkC,CAAC;AAGrE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAgB/B;;;;;;;;;GASG;AACH,qBAAa,YAAY;IACvB;;OAEG;IACI,aAAa,SAAS;IACtB,qBAAqB,SAAM;IAC3B,kBAAkB,EAAE,MAAM,CAAK;IACtC;;;OAGG;gBACS,kBAAkB,EAAE,MAAM,EAAE,aAAa,SAAM,EAAE,iBAAiB,SAAK;IAKnF;;;;;OAKG;WACW,MAAM,CAAC,2BAA2B,EAAE,MAAM,GAAG,YAAY,GAAG,YAAY;IAMtF,6FAA6F;IACtF,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAGrC,8DAA8D;IACvD,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;CAO9C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