@itwin/core-geometry 3.1.0-dev.7 → 3.1.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 +70 -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
@@ -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/PolygonOff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BAAiB,CAAC,uBAAuB,EAAE,MAAM,GAAG,YAAY,GAAG,aAAa,GAAG,MAAM;IAMvG,2BAA2B;IACpB,KAAK,IAAI,aAAa;CAG9B;AAwYD;;;GAGG;AACH,qBAAa,wBAAwB;IACnC,2BAA2B;;IAG3B,OAAO,CAAC,MAAM,CAAC,UAAU,CAAqB;IAC9C,OAAO,CAAC,MAAM,CAAC,SAAS,CAAqB;IAC7C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAoB;IAC3C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAoB;IAG3C,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAalC;;;;;;OAMG;IACI,4BAA4B,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,2BAA2B,EAAE,MAAM,GAAG,YAAY,GAAG,eAAe,GAAG,SAAS;CA8CvJ;AAED;;;GAGG;AACH,qBAAa,2BAA2B;IACtC,2BAA2B;;IAG3B;;;;;;OAMG;WACW,eAAe,CAAC,EAAE,EAAE,cAAc,GAAG,SAAS,EAAE,UAAU,EAAE,OAAO,GAAG,SAAS,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS;IASzJ;;;;;;;OAOG;WACW,6BAA6B,CAAC,CAAC,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,GAAG,aAAa,GAAG,cAAc,GAAG,cAAc,EAAE,GAAG,SAAS;IAgB9J;;;;;;;;;;;;;OAaG;WACW,sBAAsB,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,uBAAuB,EAAE,MAAM,GAAG,YAAY,GAAG,aAAa,GAAG,eAAe,GAAG,SAAS;CA4CvJ"}
@@ -7,10 +7,9 @@
7
7
  * @module Curve
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.CurveChainWireOffsetContext = exports.PolygonWireOffsetContext = exports.JointOptions = void 0;
10
+ exports.CurveChainWireOffsetContext = exports.PolygonWireOffsetContext = exports.OffsetOptions = exports.JointOptions = void 0;
11
11
  const Geometry_1 = require("../../Geometry");
12
12
  const AngleSweep_1 = require("../../geometry3d/AngleSweep");
13
- /* eslint-disable no-console */
14
13
  const Point3dVector3d_1 = require("../../geometry3d/Point3dVector3d");
15
14
  const Ray3d_1 = require("../../geometry3d/Ray3d");
16
15
  const Arc3d_1 = require("../Arc3d");
@@ -22,6 +21,7 @@ const LineString3d_1 = require("../LineString3d");
22
21
  const Loop_1 = require("../Loop");
23
22
  const Path_1 = require("../Path");
24
23
  const RegionOps_1 = require("../RegionOps");
24
+ const StrokeOptions_1 = require("../StrokeOptions");
25
25
  /**
26
26
  * Classification of contortions at a joint.
27
27
  * @internal
@@ -36,7 +36,7 @@ var JointMode;
36
36
  JointMode[JointMode["Gap"] = 4] = "Gap";
37
37
  })(JointMode || (JointMode = {}));
38
38
  /**
39
- * * control parameters for joint construction.
39
+ * * Control parameters for joint construction.
40
40
  * * Decision order is:
41
41
  * * if turn angle is greater than minArcDegrees, make an arc.
42
42
  * * if turn angle is less than or equal maxChamferTurnDegrees, extend curves along tangent to single intersection point.
@@ -50,20 +50,35 @@ class JointOptions {
50
50
  * * leftOffsetDistance is required
51
51
  * * minArcDegrees and maxChamferDegrees are optional.
52
52
  */
