@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.
- package/lib/cjs/curve/Arc3d.d.ts +70 -86
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +109 -96
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +47 -30
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +63 -34
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +40 -41
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +31 -35
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +137 -92
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +114 -75
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.d.ts +26 -20
- package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js +11 -9
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +34 -25
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +76 -38
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +70 -51
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +120 -71
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.d.ts +14 -13
- package/lib/cjs/curve/Query/StrokeCountMap.d.ts.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.js +9 -8
- package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts +29 -21
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js +44 -22
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +2 -2
- package/lib/cjs/geometry3d/Matrix3d.js +2 -2
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +70 -86
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +109 -96
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +47 -30
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +63 -34
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +40 -41
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +31 -35
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +137 -92
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +114 -75
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.d.ts +26 -20
- package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/esm/curve/GeometryQuery.js +11 -9
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +34 -25
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +76 -38
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +70 -51
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +120 -71
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.d.ts +14 -13
- package/lib/esm/curve/Query/StrokeCountMap.d.ts.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.js +9 -8
- package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts +29 -21
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js +44 -22
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +2 -2
- package/lib/esm/geometry3d/Matrix3d.js +2 -2
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/package.json +3 -3
|
@@ -20,7 +20,8 @@ import { LineString3d } from "./LineString3d";
|
|
|
20
20
|
import { ProxyCurve } from "./ProxyCurve";
|
|
21
21
|
/**
|
|
22
22
|
* A `CurveCollection` is an abstract (non-instantiable) class for various sets of curves with particular structures:
|
|
23
|
-
* - `CurveChain` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive
|
|
23
|
+
* - `CurveChain` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive` joining head-to-tail.
|
|
24
|
+
* The two instantiable forms of `CurveChain` are
|
|
24
25
|
* - `Path` - A chain not required to close, and not enclosing a planar area
|
|
25
26
|
* - `Loop` - A chain required to close from last to first so that a planar area is enclosed.
|
|
26
27
|
* - `ParityRegion` -- a collection of coplanar `Loop`s, with "in/out" classification by parity rules
|
|
@@ -36,11 +37,13 @@ export class CurveCollection extends GeometryQuery {
|
|
|
36
37
|
/** String name for schema properties */
|
|
37
38
|
this.geometryCategory = "curveCollection";
|
|
38
39
|
/* eslint-disable @typescript-eslint/naming-convention, no-empty */
|
|
39
|
-
/**
|
|
40
|
+
/** Flag for inner loop status. Only used by `Loop`. */
|
|
40
41
|
this.isInner = false;
|
|
41
42
|
}
|
|
42
43
|
/** Return the sum of the lengths of all contained curves. */
|
|
43
|
-
sumLengths() {
|
|
44
|
+
sumLengths() {
|
|
45
|
+
return SumLengthsContext.sumLengths(this);
|
|
46
|
+
}
|
|
44
47
|
/** Return the closest point on the contained curves */
|
|
45
48
|
closestPoint(spacePoint) {
|
|
46
49
|
let detailA;
|
|
@@ -58,17 +61,24 @@ export class CurveCollection extends GeometryQuery {
|
|
|
58
61
|
}
|
|
59
62
|
return detailA;
|
|
60
63
|
}
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
64
|
+
/**
|
|
65
|
+
* Return the max gap between adjacent primitives in Path and Loop collections.
|
|
63
66
|
* * In a Path, gaps are computed between consecutive primitives.
|
|
64
67
|
* * In a Loop, gaps are computed between consecutive primitives and between last and first.
|
|
65
|
-
* * gaps are NOT computed between consecutive CurvePrimitives in "unstructured" collections. The type is
|
|
68
|
+
* * gaps are NOT computed between consecutive CurvePrimitives in "unstructured" collections. The type is
|
|
69
|
+
* "unstructured" so gaps should not be semantically meaningful.
|
|
66
70
|
*/
|
|
67
|
-
maxGap() {
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
maxGap() {
|
|
72
|
+
return GapSearchContext.maxGap(this);
|
|
73
|
+
}
|
|
74
|
+
/** Return true if the curve collection has any primitives other than LineSegment3d and LineString3d */
|
|
75
|
+
checkForNonLinearPrimitives() {
|
|
76
|
+
return CountLinearPartsSearchContext.hasNonLinearPrimitives(this);
|
|
77
|
+
}
|
|
70
78
|
/** Apply transform recursively to children */
|
|
71
|
-
tryTransformInPlace(transform) {
|
|
79
|
+
tryTransformInPlace(transform) {
|
|
80
|
+
return TransformInPlaceContext.tryTransformInPlace(this, transform);
|
|
81
|
+
}
|
|
72
82
|
/** Return a deep copy. */
|
|
73
83
|
clone() {
|
|
74
84
|
return CloneCurvesContext.clone(this);
|
|
@@ -94,15 +104,18 @@ export class CurveCollection extends GeometryQuery {
|
|
|
94
104
|
}
|
|
95
105
|
/**
|
|
96
106
|
* Return an array containing only the curve primitives.
|
|
97
|
-
* @param collectorArray optional array to receive primitives.
|
|
98
|
-
*
|
|
107
|
+
* @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without
|
|
108
|
+
* clearing the array.)
|
|
109
|
+
* @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true,
|
|
110
|
+
* it recurses to its (otherwise hidden) children.
|
|
99
111
|
*/
|
|
100
112
|
collectCurvePrimitives(collectorArray, smallestPossiblePrimitives = false, explodeLineStrings = false) {
|
|
101
113
|
const results = collectorArray === undefined ? [] : collectorArray;
|
|
102
114
|
this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLineStrings);
|
|
103
115
|
return results;
|
|
104
116
|
}
|
|
105
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Return true for planar region types:
|
|
106
119
|
* * `Loop`
|
|
107
120
|
* * `ParityRegion`
|
|
108
121
|
* * `UnionRegion`
|
|
@@ -110,12 +123,12 @@ export class CurveCollection extends GeometryQuery {
|
|
|
110
123
|
get isAnyRegionType() {
|
|
111
124
|
return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 5 || this.dgnBoundaryType() === 4;
|
|
112
125
|
}
|
|
113
|
-
/** Return true for a `Path`, i.e. a chain of curves joined head-to-tail
|
|
114
|
-
*/
|
|
126
|
+
/** Return true for a `Path`, i.e. a chain of curves joined head-to-tail */
|
|
115
127
|
get isOpenPath() {
|
|
116
128
|
return this.dgnBoundaryType() === 1;
|
|
117
129
|
}
|
|
118
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* Return true for a single-loop planar region type, i.e. `Loop`.
|
|
119
132
|
* * This is _not- a test for physical closure of a `Path`
|
|
120
133
|
*/
|
|
121
134
|
get isClosedPath() {
|
|
@@ -150,19 +163,25 @@ export class CurveCollection extends GeometryQuery {
|
|
|
150
163
|
}
|
|
151
164
|
return undefined;
|
|
152
165
|
}
|
|
153
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters
|
|
168
|
+
* of projection.
|
|
154
169
|
* @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.
|
|
155
170
|
* @param lowHigh optional receiver for output
|
|
156
|
-
* @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the
|
|
171
|
+
* @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the
|
|
172
|
+
* end of the ray.
|
|
157
173
|
*/
|
|
158
174
|
projectedParameterRange(ray, lowHigh) {
|
|
159
175
|
return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);
|
|
160
176
|
}
|
|
161
177
|
}
|
|
162
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* Shared base class for use by both open and closed paths.
|
|
163
180
|
* - A `CurveChain` contains only curvePrimitives. No other paths, loops, or regions allowed.
|
|
164
|
-
* - A single entry in the chain can in fact contain multiple curve primitives if the entry itself is (for instance)
|
|
165
|
-
*
|
|
181
|
+
* - A single entry in the chain can in fact contain multiple curve primitives if the entry itself is (for instance)
|
|
182
|
+
* `CurveChainWithDistanceIndex`
|
|
183
|
+
* which presents itself (through method interface) as a CurvePrimitive with well defined mappings from fraction
|
|
184
|
+
* to xyz, but in fact does all the
|
|
166
185
|
* calculations over multiple primitives.
|
|
167
186
|
* - The specific derived classes are `Path` and `Loop`
|
|
168
187
|
* - `CurveChain` is an intermediate class. It is not instantiable on its own.
|
|
@@ -195,7 +214,8 @@ export class CurveChain extends CurveCollection {
|
|
|
195
214
|
}
|
|
196
215
|
return undefined;
|
|
197
216
|
}
|
|
198
|
-
/**
|
|
217
|
+
/**
|
|
218
|
+
* Stroke the chain into a simple xyz array.
|
|
199
219
|
* @param options tolerance parameters controlling the stroking.
|
|
200
220
|
*/
|
|
201
221
|
getPackedStrokes(options) {
|
|
@@ -220,7 +240,8 @@ export class CurveChain extends CurveCollection {
|
|
|
220
240
|
return strokes;
|
|
221
241
|
}
|
|
222
242
|
*/
|
|
223
|
-
/**
|
|
243
|
+
/**
|
|
244
|
+
* Add a child curve.
|
|
224
245
|
* * Returns false if the given child is not a CurvePrimitive.
|
|
225
246
|
*/
|
|
226
247
|
tryAddChild(child) {
|
|
@@ -236,7 +257,7 @@ export class CurveChain extends CurveCollection {
|
|
|
236
257
|
return this._curves[i];
|
|
237
258
|
return undefined;
|
|
238
259
|
}
|
|
239
|
-
/**
|
|
260
|
+
/** Invoke `curve.extendRange(range, transform)` for each child */
|
|
240
261
|
extendRange(range, transform) {
|
|
241
262
|
for (const curve of this._curves)
|
|
242
263
|
curve.extendRange(range, transform);
|
|
@@ -250,7 +271,8 @@ export class CurveChain extends CurveCollection {
|
|
|
250
271
|
curve.reverseInPlace();
|
|
251
272
|
this._curves.reverse();
|
|
252
273
|
}
|
|
253
|
-
/**
|
|
274
|
+
/**
|
|
275
|
+
* Return the index where target is found in the array of children
|
|
254
276
|
* @param alsoSearchProxies whether to also check proxy curves of the children
|
|
255
277
|
*/
|
|
256
278
|
childIndex(target, alsoSearchProxies) {
|
|
@@ -269,8 +291,7 @@ export class CurveChain extends CurveCollection {
|
|
|
269
291
|
}
|
|
270
292
|
return undefined;
|
|
271
293
|
}
|
|
272
|
-
/** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive.
|
|
273
|
-
*/
|
|
294
|
+
/** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive. */
|
|
274
295
|
primitiveIndexAndFractionToCurveLocationDetailPointAndDerivative(index, fraction, cyclic = false, result) {
|
|
275
296
|
const primitive = this.cyclicCurvePrimitive(index, cyclic);
|
|
276
297
|
if (primitive) {
|
|
@@ -285,8 +306,10 @@ export class CurveChain extends CurveCollection {
|
|
|
285
306
|
* @public
|
|
286
307
|
*/
|
|
287
308
|
export class BagOfCurves extends CurveCollection {
|
|
288
|
-
/**
|
|
289
|
-
isSameGeometryClass(other) {
|
|
309
|
+
/** Test if `other` is an instance of `BagOfCurves` */
|
|
310
|
+
isSameGeometryClass(other) {
|
|
311
|
+
return other instanceof BagOfCurves;
|
|
312
|
+
}
|
|
290
313
|
/** Construct an empty `BagOfCurves` */
|
|
291
314
|
constructor() {
|
|
292
315
|
super();
|
|
@@ -295,8 +318,10 @@ export class BagOfCurves extends CurveCollection {
|
|
|
295
318
|
this._children = [];
|
|
296
319
|
}
|
|
297
320
|
/** Return the (reference to) array of children */
|
|
298
|
-
get children() {
|
|
299
|
-
|
|
321
|
+
get children() {
|
|
322
|
+
return this._children;
|
|
323
|
+
}
|
|
324
|
+
/** Create with given curves. */
|
|
300
325
|
static create(...data) {
|
|
301
326
|
const result = new BagOfCurves();
|
|
302
327
|
for (const child of data) {
|
|
@@ -305,8 +330,10 @@ export class BagOfCurves extends CurveCollection {
|
|
|
305
330
|
return result;
|
|
306
331
|
}
|
|
307
332
|
/** Return the boundary type (0) of a corresponding MicroStation CurveVector */
|
|
308
|
-
dgnBoundaryType() {
|
|
309
|
-
|
|
333
|
+
dgnBoundaryType() {
|
|
334
|
+
return 0;
|
|
335
|
+
}
|
|
336
|
+
/** Invoke `processor.announceBagOfCurves(this, indexInParent);` */
|
|
310
337
|
announceToCurveProcessor(processor, indexInParent = -1) {
|
|
311
338
|
return processor.announceBagOfCurves(this, indexInParent);
|
|
312
339
|
}
|
|
@@ -330,7 +357,9 @@ export class BagOfCurves extends CurveCollection {
|
|
|
330
357
|
return clone;
|
|
331
358
|
}
|
|
332
359
|
/** Return an empty `BagOfCurves` */
|
|
333
|
-
cloneEmptyPeer() {
|
|
360
|
+
cloneEmptyPeer() {
|
|
361
|
+
return new BagOfCurves();
|
|
362
|
+
}
|
|
334
363
|
/** Add a child */
|
|
335
364
|
tryAddChild(child) {
|
|
336
365
|
if (child)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveCollection.js","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":"AAAA;;;+F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D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,oCAAoC;IAC7B,cAAc,KAAkB,OAAO,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC;IAClE,mBAAmB;IACZ,WAAW,CAAC,KAA2B;QAC5C,IAAI,KAAK;YACP,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,2BAA2B;IACpB,QAAQ,CAAC,CAAS;QACvB,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM;YAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,8EAA8E;IACvE,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAO,yCAAyC;IAAtD;QACE,8GAA8G;QACvG,8BAAyB,GAAY,IAAI,CAAC;QACjD,0CAA0C;QACnC,8BAAyB,GAAY,IAAI,CAAC;QACjD,gDAAgD;QACzC,4BAAuB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;QAC9D,uDAAuD;QAChD,2BAAsB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;IAC/D,CAAC;CAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { AnyCurve } from \"./CurveChain\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { CloneCurvesContext } from \"./internalContexts/CloneCurvesContext\";\r\nimport { CloneWithExpandedLineStrings } from \"./internalContexts/CloneWithExpandedLineStrings\";\r\nimport { CountLinearPartsSearchContext } from \"./internalContexts/CountLinearPartsSearchContext\";\r\nimport { GapSearchContext } from \"./internalContexts/GapSearchContext\";\r\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\r\nimport { SumLengthsContext } from \"./internalContexts/SumLengthsContext\";\r\nimport { TransformInPlaceContext } from \"./internalContexts/TransformInPlaceContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { ProxyCurve } from \"./ProxyCurve\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/** Describes the concrete type of a [[CurveCollection]]. Each type name maps to a specific subclass and can be used in conditional statements for type-switching.\r\n * - \"loop\" => [[Loop]]\r\n * - \"path\" => [[Path]]\r\n * - \"unionRegion\" => [[UnionRegion]]\r\n * - \"parityRegion\" => [[ParityRegion]]\r\n * - \"bagOfCurves\" => [[BagOfCurves]]\r\n * @public\r\n */\r\nexport type CurveCollectionType = \"loop\" | \"path\" | \"unionRegion\" | \"parityRegion\" | \"bagOfCurves\";\r\n\r\n/**\r\n * A `CurveCollection` is an abstract (non-instantiable) class for various sets of curves with particular structures:\r\n * - `CurveChain` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive ` joining head-to-tail. The two instantiable forms of `CurveChain` are\r\n * - `Path` - A chain not required to close, and not enclosing a planar area\r\n * - `Loop` - A chain required to close from last to first so that a planar area is enclosed.\r\n * - `ParityRegion` -- a collection of coplanar `Loop`s, with \"in/out\" classification by parity rules\r\n * - `UnionRegion` -- a collection of coplanar `Loop`s, with \"in/out\" classification by union rules\r\n * - `BagOfCurves` -- a collection of `AnyCurve` with no implied structure.\r\n *\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveCollection extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"curveCollection\";\r\n /** Type discriminator. */\r\n public abstract readonly curveCollectionType: CurveCollectionType;\r\n\r\n /* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n /** Flag for inner loop status. Only used by `Loop`. */\r\n public isInner: boolean = false;\r\n /** Return the sum of the lengths of all contained curves. */\r\n public sumLengths(): number { return SumLengthsContext.sumLengths(this); }\r\n /** Return the closest point on the contained curves */\r\n public closestPoint(spacePoint: Point3d): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const detailB = child.closestPoint(spacePoint, false);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n } else if (child instanceof CurveCollection) {\r\n const detailB = child.closestPoint(spacePoint);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n }\r\n }\r\n }\r\n return detailA;\r\n }\r\n\r\n /** return the max gap between adjacent primitives in Path and Loop collections.\r\n *\r\n * * In a Path, gaps are computed between consecutive primitives.\r\n * * In a Loop, gaps are computed between consecutive primitives and between last and first.\r\n * * gaps are NOT computed between consecutive CurvePrimitives in \"unstructured\" collections. The type is \"unstructured\" so gaps should not be semantically meaningful.\r\n */\r\n public maxGap(): number { return GapSearchContext.maxGap(this); }\r\n /** return true if the curve collection has any primitives other than LineSegment3d and LineString3d */\r\n public checkForNonLinearPrimitives(): boolean { return CountLinearPartsSearchContext.hasNonLinearPrimitives(this); }\r\n /** Apply transform recursively to children */\r\n public tryTransformInPlace(transform: Transform): boolean { return TransformInPlaceContext.tryTransformInPlace(this, transform); }\r\n /** Return a deep copy. */\r\n public override clone(): CurveCollection {\r\n return CloneCurvesContext.clone(this) as CurveCollection;\r\n }\r\n /** Create a deep copy of transformed curves. */\r\n public override cloneTransformed(transform: Transform): CurveCollection | undefined {\r\n return CloneCurvesContext.clone(this, transform);\r\n }\r\n /** Create a deep copy with all linestrings expanded to multiple LineSegment3d. */\r\n public cloneWithExpandedLineStrings(): CurveCollection {\r\n return CloneWithExpandedLineStrings.clone(this);\r\n }\r\n /** Recurse through children to collect CurvePrimitive's in flat array. */\r\n private collectCurvePrimitivesGo(results: CurvePrimitive[], smallestPossiblePrimitives: boolean, explodeLinestrings: boolean = false) {\r\n if (this.children) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n else if (child instanceof CurveCollection)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Return an array containing only the curve primitives.\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without clearing the array.)\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true, it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLineStrings: boolean = false): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLineStrings);\r\n return results;\r\n }\r\n\r\n /** Return true for planar region types:\r\n * * `Loop`\r\n * * `ParityRegion`\r\n * * `UnionRegion`\r\n */\r\n public get isAnyRegionType(): boolean {\r\n return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 5 || this.dgnBoundaryType() === 4;\r\n }\r\n /** Return true for a `Path`, i.e. a chain of curves joined head-to-tail\r\n */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\r\n }\r\n /** Return true for a single-loop planar region type, i.e. `Loop`.\r\n * * This is _not- a test for physical closure of a `Path`\r\n */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /** Return a CurveCollection with the same structure but all curves replaced by strokes. */\r\n public abstract cloneStroked(options?: StrokeOptions): AnyCurve;\r\n\r\n /** Support method for ICurvePrimitive ... one line call to specific announce method . . */\r\n public abstract announceToCurveProcessor(processor: RecursiveCurveProcessor): void;\r\n /** clone an empty collection. */\r\n public abstract cloneEmptyPeer(): CurveCollection;\r\n /** Return the boundary type of a corresponding MicroStation CurveVector.\r\n * * Derived class must implement.\r\n */\r\n public abstract dgnBoundaryType(): number;\r\n /**\r\n * Try to add a child.\r\n * @param child child to add.\r\n * @return true if child is an acceptable type for this collection.\r\n */\r\n public abstract tryAddChild(child: AnyCurve | undefined): boolean;\r\n /** Return a child identified by by index */\r\n public abstract getChild(i: number): AnyCurve | undefined;\r\n /** Extend (increase) `rangeToExtend` as needed to include these curves (optionally transformed) */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const children = this.children;\r\n if (children) {\r\n for (const c of children) {\r\n c.extendRange(rangeToExtend, transform);\r\n }\r\n }\r\n }\r\n /**\r\n * * Find any curve primitive in the source.\r\n * * Evaluate it at a fraction (which by default is an interior fraction)\r\n * @param source containing `CurvePrimitive` or `CurveCollection`\r\n * @param fraction fraction to use in `curve.fractionToPoint(fraction)`\r\n */\r\n public static createCurveLocationDetailOnAnyCurvePrimitive(source: GeometryQuery | undefined, fraction: number = 0.5): CurveLocationDetail | undefined {\r\n if (!source)\r\n return undefined;\r\n if (source instanceof CurvePrimitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFraction(source, fraction);\r\n } else if (source instanceof CurveCollection && source.children !== undefined)\r\n for (const child of source.children) {\r\n const detail = this.createCurveLocationDetailOnAnyCurvePrimitive(child, fraction);\r\n if (detail)\r\n return detail;\r\n }\r\n return undefined;\r\n }\r\n /** Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the end of the ray.\r\n */\r\n public projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n\r\n/** Shared base class for use by both open and closed paths.\r\n * - A `CurveChain` contains only curvePrimitives. No other paths, loops, or regions allowed.\r\n * - A single entry in the chain can in fact contain multiple curve primitives if the entry itself is (for instance) `CurveChainWithDistanceIndex`\r\n * which presents itself (through method interface) as a CurvePrimitive with well defined mappings from fraction to xyz, but in fact does all the\r\n * calculations over multiple primitives.\r\n * - The specific derived classes are `Path` and `Loop`\r\n * - `CurveChain` is an intermediate class. It is not instantiable on its own.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveChain extends CurveCollection {\r\n /** The curve primitives in the chain. */\r\n protected _curves: CurvePrimitive[];\r\n protected constructor() { super(); this._curves = []; }\r\n /** Return the array of `CurvePrimitive` */\r\n public override get children(): CurvePrimitive[] {\r\n if (this._curves === undefined)\r\n this._curves = [];\r\n return this._curves;\r\n }\r\n /**\r\n * Return the `[index]` curve primitive, optionally using `modulo` to map`index` to the cyclic indexing.\r\n * * In particular, `-1` is the final curve.\r\n * @param index cyclic index\r\n */\r\n public cyclicCurvePrimitive(index: number, cyclic: boolean = true): CurvePrimitive | undefined {\r\n const n = this.children.length;\r\n if (n === 0)\r\n return undefined;\r\n /** Try simplest non-cyclic access first . . */\r\n if (index >= 0 && index < n)\r\n return this.children[index];\r\n if (cyclic) {\r\n const index2 = Geometry.modulo(index, n);\r\n return this.children[index2];\r\n }\r\n return undefined;\r\n }\r\n /** Stroke the chain into a simple xyz array.\r\n * @param options tolerance parameters controlling the stroking.\r\n */\r\n public getPackedStrokes(options?: StrokeOptions): GrowableXYZArray | undefined {\r\n const tree = this.cloneStroked(options);\r\n if (tree instanceof CurveChain) {\r\n const children = tree.children;\r\n if (children.length === 1) {\r\n const ls = children[0];\r\n if (ls instanceof LineString3d)\r\n return ls.packedPoints;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Return a structural clone, with CurvePrimitive objects stroked. */\r\n public abstract override cloneStroked(options?: StrokeOptions): AnyCurve;\r\n /* EDL 01/20 Path, Loop, CurveChainWithDistanceIndex all implement this.\r\n Reducing it to abstract.\r\n Hypothetically, a derived class in the wild might be depending on this.\r\n {\r\n const strokes = LineString3d.create();\r\n for (const curve of this.children)\r\n curve.emitStrokes(strokes, options);\r\n return strokes;\r\n }\r\n */\r\n /** add a child curve.\r\n * * Returns false if the given child is not a CurvePrimitive.\r\n */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child && child instanceof CurvePrimitive) {\r\n this._curves.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child by index */\r\n public getChild(i: number): CurvePrimitive | undefined {\r\n if (i < this._curves.length) return this._curves[i];\r\n return undefined;\r\n }\r\n /** invoke `curve.extendRange(range, transform)` for each child */\r\n public override extendRange(range: Range3d, transform?: Transform): void {\r\n for (const curve of this._curves)\r\n curve.extendRange(range, transform);\r\n }\r\n /**\r\n * Reverse each child curve (in place)\r\n * Reverse the order of the children in the CurveChain array.\r\n */\r\n public reverseChildrenInPlace() {\r\n for (const curve of this._curves)\r\n curve.reverseInPlace();\r\n this._curves.reverse();\r\n }\r\n /** Return the index where target is found in the array of children\r\n * @param alsoSearchProxies whether to also check proxy curves of the children\r\n */\r\n public childIndex(target: CurvePrimitive | undefined, alsoSearchProxies?: boolean): number | undefined {\r\n for (let i = 0; i < this._curves.length; i++){\r\n if (this._curves[i] === target)\r\n return i;\r\n }\r\n if (alsoSearchProxies ?? false) {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n const childCurve = this._curves[i];\r\n if (childCurve instanceof ProxyCurve) {\r\n if (childCurve.proxyCurve === target)\r\n return i;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive.\r\n */\r\n public primitiveIndexAndFractionToCurveLocationDetailPointAndDerivative(index: number, fraction: number, cyclic: boolean = false, result?: CurveLocationDetail): CurveLocationDetail | undefined {\r\n const primitive = this.cyclicCurvePrimitive(index, cyclic);\r\n if (primitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFractionPointAndDerivative(primitive, fraction, result);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * * A `BagOfCurves` object is a collection of `AnyCurve` objects.\r\n * * A `BagOfCurves` has no implied properties such as being planar.\r\n * @public\r\n */\r\nexport class BagOfCurves extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"bagOfCurves\";\r\n\r\n /** test if `other` is an instance of `BagOfCurves` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean { return other instanceof BagOfCurves; }\r\n /** Array of children.\r\n * * No restrictions on type.\r\n */\r\n protected _children: AnyCurve[];\r\n /** Construct an empty `BagOfCurves` */\r\n public constructor() { super(); this._children = []; }\r\n /** Return the (reference to) array of children */\r\n public override get children(): AnyCurve[] { return this._children; }\r\n /** create with given curves. */\r\n public static create(...data: AnyCurve[]): BagOfCurves {\r\n const result = new BagOfCurves();\r\n for (const child of data) {\r\n result.tryAddChild(child);\r\n }\r\n return result;\r\n }\r\n /** Return the boundary type (0) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number { return 0; }\r\n /** invoke `processor.announceBagOfCurves(this, indexInParent);` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceBagOfCurves(this, indexInParent);\r\n }\r\n /** Clone all children in stroked form. */\r\n public cloneStroked(options?: StrokeOptions): BagOfCurves {\r\n const clone = new BagOfCurves();\r\n let child;\r\n for (child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const ls = LineString3d.create();\r\n child.emitStrokes(ls, options);\r\n if (ls)\r\n clone.children.push(ls);\r\n } else if (child instanceof CurveCollection) {\r\n const childStrokes = child.cloneStroked(options);\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n }\r\n return clone;\r\n }\r\n /** Return an empty `BagOfCurves` */\r\n public cloneEmptyPeer(): BagOfCurves { return new BagOfCurves(); }\r\n /** Add a child */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child)\r\n this._children.push(child);\r\n return true;\r\n }\r\n /** Get a child by index */\r\n public getChild(i: number): AnyCurve | undefined {\r\n if (i < this._children.length)\r\n return this._children[i];\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBagOfCurves(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBagOfCurves(this);\r\n }\r\n}\r\n/**\r\n * * Options to control method `RegionOps.consolidateAdjacentPrimitives`\r\n * @public\r\n */\r\nexport class ConsolidateAdjacentCurvePrimitivesOptions {\r\n /** True to consolidated linear geometry (e.g. separate LineSegment3d and LineString3d) into LineString3d */\r\n public consolidateLinearGeometry: boolean = true;\r\n /** True to consolidate contiguous arcs */\r\n public consolidateCompatibleArcs: boolean = true;\r\n /** Tolerance for collapsing identical points */\r\n public duplicatePointTolerance = Geometry.smallMetricDistance;\r\n /** Tolerance for removing interior colinear points. */\r\n public colinearPointTolerance = Geometry.smallMetricDistance;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"CurveCollection.js","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQvC,OAAO,EAAE,mBAAmB,EAAE,M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AAW,EAAE,CAAC;IAC3B,CAAC;IACD,mBAAmB;IACZ,WAAW,CAAC,KAA2B;QAC5C,IAAI,KAAK;YACP,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,2BAA2B;IACpB,QAAQ,CAAC,CAAS;QACvB,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM;YAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,8EAA8E;IACvE,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,yCAAyC;IAAtD;QACE,8GAA8G;QACvG,8BAAyB,GAAY,IAAI,CAAC;QACjD,0CAA0C;QACnC,8BAAyB,GAAY,IAAI,CAAC;QACjD,gDAAgD;QACzC,4BAAuB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;QAC9D,uDAAuD;QAChD,2BAAsB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;IAC/D,CAAC;CAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { AnyCurve } from \"./CurveChain\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { CloneCurvesContext } from \"./internalContexts/CloneCurvesContext\";\r\nimport { CloneWithExpandedLineStrings } from \"./internalContexts/CloneWithExpandedLineStrings\";\r\nimport { CountLinearPartsSearchContext } from \"./internalContexts/CountLinearPartsSearchContext\";\r\nimport { GapSearchContext } from \"./internalContexts/GapSearchContext\";\r\nimport { PlaneAltitudeRangeContext } from \"./internalContexts/PlaneAltitudeRangeContext\";\r\nimport { SumLengthsContext } from \"./internalContexts/SumLengthsContext\";\r\nimport { TransformInPlaceContext } from \"./internalContexts/TransformInPlaceContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { ProxyCurve } from \"./ProxyCurve\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * Describes the concrete type of a [[CurveCollection]]. Each type name maps to a specific subclass and can be\r\n * used in conditional statements for type-switching.\r\n * - \"loop\" => [[Loop]]\r\n * - \"path\" => [[Path]]\r\n * - \"unionRegion\" => [[UnionRegion]]\r\n * - \"parityRegion\" => [[ParityRegion]]\r\n * - \"bagOfCurves\" => [[BagOfCurves]]\r\n * @public\r\n */\r\nexport type CurveCollectionType = \"loop\" | \"path\" | \"unionRegion\" | \"parityRegion\" | \"bagOfCurves\";\r\n\r\n/**\r\n * A `CurveCollection` is an abstract (non-instantiable) class for various sets of curves with particular structures:\r\n * - `CurveChain` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive` joining head-to-tail.\r\n * The two instantiable forms of `CurveChain` are\r\n * - `Path` - A chain not required to close, and not enclosing a planar area\r\n * - `Loop` - A chain required to close from last to first so that a planar area is enclosed.\r\n * - `ParityRegion` -- a collection of coplanar `Loop`s, with \"in/out\" classification by parity rules\r\n * - `UnionRegion` -- a collection of coplanar `Loop`s, with \"in/out\" classification by union rules\r\n * - `BagOfCurves` -- a collection of `AnyCurve` with no implied structure.\r\n *\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveCollection extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"curveCollection\";\r\n /** Type discriminator. */\r\n public abstract readonly curveCollectionType: CurveCollectionType;\r\n /* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n /** Flag for inner loop status. Only used by `Loop`. */\r\n public isInner: boolean = false;\r\n /** Return the sum of the lengths of all contained curves. */\r\n public sumLengths(): number {\r\n return SumLengthsContext.sumLengths(this);\r\n }\r\n /** Return the closest point on the contained curves */\r\n public closestPoint(spacePoint: Point3d): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const detailB = child.closestPoint(spacePoint, false);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n } else if (child instanceof CurveCollection) {\r\n const detailB = child.closestPoint(spacePoint);\r\n detailA = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n }\r\n }\r\n }\r\n return detailA;\r\n }\r\n /**\r\n * Return the max gap between adjacent primitives in Path and Loop collections.\r\n * * In a Path, gaps are computed between consecutive primitives.\r\n * * In a Loop, gaps are computed between consecutive primitives and between last and first.\r\n * * gaps are NOT computed between consecutive CurvePrimitives in \"unstructured\" collections. The type is\r\n * \"unstructured\" so gaps should not be semantically meaningful.\r\n */\r\n public maxGap(): number {\r\n return GapSearchContext.maxGap(this);\r\n }\r\n /** Return true if the curve collection has any primitives other than LineSegment3d and LineString3d */\r\n public checkForNonLinearPrimitives(): boolean {\r\n return CountLinearPartsSearchContext.hasNonLinearPrimitives(this);\r\n }\r\n /** Apply transform recursively to children */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n return TransformInPlaceContext.tryTransformInPlace(this, transform);\r\n }\r\n /** Return a deep copy. */\r\n public override clone(): CurveCollection {\r\n return CloneCurvesContext.clone(this) as CurveCollection;\r\n }\r\n /** Create a deep copy of transformed curves. */\r\n public override cloneTransformed(transform: Transform): CurveCollection | undefined {\r\n return CloneCurvesContext.clone(this, transform);\r\n }\r\n /** Create a deep copy with all linestrings expanded to multiple LineSegment3d. */\r\n public cloneWithExpandedLineStrings(): CurveCollection {\r\n return CloneWithExpandedLineStrings.clone(this);\r\n }\r\n /** Recurse through children to collect CurvePrimitive's in flat array. */\r\n private collectCurvePrimitivesGo(\r\n results: CurvePrimitive[], smallestPossiblePrimitives: boolean, explodeLinestrings: boolean = false\r\n ): void {\r\n if (this.children) {\r\n for (const child of this.children) {\r\n if (child instanceof CurvePrimitive)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n else if (child instanceof CurveCollection)\r\n child.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n }\r\n }\r\n }\r\n /**\r\n * Return an array containing only the curve primitives.\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without\r\n * clearing the array.)\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true,\r\n * it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(\r\n collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLineStrings: boolean = false\r\n ): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLineStrings);\r\n return results;\r\n }\r\n /**\r\n * Return true for planar region types:\r\n * * `Loop`\r\n * * `ParityRegion`\r\n * * `UnionRegion`\r\n */\r\n public get isAnyRegionType(): boolean {\r\n return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 5 || this.dgnBoundaryType() === 4;\r\n }\r\n /** Return true for a `Path`, i.e. a chain of curves joined head-to-tail */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\r\n }\r\n /**\r\n * Return true for a single-loop planar region type, i.e. `Loop`.\r\n * * This is _not- a test for physical closure of a `Path`\r\n */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /** Return a CurveCollection with the same structure but all curves replaced by strokes. */\r\n public abstract cloneStroked(options?: StrokeOptions): AnyCurve;\r\n /** Support method for ICurvePrimitive ... one line call to specific announce method . . */\r\n public abstract announceToCurveProcessor(processor: RecursiveCurveProcessor): void;\r\n /** Clone an empty collection. */\r\n public abstract cloneEmptyPeer(): CurveCollection;\r\n /**\r\n * Return the boundary type of a corresponding MicroStation CurveVector.\r\n * * Derived class must implement.\r\n */\r\n public abstract dgnBoundaryType(): number;\r\n /**\r\n * Try to add a child.\r\n * @param child child to add.\r\n * @return true if child is an acceptable type for this collection.\r\n */\r\n public abstract tryAddChild(child: AnyCurve | undefined): boolean;\r\n /** Return a child identified by by index */\r\n public abstract getChild(i: number): AnyCurve | undefined;\r\n /** Extend (increase) `rangeToExtend` as needed to include these curves (optionally transformed) */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n const children = this.children;\r\n if (children) {\r\n for (const c of children) {\r\n c.extendRange(rangeToExtend, transform);\r\n }\r\n }\r\n }\r\n /**\r\n * * Find any curve primitive in the source.\r\n * * Evaluate it at a fraction (which by default is an interior fraction)\r\n * @param source containing `CurvePrimitive` or `CurveCollection`\r\n * @param fraction fraction to use in `curve.fractionToPoint(fraction)`\r\n */\r\n public static createCurveLocationDetailOnAnyCurvePrimitive(\r\n source: GeometryQuery | undefined, fraction: number = 0.5\r\n ): CurveLocationDetail | undefined {\r\n if (!source)\r\n return undefined;\r\n if (source instanceof CurvePrimitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFraction(source, fraction);\r\n } else if (source instanceof CurveCollection && source.children !== undefined)\r\n for (const child of source.children) {\r\n const detail = this.createCurveLocationDetailOnAnyCurvePrimitive(child, fraction);\r\n if (detail)\r\n return detail;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters\r\n * of projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n\r\n/**\r\n * Shared base class for use by both open and closed paths.\r\n * - A `CurveChain` contains only curvePrimitives. No other paths, loops, or regions allowed.\r\n * - A single entry in the chain can in fact contain multiple curve primitives if the entry itself is (for instance)\r\n * `CurveChainWithDistanceIndex`\r\n * which presents itself (through method interface) as a CurvePrimitive with well defined mappings from fraction\r\n * to xyz, but in fact does all the\r\n * calculations over multiple primitives.\r\n * - The specific derived classes are `Path` and `Loop`\r\n * - `CurveChain` is an intermediate class. It is not instantiable on its own.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport abstract class CurveChain extends CurveCollection {\r\n /** The curve primitives in the chain. */\r\n protected _curves: CurvePrimitive[];\r\n protected constructor() { super(); this._curves = []; }\r\n /** Return the array of `CurvePrimitive` */\r\n public override get children(): CurvePrimitive[] {\r\n if (this._curves === undefined)\r\n this._curves = [];\r\n return this._curves;\r\n }\r\n /**\r\n * Return the `[index]` curve primitive, optionally using `modulo` to map`index` to the cyclic indexing.\r\n * * In particular, `-1` is the final curve.\r\n * @param index cyclic index\r\n */\r\n public cyclicCurvePrimitive(index: number, cyclic: boolean = true): CurvePrimitive | undefined {\r\n const n = this.children.length;\r\n if (n === 0)\r\n return undefined;\r\n /** Try simplest non-cyclic access first . . */\r\n if (index >= 0 && index < n)\r\n return this.children[index];\r\n if (cyclic) {\r\n const index2 = Geometry.modulo(index, n);\r\n return this.children[index2];\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Stroke the chain into a simple xyz array.\r\n * @param options tolerance parameters controlling the stroking.\r\n */\r\n public getPackedStrokes(options?: StrokeOptions): GrowableXYZArray | undefined {\r\n const tree = this.cloneStroked(options);\r\n if (tree instanceof CurveChain) {\r\n const children = tree.children;\r\n if (children.length === 1) {\r\n const ls = children[0];\r\n if (ls instanceof LineString3d)\r\n return ls.packedPoints;\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Return a structural clone, with CurvePrimitive objects stroked. */\r\n public abstract override cloneStroked(options?: StrokeOptions): AnyCurve;\r\n /* EDL 01/20 Path, Loop, CurveChainWithDistanceIndex all implement this.\r\n Reducing it to abstract.\r\n Hypothetically, a derived class in the wild might be depending on this.\r\n {\r\n const strokes = LineString3d.create();\r\n for (const curve of this.children)\r\n curve.emitStrokes(strokes, options);\r\n return strokes;\r\n }\r\n */\r\n /**\r\n * Add a child curve.\r\n * * Returns false if the given child is not a CurvePrimitive.\r\n */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child && child instanceof CurvePrimitive) {\r\n this._curves.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child by index */\r\n public getChild(i: number): CurvePrimitive | undefined {\r\n if (i < this._curves.length) return this._curves[i];\r\n return undefined;\r\n }\r\n /** Invoke `curve.extendRange(range, transform)` for each child */\r\n public override extendRange(range: Range3d, transform?: Transform): void {\r\n for (const curve of this._curves)\r\n curve.extendRange(range, transform);\r\n }\r\n /**\r\n * Reverse each child curve (in place)\r\n * Reverse the order of the children in the CurveChain array.\r\n */\r\n public reverseChildrenInPlace() {\r\n for (const curve of this._curves)\r\n curve.reverseInPlace();\r\n this._curves.reverse();\r\n }\r\n /**\r\n * Return the index where target is found in the array of children\r\n * @param alsoSearchProxies whether to also check proxy curves of the children\r\n */\r\n public childIndex(target: CurvePrimitive | undefined, alsoSearchProxies?: boolean): number | undefined {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n if (this._curves[i] === target)\r\n return i;\r\n }\r\n if (alsoSearchProxies ?? false) {\r\n for (let i = 0; i < this._curves.length; i++) {\r\n const childCurve = this._curves[i];\r\n if (childCurve instanceof ProxyCurve) {\r\n if (childCurve.proxyCurve === target)\r\n return i;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive. */\r\n public primitiveIndexAndFractionToCurveLocationDetailPointAndDerivative(\r\n index: number, fraction: number, cyclic: boolean = false, result?: CurveLocationDetail\r\n ): CurveLocationDetail | undefined {\r\n const primitive = this.cyclicCurvePrimitive(index, cyclic);\r\n if (primitive) {\r\n return CurveLocationDetail.createCurveEvaluatedFractionPointAndDerivative(primitive, fraction, result);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * * A `BagOfCurves` object is a collection of `AnyCurve` objects.\r\n * * A `BagOfCurves` has no implied properties such as being planar.\r\n * @public\r\n */\r\nexport class BagOfCurves extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"bagOfCurves\";\r\n /** Test if `other` is an instance of `BagOfCurves` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof BagOfCurves;\r\n }\r\n /**\r\n * Array of children.\r\n * * No restrictions on type.\r\n */\r\n protected _children: AnyCurve[];\r\n /** Construct an empty `BagOfCurves` */\r\n public constructor() { super(); this._children = []; }\r\n /** Return the (reference to) array of children */\r\n public override get children(): AnyCurve[] {\r\n return this._children;\r\n }\r\n /** Create with given curves. */\r\n public static create(...data: AnyCurve[]): BagOfCurves {\r\n const result = new BagOfCurves();\r\n for (const child of data) {\r\n result.tryAddChild(child);\r\n }\r\n return result;\r\n }\r\n /** Return the boundary type (0) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 0;\r\n }\r\n /** Invoke `processor.announceBagOfCurves(this, indexInParent);` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceBagOfCurves(this, indexInParent);\r\n }\r\n /** Clone all children in stroked form. */\r\n public cloneStroked(options?: StrokeOptions): BagOfCurves {\r\n const clone = new BagOfCurves();\r\n let child;\r\n for (child of this.children) {\r\n if (child instanceof CurvePrimitive) {\r\n const ls = LineString3d.create();\r\n child.emitStrokes(ls, options);\r\n if (ls)\r\n clone.children.push(ls);\r\n } else if (child instanceof CurveCollection) {\r\n const childStrokes = child.cloneStroked(options);\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n }\r\n return clone;\r\n }\r\n /** Return an empty `BagOfCurves` */\r\n public cloneEmptyPeer(): BagOfCurves {\r\n return new BagOfCurves();\r\n }\r\n /** Add a child */\r\n public tryAddChild(child: AnyCurve | undefined): boolean {\r\n if (child)\r\n this._children.push(child);\r\n return true;\r\n }\r\n /** Get a child by index */\r\n public getChild(i: number): AnyCurve | undefined {\r\n if (i < this._children.length)\r\n return this._children[i];\r\n return undefined;\r\n }\r\n /** Second step of double dispatch: call `handler.handleBagOfCurves(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleBagOfCurves(this);\r\n }\r\n}\r\n\r\n/**\r\n * * Options to control method `RegionOps.consolidateAdjacentPrimitives`\r\n * @public\r\n */\r\nexport class ConsolidateAdjacentCurvePrimitivesOptions {\r\n /** True to consolidated linear geometry (e.g. separate LineSegment3d and LineString3d) into LineString3d */\r\n public consolidateLinearGeometry: boolean = true;\r\n /** True to consolidate contiguous arcs */\r\n public consolidateCompatibleArcs: boolean = true;\r\n /** Tolerance for collapsing identical points */\r\n public duplicatePointTolerance = Geometry.smallMetricDistance;\r\n /** Tolerance for removing interior colinear points. */\r\n public colinearPointTolerance = Geometry.smallMetricDistance;\r\n}\r\n"]}
|
|
@@ -38,7 +38,7 @@ export declare enum CurveSearchStatus {
|
|
|
38
38
|
export declare class CurveLocationDetail {
|
|
39
39
|
/** The curve being evaluated */
|
|
40
40
|
curve?: CurvePrimitive;
|
|
41
|
-
/**
|
|
41
|
+
/** Optional ray */
|
|
42
42
|
ray?: Ray3d;
|
|
43
43
|
/** The fractional position along the curve */
|
|
44
44
|
fraction: number;
|
|
@@ -48,43 +48,49 @@ export declare class CurveLocationDetail {
|
|
|
48
48
|
point: Point3d;
|
|
49
49
|
/** A vector (e.g. tangent vector) in context */
|
|
50
50
|
vectorInCurveLocationDetail?: Vector3d;
|
|
51
|
-
/** A context-specific numeric value.
|
|
51
|
+
/** A context-specific numeric value. (e.g. a distance) */
|
|
52
52
|
a: number;
|
|
53
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Optional CurveLocationDetail with more detail of location. For instance, a detail for fractional position within
|
|
54
55
|
* a CurveChainWithDistanceIndex returns fraction and distance along the chain as its primary data and
|
|
55
56
|
* further detail of the particular curve within the chain in the childDetail.
|
|
56
57
|
*/
|
|
57
58
|
childDetail?: CurveLocationDetail;
|
|
58
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* A status indicator for certain searches.
|
|
59
61
|
* * e.g. CurvePrimitive.moveSignedDistanceFromFraction
|
|
60
62
|
*/
|
|
61
63
|
curveSearchStatus?: CurveSearchStatus;
|
|
62
|
-
/** (
|
|
64
|
+
/** (Optional) second fraction, e.g. end of interval of coincident curves */
|
|
63
65
|
fraction1?: number;
|
|
64
|
-
/** (
|
|
66
|
+
/** (Optional) second point, e.g. end of interval of coincident curves */
|
|
65
67
|
point1?: Point3d;
|
|
66
68
|
/** A context-specific additional point */
|
|
67
69
|
pointQ: Point3d;
|
|
70
|
+
/** constructor */
|
|
68
71
|
constructor();
|
|
69
72
|
/** Set the (optional) intervalRole field */
|
|
70
73
|
setIntervalRole(value: CurveIntervalRole): void;
|
|
71
74
|
/** Set the (optional) fraction1 and point1, using direct assignment (capture!) to point1 */
|
|
72
75
|
captureFraction1Point1(fraction1: number, point1: Point3d): void;
|
|
73
|
-
/**
|
|
76
|
+
/** Test if this pair has fraction1 defined */
|
|
74
77
|
get hasFraction1(): boolean;
|
|
75
|
-
/**
|
|
78
|
+
/** Test if this is an isolated point. This is true if intervalRole is any of (undefined, isolated, isolatedAtVertex) */
|
|
76
79
|
get isIsolated(): boolean;
|
|
77
|
-
/**
|
|
80
|
+
/** Return the fraction delta. (0 if no fraction1) */
|
|
78
81
|
get fractionDelta(): number;
|
|
79
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* If (fraction1, point1) are defined, make them the primary (and only) data.
|
|
80
84
|
* * No action if undefined.
|
|
81
85
|
*/
|
|
82
86
|
collapseToEnd(): void;
|
|
83
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* Make (fraction, point) the primary (and only) data.
|
|
84
89
|
* * No action if undefined.
|
|
85
90
|
*/
|
|
86
91
|
collapseToStart(): void;
|
|
87
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* Return a complete copy, WITH CAVEATS . . .
|
|
88
94
|
* * curve member is copied as a reference.
|
|
89
95
|
* * point and vector members are cloned.
|
|
90
96
|
*/
|
|
@@ -108,41 +114,30 @@ export declare class CurveLocationDetail {
|
|
|
108
114
|
* @param a (optional) numeric value to install.
|
|
109
115
|
*/
|
|
110
116
|
setFR(fraction: number, ray: Ray3d, a?: number): void;
|
|
111
|
-
/** Set the CurvePrimitive pointer, leaving all other properties untouched.
|
|
112
|
-
*/
|
|
117
|
+
/** Set the CurvePrimitive pointer, leaving all other properties untouched. */
|
|
113
118
|
setCurve(curve: CurvePrimitive): void;
|
|
114
119
|
/** record the distance from the CurveLocationDetail's point to the parameter point. */
|
|
115
120
|
setDistanceTo(point: Point3d): void;
|
|
116
|
-
/**
|
|
117
|
-
*/
|
|
121
|
+
/** Create with a CurvePrimitive pointer but no coordinate data. */
|
|
118
122
|
static create(curve?: CurvePrimitive, result?: CurveLocationDetail): CurveLocationDetail;
|
|
119
|
-
/**
|
|
120
|
-
*/
|
|
123
|
+
/** Create with CurvePrimitive pointer, fraction, and point coordinates. */
|
|
121
124
|
static createCurveFractionPoint(curve: CurvePrimitive | undefined, fraction: number, point: Point3d, result?: CurveLocationDetail): CurveLocationDetail;
|
|
122
|
-
/**
|
|
123
|
-
* Create a new detail with only ray, fraction, and point.
|
|
124
|
-
*/
|
|
125
|
+
/** Create a new detail with only ray, fraction, and point. */
|
|
125
126
|
static createRayFractionPoint(ray: Ray3d, fraction: number, point: Point3d, result?: CurveLocationDetail): CurveLocationDetail;
|
|
126
|
-
/**
|
|
127
|
-
*/
|
|
127
|
+
/** Create with CurvePrimitive pointer, fraction, and point coordinates */
|
|
128
128
|
static createCurveFractionPointDistanceCurveSearchStatus(curve: CurvePrimitive | undefined, fraction: number, point: Point3d, distance: number, status: CurveSearchStatus, result?: CurveLocationDetail): CurveLocationDetail;
|
|
129
|
-
/**
|
|
130
|
-
* *
|
|
131
|
-
*/
|
|
129
|
+
/** Create with curveSearchStatus affected by allowExtension. */
|
|
132
130
|
static createConditionalMoveSignedDistance(allowExtension: boolean, curve: CurvePrimitive, startFraction: number, endFraction: number, requestedSignedDistance: number, result?: CurveLocationDetail): CurveLocationDetail;
|
|
133
|
-
/**
|
|
134
|
-
*/
|
|
131
|
+
/** Create with CurvePrimitive pointer and fraction for evaluation. */
|
|
135
132
|
static createCurveEvaluatedFraction(curve: CurvePrimitive, fraction: number, result?: CurveLocationDetail): CurveLocationDetail;
|
|
136
|
-
/**
|
|
137
|
-
*/
|
|
133
|
+
/** Create with CurvePrimitive pointer and fraction for evaluation. */
|
|
138
134
|
static createCurveEvaluatedFractionPointAndDerivative(curve: CurvePrimitive, fraction: number, result?: CurveLocationDetail): CurveLocationDetail;
|
|
139
|
-
/**
|
|
140
|
-
*/
|
|
135
|
+
/** Create with CurvePrimitive pointer and 2 fractions for evaluation. */
|
|
141
136
|
static createCurveEvaluatedFractionFraction(curve: CurvePrimitive, fraction0: number, fraction1: number, result?: CurveLocationDetail): CurveLocationDetail;
|
|
142
|
-
/**
|
|
143
|
-
*/
|
|
137
|
+
/** Create with CurvePrimitive pointer, fraction, and point coordinates. */
|
|
144
138
|
static createCurveFractionPointDistance(curve: CurvePrimitive, fraction: number, point: Point3d, a: number, result?: CurveLocationDetail): CurveLocationDetail;
|
|
145
|
-
/**
|
|
139
|
+
/**
|
|
140
|
+
* Update or create if closer than current contents.
|
|
146
141
|
* @param curve candidate curve
|
|
147
142
|
* @param fraction candidate fraction
|
|
148
143
|
* @param point candidate point
|
|
@@ -151,12 +146,12 @@ export declare class CurveLocationDetail {
|
|
|
151
146
|
*/
|
|
152
147
|
updateIfCloserCurveFractionPointDistance(curve: CurvePrimitive, fraction: number, point: Point3d, a: number): boolean;
|
|
153
148
|
/**
|
|
154
|
-
*
|
|
149
|
+
* Exchange the (fraction,fraction1) and (point, point1) pairs.
|
|
155
150
|
* * (Skip each swap if its "1" value is undefined)
|
|
156
151
|
*/
|
|
157
152
|
swapFractionsAndPoints(): void;
|
|
158
153
|
/**
|
|
159
|
-
*
|
|
154
|
+
* Return the fraction where f falls between fraction and fraction1.
|
|
160
155
|
* * ASSUME fraction1 defined
|
|
161
156
|
*/
|
|
162
157
|
inverseInterpolateFraction(f: number, defaultFraction?: number): number;
|
|
@@ -167,7 +162,8 @@ export declare class CurveLocationDetail {
|
|
|
167
162
|
*/
|
|
168
163
|
static chooseSmallerA(detailA: CurveLocationDetail | undefined, detailB: CurveLocationDetail | undefined): CurveLocationDetail | undefined;
|
|
169
164
|
}
|
|
170
|
-
/**
|
|
165
|
+
/**
|
|
166
|
+
* Enumeration of configurations for intersections and min/max distance-between-curve
|
|
171
167
|
* @public
|
|
172
168
|
*/
|
|
173
169
|
export declare enum CurveCurveApproachType {
|
|
@@ -180,7 +176,8 @@ export declare enum CurveCurveApproachType {
|
|
|
180
176
|
/** Completely parallel geometry. */
|
|
181
177
|
ParallelGeometry = 3
|
|
182
178
|
}
|
|
183
|
-
/**
|
|
179
|
+
/**
|
|
180
|
+
* A pair of CurveLocationDetail.
|
|
184
181
|
* @public
|
|
185
182
|
*/
|
|
186
183
|
export declare class CurveLocationDetailPair {
|
|
@@ -188,14 +185,16 @@ export declare class CurveLocationDetailPair {
|
|
|
188
185
|
detailA: CurveLocationDetail;
|
|
189
186
|
/** The second of the two details ... */
|
|
190
187
|
detailB: CurveLocationDetail;
|
|
191
|
-
/**
|
|
188
|
+
/**
|
|
189
|
+
* Enumeration of how the detail pairs relate.
|
|
192
190
|
* * This is set only by certain closeApproach calculations.
|
|
193
191
|
*/
|
|
194
192
|
approachType?: CurveCurveApproachType;
|
|
195
193
|
constructor(detailA?: CurveLocationDetail, detailB?: CurveLocationDetail);
|
|
196
194
|
/** Create a curve detail pair using references to two CurveLocationDetails */
|
|
197
195
|
static createCapture(detailA: CurveLocationDetail, detailB: CurveLocationDetail, result?: CurveLocationDetailPair): CurveLocationDetailPair;
|
|
198
|
-
/**
|
|
196
|
+
/**
|
|
197
|
+
* Create a curve detail pair using references to two CurveLocationDetails.
|
|
199
198
|
* * optionally install in reversed positions
|
|
200
199
|
*/
|
|
201
200
|
static createCaptureOptionalReverse(detailA: CurveLocationDetail, detailB: CurveLocationDetail, reversed: boolean, result?: CurveLocationDetailPair): CurveLocationDetailPair;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveLocationDetail.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveLocationDetail.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;GAGG;AACH,oBAAY,iBAAiB;IAC3B,+DAA+D;IAC/D,QAAQ,IAAI;IACZ,4CAA4C;IAC5C,gBAAgB,IAAI;IACpB,2CAA2C;IAC3C,aAAa,KAAK;IAClB,gDAAgD;IAChD,gBAAgB,KAAK;IACrB,qCAAqC;IACrC,WAAW,KAAK;CAC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