@itwin/core-geometry 4.1.0-dev.4 → 4.1.0-dev.5

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 (79) hide show
  1. package/lib/cjs/curve/Arc3d.d.ts +70 -86
  2. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  3. package/lib/cjs/curve/Arc3d.js +109 -96
  4. package/lib/cjs/curve/Arc3d.js.map +1 -1
  5. package/lib/cjs/curve/CurveCollection.d.ts +47 -30
  6. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  7. package/lib/cjs/curve/CurveCollection.js +63 -34
  8. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  9. package/lib/cjs/curve/CurveLocationDetail.d.ts +40 -41
  10. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  11. package/lib/cjs/curve/CurveLocationDetail.js +31 -35
  12. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  13. package/lib/cjs/curve/CurvePrimitive.d.ts +137 -92
  14. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  15. package/lib/cjs/curve/CurvePrimitive.js +114 -75
  16. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  17. package/lib/cjs/curve/GeometryQuery.d.ts +26 -20
  18. package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
  19. package/lib/cjs/curve/GeometryQuery.js +11 -9
  20. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  21. package/lib/cjs/curve/LineSegment3d.d.ts +34 -25
  22. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  23. package/lib/cjs/curve/LineSegment3d.js +76 -38
  24. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  25. package/lib/cjs/curve/LineString3d.d.ts +70 -51
  26. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  27. package/lib/cjs/curve/LineString3d.js +120 -71
  28. package/lib/cjs/curve/LineString3d.js.map +1 -1
  29. package/lib/cjs/curve/Query/StrokeCountMap.d.ts +14 -13
  30. package/lib/cjs/curve/Query/StrokeCountMap.d.ts.map +1 -1
  31. package/lib/cjs/curve/Query/StrokeCountMap.js +9 -8
  32. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  33. package/lib/cjs/curve/StrokeOptions.d.ts +29 -21
  34. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  35. package/lib/cjs/curve/StrokeOptions.js +44 -22
  36. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  37. package/lib/cjs/geometry3d/Matrix3d.d.ts +2 -2
  38. package/lib/cjs/geometry3d/Matrix3d.js +2 -2
  39. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  40. package/lib/esm/curve/Arc3d.d.ts +70 -86
  41. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  42. package/lib/esm/curve/Arc3d.js +109 -96
  43. package/lib/esm/curve/Arc3d.js.map +1 -1
  44. package/lib/esm/curve/CurveCollection.d.ts +47 -30
  45. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  46. package/lib/esm/curve/CurveCollection.js +63 -34
  47. package/lib/esm/curve/CurveCollection.js.map +1 -1
  48. package/lib/esm/curve/CurveLocationDetail.d.ts +40 -41
  49. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  50. package/lib/esm/curve/CurveLocationDetail.js +31 -35
  51. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  52. package/lib/esm/curve/CurvePrimitive.d.ts +137 -92
  53. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  54. package/lib/esm/curve/CurvePrimitive.js +114 -75
  55. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  56. package/lib/esm/curve/GeometryQuery.d.ts +26 -20
  57. package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
  58. package/lib/esm/curve/GeometryQuery.js +11 -9
  59. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  60. package/lib/esm/curve/LineSegment3d.d.ts +34 -25
  61. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  62. package/lib/esm/curve/LineSegment3d.js +76 -38
  63. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  64. package/lib/esm/curve/LineString3d.d.ts +70 -51
  65. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  66. package/lib/esm/curve/LineString3d.js +120 -71
  67. package/lib/esm/curve/LineString3d.js.map +1 -1
  68. package/lib/esm/curve/Query/StrokeCountMap.d.ts +14 -13
  69. package/lib/esm/curve/Query/StrokeCountMap.d.ts.map +1 -1
  70. package/lib/esm/curve/Query/StrokeCountMap.js +9 -8
  71. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  72. package/lib/esm/curve/StrokeOptions.d.ts +29 -21
  73. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  74. package/lib/esm/curve/StrokeOptions.js +44 -22
  75. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  76. package/lib/esm/geometry3d/Matrix3d.d.ts +2 -2
  77. package/lib/esm/geometry3d/Matrix3d.js +2 -2
  78. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  79. package/package.json +3 -3
@@ -38,7 +38,7 @@ export var CurveSearchStatus;
38
38
  CurveSearchStatus[CurveSearchStatus["stoppedAtBoundary"] = 2] = "stoppedAtBoundary";
39
39
  })(CurveSearchStatus || (CurveSearchStatus = {}));
40
40
  /**
41
- * use to update a vector in case where source and prior result are both possibly undefined.
41
+ * Use to update a vector in case where source and prior result are both possibly undefined.
42
42
  * * Any undefined source returns undefined.
43
43
  * * For defined source, reuse optional result if available.
44
44
  * @param source optional source
@@ -57,6 +57,7 @@ function optionalVectorUpdate(source, result) {
57
57
  * @public
58
58
  */