53
- constructor(leftOffsetDistance, minArcDegrees = 180, maxChamferDegrees = 90) {
53
+ constructor(leftOffsetDistance, minArcDegrees = 180, maxChamferDegrees = 90, preserveEllipticalArcs = false) {
54
54
  /** smallest arc to construct.
55
55
  * * If this control angle is large, arcs are never created.
56
56
  */
57
57
  this.minArcDegrees = 180.0;
58
58
  this.maxChamferTurnDegrees = 90;
59
+ /** Offset distance, positive to left of base curve. */
59
60
  this.leftOffsetDistance = 0;
61
+ /** Whether to offset elliptical arcs as elliptical arcs (true) or as B-spline curves (false, default). */
62
+ this.preserveEllipticalArcs = false;
60
63
  this.leftOffsetDistance = leftOffsetDistance;
61
64
  this.minArcDegrees = minArcDegrees;
62
65
  this.maxChamferTurnDegrees = maxChamferDegrees;
66
+ this.preserveEllipticalArcs = preserveEllipticalArcs;
67
+ }
68
+ /** Return a deep clone. */
69
+ clone() {
70
+ return new JointOptions(this.leftOffsetDistance, this.minArcDegrees, this.maxChamferTurnDegrees, this.preserveEllipticalArcs);
71
+ }
72
+ /** Copy values of input options */
73
+ setFrom(other) {
74
+ this.leftOffsetDistance = other.leftOffsetDistance;
75
+ this.minArcDegrees = other.minArcDegrees;
76
+ this.maxChamferTurnDegrees = other.maxChamferTurnDegrees;
77
+ this.preserveEllipticalArcs = other.preserveEllipticalArcs;
63
78
  }
64
79
  /**
65
- * Parse a number of JointOptions up to JointOptions:
66
- * * If leftOffsetDistanceOptions is a number, create a JointOptions with default arc and chamfer values.
80
+ * Parse a number or JointOptions up to JointOptions:
81
+ * * If leftOffsetDistanceOptions is a number, create a JointOptions with other options set to default values.
67
82
  * * If leftOffsetDistanceOrOptions is a JointOptions, return it unchanged.
68
83
  * @param leftOffsetDistanceOrOptions
69
84
  */
@@ -87,6 +102,44 @@ class JointOptions {
87
102
  }
88
103
  }
89
104
  exports.JointOptions = JointOptions;
