@itwin/core-geometry 5.0.0-dev.13 → 5.0.0-dev.16

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 (95) hide show
  1. package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
  2. package/lib/cjs/bspline/BSplineCurveOps.js +18 -21
  3. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  4. package/lib/cjs/curve/Arc3d.d.ts +5 -2
  5. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  6. package/lib/cjs/curve/Arc3d.js +9 -2
  7. package/lib/cjs/curve/Arc3d.js.map +1 -1
  8. package/lib/cjs/curve/CurveFactory.d.ts +68 -47
  9. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  10. package/lib/cjs/curve/CurveFactory.js +99 -70
  11. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  12. package/lib/cjs/curve/StrokeOptions.d.ts +1 -1
  13. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  14. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  15. package/lib/cjs/geometry3d/AngleSweep.d.ts +1 -1
  16. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  17. package/lib/cjs/geometry3d/AngleSweep.js +1 -1
  18. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  19. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +32 -10
  20. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  21. package/lib/cjs/geometry3d/GrowableXYZArray.js +54 -16
  22. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  23. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +13 -2
  24. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  25. package/lib/cjs/geometry3d/IndexedXYZCollection.js +24 -10
  26. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  27. package/lib/cjs/geometry3d/Matrix3d.d.ts +3 -4
  28. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  29. package/lib/cjs/geometry3d/Matrix3d.js +3 -4
  30. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  31. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +1 -1
  32. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  33. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +4 -4
  34. package/lib/cjs/geometry3d/Point3dVector3d.js +4 -4
  35. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  36. package/lib/cjs/geometry3d/PolylineOps.d.ts +7 -4
  37. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  38. package/lib/cjs/geometry3d/PolylineOps.js +7 -4
  39. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  40. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +13 -6
  41. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  42. package/lib/cjs/polyface/PolyfaceBuilder.js +42 -25
  43. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  44. package/lib/cjs/serialization/GeometrySamples.d.ts +5 -5
  45. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  46. package/lib/cjs/serialization/GeometrySamples.js +5 -5
  47. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  48. package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
  49. package/lib/esm/bspline/BSplineCurveOps.js +18 -21
  50. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  51. package/lib/esm/curve/Arc3d.d.ts +5 -2
  52. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  53. package/lib/esm/curve/Arc3d.js +9 -2
  54. package/lib/esm/curve/Arc3d.js.map +1 -1
  55. package/lib/esm/curve/CurveFactory.d.ts +68 -47
  56. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  57. package/lib/esm/curve/CurveFactory.js +99 -70
  58. package/lib/esm/curve/CurveFactory.js.map +1 -1
  59. package/lib/esm/curve/StrokeOptions.d.ts +1 -1
  60. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  61. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  62. package/lib/esm/geometry3d/AngleSweep.d.ts +1 -1
  63. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  64. package/lib/esm/geometry3d/AngleSweep.js +1 -1
  65. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  66. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +32 -10
  67. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  68. package/lib/esm/geometry3d/GrowableXYZArray.js +54 -16
  69. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  70. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +13 -2
  71. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  72. package/lib/esm/geometry3d/IndexedXYZCollection.js +24 -10
  73. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  74. package/lib/esm/geometry3d/Matrix3d.d.ts +3 -4
  75. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  76. package/lib/esm/geometry3d/Matrix3d.js +3 -4
  77. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  78. package/lib/esm/geometry3d/Point3dArrayCarrier.js +1 -1
  79. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  80. package/lib/esm/geometry3d/Point3dVector3d.d.ts +4 -4
  81. package/lib/esm/geometry3d/Point3dVector3d.js +4 -4
  82. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  83. package/lib/esm/geometry3d/PolylineOps.d.ts +7 -4
  84. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  85. package/lib/esm/geometry3d/PolylineOps.js +7 -4
  86. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  87. package/lib/esm/polyface/PolyfaceBuilder.d.ts +13 -6
  88. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  89. package/lib/esm/polyface/PolyfaceBuilder.js +42 -25
  90. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  91. package/lib/esm/serialization/GeometrySamples.d.ts +5 -5
  92. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  93. package/lib/esm/serialization/GeometrySamples.js +5 -5
  94. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  95. package/package.json +3 -3
@@ -23,13 +23,14 @@ import { Path } from "./Path";
23
23
  import { IntegratedSpiralTypeName } from "./spiral/TransitionSpiral3d";
24
24
  import { StrokeOptions } from "./StrokeOptions";
25
25
  /**
26
- * Interface to carry parallel arrays of planes and sections, and optional geometry assembled from them, as returned by [CurveFactory.createMiteredSweepSections].
26
+ * Interface to carry parallel arrays of planes and sections, and optional geometry assembled from them,
27
+ * as returned by [CurveFactory.createMiteredSweepSections].
27
28
  * @public
28
29
  */