59
59
  export class CurveLocationDetail {
60
+ /** constructor */
60
61
  constructor() {
61
62
  this.pointQ = Point3d.createZero();
62
63
  this.fraction = 0;
@@ -72,21 +73,22 @@ export class CurveLocationDetail {
72
73
  this.fraction1 = fraction1;
73
74
  this.point1 = point1;
74
75
  }
75
- /** test if this pair has fraction1 defined */
76
+ /** Test if this pair has fraction1 defined */
76
77
  get hasFraction1() {
77
78
  return this.fraction1 !== undefined;
78
79
  }
79
- /** test if this is an isolated point. This is true if intervalRole is any of (undefined, isolated, isolatedAtVertex) */
80
+ /** Test if this is an isolated point. This is true if intervalRole is any of (undefined, isolated, isolatedAtVertex) */
80
81
  get isIsolated() {
81
82
  return this.intervalRole === undefined
82
83
  || this.intervalRole === CurveIntervalRole.isolated
83
84
  || this.intervalRole === CurveIntervalRole.isolatedAtVertex;
84
85
  }
85
- /** return the fraction delta. (0 if no fraction1) */
86
+ /** Return the fraction delta. (0 if no fraction1) */
86
87
  get fractionDelta() {
87
88
  return this.fraction1 !== undefined ? this.fraction1 - this.fraction : 0.0;
88
89
  }
89
- /** If (fraction1, point1) are defined, make them the primary (and only) data.
90
+ /**
91
+ * If (fraction1, point1) are defined, make them the primary (and only) data.
90
92
  * * No action if undefined.
91
93
  */
92
94
  collapseToEnd() {
@@ -99,14 +101,16 @@ export class CurveLocationDetail {
99
101
  this.point1 = undefined;
100
102
  }
101
103
  }
102
- /** make (fraction, point) the primary (and only) data.
104
+ /**
105
+ * Make (fraction, point) the primary (and only) data.
103
106
  * * No action if undefined.
104
107
  */
105
108
  collapseToStart() {
106
109
  this.fraction1 = undefined;
107
110
  this.point1 = undefined;
108
111
  }
109
- /** Return a complete copy, WITH CAVEATS . . .
112
+ /**
113
+ * Return a complete copy, WITH CAVEATS . . .
110
114
  * * curve member is copied as a reference.
111
115
  * * point and vector members are cloned.
112
116
  */
@@ -150,22 +154,19 @@ export class CurveLocationDetail {
150
154
  setFR(fraction, ray, a = 0) {
151
155
  return this.setFP(fraction, ray.origin, ray.direction, a);
152
156
  }
153
- /** Set the CurvePrimitive pointer, leaving all other properties untouched.
154
- */
157
+ /** Set the CurvePrimitive pointer, leaving all other properties untouched. */
155
158
  setCurve(curve) { this.curve = curve; }
156
159
  /** record the distance from the CurveLocationDetail's point to the parameter point. */
157
160
  setDistanceTo(point) {
158
161
  this.a = this.point.distance(point);
159
162
  }
160
- /** create with a CurvePrimitive pointer but no coordinate data.
161
- */
163
+ /** Create with a CurvePrimitive pointer but no coordinate data. */
162
164
  static create(curve, result) {
163
165
  result = result ? result : new CurveLocationDetail();
164
166
  result.curve = curve;
165
167
  return result;
166
168
  }
167
- /** create with CurvePrimitive pointer, fraction, and point coordinates.
168
- */
169
+ /** Create with CurvePrimitive pointer, fraction, and point coordinates. */
169
170
  static createCurveFractionPoint(curve, fraction, point, result) {
170
171
  result = result ? result : new CurveLocationDetail();
171
172
  result.curve = curve;
@@ -176,9 +177,7 @@ export class CurveLocationDetail {
176
177
  result.curveSearchStatus = undefined;
177
178
  return result;
178
179
  }
179
- /**
180
- * Create a new detail with only ray, fraction, and point.
181
- */
180
+ /** Create a new detail with only ray, fraction, and point. */
182
181
  static createRayFractionPoint(ray, fraction, point, result) {
183
182
  result = result ? result : new CurveLocationDetail();
184
183
  result.fraction = fraction;
@@ -186,8 +185,7 @@ export class CurveLocationDetail {
186
185
  result.point.setFromPoint3d(point);
187
186
  return result;
188
187
  }
189
- /** create with CurvePrimitive pointer, fraction, and point coordinates
190
- */
188
+ /** Create with CurvePrimitive pointer, fraction, and point coordinates */
191
189
  static createCurveFractionPointDistanceCurveSearchStatus(curve, fraction, point, distance, status, result) {
192
190
  result = result ? result : new CurveLocationDetail();
193
191
  result.curve = curve;
@@ -198,9 +196,7 @@ export class CurveLocationDetail {
198
196
  result.curveSearchStatus = status;
199
197
  return result;
200
198
  }
201
- /** create with curveSearchStatus affected by allowExtension.
202
- * *
203
- */
199
+ /** Create with curveSearchStatus affected by allowExtension. */
204
200
  static createConditionalMoveSignedDistance(allowExtension, curve, startFraction, endFraction, requestedSignedDistance, result) {
205
201
  let a = requestedSignedDistance;
206
202
  let status = CurveSearchStatus.success;
@@ -226,8 +222,7 @@ export class CurveLocationDetail {
226
222
  result.curveSearchStatus = status;
227
223
  return result;
228
224
  }
229
- /** create with CurvePrimitive pointer and fraction for evaluation.
230
- */
225
+ /** Create with CurvePrimitive pointer and fraction for evaluation. */
231
226
  static createCurveEvaluatedFraction(curve, fraction, result) {
232
227
  result = result ? result : new CurveLocationDetail();
233
228
  result.curve = curve;
@@ -238,8 +233,7 @@ export class CurveLocationDetail {
238
233
  result.a = 0.0;
239
234
  return result;
240
235
  }
241
- /** create with CurvePrimitive pointer and fraction for evaluation.
242
- */
236
+ /** Create with CurvePrimitive pointer and fraction for evaluation. */
243
237
  static createCurveEvaluatedFractionPointAndDerivative(curve, fraction, result) {
244
238
  result = result ? result : new CurveLocationDetail();
245
239
  result.curve = curve;
@@ -251,8 +245,7 @@ export class CurveLocationDetail {
251
245
  result.a = 0.0;
252
246
  return result;
253
247
  }
254
- /** create with CurvePrimitive pointer and 2 fractions for evaluation.
255
- */
248
+ /** Create with CurvePrimitive pointer and 2 fractions for evaluation. */
256
249
  static createCurveEvaluatedFractionFraction(curve, fraction0, fraction1, result) {
257
250
  result = result ? result : new CurveLocationDetail();
258
251
  result.curve = curve;
@@ -265,8 +258,7 @@ export class CurveLocationDetail {
265
258
  result.a = 0.0;
266
259
  return result;
267
260
  }
268
- /** create with CurvePrimitive pointer, fraction, and point coordinates.
269
- */
261
+ /** Create with CurvePrimitive pointer, fraction, and point coordinates. */
270
262
  static createCurveFractionPointDistance(curve, fraction, point, a, result) {
271
263
  result = result ? result : new CurveLocationDetail();
272
264
  result.curve = curve;
@@ -277,7 +269,8 @@ export class CurveLocationDetail {
277
269
  result.curveSearchStatus = undefined;
278
270
  return result;
279
271
  }
280
- /** update or create if closer than current contents.
272
+ /**
273
+ * Update or create if closer than current contents.
281
274
  * @param curve candidate curve
282
275
  * @param fraction candidate fraction
283
276
  * @param point candidate point
@@ -291,7 +284,7 @@ export class CurveLocationDetail {
291
284
  return true;
292
285
  }
293
286
  /**
294
- * * Exchange the (fraction,fraction1) and (point, point1) pairs.
287
+ * Exchange the (fraction,fraction1) and (point, point1) pairs.
295
288
  * * (Skip each swap if its "1" value is undefined)
296
289
  */
297
290
  swapFractionsAndPoints() {
@@ -307,7 +300,7 @@ export class CurveLocationDetail {
307
300
  }
308
301
  }
309
302
  /**
310
- * * return the fraction where f falls between fraction and fraction1.
303
+ * Return the fraction where f falls between fraction and fraction1.
311
304
  * * ASSUME fraction1 defined
312
305
  */
313
306
  inverseInterpolateFraction(f, defaultFraction = 0) {
@@ -330,7 +323,8 @@ export class CurveLocationDetail {
330
323
  return detailB;
331
324
  }
332
325
  }
333
- /** Enumeration of configurations for intersections and min/max distance-between-curve
326
+ /**
327
+ * Enumeration of configurations for intersections and min/max distance-between-curve
334
328
  * @public
335
329
  */
336
330
  export var CurveCurveApproachType;
@@ -344,7 +338,8 @@ export var CurveCurveApproachType;
344
338
  /** Completely parallel geometry. */
345
339
  CurveCurveApproachType[CurveCurveApproachType["ParallelGeometry"] = 3] = "ParallelGeometry";
346
340
  })(CurveCurveApproachType || (CurveCurveApproachType = {}));
347
- /** A pair of CurveLocationDetail.
341
+ /**
342
+ * A pair of CurveLocationDetail.
348
343
  * @public
349
344
  */
350
345
  export class CurveLocationDetailPair {
@@ -359,7 +354,8 @@ export class CurveLocationDetailPair {
359
354
  result.detailB = detailB;
360
355
  return result;
361
356
  }
362
- /** Create a curve detail pair using references to two CurveLocationDetails.
357
+ /**
358
+ * Create a curve detail pair using references to two CurveLocationDetails.
363
359
  * * optionally install in reversed positions
364
360
  */
365
361
  static createCaptureOptionalReverse(detailA, detailB, reversed, result) {
@@ -1 +1 @@
1
- {"version":3,"file":"CurveLocationDetail.js","sourceRoot":"","sources":["../../../src/curve/CurveLocationDetail.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAIlE;;;GAGG;AACH,MAAM,CAAN,IAAY,iBAWX;AAXD,WAAY,iBAAiB;IAC3B,+DAA+D;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,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,uBAAuB,EAAE,CAAC;QACzD,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACtC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACtC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,+BAA+B;IACxB,WAAW;QAChB,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACnB,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\nimport { Geometry } from \"../Geometry\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\n\r\n/**\r\n * An enumeration of special conditions being described by a CurveLocationDetail.\r\n * @public\r\n */\r\nexport enum CurveIntervalRole {\r\n /** This point is an isolated point NOT at a primary vertex. */\r\n isolated = 0,\r\n /** This point is an isolated vertex hit */\r\n isolatedAtVertex = 1,\r\n /** This is the beginning of an interval */\r\n intervalStart = 10,\r\n /** This is an interior point of an interval. */\r\n intervalInterior = 11,\r\n /** This is the end of an interval */\r\n intervalEnd = 12,\r\n}\r\n/**\r\n * Return code for CurvePrimitive method `moveSignedDistanceFromFraction`\r\n * @public\r\n */\r\nexport enum CurveSearchStatus {\r\n /** unimplemented or zero length curve */\r\n error,\r\n /** complete success of search */\r\n success = 1,\r\n /** search ended prematurely (e.g. at incomplete distance moved) at start or end of curve */\r\n stoppedAtBoundary = 2,\r\n}\r\n\r\n/**\r\n * use to update a vector in case where source and prior result are both possibly undefined.\r\n * * Any undefined source returns undefined.\r\n * * For defined source, reuse optional result if available.\r\n * @param source optional source\r\n * @param result optional result\r\n */\r\nfunction optionalVectorUpdate(source: Vector3d | undefined, result: Vector3d | undefined): Vector3d | undefined {\r\n if (source) {\r\n return source.clone(result);\r\n }\r\n return undefined;\r\n}\r\n/**\r\n * CurveLocationDetail carries point and parameter data about a point evaluated on a curve.\r\n * * These are returned by a variety of queries.\r\n * * Particular contents can vary among the queries.\r\n * @public\r\n */\r\nexport class CurveLocationDetail {\r\n /** The curve being evaluated */\r\n public curve?: CurvePrimitive;\r\n /** optional ray */\r\n public ray?: Ray3d;\r\n /** The fractional position along the curve */\r\n public fraction: number;\r\n /** Detail condition of the role this point has in some context */\r\n public intervalRole?: CurveIntervalRole;\r\n /** The point on the curve */\r\n public point: Point3d;\r\n /** A vector (e.g. tangent vector) in context */\r\n public vectorInCurveLocationDetail?: Vector3d;\r\n /** A context-specific numeric value. (E.g. a distance) */\r\n public a: number;\r\n /** optional CurveLocationDetail with more detail of location. For instance, a detail for fractional position within\r\n * a CurveChainWithDistanceIndex returns fraction and distance along the chain as its primary data and\r\n * further detail of the particular curve within the chain in the childDetail.\r\n */\r\n public childDetail?: CurveLocationDetail;\r\n /** A status indicator for certain searches.\r\n * * e.g. CurvePrimitive.moveSignedDistanceFromFraction\r\n */\r\n public curveSearchStatus?: CurveSearchStatus;\r\n /** (optional) second fraction, e.g. end of interval of coincident curves */\r\n public fraction1?: number;\r\n /** (optional) second point, e.g. end of interval of coincident curves */\r\n public point1?: Point3d;\r\n /** A context-specific additional point */\r\n public pointQ: Point3d; // extra point for use in computations\r\n\r\n public constructor() {\r\n this.pointQ = Point3d.createZero();\r\n this.fraction = 0;\r\n this.point = Point3d.createZero();\r\n this.a = 0.0;\r\n }\r\n /** Set the (optional) intervalRole field */\r\n public setIntervalRole(value: CurveIntervalRole): void {\r\n this.intervalRole = value;\r\n }\r\n /** Set the (optional) fraction1 and point1, using direct assignment (capture!) to point1 */\r\n public captureFraction1Point1(fraction1: number, point1: Point3d): void {\r\n this.fraction1 = fraction1;\r\n this.point1 = point1;\r\n }\r\n\r\n /** test if this pair has fraction1 defined */\r\n public get hasFraction1(): boolean {\r\n return this.fraction1 !== undefined;\r\n }\r\n\r\n /** test if this is an isolated point. This is true if intervalRole is any of (undefined, isolated, isolatedAtVertex) */\r\n public get isIsolated(): boolean {\r\n return this.intervalRole === undefined\r\n || this.intervalRole === CurveIntervalRole.isolated\r\n || this.intervalRole === CurveIntervalRole.isolatedAtVertex;\r\n }\r\n\r\n /** return the fraction delta. (0 if no fraction1) */\r\n public get fractionDelta(): number {\r\n return this.fraction1 !== undefined ? this.fraction1 - this.fraction : 0.0;\r\n }\r\n\r\n /** If (fraction1, point1) are defined, make them the primary (and only) data.\r\n * * No action if undefined.\r\n */\r\n public collapseToEnd() {\r\n if (this.fraction1 !== undefined) {\r\n this.fraction = this.fraction1;\r\n this.fraction1 = undefined;\r\n }\r\n if (this.point1) {\r\n this.point = this.point1;\r\n this.point1 = undefined;\r\n }\r\n }\r\n\r\n /** make (fraction, point) the primary (and only) data.\r\n * * No action if undefined.\r\n */\r\n public collapseToStart() {\r\n this.fraction1 = undefined;\r\n this.point1 = undefined;\r\n }\r\n\r\n /** Return a complete copy, WITH CAVEATS . . .\r\n * * curve member is copied as a reference.\r\n * * point and vector members are cloned.\r\n */\r\n public clone(result?: CurveLocationDetail): CurveLocationDetail {\r\n if (result === this)\r\n return result;\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = this.curve;\r\n result.fraction = this.fraction;\r\n result.fraction1 = this.fraction1;\r\n result.point1 = this.point1;\r\n result.point.setFromPoint3d(this.point);\r\n result.vectorInCurveLocationDetail = optionalVectorUpdate(this.vectorInCurveLocationDetail, result.vectorInCurveLocationDetail);\r\n result.a = this.a;\r\n result.curveSearchStatus = this.curveSearchStatus;\r\n return result;\r\n }\r\n\r\n /**\r\n * Updated in this instance.\r\n * * Note that if caller omits `vector` and `a`, those fields are updated to the call-list defaults (NOT left as-is)\r\n * * point and vector updates are by data copy (not capture of pointers)\r\n * @param fraction (required) fraction to install\r\n * @param point (required) point to install\r\n * @param vector (optional) vector to install.\r\n * @param a (optional) numeric value to install.\r\n */\r\n public setFP(fraction: number, point: Point3d, vector?: Vector3d, a: number = 0.0) {\r\n this.fraction = fraction;\r\n this.point.setFrom(point);\r\n this.vectorInCurveLocationDetail = optionalVectorUpdate(vector, this.vectorInCurveLocationDetail);\r\n this.a = a;\r\n }\r\n\r\n /**\r\n * Updated in this instance.\r\n * * Note that if caller omits a`, that field is updated to the call-list default (NOT left as-is)\r\n * * point and vector updates are by data copy (not capture of the ray members)\r\n * @param fraction (required) fraction to install\r\n * @param ray (required) point and vector to install\r\n * @param a (optional) numeric value to install.\r\n */\r\n public setFR(fraction: number, ray: Ray3d, a: number = 0) {\r\n return this.setFP(fraction, ray.origin, ray.direction, a);\r\n }\r\n /** Set the CurvePrimitive pointer, leaving all other properties untouched.\r\n */\r\n public setCurve(curve: CurvePrimitive) { this.curve = curve; }\r\n\r\n /** record the distance from the CurveLocationDetail's point to the parameter point. */\r\n public setDistanceTo(point: Point3d) {\r\n this.a = this.point.distance(point);\r\n }\r\n\r\n /** create with a CurvePrimitive pointer but no coordinate data.\r\n */\r\n public static create(\r\n curve?: CurvePrimitive,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n return result;\r\n }\r\n\r\n /** create with CurvePrimitive pointer, fraction, and point coordinates.\r\n */\r\n public static createCurveFractionPoint(\r\n curve: CurvePrimitive | undefined,\r\n fraction: number,\r\n point: Point3d,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n result.point.setFromPoint3d(point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = 0.0;\r\n result.curveSearchStatus = undefined;\r\n return result;\r\n }\r\n /**\r\n * Create a new detail with only ray, fraction, and point.\r\n */\r\n public static createRayFractionPoint(ray: Ray3d, fraction: number, point: Point3d, result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.fraction = fraction;\r\n result.ray = ray;\r\n result.point.setFromPoint3d(point);\r\n return result;\r\n }\r\n\r\n /** create with CurvePrimitive pointer, fraction, and point coordinates\r\n */\r\n public static createCurveFractionPointDistanceCurveSearchStatus(\r\n curve: CurvePrimitive | undefined,\r\n fraction: number,\r\n point: Point3d,\r\n distance: number,\r\n status: CurveSearchStatus,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n result.point.setFromPoint3d(point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = distance;\r\n result.curveSearchStatus = status;\r\n return result;\r\n }\r\n /** create with curveSearchStatus affected by allowExtension.\r\n * *\r\n */\r\n public static createConditionalMoveSignedDistance(\r\n allowExtension: boolean,\r\n curve: CurvePrimitive,\r\n startFraction: number,\r\n endFraction: number,\r\n requestedSignedDistance: number,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n let a = requestedSignedDistance;\r\n let status = CurveSearchStatus.success;\r\n if (!allowExtension && !Geometry.isIn01(endFraction)) {\r\n // cap the movement at the endpoint\r\n if (endFraction < 0.0) {\r\n a = - curve.curveLengthBetweenFractions(startFraction, 0.0);\r\n endFraction = 0.0;\r\n status = CurveSearchStatus.stoppedAtBoundary;\r\n } else if (endFraction > 1.0) {\r\n endFraction = 1.0;\r\n a = curve.curveLengthBetweenFractions(startFraction, 1.0);\r\n status = CurveSearchStatus.stoppedAtBoundary;\r\n }\r\n }\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = endFraction;\r\n result.point = curve.fractionToPoint(endFraction, result.point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = a;\r\n result.curveSearchStatus = status;\r\n return result;\r\n }\r\n\r\n /** create with CurvePrimitive pointer and fraction for evaluation.\r\n */\r\n public static createCurveEvaluatedFraction(\r\n curve: CurvePrimitive,\r\n fraction: number,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n result.point = curve.fractionToPoint(fraction);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.curveSearchStatus = undefined;\r\n result.a = 0.0;\r\n return result;\r\n }\r\n /** create with CurvePrimitive pointer and fraction for evaluation.\r\n */\r\n public static createCurveEvaluatedFractionPointAndDerivative(\r\n curve: CurvePrimitive,\r\n fraction: number,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n const ray = curve.fractionToPointAndDerivative(fraction);\r\n result.point = ray.origin;\r\n result.vectorInCurveLocationDetail = ray.direction;\r\n result.curveSearchStatus = undefined;\r\n result.a = 0.0;\r\n return result;\r\n }\r\n\r\n /** create with CurvePrimitive pointer and 2 fractions for evaluation.\r\n */\r\n public static createCurveEvaluatedFractionFraction(\r\n curve: CurvePrimitive,\r\n fraction0: number,\r\n fraction1: number,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction0;\r\n result.point = curve.fractionToPoint(fraction0);\r\n result.fraction1 = fraction1;\r\n result.point1 = curve.fractionToPoint(fraction1);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.curveSearchStatus = undefined;\r\n result.a = 0.0;\r\n return result;\r\n }\r\n\r\n /** create with CurvePrimitive pointer, fraction, and point coordinates.\r\n */\r\n public static createCurveFractionPointDistance(\r\n curve: CurvePrimitive,\r\n fraction: number,\r\n point: Point3d,\r\n a: number,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n result.point.setFromPoint3d(point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = a;\r\n result.curveSearchStatus = undefined;\r\n return result;\r\n }\r\n\r\n /** update or create if closer than current contents.\r\n * @param curve candidate curve\r\n * @param fraction candidate fraction\r\n * @param point candidate point\r\n * @param a candidate distance\r\n * @returns true if the given distance is smaller (and hence this detail was updated.)\r\n */\r\n public updateIfCloserCurveFractionPointDistance(\r\n curve: CurvePrimitive,\r\n fraction: number,\r\n point: Point3d,\r\n a: number): boolean {\r\n if (this.a < a)\r\n return false;\r\n CurveLocationDetail.createCurveFractionPointDistance(curve, fraction, point, a, this);\r\n return true;\r\n }\r\n /**\r\n * * Exchange the (fraction,fraction1) and (point, point1) pairs.\r\n * * (Skip each swap if its \"1\" value is undefined)\r\n */\r\n public swapFractionsAndPoints() {\r\n if (this.fraction1 !== undefined) {\r\n const f = this.fraction; this.fraction = this.fraction1; this.fraction1 = f;\r\n }\r\n if (this.point1 !== undefined) {\r\n const p = this.point; this.point = this.point1; this.point1 = p;\r\n }\r\n }\r\n /**\r\n * * return the fraction where f falls between fraction and fraction1.\r\n * * ASSUME fraction1 defined\r\n */\r\n public inverseInterpolateFraction(f: number, defaultFraction: number = 0): number {\r\n const a = Geometry.inverseInterpolate01(this.fraction, this.fraction1!, f);\r\n if (a === undefined)\r\n return defaultFraction;\r\n return a;\r\n }\r\n /**\r\n * Return the detail with smaller `a` value -- detailA returned if equal.\r\n * @param detailA first candidate\r\n * @param detailB second candidate\r\n */\r\n public static chooseSmallerA(detailA: CurveLocationDetail | undefined, detailB: CurveLocationDetail | undefined): CurveLocationDetail | undefined {\r\n if (detailA) {\r\n if (!detailB)\r\n return detailA;\r\n return detailA.a <= detailB.a ? detailA : detailB;\r\n }\r\n return detailB;\r\n }\r\n}\r\n/** Enumeration of configurations for intersections and min/max distance-between-curve\r\n * @public\r\n */\r\nexport enum CurveCurveApproachType {\r\n /** Intersection at a single point */\r\n Intersection = 0,\r\n /** Distinct points on the two curves, with each curve's tangent perpendicular to the chord between the points */\r\n PerpendicularChord = 1,\r\n /** Completely coincident geometry */\r\n CoincidentGeometry = 2,\r\n /** Completely parallel geometry. */\r\n ParallelGeometry = 3,\r\n}\r\n/** A pair of CurveLocationDetail.\r\n * @public\r\n */\r\nexport class CurveLocationDetailPair {\r\n /** The first of the two details ... */\r\n public detailA: CurveLocationDetail;\r\n /** The second of the two details ... */\r\n public detailB: CurveLocationDetail;\r\n /** enumeration of how the detail pairs relate.\r\n * * This is set only by certain closeApproach calculations.\r\n */\r\n public approachType?: CurveCurveApproachType;\r\n\r\n public constructor(detailA?: CurveLocationDetail, detailB?: CurveLocationDetail) {\r\n this.detailA = detailA ? detailA : new CurveLocationDetail();\r\n this.detailB = detailB ? detailB : new CurveLocationDetail();\r\n }\r\n\r\n /** Create a curve detail pair using references to two CurveLocationDetails */\r\n public static createCapture(detailA: CurveLocationDetail, detailB: CurveLocationDetail, result?: CurveLocationDetailPair): CurveLocationDetailPair {\r\n result = result ? result : new CurveLocationDetailPair();\r\n result.detailA = detailA;\r\n result.detailB = detailB;\r\n return result;\r\n }\r\n /** Create a curve detail pair using references to two CurveLocationDetails.\r\n * * optionally install in reversed positions\r\n */\r\n public static createCaptureOptionalReverse(detailA: CurveLocationDetail, detailB: CurveLocationDetail,\r\n reversed: boolean,\r\n result?: CurveLocationDetailPair): CurveLocationDetailPair {\r\n result = result ? result : new CurveLocationDetailPair();\r\n if (reversed) {\r\n result.detailA = detailA;\r\n result.detailB = detailB;\r\n\r\n } else {\r\n result.detailA = detailA;\r\n result.detailB = detailB;\r\n }\r\n return result;\r\n }\r\n\r\n /** Make a deep copy of this CurveLocationDetailPair */\r\n public clone(result?: CurveLocationDetailPair): CurveLocationDetailPair {\r\n result = result ? result : new CurveLocationDetailPair();\r\n result.detailA = this.detailA.clone();\r\n result.detailB = this.detailB.clone();\r\n result.approachType = this.approachType;\r\n return result;\r\n }\r\n /** Swap the details of A, B */\r\n public swapDetails() {\r\n const q = this.detailA;\r\n this.detailA = this.detailB;\r\n this.detailB = q;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CurveLocationDetail.js","sourceRoot":"","sources":["../../../src/curve/CurveLocationDetail.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAIlE;;;GAGG;AACH,MAAM,CAAN,IAAY,iBAWX;AAXD,WAAY,iBAAiB;IAC3B,+DAA+D;IAC/D,iEAAY,CAAA;IACZ,4CAA4C;IAC5C,iFAAoB,CAAA;IACpB,2CAA2C;IAC3C,4EAAkB,CAAA;IAClB,gDAAgD;IAChD,kFAAqB,CAAA;IACrB,qCAAqC;IACrC,wEAAgB,CAAA;AAClB,CAAC,EAXW,iBAAiB,KAAjB,iBAAiB,QAW5B;AACD;;;GAGG;AACH,MAAM,CAAN,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,0CAA0C;IAC1C,2DAAK,CAAA;IACL,iCAAiC;IACjC,+DAAW,CAAA;IACX,4FAA4F;IAC5F,mFAAqB,CAAA;AACvB,CAAC,EAPW,iBAAiB,KAAjB,iBAAiB,QAO5B;AAED;;;;;;GAMG;AACH,SAAS,oBAAoB,CAAC,MAA4B,EAAE,MAA4B;IACtF,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KAC7B;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IAgC9B,kBAAkB;IAClB;QACE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAA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AO,CAAC;QACzB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,4BAA4B,CACxC,OAA4B,EAAE,OAA4B,EAAE,QAAiB,EAAE,MAAgC;QAE/G,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,uBAAuB,EAAE,CAAC;QACzD,IAAI,QAAQ,EAAE;YACZ,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;YACzB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;SAE1B;aAAM;YACL,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;YACzB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;SAC1B;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,uDAAuD;IAChD,KAAK,CAAC,MAAgC;QAC3C,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,uBAAuB,EAAE,CAAC;QACzD,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACtC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACtC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,+BAA+B;IACxB,WAAW;QAChB,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACnB,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\nimport { Geometry } from \"../Geometry\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\n\r\n/**\r\n * An enumeration of special conditions being described by a CurveLocationDetail.\r\n * @public\r\n */\r\nexport enum CurveIntervalRole {\r\n /** This point is an isolated point NOT at a primary vertex. */\r\n isolated = 0,\r\n /** This point is an isolated vertex hit */\r\n isolatedAtVertex = 1,\r\n /** This is the beginning of an interval */\r\n intervalStart = 10,\r\n /** This is an interior point of an interval. */\r\n intervalInterior = 11,\r\n /** This is the end of an interval */\r\n intervalEnd = 12,\r\n}\r\n/**\r\n * Return code for CurvePrimitive method `moveSignedDistanceFromFraction`\r\n * @public\r\n */\r\nexport enum CurveSearchStatus {\r\n /** unimplemented or zero length curve */\r\n error,\r\n /** complete success of search */\r\n success = 1,\r\n /** search ended prematurely (e.g. at incomplete distance moved) at start or end of curve */\r\n stoppedAtBoundary = 2,\r\n}\r\n\r\n/**\r\n * Use to update a vector in case where source and prior result are both possibly undefined.\r\n * * Any undefined source returns undefined.\r\n * * For defined source, reuse optional result if available.\r\n * @param source optional source\r\n * @param result optional result\r\n */\r\nfunction optionalVectorUpdate(source: Vector3d | undefined, result: Vector3d | undefined): Vector3d | undefined {\r\n if (source) {\r\n return source.clone(result);\r\n }\r\n return undefined;\r\n}\r\n\r\n/**\r\n * CurveLocationDetail carries point and parameter data about a point evaluated on a curve.\r\n * * These are returned by a variety of queries.\r\n * * Particular contents can vary among the queries.\r\n * @public\r\n */\r\nexport class CurveLocationDetail {\r\n /** The curve being evaluated */\r\n public curve?: CurvePrimitive;\r\n /** Optional ray */\r\n public ray?: Ray3d;\r\n /** The fractional position along the curve */\r\n public fraction: number;\r\n /** Detail condition of the role this point has in some context */\r\n public intervalRole?: CurveIntervalRole;\r\n /** The point on the curve */\r\n public point: Point3d;\r\n /** A vector (e.g. tangent vector) in context */\r\n public vectorInCurveLocationDetail?: Vector3d;\r\n /** A context-specific numeric value. (e.g. a distance) */\r\n public a: number;\r\n /**\r\n * Optional CurveLocationDetail with more detail of location. For instance, a detail for fractional position within\r\n * a CurveChainWithDistanceIndex returns fraction and distance along the chain as its primary data and\r\n * further detail of the particular curve within the chain in the childDetail.\r\n */\r\n public childDetail?: CurveLocationDetail;\r\n /**\r\n * A status indicator for certain searches.\r\n * * e.g. CurvePrimitive.moveSignedDistanceFromFraction\r\n */\r\n public curveSearchStatus?: CurveSearchStatus;\r\n /** (Optional) second fraction, e.g. end of interval of coincident curves */\r\n public fraction1?: number;\r\n /** (Optional) second point, e.g. end of interval of coincident curves */\r\n public point1?: Point3d;\r\n /** A context-specific additional point */\r\n public pointQ: Point3d; // extra point for use in computations\r\n /** constructor */\r\n public constructor() {\r\n this.pointQ = Point3d.createZero();\r\n this.fraction = 0;\r\n this.point = Point3d.createZero();\r\n this.a = 0.0;\r\n }\r\n /** Set the (optional) intervalRole field */\r\n public setIntervalRole(value: CurveIntervalRole): void {\r\n this.intervalRole = value;\r\n }\r\n /** Set the (optional) fraction1 and point1, using direct assignment (capture!) to point1 */\r\n public captureFraction1Point1(fraction1: number, point1: Point3d): void {\r\n this.fraction1 = fraction1;\r\n this.point1 = point1;\r\n }\r\n /** Test if this pair has fraction1 defined */\r\n public get hasFraction1(): boolean {\r\n return this.fraction1 !== undefined;\r\n }\r\n /** Test if this is an isolated point. This is true if intervalRole is any of (undefined, isolated, isolatedAtVertex) */\r\n public get isIsolated(): boolean {\r\n return this.intervalRole === undefined\r\n || this.intervalRole === CurveIntervalRole.isolated\r\n || this.intervalRole === CurveIntervalRole.isolatedAtVertex;\r\n }\r\n /** Return the fraction delta. (0 if no fraction1) */\r\n public get fractionDelta(): number {\r\n return this.fraction1 !== undefined ? this.fraction1 - this.fraction : 0.0;\r\n }\r\n /**\r\n * If (fraction1, point1) are defined, make them the primary (and only) data.\r\n * * No action if undefined.\r\n */\r\n public collapseToEnd() {\r\n if (this.fraction1 !== undefined) {\r\n this.fraction = this.fraction1;\r\n this.fraction1 = undefined;\r\n }\r\n if (this.point1) {\r\n this.point = this.point1;\r\n this.point1 = undefined;\r\n }\r\n }\r\n /**\r\n * Make (fraction, point) the primary (and only) data.\r\n * * No action if undefined.\r\n */\r\n public collapseToStart() {\r\n this.fraction1 = undefined;\r\n this.point1 = undefined;\r\n }\r\n /**\r\n * Return a complete copy, WITH CAVEATS . . .\r\n * * curve member is copied as a reference.\r\n * * point and vector members are cloned.\r\n */\r\n public clone(result?: CurveLocationDetail): CurveLocationDetail {\r\n if (result === this)\r\n return result;\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = this.curve;\r\n result.fraction = this.fraction;\r\n result.fraction1 = this.fraction1;\r\n result.point1 = this.point1;\r\n result.point.setFromPoint3d(this.point);\r\n result.vectorInCurveLocationDetail = optionalVectorUpdate(\r\n this.vectorInCurveLocationDetail, result.vectorInCurveLocationDetail\r\n );\r\n result.a = this.a;\r\n result.curveSearchStatus = this.curveSearchStatus;\r\n return result;\r\n }\r\n /**\r\n * Updated in this instance.\r\n * * Note that if caller omits `vector` and `a`, those fields are updated to the call-list defaults (NOT left as-is)\r\n * * point and vector updates are by data copy (not capture of pointers)\r\n * @param fraction (required) fraction to install\r\n * @param point (required) point to install\r\n * @param vector (optional) vector to install.\r\n * @param a (optional) numeric value to install.\r\n */\r\n public setFP(fraction: number, point: Point3d, vector?: Vector3d, a: number = 0.0) {\r\n this.fraction = fraction;\r\n this.point.setFrom(point);\r\n this.vectorInCurveLocationDetail = optionalVectorUpdate(vector, this.vectorInCurveLocationDetail);\r\n this.a = a;\r\n }\r\n /**\r\n * Updated in this instance.\r\n * * Note that if caller omits a`, that field is updated to the call-list default (NOT left as-is)\r\n * * point and vector updates are by data copy (not capture of the ray members)\r\n * @param fraction (required) fraction to install\r\n * @param ray (required) point and vector to install\r\n * @param a (optional) numeric value to install.\r\n */\r\n public setFR(fraction: number, ray: Ray3d, a: number = 0) {\r\n return this.setFP(fraction, ray.origin, ray.direction, a);\r\n }\r\n /** Set the CurvePrimitive pointer, leaving all other properties untouched. */\r\n public setCurve(curve: CurvePrimitive) { this.curve = curve; }\r\n /** record the distance from the CurveLocationDetail's point to the parameter point. */\r\n public setDistanceTo(point: Point3d) {\r\n this.a = this.point.distance(point);\r\n }\r\n /** Create with a CurvePrimitive pointer but no coordinate data. */\r\n public static create(\r\n curve?: CurvePrimitive,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer, fraction, and point coordinates. */\r\n public static createCurveFractionPoint(\r\n curve: CurvePrimitive | undefined,\r\n fraction: number,\r\n point: Point3d,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n result.point.setFromPoint3d(point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = 0.0;\r\n result.curveSearchStatus = undefined;\r\n return result;\r\n }\r\n /** Create a new detail with only ray, fraction, and point. */\r\n public static createRayFractionPoint(\r\n ray: Ray3d, fraction: number, point: Point3d, result?: CurveLocationDetail\r\n ): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.fraction = fraction;\r\n result.ray = ray;\r\n result.point.setFromPoint3d(point);\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer, fraction, and point coordinates */\r\n public static createCurveFractionPointDistanceCurveSearchStatus(\r\n curve: CurvePrimitive | undefined,\r\n fraction: number,\r\n point: Point3d,\r\n distance: number,\r\n status: CurveSearchStatus,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n result.point.setFromPoint3d(point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = distance;\r\n result.curveSearchStatus = status;\r\n return result;\r\n }\r\n /** Create with curveSearchStatus affected by allowExtension. */\r\n public static createConditionalMoveSignedDistance(\r\n allowExtension: boolean,\r\n curve: CurvePrimitive,\r\n startFraction: number,\r\n endFraction: number,\r\n requestedSignedDistance: number,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n let a = requestedSignedDistance;\r\n let status = CurveSearchStatus.success;\r\n if (!allowExtension && !Geometry.isIn01(endFraction)) {\r\n // cap the movement at the endpoint\r\n if (endFraction < 0.0) {\r\n a = - curve.curveLengthBetweenFractions(startFraction, 0.0);\r\n endFraction = 0.0;\r\n status = CurveSearchStatus.stoppedAtBoundary;\r\n } else if (endFraction > 1.0) {\r\n endFraction = 1.0;\r\n a = curve.curveLengthBetweenFractions(startFraction, 1.0);\r\n status = CurveSearchStatus.stoppedAtBoundary;\r\n }\r\n }\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = endFraction;\r\n result.point = curve.fractionToPoint(endFraction, result.point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = a;\r\n result.curveSearchStatus = status;\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer and fraction for evaluation. */\r\n public static createCurveEvaluatedFraction(\r\n curve: CurvePrimitive,\r\n fraction: number,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n result.point = curve.fractionToPoint(fraction);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.curveSearchStatus = undefined;\r\n result.a = 0.0;\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer and fraction for evaluation. */\r\n public static createCurveEvaluatedFractionPointAndDerivative(\r\n curve: CurvePrimitive,\r\n fraction: number,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n const ray = curve.fractionToPointAndDerivative(fraction);\r\n result.point = ray.origin;\r\n result.vectorInCurveLocationDetail = ray.direction;\r\n result.curveSearchStatus = undefined;\r\n result.a = 0.0;\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer and 2 fractions for evaluation. */\r\n public static createCurveEvaluatedFractionFraction(\r\n curve: CurvePrimitive,\r\n fraction0: number,\r\n fraction1: number,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction0;\r\n result.point = curve.fractionToPoint(fraction0);\r\n result.fraction1 = fraction1;\r\n result.point1 = curve.fractionToPoint(fraction1);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.curveSearchStatus = undefined;\r\n result.a = 0.0;\r\n return result;\r\n }\r\n /** Create with CurvePrimitive pointer, fraction, and point coordinates. */\r\n public static createCurveFractionPointDistance(\r\n curve: CurvePrimitive,\r\n fraction: number,\r\n point: Point3d,\r\n a: number,\r\n result?: CurveLocationDetail): CurveLocationDetail {\r\n result = result ? result : new CurveLocationDetail();\r\n result.curve = curve;\r\n result.fraction = fraction;\r\n result.point.setFromPoint3d(point);\r\n result.vectorInCurveLocationDetail = undefined;\r\n result.a = a;\r\n result.curveSearchStatus = undefined;\r\n return result;\r\n }\r\n /**\r\n * Update or create if closer than current contents.\r\n * @param curve candidate curve\r\n * @param fraction candidate fraction\r\n * @param point candidate point\r\n * @param a candidate distance\r\n * @returns true if the given distance is smaller (and hence this detail was updated.)\r\n */\r\n public updateIfCloserCurveFractionPointDistance(\r\n curve: CurvePrimitive,\r\n fraction: number,\r\n point: Point3d,\r\n a: number): boolean {\r\n if (this.a < a)\r\n return false;\r\n CurveLocationDetail.createCurveFractionPointDistance(curve, fraction, point, a, this);\r\n return true;\r\n }\r\n /**\r\n * Exchange the (fraction,fraction1) and (point, point1) pairs.\r\n * * (Skip each swap if its \"1\" value is undefined)\r\n */\r\n public swapFractionsAndPoints() {\r\n if (this.fraction1 !== undefined) {\r\n const f = this.fraction; this.fraction = this.fraction1; this.fraction1 = f;\r\n }\r\n if (this.point1 !== undefined) {\r\n const p = this.point; this.point = this.point1; this.point1 = p;\r\n }\r\n }\r\n /**\r\n * Return the fraction where f falls between fraction and fraction1.\r\n * * ASSUME fraction1 defined\r\n */\r\n public inverseInterpolateFraction(f: number, defaultFraction: number = 0): number {\r\n const a = Geometry.inverseInterpolate01(this.fraction, this.fraction1!, f);\r\n if (a === undefined)\r\n return defaultFraction;\r\n return a;\r\n }\r\n /**\r\n * Return the detail with smaller `a` value -- detailA returned if equal.\r\n * @param detailA first candidate\r\n * @param detailB second candidate\r\n */\r\n public static chooseSmallerA(detailA: CurveLocationDetail | undefined, detailB: CurveLocationDetail | undefined): CurveLocationDetail | undefined {\r\n if (detailA) {\r\n if (!detailB)\r\n return detailA;\r\n return detailA.a <= detailB.a ? detailA : detailB;\r\n }\r\n return detailB;\r\n }\r\n}\r\n/**\r\n * Enumeration of configurations for intersections and min/max distance-between-curve\r\n * @public\r\n */\r\nexport enum CurveCurveApproachType {\r\n /** Intersection at a single point */\r\n Intersection = 0,\r\n /** Distinct points on the two curves, with each curve's tangent perpendicular to the chord between the points */\r\n PerpendicularChord = 1,\r\n /** Completely coincident geometry */\r\n CoincidentGeometry = 2,\r\n /** Completely parallel geometry. */\r\n ParallelGeometry = 3,\r\n}\r\n/**\r\n * A pair of CurveLocationDetail.\r\n * @public\r\n */\r\nexport class CurveLocationDetailPair {\r\n /** The first of the two details ... */\r\n public detailA: CurveLocationDetail;\r\n /** The second of the two details ... */\r\n public detailB: CurveLocationDetail;\r\n /**\r\n * Enumeration of how the detail pairs relate.\r\n * * This is set only by certain closeApproach calculations.\r\n */\r\n public approachType?: CurveCurveApproachType;\r\n\r\n public constructor(detailA?: CurveLocationDetail, detailB?: CurveLocationDetail) {\r\n this.detailA = detailA ? detailA : new CurveLocationDetail();\r\n this.detailB = detailB ? detailB : new CurveLocationDetail();\r\n }\r\n /** Create a curve detail pair using references to two CurveLocationDetails */\r\n public static createCapture(\r\n detailA: CurveLocationDetail, detailB: CurveLocationDetail, result?: CurveLocationDetailPair\r\n ): CurveLocationDetailPair {\r\n result = result ? result : new CurveLocationDetailPair();\r\n result.detailA = detailA;\r\n result.detailB = detailB;\r\n return result;\r\n }\r\n /**\r\n * Create a curve detail pair using references to two CurveLocationDetails.\r\n * * optionally install in reversed positions\r\n */\r\n public static createCaptureOptionalReverse(\r\n detailA: CurveLocationDetail, detailB: CurveLocationDetail, reversed: boolean, result?: CurveLocationDetailPair\r\n ): CurveLocationDetailPair {\r\n result = result ? result : new CurveLocationDetailPair();\r\n if (reversed) {\r\n result.detailA = detailA;\r\n result.detailB = detailB;\r\n\r\n } else {\r\n result.detailA = detailA;\r\n result.detailB = detailB;\r\n }\r\n return result;\r\n }\r\n /** Make a deep copy of this CurveLocationDetailPair */\r\n public clone(result?: CurveLocationDetailPair): CurveLocationDetailPair {\r\n result = result ? result : new CurveLocationDetailPair();\r\n result.detailA = this.detailA.clone();\r\n result.detailB = this.detailB.clone();\r\n result.approachType = this.approachType;\r\n return result;\r\n }\r\n /** Swap the details of A, B */\r\n public swapDetails() {\r\n const q = this.detailA;\r\n this.detailA = this.detailB;\r\n this.detailB = q;\r\n }\r\n}\r\n"]}