105
+ /**
106
+ * Options for offsetting a curve.
107
+ * @public
108
+ */
109
+ class OffsetOptions {
110
+ /** Options that are provided are captured. */
111
+ constructor(offsetDistanceOrOptions, strokeOptions) {
112
+ this.jointOptions = JointOptions.create(offsetDistanceOrOptions);
113
+ this.strokeOptions = (strokeOptions !== undefined) ? strokeOptions : StrokeOptions_1.StrokeOptions.createForCurves();
114
+ }
115
+ get minArcDegrees() { return this.jointOptions.minArcDegrees; }
116
+ set minArcDegrees(value) { this.jointOptions.minArcDegrees = value; }
117
+ get maxChamferTurnDegrees() { return this.jointOptions.maxChamferTurnDegrees; }
118
+ set maxChamferTurnDegrees(value) { this.jointOptions.maxChamferTurnDegrees = value; }
119
+ get leftOffsetDistance() { return this.jointOptions.leftOffsetDistance; }
120
+ set leftOffsetDistance(value) { this.jointOptions.leftOffsetDistance = value; }
121
+ get preserveEllipticalArcs() { return this.jointOptions.preserveEllipticalArcs; }
122
+ set preserveEllipticalArcs(value) { this.jointOptions.preserveEllipticalArcs = value; }
123
+ /** Convert variant input into OffsetOptions.
124
+ * * If a JointOptions is provided, it is captured.
125
+ * * If an OffsetOptions is provided, a reference to it is returned. */
126
+ static create(offsetDistanceOrOptions) {
127
+ if (offsetDistanceOrOptions instanceof OffsetOptions)
128
+ return offsetDistanceOrOptions;
129
+ return new OffsetOptions(offsetDistanceOrOptions);
130
+ }
131
+ /** Convert variant input into offset distance */
132
+ static getOffsetDistance(offsetDistanceOrOptions) {
133
+ if (typeof offsetDistanceOrOptions === "number")
134
+ return offsetDistanceOrOptions;
135
+ return offsetDistanceOrOptions.leftOffsetDistance;
136
+ }
137
+ /** Return a deep clone. */
138
+ clone() {
139
+ return new OffsetOptions(this.jointOptions.clone(), this.strokeOptions.clone());
140
+ }
141
+ }
142
+ exports.OffsetOptions = OffsetOptions;
90
143
  /**
91
144
  * Description of geometry around a joint.
92
145
  * @internal
@@ -242,22 +295,21 @@ class Joint {
242
295
  }
243
296
  return true;
244
297
  }
298
+ /** NOTE: no assumption on type of curve0, curve1 */
245
299
  annotateExtension(options) {
246
300
  if (this.curve0 && this.curve1) {
247
- const ray0 = this.curve0.fractionToPointAndDerivative(1.0); // And we know that is full length ray !
248
- const ray1 = this.curve1.fractionToPointAndDerivative(0.0); // ditto
301
+ const ray0 = this.curve0.fractionToPointAndDerivative(1.0);
302
+ const ray1 = this.curve1.fractionToPointAndDerivative(0.0);
249
303
  const intersection = Ray3d_1.Ray3d.closestApproachRay3dRay3d(ray0, ray1);
250
304
  if (intersection.approachType === CurveLocationDetail_1.CurveCurveApproachType.Intersection) {
251
- this.fraction0 = 1.0;
252
- this.fraction1 = 0.0;
253
305
  if (intersection.detailA.fraction >= 0.0 && intersection.detailB.fraction <= 0.0) {
306
+ this.fraction0 = 1.0;
307
+ this.fraction1 = 0.0;
254
308
  this.flexure = JointMode.Extend;
255
309
  const theta = ray0.getDirectionRef().angleToXY(ray1.getDirectionRef());
256
310
  if (options.needArc(theta)) {
257
311
  const arc = Joint.constructArc(ray0, this.curve0.baseCurveEnd, ray1);
258
312
  if (arc) {
259
- this.fraction0 = 1.0;
260
- this.fraction1 = 0.0;
261
313
  this.jointCurve = arc;
262
314
  return;
263
315
  }
@@ -325,37 +377,34 @@ class Joint {
325
377
  this.fraction1 = 0.0;
326
378
  }
327
379
  else if (this.curve0 && this.curve1) {
328
- const ray0 = this.curve0.fractionToPointAndDerivative(0.0); // And we know that is full length ray !
329
- const ray1 = this.curve1.fractionToPointAndDerivative(0.0); // ditto
330
- if (this.curve0 instanceof LineSegment3d_1.LineSegment3d && this.curve1 instanceof LineSegment3d_1.LineSegment3d) {
331
- // check for direct intersection -- occurs on offset of colinear base segments.
332
- if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) {
333
- this.fraction0 = 1.0;
334
- this.fraction1 = 0.0;
335
- this.flexure = JointMode.Trim;
336
- }
337
- else {
338
- const intersection = Ray3d_1.Ray3d.closestApproachRay3dRay3d(ray0, ray1);
339
- if (intersection.approachType === CurveLocationDetail_1.CurveCurveApproachType.Intersection) {
340
- this.fraction0 = intersection.detailA.fraction;
341
- this.fraction1 = intersection.detailB.fraction;
342
- if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) {
343
- this.annotateExtension(options);
344
- }
345
- else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) {
346
- this.flexure = JointMode.Trim;
347
- }
348
- else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) {
349
- this.flexure = JointMode.Gap;
350
- this.jointCurve = LineSegment3d_1.LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));
351
- this.fraction0 = 1.0;
352
- this.fraction1 = 0.0;
353
- }
380
+ // check for direct intersection -- occurs on offset of colinear base segments, and closed primitives
381
+ if (this.curve0.endPoint().isAlmostEqual(this.curve1.startPoint())) {
382
+ this.fraction0 = 1.0;
383
+ this.fraction1 = 0.0;
384
+ this.flexure = JointMode.Trim;
385
+ }
386
+ else if (this.curve0 instanceof LineSegment3d_1.LineSegment3d && this.curve1 instanceof LineSegment3d_1.LineSegment3d) {
387
+ const ray0 = this.curve0.fractionToPointAndDerivative(0.0); // And we know that is full length ray !
388
+ const ray1 = this.curve1.fractionToPointAndDerivative(0.0); // ditto
389
+ const intersection = Ray3d_1.Ray3d.closestApproachRay3dRay3d(ray0, ray1);
390
+ if (intersection.approachType === CurveLocationDetail_1.CurveCurveApproachType.Intersection) {
391
+ this.fraction0 = intersection.detailA.fraction;
392
+ this.fraction1 = intersection.detailB.fraction;
393
+ if (this.fraction0 >= 1.0 && this.fraction1 <= 0.0) {
394
+ this.annotateExtension(options);
395
+ }
396
+ else if (this.fraction0 < 1.0 && this.fraction1 > 0.0) {
397
+ this.flexure = JointMode.Trim;
398
+ }
399
+ else if (this.fraction0 > 1.0 && this.fraction1 > 1.0) {
400
+ this.flexure = JointMode.Gap;
401
+ this.jointCurve = LineSegment3d_1.LineSegment3d.create(this.curve0.fractionToPoint(1.0), this.curve1.fractionToPoint(0.0));
402
+ this.fraction0 = 1.0;
403
+ this.fraction1 = 0.0;
354
404
  }
355
405
  }
356
406
  }
357
- else {
358
- // generic pair of curves ...
407
+ else { // generic pair of curves ...
359
408
  const intersections = CurveCurve_1.CurveCurve.intersectionXYPairs(this.curve0, false, this.curve1, false);
360
409
  const intersectionIndex = this.selectIntersectionIndexByFraction(1.0, 0.0, intersections);
361
410
  if (intersectionIndex >= 0) {
@@ -543,15 +592,6 @@ class CurveChainWireOffsetContext {
543
592
  /** construct a context. */
544
593
  constructor() {
545
594
  }
546
- // Construct a single offset from base points
547
- static createOffsetSegment(basePointA, basePointB, distanceLeft) {
548
- Point3dVector3d_1.Vector3d.createStartEnd(basePointA, basePointB, this._unitAlong);
549
- if (this._unitAlong.normalizeInPlace()) {
550
- this._unitAlong.rotate90CCWXY(this._unitPerp);
551
- return LineSegment3d_1.LineSegment3d.create(basePointA.plusScaled(this._unitPerp, distanceLeft, this._offsetA), basePointB.plusScaled(this._unitPerp, distanceLeft, this._offsetB));
552
- }
553
- return undefined;
554
- }
555
595
  /**
556
596
  * Annotate a CurvePrimitive with properties `baseCurveStart` and `baseCurveEnd`.
557
597
  * * return cp
@@ -574,70 +614,44 @@ class CurveChainWireOffsetContext {
574
614
  * * `(primitive as any).baseCurveStart: Point3d`
575
615
  * * `(primitive as any).baseCurveEnd: Point3d`
576
616
  * @param g primitive to offset
577
- * @param distanceLeft
617
+ * @param offsetDistanceOrOptions offset distance (positive to left of g), or options object
578
618
  */
579
- static createSingleOffsetPrimitiveXY(g, distanceLeft) {
580
- const point0 = g.fractionToPoint(0.0);
581
- const point1 = g.fractionToPoint(1.0);
582
- if (g instanceof LineSegment3d_1.LineSegment3d) {
583
- return this.applyBasePoints(this.createOffsetSegment(point0, point1, distanceLeft), point0, point1);
584
- }
585
- else if (g instanceof Arc3d_1.Arc3d) {
586
- const g1 = g.cloneAtZ();
587
- if (g1.isCircular) {
588
- const sign = g1.sweep.sweepRadians * g1.matrixRef.coffs[8] >= 0.0 ? 1.0 : -1.0;
589
- const r = g1.matrixRef.columnXMagnitude();
590
- const r1 = r - sign * distanceLeft;
591
- if (!Geometry_1.Geometry.isSmallMetricDistance(r1) && r * r1 > 0.0) {
592
- const factor = r1 / r;
593
- const matrix = g1.matrixClone();
594
- matrix.scaleColumnsInPlace(factor, factor, 1.0);
595
- return this.applyBasePoints(Arc3d_1.Arc3d.createRefs(g1.center.clone(), matrix, g1.sweep.clone()), g.startPoint(), g.endPoint());
596
- }
597
- }
598
- }
599
- else if (g instanceof LineString3d_1.LineString3d) {
600
- const n = g.numPoints();
601
- if (n > 1) {
602
- const offsets = [];
603
- const pointA = Point3dVector3d_1.Point3d.create();
604
- const pointB = Point3dVector3d_1.Point3d.create();
605
- g.packedPoints.getPoint3dAtUncheckedPointIndex(0, pointA);
606
- for (let i = 1; i < n; i++) {
607
- g.packedPoints.getPoint3dAtUncheckedPointIndex(i, pointB);
608
- const g1 = this.applyBasePoints(this.createOffsetSegment(pointA, pointB, distanceLeft), pointA.clone(), pointB.clone());
609
- if (g1 !== undefined)
610
- offsets.push(g1);
611
- pointA.setFromPoint3d(pointB);
612
- }
613
- return offsets;
614
- }
619
+ static createSingleOffsetPrimitiveXY(g, offsetDistanceOrOptions) {
620
+ const offset = g.constructOffsetXY(offsetDistanceOrOptions);
621
+ if (offset === undefined)
622
+ return undefined;
623
+ // decorate each offset with its base curve's endpoints
624
+ if (Array.isArray(offset)) {
625
+ const basePrims = g.collectCurvePrimitives(undefined, true, true);
626
+ if (basePrims.length !== offset.length)
627
+ return undefined; // unexpected aggregate curve type!
628
+ for (let i = 0; i < basePrims.length; ++i)
629
+ this.applyBasePoints(offset[i], basePrims[i].startPoint(), basePrims[i].endPoint());
630
+ return offset;
615
631
  }
616
- return undefined;
632
+ return this.applyBasePoints(offset, g.startPoint(), g.endPoint());
617
633
  }
618
634
  /**
619
- * Construct curves that are offset from a Path or Loop
635
+ * Construct curves that are offset from a Path or Loop as viewed in xy-plane (ignoring z).
620
636
  * * The construction will remove "some" local effects of features smaller than the offset distance, but will not detect self intersection among widely separated edges.
621
- * * Offset distance is defined as positive to the left.
622
- * * If offsetDistanceOrOptions is given as a number, default options are applied.
637
+ * * If offsetDistance is given as a number, default OffsetOptions are applied.
623
638
  * * When the offset needs to do an "outside" turn, the first applicable construction is applied:
624
639
  * * If the turn is larger than `options.minArcDegrees`, a circular arc is constructed.
625
- * * if the turn is larger than `options.maxChamferDegrees`, the turn is constructed as a sequence of straight lines that are
640
+ * * If the turn is less than or equal to `options.maxChamferTurnDegrees`, extend curves along tangent to single intersection point.
641
+ * * If the turn is larger than `options.maxChamferDegrees`, the turn is constructed as a sequence of straight lines that are:
626
642
  * * outside the arc
627
643
  * * have uniform turn angle less than `options.maxChamferDegrees`
628
644
  * * each line segment (except first and last) touches the arc at its midpoint.
629
- * * Otherwise the prior and successor curves are extended to simple intersection.
630
- * @param curves input curves
631
- * @param offsetDistanceOrOptions offset controls.
645
+ * @param curves base curves.
646
+ * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.
632
647
  */
633
- static constructCurveXYOffsetGo(curves, options) {
648
+ static constructCurveXYOffset(curves, offsetDistanceOrOptions) {
634
649
  const wrap = curves instanceof Loop_1.Loop;
635
- if (options === undefined)
636
- return undefined;
650
+ const offsetOptions = OffsetOptions.create(offsetDistanceOrOptions);
637
651
  const simpleOffsets = [];
638
652
  // setup pass: get simple offsets of each primitive
639
653
  for (const c of curves.children) {
640
- const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, options.leftOffsetDistance);
654
+ const c1 = CurveChainWireOffsetContext.createSingleOffsetPrimitiveXY(c, offsetOptions);
641
655
  if (c1 === undefined) {
642
656
  // bad .. maybe arc to inside?
643
657
  }
@@ -669,24 +683,11 @@ class CurveChainWireOffsetContext {
669
683
  if (joint0 && previousJoint && curves instanceof Loop_1.Loop)
670
684
  Joint.link(previousJoint, joint0);
671
685
  const numOffset = simpleOffsets.length;
672
- Joint.annotateChain(joint0, options, numOffset);
686
+ Joint.annotateChain(joint0, offsetOptions.jointOptions, numOffset);
673
687
  const outputCurves = [];
674
688
  Joint.collectCurvesFromChain(joint0, outputCurves, numOffset);
675
689
  return RegionOps_1.RegionOps.createLoopPathOrBagOfCurves(outputCurves, wrap, true);
676
690
  }
677
- /**
678
- * Construct offset curves as viewed in xy.
679
- * @param curves base curves.
680
- * @param offsetDistanceOrOptions distance (positive left, negative right) or options.
681
- */
682
- static constructCurveXYOffset(curves, offsetDistanceOrOptions) {
683
- const options = JointOptions.create(offsetDistanceOrOptions);
684
- return this.constructCurveXYOffsetGo(curves, options);
685
- }
686
691
  }
687
692
  exports.CurveChainWireOffsetContext = CurveChainWireOffsetContext;
688
- CurveChainWireOffsetContext._unitAlong = Point3dVector3d_1.Vector3d.create();
689
- CurveChainWireOffsetContext._unitPerp = Point3dVector3d_1.Vector3d.create();
690
- CurveChainWireOffsetContext._offsetA = Point3dVector3d_1.Point3d.create();
691
- CurveChainWireOffsetContext._offsetB = Point3dVector3d_1.Point3d.create();
692
693
  //# sourceMappingURL=PolygonOffsetContext.js.map