29
30
  export interface SectionSequenceWithPlanes {
30
- /** the plane of each section */
31
+ /** The plane of each section. */
31
32
  planes: Plane3dByOriginAndUnitNormal[];
32
- /** section curve projected onto the corresponding plane */
33
+ /** Section curve projected onto the corresponding plane. */
33
34
  sections: AnyCurve[];
34
35
  /**
35
36
  * Optional `RuledSweep` generated from the sections.
@@ -64,13 +65,25 @@ export interface MiteredSweepOptions {
64
65
  strokeOptions?: StrokeOptions;
65
66
  /** Whether to cap the ruled sweep if outputting a ruled sweep or mesh. Default value is `false`. */
66
67
  capped?: boolean;
68
+ /**
69
+ * If the centerline is not physically closed, the first section's normal is aligned to this vector (typically points
70
+ * toward the swept geometry). If the centerline is physically closed, the first section's normal is aligned to this
71
+ * vector if and only if endTangent is provided and is equal to startTangent.
72
+ */
73
+ startTangent?: Vector3d;
74
+ /**
75
+ * If the centerline is not physically closed, the last section's normal is aligned to this vector (typically points
76
+ * away from the swept geometry). If the centerline is physically closed, the last section's normal is aligned to this
77
+ * vector if and only if startTangent is provided and is equal to endTangent.
78
+ */
79
+ endTangent?: Vector3d;
67
80
  }
68
81
  /**
69
82
  * The `CurveFactory` class contains methods for specialized curve constructions.
70
83
  * @public
71
84
  */
72
85
  export declare class CurveFactory {
73
- /** (cautiously) construct and save a line segment between fractional positions. */
86
+ /** (Cautiously) construct and save a line segment between fractional positions. */
74
87
  private static addPartialSegment;
75
88
  /**
76
89
  * Create a circular arc defined by start point, tangent at start point, and end point.
@@ -89,23 +102,25 @@ export declare class CurveFactory {
89
102
  * @param allowBackupAlongEdge true to allow edges to be created going "backwards" along edges if needed to create the blend.
90
103
  */
91
104
  static createFilletsInLineString(points: LineString3d | IndexedXYZCollection | Point3d[], radius: number | number[], allowBackupAlongEdge?: boolean): Path | undefined;
92
- /** Create a `Loop` with given xy corners and fixed z.
105
+ /**
106
+ * Create a `Loop` with given xy corners and fixed z.
93
107
  * * The corners always proceed counter clockwise from lower left.
94
108
  * * If the radius is too large for the outer rectangle size, it is reduced to half of the the smaller x or y size.
95
- */
109
+ */
96
110
  static createRectangleXY(x0: number, y0: number, x1: number, y1: number, z?: number, filletRadius?: number): Loop;
97
111
  /**
98
112
  * If `arcB` is a continuation of `arcA`, extend `arcA` (in place) to include the range of `arcB`
99
113
  * * This only succeeds if the two arcs are part of identical complete arcs and end of `arcA` matches the beginning of `arcB`.
100
- * @param arcA first arc, modified in place
101
- * @param arcB second arc, unmodified
102
- * @param allowReversed whether to consolidate even when second arc is reversed
103
- * @returns whether `arcA` was modified
114
+ * @param arcA first arc, modified in place.
115
+ * @param arcB second arc, unmodified.
116
+ * @param allowReversed whether to consolidate even when second arc is reversed.
117
+ * @returns whether `arcA` was modified.
104
118
  */
105
119
  static appendToArcInPlace(arcA: Arc3d, arcB: Arc3d, allowReverse?: boolean): boolean;
106
120
  /**
107
121
  * Return a `Path` containing arcs are on the surface of an ellipsoid and pass through a sequence of points.
108
- * * Each arc passes through the two given endpoints and in the plane containing the true surface normal at given `fractionForIntermediateNormal`
122
+ * * Each arc passes through the two given endpoints and in the plane containing the true surface normal at
123
+ * given `fractionForIntermediateNormal`
109
124
  * @param ellipsoid
110
125
  * @param pathPoints
111
126
  * @param fractionForIntermediateNormal fractional position for surface normal used to create the section plane.
@@ -114,36 +129,47 @@ export declare class CurveFactory {
114
129
  private static appendGeometryQueryArray;
115
130
  /**
116
131
  * Create solid primitives for pipe segments (e.g. Cone or TorusPipe) around line and arc primitives.
117
- * @param centerline centerline geometry/
132
+ * @param centerline centerline geometry.
118
133
  * @param pipeRadius radius of pipe.
119
134
  */
120
135
  static createPipeSegments(centerline: CurvePrimitive | CurveChain, pipeRadius: number): GeometryQuery | GeometryQuery[] | undefined;
121
136
  /**
122
- * * Create section arcs for mitered pipe.
123
- * * At each end of each pipe, the pipe is cut by the plane that bisects the angle between successive pipe centerlines.
124
- * * The arc definitions are constructed so that lines between corresponding fractional positions on the arcs are
125
- * axial lines on the pipes.
126
- * * This means that each arc definition axes (aka vector0 and vector90) are _not_ perpendicular to each other.
127
- * * Circular or elliptical pipe cross sections can be specified by supplying either a radius, a pair of semi-axis lengths, or a full Arc3d.
128
- * * For semi-axis length input, x corresponds to an ellipse local axis nominally situated parallel to the xy-plane.
129
- * * The center of Arc3d input is translated to the centerline start point to act as initial cross section.
130
- * @param centerline centerline of pipe
131
- * @param sectionData circle radius, ellipse semi-axis lengths, or full Arc3d
137
+ * Create section arcs for mitered pipe.
138
+ * * At the end of each pipe segment, the pipe is mitered by the plane that bisects the angle between successive
139
+ * centerline segments.
140
+ * * The section arcs are constructed so that lines between corresponding fractional positions on the arcs are
141
+ * axial lines on the pipes.
142
+ * * This means that the initial arc's vector0 and vector90 lengths and angular separation are _not_ preserved in
143
+ * the section arcs.
144
+ * * Circular or elliptical pipe cross sections can be specified by supplying either a radius, a pair of semi-axis
145
+ * lengths, or an Arc3d:
146
+ * * For semi-axis length input, x and y correspond to ellipse local axes perpendicular to each other and to the
147
+ * start tangent.
148
+ * * For Arc3d input, the center is translated to the centerline start point, but otherwise the arc is used as-is
149
+ * for the first section. For best results, the arc should be perpendicular to the centerline start tangent.
150
+ * @param centerline centerline of pipe. For best results, ensure no successive duplicate points with e.g.,
151
+ * [[GrowableXYZArray.createCompressed]].
152
+ * @param sectionData circle radius, ellipse semi-axis lengths, or full Arc3d (if not full, function makes it full).
132
153
  */
133
154
  static createMiteredPipeSections(centerline: IndexedXYZCollection, sectionData: number | XAndY | Arc3d): Arc3d[];
134
155
  /**
135
156
  * Sweep the initialSection along each segment of the centerLine until it hits the bisector plane at the next vertex.
136
157
  * * The caller should place the initialSection on a plane perpendicular to the first edge.
137
158
  * * This plane is commonly (but not necessarily) through the start point itself.
138
- * * If the geometry is not "on a perpendicular plane", the output geometry will still be flattened onto the various planes.
139
- * * In the "open path" case (i.e when wrapIfPhysicallyClosed is false or the path does not have matched first and last points)
140
- * the first/last output plane will be at the start/end of the first/last edge and on a perpendicular plane.
141
- * * In the "closed path" case, the output plane for the first and last point is the bisector of the start and end planes from the "open path" case,
142
- * and the first/last section geometry may be different from `initialSection`.
143
- * * The centerline path does NOT have to be planar, however twisting effects effects will appear in the various bisector planes.
144
- * @param centerline sweep path, e.g., as stroked from a smooth centerline curve
145
- * @param initialSection profile curve to be swept. As noted above, this should be on a plane perpendicular to the first segment of the centerline.
146
- * @param options options for computation and output
159
+ * * If the initialSection is not "on a perpendicular plane", the output geometry will still be flattened onto the
160
+ * various planes.
161
+ * * In the "open path" case (i.e when `wrapIfPhysicallyClosed` is false or the path does not have matched first and
162
+ * last points), the first/last output plane will be at the start/end of the first/last edge and on a perpendicular
163
+ * plane.
164
+ * * In the "closed path" case, if start/edn tangents are not provided in the `options`, then the output plane for the
165
+ * first and last point is the bisector of the start and end planes from the "open path" case, and the first/last
166
+ * section geometry may be different from `initialSection`.
167
+ * * The centerline path does NOT have to be planar, however twisting effects effects will appear in the various bisector
168
+ * planes.
169
+ * @param centerline sweep path, e.g., as stroked from a smooth centerline curve.
170
+ * @param initialSection profile curve to be swept. As noted above, this should be on a plane perpendicular to the
171
+ * first segment of the centerline.
172
+ * @param options options for computation and output.
147
173
  * @return array of sections, starting with `initialSection` projected along the first edge to the first plane.
148
174
  */
149
175
  static createMiteredSweepSections(centerline: IndexedXYZCollection | Point3d[], initialSection: AnyCurve, options: MiteredSweepOptions): SectionSequenceWithPlanes | undefined;
@@ -160,11 +186,11 @@ export declare class CurveFactory {
160
186
  /**
161
187
  * Compute 2 spirals (all in XY) for a symmetric line-to-line transition.
162
188
  * * First spiral begins at given start point.
163
- * * first tangent aims at shoulder
189
+ * * first tangent aims at shoulder.
164
190
  * * outbound spiral joins line from shoulder to target.
165
- * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE
191
+ * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE.
166
192
  * @param startPoint inbound start point.
167
- * @param shoulder point target point for (both) spiral-to-line tangencies
193
+ * @param shoulder point target point for (both) spiral-to-line tangencies.
168
194
  * @return array with the computed spirals, or undefined if failure.
169
195
  */
170
196
  static createLineSpiralSpiralLine(spiralType: IntegratedSpiralTypeName, startPoint: Point3d, shoulderPoint: Point3d, targetPoint: Point3d): GeometryQuery[] | undefined;
@@ -172,30 +198,25 @@ export declare class CurveFactory {
172
198
  * Compute 2 spirals (all in XY) for a symmetric line-to-line transition.
173
199
  * * Spiral length is given.
174
200
  * * tangency points float on both lines.
175
- * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE
201
+ * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE.
176
202
  * @param pointA inbound start point.
177
- * @param shoulder point target point for (both) spiral-to-line tangencies
203
+ * @param shoulder point target point for (both) spiral-to-line tangencies.
178
204
  * @param spiralLength for each part of the spiral pair.
179
205
  * @return array with the computed spirals, or undefined if failure.
180
206
  */
181
207
  static createLineSpiralSpiralLineWithSpiralLength(spiralType: IntegratedSpiralTypeName, pointA: Point3d, pointB: Point3d, pointC: Point3d, spiralLength: number): GeometryQuery[] | undefined;
182
208
  /**
183
209
  * Compute 2 spirals and an arc (all in XY) for a symmetric line-to-line transition.
184
- * Spiral lengths and arc radius are given. (e.g. from design speed standards.)
185
- * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE
210
+ * Spiral lengths and arc radius are given (e.g., from design speed standards).
211
+ * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE.
186
212
  * @param pointA inbound start point.
187
- * @param pointB shoulder (target) point for (both) spiral-to-line tangencies
188
- * @param lengthA inbound spiral length
189
- * @param lengthB outbound spiral length
213
+ * @param pointB shoulder (target) point for (both) spiral-to-line tangencies.
214
+ * @param lengthA inbound spiral length.
215
+ * @param lengthB outbound spiral length.
190
216
  * @return array with the computed spirals, or undefined if failure.
191
217
  */
192
218
  static createLineSpiralArcSpiralLine(spiralType: IntegratedSpiralTypeName, pointA: Point3d, pointB: Point3d, pointC: Point3d, lengthA: number, lengthB: number, arcRadius: number): GeometryQuery[] | undefined;
193
- /**
194
- * Return the intersection point of 3 planes.
195
- * @param planeA
196
- * @param planeB
197
- * @param planeC
198
- */
219
+ /** Return the intersection point of 3 planes. */
199
220
  static planePlaneIntersectionRay(planeA: PlaneAltitudeEvaluator, planeB: PlaneAltitudeEvaluator): Ray3d | undefined;
200
221
  }
201
222
  //# sourceMappingURL=CurveFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CurveFactory.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveFactory.ts"],"names":[],"mappings":"AAKA;;GAEG;AAIH,OAAO,EAAkC,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE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ACtD,UAAU,EAAE,wBAAwB,EACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,OAAO,EACf,YAAY,EAAE,MAAM,GACnB,aAAa,EAAE,GAAG,SAAS;IA4C9B;;;;;;;;;OASG;WACW,6BAA6B,CACzC,UAAU,EAAE,wBAAwB,EACpC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,aAAa,EAAE,GAAG,SAAS;IAkD9B,iDAAiD;WACnC,yBAAyB,CACrC,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,sBAAsB,GAAG,KAAK,GAAG,SAAS;CAsBrF"}
@@ -52,7 +52,7 @@ var MiteredSweepOutputSelect;
52
52
  * @public
53
53
  */
54
54
  class CurveFactory {
55
- /** (cautiously) construct and save a line segment between fractional positions. */
55
+ /** (Cautiously) construct and save a line segment between fractional positions. */
56
56
  static addPartialSegment(path, allowBackup, pointA, pointB, fraction0, fraction1) {
57
57
  if (allowBackup || (fraction1 > fraction0)) {
58
58
  if (pointA !== undefined && pointB !== undefined && !Geometry_1.Geometry.isAlmostEqualNumber(fraction0, fraction1))
@@ -149,10 +149,11 @@ class CurveFactory {
149
149
  }
150
150
  return path;
151
151
  }
152
- /** Create a `Loop` with given xy corners and fixed z.
152
+ /**
153
+ * Create a `Loop` with given xy corners and fixed z.
153
154
  * * The corners always proceed counter clockwise from lower left.
154
155
  * * If the radius is too large for the outer rectangle size, it is reduced to half of the the smaller x or y size.
155
- */
156
+ */
156
157
  static createRectangleXY(x0, y0, x1, y1, z = 0, filletRadius) {
157
158
  let radius = Geometry_1.Geometry.correctSmallMetricDistance(filletRadius);
158
159
  const xMin = Math.min(x0, x1);
@@ -161,7 +162,13 @@ class CurveFactory {
161
162
  const yMax = Math.max(y0, y1);
162
163
  radius = Math.min(Math.abs(radius), 0.5 * (xMax - xMin), 0.5 * (yMax - yMin));
163
164
  if (radius === 0.0)
164
- return Loop_1.Loop.createPolygon([Point3dVector3d_1.Point3d.create(xMin, yMin, z), Point3dVector3d_1.Point3d.create(xMax, yMin, z), Point3dVector3d_1.Point3d.create(xMax, yMax, z), Point3dVector3d_1.Point3d.create(xMin, yMax, z), Point3dVector3d_1.Point3d.create(xMin, yMin, z)]);
165
+ return Loop_1.Loop.createPolygon([
166
+ Point3dVector3d_1.Point3d.create(xMin, yMin, z),
167
+ Point3dVector3d_1.Point3d.create(xMax, yMin, z),
168
+ Point3dVector3d_1.Point3d.create(xMax, yMax, z),
169
+ Point3dVector3d_1.Point3d.create(xMin, yMax, z),
170
+ Point3dVector3d_1.Point3d.create(xMin, yMin, z),
171
+ ]);
165
172
  else {
166
173
  const vectorU = Point3dVector3d_1.Vector3d.create(radius, 0, 0);
167
174
  const vectorV = Point3dVector3d_1.Vector3d.create(0, radius, 0);
@@ -169,7 +176,12 @@ class CurveFactory {
169
176
  const y0A = yMin + radius;
170
177
  const x1A = xMax - radius;
171
178
  const y1A = yMax - radius;
172
- const centers = [Point3dVector3d_1.Point3d.create(x1A, y1A, z), Point3dVector3d_1.Point3d.create(x0A, y1A, z), Point3dVector3d_1.Point3d.create(x0A, y0A, z), Point3dVector3d_1.Point3d.create(x1A, y0A, z)];
179
+ const centers = [
180
+ Point3dVector3d_1.Point3d.create(x1A, y1A, z),
181
+ Point3dVector3d_1.Point3d.create(x0A, y1A, z),
182
+ Point3dVector3d_1.Point3d.create(x0A, y0A, z),
183
+ Point3dVector3d_1.Point3d.create(x1A, y0A, z),
184
+ ];
173
185
  const loop = Loop_1.Loop.create();
174
186
  for (let i = 0; i < 4; i++) {
175
187
  const center = centers[i];
@@ -189,10 +201,10 @@ class CurveFactory {
189
201
  /**
190
202
  * If `arcB` is a continuation of `arcA`, extend `arcA` (in place) to include the range of `arcB`
191
203
  * * This only succeeds if the two arcs are part of identical complete arcs and end of `arcA` matches the beginning of `arcB`.
192
- * @param arcA first arc, modified in place
193
- * @param arcB second arc, unmodified
194
- * @param allowReversed whether to consolidate even when second arc is reversed
195
- * @returns whether `arcA` was modified
204
+ * @param arcA first arc, modified in place.
205
+ * @param arcB second arc, unmodified.
206
+ * @param allowReversed whether to consolidate even when second arc is reversed.
207
+ * @returns whether `arcA` was modified.
196
208
  */
197
209
  static appendToArcInPlace(arcA, arcB, allowReverse = false) {
198
210
  if (arcA.center.isAlmostEqual(arcB.center)) {
@@ -208,7 +220,7 @@ class CurveFactory {
208
220
  arcA.sweep.setStartEndRadians(arcA.sweep.startRadians, arcA.sweep.startRadians + arcA.sweep.sweepRadians + sweepSign * arcB.sweep.sweepRadians);
209
221
  return true;
210
222
  }
211
- // Also ok if negated tangent . ..
223
+ // Also ok if negated tangent
212
224
  if (allowReverse) {
213
225
  startB.direction.scaleInPlace(-1.0);
214
226
  if (endA.isAlmostEqual(startB)) {
@@ -221,7 +233,8 @@ class CurveFactory {
221
233
  }
222
234
  /**
223
235
  * Return a `Path` containing arcs are on the surface of an ellipsoid and pass through a sequence of points.
224
- * * Each arc passes through the two given endpoints and in the plane containing the true surface normal at given `fractionForIntermediateNormal`
236
+ * * Each arc passes through the two given endpoints and in the plane containing the true surface normal at
237
+ * given `fractionForIntermediateNormal`
225
238
  * @param ellipsoid
226
239
  * @param pathPoints
227
240
  * @param fractionForIntermediateNormal fractional position for surface normal used to create the section plane.
@@ -244,7 +257,7 @@ class CurveFactory {
244
257
  }
245
258
  /**
246
259
  * Create solid primitives for pipe segments (e.g. Cone or TorusPipe) around line and arc primitives.
247
- * @param centerline centerline geometry/
260
+ * @param centerline centerline geometry.
248
261
  * @param pipeRadius radius of pipe.
249
262
  */
250
263
  static createPipeSegments(centerline, pipeRadius) {
@@ -270,16 +283,22 @@ class CurveFactory {
270
283
  return undefined;
271
284
  }
272
285
  /**
273
- * * Create section arcs for mitered pipe.
274
- * * At each end of each pipe, the pipe is cut by the plane that bisects the angle between successive pipe centerlines.
275
- * * The arc definitions are constructed so that lines between corresponding fractional positions on the arcs are
276
- * axial lines on the pipes.
277
- * * This means that each arc definition axes (aka vector0 and vector90) are _not_ perpendicular to each other.
278
- * * Circular or elliptical pipe cross sections can be specified by supplying either a radius, a pair of semi-axis lengths, or a full Arc3d.
279
- * * For semi-axis length input, x corresponds to an ellipse local axis nominally situated parallel to the xy-plane.
280
- * * The center of Arc3d input is translated to the centerline start point to act as initial cross section.
281
- * @param centerline centerline of pipe
282
- * @param sectionData circle radius, ellipse semi-axis lengths, or full Arc3d
286
+ * Create section arcs for mitered pipe.
287
+ * * At the end of each pipe segment, the pipe is mitered by the plane that bisects the angle between successive
288
+ * centerline segments.
289
+ * * The section arcs are constructed so that lines between corresponding fractional positions on the arcs are
290
+ * axial lines on the pipes.
291
+ * * This means that the initial arc's vector0 and vector90 lengths and angular separation are _not_ preserved in
292
+ * the section arcs.
293
+ * * Circular or elliptical pipe cross sections can be specified by supplying either a radius, a pair of semi-axis
294
+ * lengths, or an Arc3d:
295
+ * * For semi-axis length input, x and y correspond to ellipse local axes perpendicular to each other and to the
296
+ * start tangent.
297
+ * * For Arc3d input, the center is translated to the centerline start point, but otherwise the arc is used as-is
298
+ * for the first section. For best results, the arc should be perpendicular to the centerline start tangent.
299
+ * @param centerline centerline of pipe. For best results, ensure no successive duplicate points with e.g.,
300
+ * [[GrowableXYZArray.createCompressed]].
301
+ * @param sectionData circle radius, ellipse semi-axis lengths, or full Arc3d (if not full, function makes it full).
283
302
  */
284
303
  static createMiteredPipeSections(centerline, sectionData) {
285
304
  const arcs = [];
@@ -288,15 +307,15 @@ class CurveFactory {
288
307
  const vector0 = Point3dVector3d_1.Vector3d.create();
289
308
  const vector90 = Point3dVector3d_1.Vector3d.create();
290
309
  const vectorBC = Point3dVector3d_1.Vector3d.create();
291
- const currentCenter = Point3dVector3d_1.Point3d.create();
292
- centerline.vectorIndexIndex(0, 1, vectorBC);
293
- centerline.getPoint3dAtUncheckedPointIndex(0, currentCenter);
294
- let initialSection;
310
+ const sweep = AngleSweep_1.AngleSweep.create360();
311
+ centerline.vectorIndexIndex(0, 1, vectorBC); // initially, the start tangent
295
312
  if (sectionData instanceof Arc3d_1.Arc3d) {
296
- initialSection = sectionData.clone();
297
- initialSection.center.setFrom(currentCenter);
298
313
  vector0.setFrom(sectionData.vector0);
299
314
  vector90.setFrom(sectionData.vector90);
315
+ sweep.setFrom(sectionData.sweep); // allow e.g., half-pipe
316
+ const sectionFacesForward = sectionData.matrixRef.columnDotXYZ(Geometry_1.AxisIndex.Z, vectorBC.x, vectorBC.y, vectorBC.z) > 0;
317
+ if (sectionFacesForward !== sectionData.sweep.isCCW)
318
+ sweep.reverseInPlace();
300
319
  }
301
320
  else if (typeof sectionData === "number" || Point3dVector3d_1.Point3d.isXAndY(sectionData)) {
302
321
  const length0 = (typeof sectionData === "number") ? sectionData : sectionData.x;
@@ -304,31 +323,31 @@ class CurveFactory {
304
323
  const baseFrame = Matrix3d_1.Matrix3d.createRigidHeadsUp(vectorBC, Geometry_1.AxisOrder.ZXY);
305
324
  baseFrame.columnX(vector0).scaleInPlace(length0);
306
325
  baseFrame.columnY(vector90).scaleInPlace(length90);
307
- initialSection = Arc3d_1.Arc3d.create(currentCenter, vector0, vector90, AngleSweep_1.AngleSweep.create360());
308
326
  }
309
327
  else {
310
328
  return [];
311
329
  }
330
+ // ASSUME: initial section normal points toward sweep direction for subsequent facet creation
331
+ const initialSection = Arc3d_1.Arc3d.create(undefined, vector0, vector90, sweep);
332
+ centerline.getPoint3dAtUncheckedPointIndex(0, initialSection.centerRef);
312
333
  arcs.push(initialSection);
313
334
  const vectorAB = Point3dVector3d_1.Vector3d.create();
314
335
  const bisector = Point3dVector3d_1.Vector3d.create();
336
+ const center = Point3dVector3d_1.Point3d.create();
315
337
  for (let i = 1; i < centerline.length; i++) {
316
338
  vectorAB.setFromVector3d(vectorBC);
317
- centerline.getPoint3dAtUncheckedPointIndex(i, currentCenter);
318
- if (i + 1 < centerline.length) {
339
+ centerline.getPoint3dAtUncheckedPointIndex(i, center);
340
+ if (i + 1 < centerline.length)
319
341
  centerline.vectorIndexIndex(i, i + 1, vectorBC);
320
- }
321
- else {
342
+ else
322
343
  vectorBC.setFromVector3d(vectorAB);
323
- }
324
344
  if (vectorAB.normalizeInPlace() && vectorBC.normalizeInPlace()) {
325
345
  vectorAB.interpolate(0.5, vectorBC, bisector);
326
- // On the end ellipse for this pipe section. ..
327
- // center comes directly from centerline[i]
328
- // vector0 and vector90 are obtained by sweeping the corresponding vectors of the start ellipse to the split plane.
346
+ // At pipe end, the ellipse center comes directly from centerline[i], and vector0/vector90 are
347
+ // obtained by sweeping the corresponding vectors of the pipe start ellipse to the bisector plane.
329
348
  moveVectorToPlane(vector0, vectorAB, bisector, vector0);
330
349
  moveVectorToPlane(vector90, vectorAB, bisector, vector90);
331
- arcs.push(Arc3d_1.Arc3d.create(currentCenter, vector0, vector90, AngleSweep_1.AngleSweep.create360()));
350
+ arcs.push(Arc3d_1.Arc3d.create(center, vector0, vector90, sweep));
332
351
  }
333
352
  }
334
353
  return arcs;
@@ -337,21 +356,38 @@ class CurveFactory {
337
356
  * Sweep the initialSection along each segment of the centerLine until it hits the bisector plane at the next vertex.
338
357
  * * The caller should place the initialSection on a plane perpendicular to the first edge.
339
358
  * * This plane is commonly (but not necessarily) through the start point itself.
340
- * * If the geometry is not "on a perpendicular plane", the output geometry will still be flattened onto the various planes.
341
- * * In the "open path" case (i.e when wrapIfPhysicallyClosed is false or the path does not have matched first and last points)
342
- * the first/last output plane will be at the start/end of the first/last edge and on a perpendicular plane.
343
- * * In the "closed path" case, the output plane for the first and last point is the bisector of the start and end planes from the "open path" case,
344
- * and the first/last section geometry may be different from `initialSection`.
345
- * * The centerline path does NOT have to be planar, however twisting effects effects will appear in the various bisector planes.
346
- * @param centerline sweep path, e.g., as stroked from a smooth centerline curve
347
- * @param initialSection profile curve to be swept. As noted above, this should be on a plane perpendicular to the first segment of the centerline.
348
- * @param options options for computation and output
359
+ * * If the initialSection is not "on a perpendicular plane", the output geometry will still be flattened onto the
360
+ * various planes.
361
+ * * In the "open path" case (i.e when `wrapIfPhysicallyClosed` is false or the path does not have matched first and
362
+ * last points), the first/last output plane will be at the start/end of the first/last edge and on a perpendicular
363
+ * plane.
364
+ * * In the "closed path" case, if start/edn tangents are not provided in the `options`, then the output plane for the
365
+ * first and last point is the bisector of the start and end planes from the "open path" case, and the first/last
366
+ * section geometry may be different from `initialSection`.
367
+ * * The centerline path does NOT have to be planar, however twisting effects effects will appear in the various bisector
368
+ * planes.
369
+ * @param centerline sweep path, e.g., as stroked from a smooth centerline curve.
370
+ * @param initialSection profile curve to be swept. As noted above, this should be on a plane perpendicular to the
371
+ * first segment of the centerline.
372
+ * @param options options for computation and output.
349
373
  * @return array of sections, starting with `initialSection` projected along the first edge to the first plane.
350
374
  */
351
375
  static createMiteredSweepSections(centerline, initialSection, options) {
352
376
  const sectionData = { sections: [], planes: [] };
353
377
  const planes = PolylineOps_1.PolylineOps.createBisectorPlanesForDistinctPoints(centerline, options.wrapIfPhysicallyClosed);
378
+ // apply start/end tangent options
354
379
  if (planes !== undefined && planes.length > 1) {
380
+ const firstPlane = planes[0];
381
+ const lastPlane = planes[planes.length - 1];
382
+ const startTang = options.startTangent;
383
+ const endTang = options.endTangent;
384
+ if (!firstPlane.getOriginRef().isAlmostEqual(lastPlane.getOriginRef()) ||
385
+ (startTang && endTang && startTang.isAlmostEqual(endTang, 0.0))) {
386
+ if (startTang?.tryNormalizeInPlace())
387
+ firstPlane.getNormalRef().setFrom(startTang);
388
+ if (endTang?.tryNormalizeInPlace())
389
+ lastPlane.getNormalRef().setFrom(endTang);
390
+ }
355
391
  // Projection to target plane, constructing sweep direction from two given planes.
356
392
  // If successful, push the target plane and swept section to the output arrays and return the swept section.
357
393
  // If unsuccessful, leave the output arrays alone and return the input section.
@@ -360,12 +396,12 @@ class CurveFactory {
360
396
  const transform = Transform_1.Transform.createFlattenAlongVectorToPlane(sweepVector, targetPlane.getOriginRef(), targetPlane.getNormalRef());
361
397
  if (transform === undefined)
362
398
  return section;
363
- const section1 = section.cloneTransformed(transform);
364
- if (section1 === undefined)
399
+ const transformedSection = section.cloneTransformed(transform);
400
+ if (transformedSection === undefined)
365
401
  return section;
366
402
  sectionData.planes.push(targetPlane);
367
- sectionData.sections.push(section1);
368
- return section1;
403
+ sectionData.sections.push(transformedSection);
404
+ return transformedSection;
369
405
  };
370
406
  let currentSection = doSweepToPlane(planes[0], planes[1], planes[0], initialSection);
371
407
  for (let i = 1; i < planes.length; i++) {
@@ -401,11 +437,11 @@ class CurveFactory {
401
437
  /**
402
438
  * Compute 2 spirals (all in XY) for a symmetric line-to-line transition.
403
439
  * * First spiral begins at given start point.
404
- * * first tangent aims at shoulder
440
+ * * first tangent aims at shoulder.
405
441
  * * outbound spiral joins line from shoulder to target.
406
- * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE
442
+ * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE.
407
443
  * @param startPoint inbound start point.
408
- * @param shoulder point target point for (both) spiral-to-line tangencies
444
+ * @param shoulder point target point for (both) spiral-to-line tangencies.
409
445
  * @return array with the computed spirals, or undefined if failure.
410
446
  */
411
447
  static createLineSpiralSpiralLine(spiralType, startPoint, shoulderPoint, targetPoint) {
@@ -443,9 +479,9 @@ class CurveFactory {
443
479
  * Compute 2 spirals (all in XY) for a symmetric line-to-line transition.
444
480
  * * Spiral length is given.
445
481
  * * tangency points float on both lines.
446
- * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE
482
+ * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE.
447
483
  * @param pointA inbound start point.
448
- * @param shoulder point target point for (both) spiral-to-line tangencies
484
+ * @param shoulder point target point for (both) spiral-to-line tangencies.
449
485
  * @param spiralLength for each part of the spiral pair.
450
486
  * @return array with the computed spirals, or undefined if failure.
451
487
  */
@@ -483,12 +519,12 @@ class CurveFactory {
483
519
  }
484
520
  /**
485
521
  * Compute 2 spirals and an arc (all in XY) for a symmetric line-to-line transition.
486
- * Spiral lengths and arc radius are given. (e.g. from design speed standards.)
487
- * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE
522
+ * Spiral lengths and arc radius are given (e.g., from design speed standards).
523
+ * @param spiralType name of spiral type. THIS MUST BE AN "Integrated" SPIRAL TYPE.
488
524
  * @param pointA inbound start point.
489
- * @param pointB shoulder (target) point for (both) spiral-to-line tangencies
490
- * @param lengthA inbound spiral length
491
- * @param lengthB outbound spiral length
525
+ * @param pointB shoulder (target) point for (both) spiral-to-line tangencies.
526
+ * @param lengthA inbound spiral length.
527
+ * @param lengthB outbound spiral length.
492
528
  * @return array with the computed spirals, or undefined if failure.
493
529
  */
494
530
  static createLineSpiralArcSpiralLine(spiralType, pointA, pointB, pointC, lengthA, lengthB, arcRadius) {
@@ -538,12 +574,7 @@ class CurveFactory {
538
574
  }
539
575
  return undefined;
540
576
  }
541
- /**
542
- * Return the intersection point of 3 planes.
543
- * @param planeA
544
- * @param planeB
545
- * @param planeC
546
- */
577
+ /** Return the intersection point of 3 planes. */
547
578
  static planePlaneIntersectionRay(planeA, planeB) {
548
579
  const altitudeA = planeA.altitudeXYZ(0, 0, 0);
549
580
  const altitudeB = planeB.altitudeXYZ(0, 0, 0);
@@ -564,9 +595,7 @@ class CurveFactory {
564
595
  }
565
596
  }
566
597
  exports.CurveFactory = CurveFactory;
567
- /**
568
- * Starting at vectorR, move parallel to vectorV until perpendicular to planeNormal
569
- */
598
+ /** Starting at vectorR, move parallel to vectorV until perpendicular to planeNormal. */
570
599
  function moveVectorToPlane(vectorR, vectorV, planeNormal, result) {
571
600
  // find s such that (vectorR + s * vectorV) DOT planeNormal = 0.
572
601
  const dotRN = vectorR.dotProduct(planeNormal);