@itwin/core-geometry 5.0.0-dev.16 → 5.0.0-dev.20
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/CurveCollection.d.ts +10 -0
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +22 -0
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +35 -28
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +119 -61
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +4 -4
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +2 -2
- package/lib/cjs/geometry3d/Point3dVector3d.js +2 -2
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +2 -2
- package/lib/cjs/geometry3d/PolygonOps.js +2 -2
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry4d/MomentData.d.ts +72 -73
- package/lib/cjs/geometry4d/MomentData.d.ts.map +1 -1
- package/lib/cjs/geometry4d/MomentData.js +62 -64
- package/lib/cjs/geometry4d/MomentData.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts +26 -23
- package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RuledSweep.js +30 -23
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SolidPrimitive.d.ts +12 -11
- package/lib/cjs/solid/SolidPrimitive.d.ts.map +1 -1
- package/lib/cjs/solid/SolidPrimitive.js +8 -5
- package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +10 -0
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +22 -0
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +35 -28
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +119 -61
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +4 -4
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +2 -2
- package/lib/esm/geometry3d/Point3dVector3d.js +2 -2
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +2 -2
- package/lib/esm/geometry3d/PolygonOps.js +2 -2
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +1 -1
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry4d/MomentData.d.ts +72 -73
- package/lib/esm/geometry4d/MomentData.d.ts.map +1 -1
- package/lib/esm/geometry4d/MomentData.js +62 -64
- package/lib/esm/geometry4d/MomentData.js.map +1 -1
- package/lib/esm/solid/RuledSweep.d.ts +26 -23
- package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
- package/lib/esm/solid/RuledSweep.js +30 -23
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SolidPrimitive.d.ts +12 -11
- package/lib/esm/solid/SolidPrimitive.d.ts.map +1 -1
- package/lib/esm/solid/SolidPrimitive.js +8 -5
- package/lib/esm/solid/SolidPrimitive.js.map +1 -1
- package/package.json +3 -3
|
@@ -16,19 +16,19 @@ const SolidPrimitive_1 = require("./SolidPrimitive");
|
|
|
16
16
|
const SweepContour_1 = require("./SweepContour");
|
|
17
17
|
/**
|
|
18
18
|
* A ruled sweep (surface) is a collection of 2 or more contours.
|
|
19
|
-
* * All contours must have identical number and type of geometry. (paths, loops, parity regions, lines, arcs, other curves)
|
|
19
|
+
* * All contours must have identical number and type of geometry. (paths, loops, parity regions, lines, arcs, other curves).
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
22
22
|
class RuledSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
23
23
|
constructor(contours, capped) {
|
|
24
24
|
super(capped);
|
|
25
|
-
/** String name for schema properties */
|
|
25
|
+
/** String name for schema properties. */
|
|
26
26
|
this.solidPrimitiveType = "ruledSweep";
|
|
27
27
|
this._contours = contours;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Create a ruled sweep from an array of contours.
|
|
31
|
-
* *
|
|
31
|
+
* * The contours are CAPTURED (not cloned).
|
|
32
32
|
*/
|
|
33
33
|
static create(contours, capped) {
|
|
34
34
|
const sweepContours = [];
|
|
@@ -41,9 +41,12 @@ class RuledSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
|
41
41
|
return new RuledSweep(sweepContours, capped);
|
|
42
42
|
}
|
|
43
43
|
/** Return a reference to the array of SweepContour. */
|
|
44
|
-
sweepContoursRef() {
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
sweepContoursRef() {
|
|
45
|
+
return this._contours;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Return clones of the sweep contours.
|
|
49
|
+
* * See also [[cloneContours]], which returns the contours without their local coordinate system definitions.
|
|
47
50
|
*/
|
|
48
51
|
cloneSweepContours() {
|
|
49
52
|
const result = [];
|
|
@@ -52,8 +55,9 @@ class RuledSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
|
52
55
|
}
|
|
53
56
|
return result;
|
|
54
57
|
}
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
58
|
+
/**
|
|
59
|
+
* Return clones of the sweep contours, each as a [[CurveCollection]].
|
|
60
|
+
* * See also [[cloneSweepContours]], which returns the contours with their local coordinate system definitions.
|
|
57
61
|
*/
|
|
58
62
|
cloneContours() {
|
|
59
63
|
const result = [];
|
|
@@ -62,7 +66,7 @@ class RuledSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
|
62
66
|
}
|
|
63
67
|
return result;
|
|
64
68
|
}
|
|
65
|
-
/** Return a deep clone */
|
|
69
|
+
/** Return a deep clone. */
|
|
66
70
|
clone() {
|
|
67
71
|
return new RuledSweep(this.cloneSweepContours(), this.capped);
|
|
68
72
|
}
|
|
@@ -87,19 +91,22 @@ class RuledSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
|
87
91
|
const result = this.clone();
|
|
88
92
|
return result.tryTransformInPlace(transform) ? result : undefined;
|
|
89
93
|
}
|
|
90
|
-
/**
|
|
91
|
-
*
|
|
94
|
+
/**
|
|
95
|
+
* Return a coordinate frame (right handed unit vectors)
|
|
96
|
+
* * origin on base contour.
|
|
92
97
|
* * x, y directions from base contour.
|
|
93
|
-
* * z direction perpendicular
|
|
98
|
+
* * z direction perpendicular.
|
|
94
99
|
*/
|
|
95
100
|
getConstructiveFrame() {
|
|
96
101
|
if (this._contours.length === 0)
|
|
97
102
|
return undefined;
|
|
98
103
|
return this._contours[0].localToWorld.cloneRigid();
|
|
99
104
|
}
|
|
100
|
-
/** Test if `other` is an instance of a `RuledSweep
|
|
101
|
-
isSameGeometryClass(other) {
|
|
102
|
-
|
|
105
|
+
/** Test if `other` is an instance of a `RuledSweep`. */
|
|
106
|
+
isSameGeometryClass(other) {
|
|
107
|
+
return other instanceof RuledSweep;
|
|
108
|
+
}
|
|
109
|
+
/** Test for near equality of two RuledSweeps. */
|
|
103
110
|
isAlmostEqual(other) {
|
|
104
111
|
if (other instanceof RuledSweep) {
|
|
105
112
|
if (this.capped !== other.capped)
|
|
@@ -114,13 +121,13 @@ class RuledSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
|
114
121
|
}
|
|
115
122
|
return false;
|
|
116
123
|
}
|
|
117
|
-
/**
|
|
124
|
+
/** Dispatch to strongly typed `handler.handleRuledSweep(this)`. */
|
|
118
125
|
dispatchToGeometryHandler(handler) {
|
|
119
126
|
return handler.handleRuledSweep(this);
|
|
120
127
|
}
|
|
121
128
|
/**
|
|
122
|
-
* Return the section curves at a fraction of the sweep
|
|
123
|
-
* @param vFraction fractional position along the sweep direction
|
|
129
|
+
* Return the section curves at a fraction of the sweep.
|
|
130
|
+
* @param vFraction fractional position along the sweep direction.
|
|
124
131
|
*/
|
|
125
132
|
constantVSection(vFraction) {
|
|
126
133
|
const numSection = this._contours.length;
|
|
@@ -143,12 +150,14 @@ class RuledSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
|
143
150
|
return undefined;
|
|
144
151
|
});
|
|
145
152
|
}
|
|
146
|
-
/** Pass each contour to `extendRange
|
|
153
|
+
/** Pass each contour to `extendRange`. */
|
|
147
154
|
extendRange(rangeToExtend, transform) {
|
|
148
155
|
for (const contour of this._contours)
|
|
149
156
|
contour.curves.extendRange(rangeToExtend, transform);
|
|
150
157
|
}
|
|
151
|
-
/**
|
|
158
|
+
/**
|
|
159
|
+
* Construct a CurveCollection with the same structure as collectionA and collectionB, with primitives constructed
|
|
160
|
+
* by the caller-supplied primitiveMutator function.
|
|
152
161
|
* @returns Returns undefined if there is any type mismatch between the two collections.
|
|
153
162
|
*/
|
|
154
163
|
static mutatePartners(collectionA, collectionB, primitiveMutator) {
|
|
@@ -199,9 +208,7 @@ class RuledSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
|
199
208
|
return undefined;
|
|
200
209
|
}
|
|
201
210
|
/**
|
|
202
|
-
*
|
|
203
|
-
* * cap flag
|
|
204
|
-
* identical first and last contours.
|
|
211
|
+
* @return true if this is a closed volume.
|
|
205
212
|
*/
|
|
206
213
|
get isClosedVolume() {
|
|
207
214
|
const n = this._contours.length;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuledSweep.js","sourceRoot":"","sources":["../../../src/solid/RuledSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sFAAmF;AAEnF,8DAAuE;AACvE,4DAAyD;AAEzD,0CAAuC;AAIvC,qDAAkD;AAClD,iDAA8C;AAQ9C;;;;GAIG;AACH,MAAa,UAAW,SAAQ,+BAAc;IAK5C,YAAoB,QAAwB,EAAE,MAAe;QAC3D,KAAK,CAAC,MAAM,CAAC,CAAC;QALhB,wCAAwC;QACxB,uBAAkB,GAAG,YAAY,CAAC;QAKhD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,MAAM,CAAC,QAAoB,EAAE,MAAe;QACxD,MAAM,aAAa,GAAG,EAAE,CAAC;QACzB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,MAAM,SAAS,GAAG,2BAAY,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;YAC7D,IAAI,SAAS,KAAK,SAAS;gBAAE,OAAO,SAAS,CAAC;YAC9C,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChC,CAAC;QACD,OAAO,IAAI,UAAU,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IACD,uDAAuD;IAChD,gBAAgB,KAAqB,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACpE;;OAEG;IACI,kBAAkB;QACvB,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACvC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;OAEG;IACI,aAAa;QAClB,M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,EAAE,CAAC;oBAClF,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;oBACvE,IAAI,CAAC,QAAQ;wBACX,OAAO,SAAS,CAAC;oBACnB,IAAI,QAAQ,YAAY,iCAAe;wBACrC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC7B,CAAC;YACH,CAAC;YACD,OAAO,WAAW,CAAC;QACrB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD;;;;OAIG;IACH,IAAW,cAAc;QACvB,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1F,CAAC;CAEF;AA1LD,gCA0LC","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 Solid\r\n */\r\n\r\nimport { ConstructCurveBetweenCurves } from \"../curve/ConstructCurveBetweenCurves\";\r\nimport { AnyCurve } from \"../curve/CurveTypes\";\r\nimport { CurveChain, CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { SolidPrimitive } from \"./SolidPrimitive\";\r\nimport { SweepContour } from \"./SweepContour\";\r\n\r\n/**\r\n * * type for a function argument taking 2 curves and returning another curve or failing with undefined.\r\n * * This is used (for instance) by `RuleSweep.mutatePartners`\r\n * @public\r\n */\r\nexport type CurvePrimitiveMutator = (primitiveA: CurvePrimitive, primitiveB: CurvePrimitive) => CurvePrimitive | undefined;\r\n/**\r\n * A ruled sweep (surface) is a collection of 2 or more contours.\r\n * * All contours must have identical number and type of geometry. (paths, loops, parity regions, lines, arcs, other curves)\r\n * @public\r\n */\r\nexport class RuledSweep extends SolidPrimitive {\r\n /** String name for schema properties */\r\n public readonly solidPrimitiveType = \"ruledSweep\";\r\n\r\n private _contours: SweepContour[];\r\n private constructor(contours: SweepContour[], capped: boolean) {\r\n super(capped);\r\n this._contours = contours;\r\n }\r\n /**\r\n * Create a ruled sweep from an array of contours.\r\n * * the contours are CAPTURED (not cloned)\r\n */\r\n public static create(contours: AnyCurve[], capped: boolean): RuledSweep | undefined {\r\n const sweepContours = [];\r\n for (const contour of contours) {\r\n const sweepable = SweepContour.createForLinearSweep(contour);\r\n if (sweepable === undefined) return undefined;\r\n sweepContours.push(sweepable);\r\n }\r\n return new RuledSweep(sweepContours, capped);\r\n }\r\n /** Return a reference to the array of SweepContour. */\r\n public sweepContoursRef(): SweepContour[] { return this._contours; }\r\n /** Return clones of all the sweep contours\r\n * * See also cloneContours, which returns the spatial contours without their local coordinate system definitions)\r\n */\r\n public cloneSweepContours(): SweepContour[] {\r\n const result = [];\r\n for (const sweepable of this._contours) {\r\n result.push(sweepable.clone());\r\n }\r\n return result;\r\n }\r\n /** Return clones of all the contours\r\n * * See also cloneContours, which returns the contours in their local coordinate systems\r\n */\r\n public cloneContours(): CurveCollection[] {\r\n const result = [];\r\n for (const sweepable of this._contours) {\r\n result.push(sweepable.curves.clone());\r\n }\r\n return result;\r\n }\r\n /** Return a deep clone */\r\n public clone(): RuledSweep {\r\n return new RuledSweep(this.cloneSweepContours(), this.capped);\r\n }\r\n /**\r\n * Transform all contours in place.\r\n * * This fails if the transformation is singular.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n if (transform.matrix.isSingular())\r\n return false;\r\n for (const contour of this._contours) {\r\n if (!contour.tryTransformInPlace(transform))\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Return a transformed clone.\r\n * * This fails if the transformation is singular.\r\n */\r\n public cloneTransformed(transform: Transform): RuledSweep | undefined {\r\n const result = this.clone();\r\n return result.tryTransformInPlace(transform) ? result : undefined;\r\n }\r\n /** Return a coordinate frame (right handed unit vectors)\r\n * * origin on base contour\r\n * * x, y directions from base contour.\r\n * * z direction perpendicular\r\n */\r\n public getConstructiveFrame(): Transform | undefined {\r\n if (this._contours.length === 0) return undefined;\r\n return this._contours[0].localToWorld.cloneRigid();\r\n }\r\n /** Test if `other` is an instance of a `RuledSweep` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof RuledSweep; }\r\n /** test same contour geometry and capping. */\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof RuledSweep) {\r\n if (this.capped !== other.capped) return false;\r\n if (this._contours.length !== other._contours.length) return false;\r\n for (let i = 0; i < this._contours.length; i++) {\r\n if (!this._contours[i].isAlmostEqual(other._contours[i]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** dispatch to strongly typed `handler.handleRuledSweep(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleRuledSweep(this);\r\n }\r\n /**\r\n * Return the section curves at a fraction of the sweep\r\n * @param vFraction fractional position along the sweep direction\r\n */\r\n public constantVSection(vFraction: number): CurveCollection | undefined {\r\n const numSection = this._contours.length;\r\n if (numSection < 2)\r\n return undefined;\r\n const q = vFraction * numSection;\r\n let section0 = 0;\r\n if (vFraction >= 1.0)\r\n section0 = numSection - 1;\r\n else\r\n section0 = Math.floor(q);\r\n if (section0 + 1 >= numSection)\r\n section0 = numSection - 2;\r\n const section1 = section0 + 1;\r\n const localFraction = Geometry.clampToStartEnd(q - section0, 0, 1);\r\n return RuledSweep.mutatePartners(this._contours[section0].curves, this._contours[section1].curves,\r\n (primitive0: CurvePrimitive, primitive1: CurvePrimitive): CurvePrimitive | undefined => {\r\n const newPrimitive = ConstructCurveBetweenCurves.interpolateBetween(primitive0, localFraction, primitive1);\r\n if (newPrimitive instanceof CurvePrimitive) return newPrimitive;\r\n return undefined;\r\n });\r\n }\r\n /** Pass each contour to `extendRange` */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n for (const contour of this._contours)\r\n contour.curves.extendRange(rangeToExtend, transform);\r\n }\r\n\r\n /** Construct a CurveCollection with the same structure as collectionA and collectionB, with primitives constructed by the caller-supplied primitiveMutator function.\r\n * @returns Returns undefined if there is any type mismatch between the two collections.\r\n */\r\n public static mutatePartners(collectionA: CurveCollection, collectionB: CurveCollection, primitiveMutator: CurvePrimitiveMutator): CurveCollection | undefined {\r\n if (!collectionA.isSameGeometryClass(collectionB))\r\n return undefined;\r\n if (collectionA instanceof CurveChain && collectionB instanceof CurveChain) {\r\n const chainA = collectionA;\r\n const chainB = collectionB;\r\n const chainC = chainA.cloneEmptyPeer() as CurveChain;\r\n const childrenA = chainA.children;\r\n const childrenB = chainB.children;\r\n if (childrenA.length !== childrenB.length)\r\n return undefined;\r\n for (let i = 0; i < childrenA.length; i++) {\r\n const newChild = primitiveMutator(childrenA[i], childrenB[i]);\r\n if (!newChild)\r\n return undefined;\r\n chainC.children.push(newChild);\r\n }\r\n return chainC;\r\n } else if (collectionA instanceof CurveCollection && collectionB instanceof CurveCollection) {\r\n const collectionC = collectionA.cloneEmptyPeer();\r\n const childrenA = collectionA.children;\r\n const childrenB = collectionB.children;\r\n const childrenC = collectionC.children;\r\n if (childrenA === undefined || childrenB === undefined || childrenC === undefined || childrenA.length !== childrenB.length)\r\n return undefined;\r\n for (let i = 0; i < childrenA.length; i++) {\r\n const childA = childrenA[i];\r\n const childB = childrenB[i];\r\n if (childA instanceof CurvePrimitive && childB instanceof CurvePrimitive) {\r\n const newPrimitive = primitiveMutator(childA, childB);\r\n if (!newPrimitive)\r\n return undefined;\r\n childrenC.push(newPrimitive);\r\n } else if (childA instanceof CurveCollection && childB instanceof CurveCollection) {\r\n const newChild = this.mutatePartners(childA, childB, primitiveMutator);\r\n if (!newChild)\r\n return undefined;\r\n if (newChild instanceof CurveCollection)\r\n childrenC.push(newChild);\r\n }\r\n }\r\n return collectionC;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return true if this is a closed volume, as observed by\r\n * * cap flag\r\n * identical first and last contours.\r\n */\r\n public get isClosedVolume(): boolean {\r\n const n = this._contours.length;\r\n return n > 1 && (this.capped || this._contours[0].isAlmostEqual(this._contours[n - 1]));\r\n }\r\n\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"RuledSweep.js","sourceRoot":"","sources":["../../../src/solid/RuledSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sFAAmF;AAEnF,8DAAuE;AACvE,4DAAyD;AAEzD,0CAAuC;AAIvC,qDAAkD;AAClD,iDAA8C;AAQ9C;;;;GAIG;AACH,MAAa,UAAW,SAAQ,+BAAc;IAK5C,YAAoB,QAAwB,EAAE,MAAe;QAC3D,KAAK,CAAC,MAAM,CAAC,CAAC;QALhB,yCAAyC;QACzB,uBAAkB,GAAG,YAAY,CAAC;QAKhD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,MAAM,CAAC,QAAoB,EAAE,MAAe;QACxD,MAAM,aAAa,GAAG,EAAE,CAAC;QACzB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,MAAM,SAAS,GAAG,2BAAY,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;YAC7D,IAAI,SAAS,KAAK,SAAS;gBACzB,OAAO,SAAS,CAAC;YACnB,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChC,CAAC;QACD,OAAO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MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;gBAC5B,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;gBAC5B,IAAI,MAAM,YAAY,+BAAc,IAAI,MAAM,YAAY,+BAAc,EAAE,CAAC;oBACzE,MAAM,YAAY,GAAG,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;oBACtD,IAAI,CAAC,YAAY;wBACf,OAAO,SAAS,CAAC;oBACnB,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBAC/B,CAAC;qBAAM,IAAI,MAAM,YAAY,iCAAe,IAAI,MAAM,YAAY,iCAAe,EAAE,CAAC;oBAClF,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;oBACvE,IAAI,CAAC,QAAQ;wBACX,OAAO,SAAS,CAAC;oBACnB,IAAI,QAAQ,YAAY,iCAAe;wBACrC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC7B,CAAC;YACH,CAAC;YACD,OAAO,WAAW,CAAC;QACrB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF;AAzMD,gCAyMC","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 Solid\r\n */\r\n\r\nimport { ConstructCurveBetweenCurves } from \"../curve/ConstructCurveBetweenCurves\";\r\nimport { AnyCurve } from \"../curve/CurveTypes\";\r\nimport { CurveChain, CurveCollection } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { SolidPrimitive } from \"./SolidPrimitive\";\r\nimport { SweepContour } from \"./SweepContour\";\r\n\r\n/**\r\n * Type for a function argument taking 2 curves and returning another curve or failing with undefined.\r\n * * This is used (for instance) by `RuleSweep.mutatePartners`.\r\n * @public\r\n */\r\nexport type CurvePrimitiveMutator = (primitiveA: CurvePrimitive, primitiveB: CurvePrimitive) => CurvePrimitive | undefined;\r\n/**\r\n * A ruled sweep (surface) is a collection of 2 or more contours.\r\n * * All contours must have identical number and type of geometry. (paths, loops, parity regions, lines, arcs, other curves).\r\n * @public\r\n */\r\nexport class RuledSweep extends SolidPrimitive {\r\n /** String name for schema properties. */\r\n public readonly solidPrimitiveType = \"ruledSweep\";\r\n\r\n private _contours: SweepContour[];\r\n private constructor(contours: SweepContour[], capped: boolean) {\r\n super(capped);\r\n this._contours = contours;\r\n }\r\n /**\r\n * Create a ruled sweep from an array of contours.\r\n * * The contours are CAPTURED (not cloned).\r\n */\r\n public static create(contours: AnyCurve[], capped: boolean): RuledSweep | undefined {\r\n const sweepContours = [];\r\n for (const contour of contours) {\r\n const sweepable = SweepContour.createForLinearSweep(contour);\r\n if (sweepable === undefined)\r\n return undefined;\r\n sweepContours.push(sweepable);\r\n }\r\n return new RuledSweep(sweepContours, capped);\r\n }\r\n /** Return a reference to the array of SweepContour. */\r\n public sweepContoursRef(): SweepContour[] {\r\n return this._contours;\r\n }\r\n /**\r\n * Return clones of the sweep contours.\r\n * * See also [[cloneContours]], which returns the contours without their local coordinate system definitions.\r\n */\r\n public cloneSweepContours(): SweepContour[] {\r\n const result = [];\r\n for (const sweepable of this._contours) {\r\n result.push(sweepable.clone());\r\n }\r\n return result;\r\n }\r\n /**\r\n * Return clones of the sweep contours, each as a [[CurveCollection]].\r\n * * See also [[cloneSweepContours]], which returns the contours with their local coordinate system definitions.\r\n */\r\n public cloneContours(): CurveCollection[] {\r\n const result = [];\r\n for (const sweepable of this._contours) {\r\n result.push(sweepable.curves.clone());\r\n }\r\n return result;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): RuledSweep {\r\n return new RuledSweep(this.cloneSweepContours(), this.capped);\r\n }\r\n /**\r\n * Transform all contours in place.\r\n * * This fails if the transformation is singular.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n if (transform.matrix.isSingular())\r\n return false;\r\n for (const contour of this._contours) {\r\n if (!contour.tryTransformInPlace(transform))\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Return a transformed clone.\r\n * * This fails if the transformation is singular.\r\n */\r\n public cloneTransformed(transform: Transform): RuledSweep | undefined {\r\n const result = this.clone();\r\n return result.tryTransformInPlace(transform) ? result : undefined;\r\n }\r\n /**\r\n * Return a coordinate frame (right handed unit vectors)\r\n * * origin on base contour.\r\n * * x, y directions from base contour.\r\n * * z direction perpendicular.\r\n */\r\n public getConstructiveFrame(): Transform | undefined {\r\n if (this._contours.length === 0)\r\n return undefined;\r\n return this._contours[0].localToWorld.cloneRigid();\r\n }\r\n /** Test if `other` is an instance of a `RuledSweep`. */\r\n public isSameGeometryClass(other: any): boolean {\r\n return other instanceof RuledSweep;\r\n }\r\n /** Test for near equality of two RuledSweeps. */\r\n public override isAlmostEqual(other: GeometryQuery): boolean {\r\n if (other instanceof RuledSweep) {\r\n if (this.capped !== other.capped)\r\n return false;\r\n if (this._contours.length !== other._contours.length)\r\n return false;\r\n for (let i = 0; i < this._contours.length; i++) {\r\n if (!this._contours[i].isAlmostEqual(other._contours[i]))\r\n return false;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Dispatch to strongly typed `handler.handleRuledSweep(this)`. */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleRuledSweep(this);\r\n }\r\n /**\r\n * Return the section curves at a fraction of the sweep.\r\n * @param vFraction fractional position along the sweep direction.\r\n */\r\n public constantVSection(vFraction: number): CurveCollection | undefined {\r\n const numSection = this._contours.length;\r\n if (numSection < 2)\r\n return undefined;\r\n const q = vFraction * numSection;\r\n let section0 = 0;\r\n if (vFraction >= 1.0)\r\n section0 = numSection - 1;\r\n else\r\n section0 = Math.floor(q);\r\n if (section0 + 1 >= numSection)\r\n section0 = numSection - 2;\r\n const section1 = section0 + 1;\r\n const localFraction = Geometry.clampToStartEnd(q - section0, 0, 1);\r\n return RuledSweep.mutatePartners(\r\n this._contours[section0].curves,\r\n this._contours[section1].curves,\r\n (primitive0: CurvePrimitive, primitive1: CurvePrimitive): CurvePrimitive | undefined => {\r\n const newPrimitive = ConstructCurveBetweenCurves.interpolateBetween(primitive0, localFraction, primitive1);\r\n if (newPrimitive instanceof CurvePrimitive) return newPrimitive;\r\n return undefined;\r\n },\r\n );\r\n }\r\n /** Pass each contour to `extendRange`. */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n for (const contour of this._contours)\r\n contour.curves.extendRange(rangeToExtend, transform);\r\n }\r\n\r\n /**\r\n * Construct a CurveCollection with the same structure as collectionA and collectionB, with primitives constructed\r\n * by the caller-supplied primitiveMutator function.\r\n * @returns Returns undefined if there is any type mismatch between the two collections.\r\n */\r\n public static mutatePartners(\r\n collectionA: CurveCollection, collectionB: CurveCollection, primitiveMutator: CurvePrimitiveMutator,\r\n ): CurveCollection | undefined {\r\n if (!collectionA.isSameGeometryClass(collectionB))\r\n return undefined;\r\n if (collectionA instanceof CurveChain && collectionB instanceof CurveChain) {\r\n const chainA = collectionA;\r\n const chainB = collectionB;\r\n const chainC = chainA.cloneEmptyPeer() as CurveChain;\r\n const childrenA = chainA.children;\r\n const childrenB = chainB.children;\r\n if (childrenA.length !== childrenB.length)\r\n return undefined;\r\n for (let i = 0; i < childrenA.length; i++) {\r\n const newChild = primitiveMutator(childrenA[i], childrenB[i]);\r\n if (!newChild)\r\n return undefined;\r\n chainC.children.push(newChild);\r\n }\r\n return chainC;\r\n } else if (collectionA instanceof CurveCollection && collectionB instanceof CurveCollection) {\r\n const collectionC = collectionA.cloneEmptyPeer();\r\n const childrenA = collectionA.children;\r\n const childrenB = collectionB.children;\r\n const childrenC = collectionC.children;\r\n if (childrenA === undefined || childrenB === undefined || childrenC === undefined || childrenA.length !== childrenB.length)\r\n return undefined;\r\n for (let i = 0; i < childrenA.length; i++) {\r\n const childA = childrenA[i];\r\n const childB = childrenB[i];\r\n if (childA instanceof CurvePrimitive && childB instanceof CurvePrimitive) {\r\n const newPrimitive = primitiveMutator(childA, childB);\r\n if (!newPrimitive)\r\n return undefined;\r\n childrenC.push(newPrimitive);\r\n } else if (childA instanceof CurveCollection && childB instanceof CurveCollection) {\r\n const newChild = this.mutatePartners(childA, childB, primitiveMutator);\r\n if (!newChild)\r\n return undefined;\r\n if (newChild instanceof CurveCollection)\r\n childrenC.push(newChild);\r\n }\r\n }\r\n return collectionC;\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * @return true if this is a closed volume.\r\n */\r\n public get isClosedVolume(): boolean {\r\n const n = this._contours.length;\r\n return n > 1 && (this.capped || this._contours[0].isAlmostEqual(this._contours[n - 1]));\r\n }\r\n}\r\n"]}
|
|
@@ -11,8 +11,9 @@ import { RotationalSweep } from "./RotationalSweep";
|
|
|
11
11
|
import { RuledSweep } from "./RuledSweep";
|
|
12
12
|
import { Sphere } from "./Sphere";
|
|
13
13
|
import { TorusPipe } from "./TorusPipe";
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
14
|
+
/**
|
|
15
|
+
* Describes the concrete type of a [[SolidPrimitive]]. Each type name maps to a specific subclass and can be used for
|
|
16
|
+
* type-switching in conditional statements.
|
|
16
17
|
* - "box" => [[Box]]
|
|
17
18
|
* - "cone" => [[Cone]]
|
|
18
19
|
* - "sphere" => [[Sphere]]
|
|
@@ -20,39 +21,39 @@ import { TorusPipe } from "./TorusPipe";
|
|
|
20
21
|
* - "rotationalSweep" => [[RotationalSweep]]
|
|
21
22
|
* - "ruledSweep" => [[RuledSweep]]
|
|
22
23
|
* - "torusPipe" => [[TorusPipe]]
|
|
23
|
-
*
|
|
24
24
|
* @public
|
|
25
25
|
*/
|
|
26
26
|
export type SolidPrimitiveType = "box" | "cone" | "sphere" | "linearSweep" | "rotationalSweep" | "ruledSweep" | "torusPipe";
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Union type of all subclasses of [[SolidPrimitive]].
|
|
28
29
|
* @public
|
|
29
30
|
*/
|
|
30
31
|
export type AnySolidPrimitive = Box | Cone | Sphere | LinearSweep | RotationalSweep | RuledSweep | TorusPipe;
|
|
31
32
|
/**
|
|
32
33
|
* Base class for SolidPrimitive variants.
|
|
33
|
-
*
|
|
34
34
|
* * The base class holds capped flag for all derived classes.
|
|
35
35
|
* @public
|
|
36
36
|
*/
|
|
37
37
|
export declare abstract class SolidPrimitive extends GeometryQuery {
|
|
38
|
-
/** String name for schema properties */
|
|
38
|
+
/** String name for schema properties. */
|
|
39
39
|
readonly geometryCategory = "solid";
|
|
40
|
-
/** String name for schema properties */
|
|
40
|
+
/** String name for schema properties. */
|
|
41
41
|
abstract readonly solidPrimitiveType: SolidPrimitiveType;
|
|
42
|
-
/**
|
|
42
|
+
/** Flag indicating whether cap region is considered closed (i.e. a planar region, rather than just a wire in space). */
|
|
43
43
|
protected _capped: boolean;
|
|
44
44
|
protected constructor(capped: boolean);
|
|
45
|
-
/** Whether this is a capped solid */
|
|
45
|
+
/** Whether this is a capped solid. */
|
|
46
46
|
get capped(): boolean;
|
|
47
47
|
set capped(capped: boolean);
|
|
48
48
|
/** Return a cross section at specified vFraction. */
|
|
49
49
|
abstract constantVSection(_vFraction: number): CurveCollection | undefined;
|
|
50
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Return a Transform from the local system of the solid to world.
|
|
51
52
|
* * The particulars of origin and orientation are specific to each SolidPrimitive type.
|
|
52
53
|
*/
|
|
53
54
|
abstract getConstructiveFrame(): Transform | undefined;
|
|
54
55
|
/**
|
|
55
|
-
*
|
|
56
|
+
* Return true if this is a closed volume
|
|
56
57
|
* * LinearSweep, Box, Cone only depend on capped.
|
|
57
58
|
* * Sphere affected by capped and latitude sweep
|
|
58
59
|
* * TorusPipe and RotationalSweep affected by capped and sweep
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolidPrimitive.d.ts","sourceRoot":"","sources":["../../../src/solid/SolidPrimitive.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,aAAa,GAAG,iBAAiB,GAAG,YAAY,GAAG,WAAW,CAAC;AAE5H
|
|
1
|
+
{"version":3,"file":"SolidPrimitive.d.ts","sourceRoot":"","sources":["../../../src/solid/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AS;IACjF;;;OAGG;aACa,oBAAoB,IAAI,SAAS,GAAG,SAAS;IAC7D;;;;;;OAMG;IACH,aAAoB,cAAc,IAAI,OAAO,CAAC;CAC/C"}
|
|
@@ -8,20 +8,23 @@ exports.SolidPrimitive = void 0;
|
|
|
8
8
|
const GeometryQuery_1 = require("../curve/GeometryQuery");
|
|
9
9
|
/**
|
|
10
10
|
* Base class for SolidPrimitive variants.
|
|
11
|
-
*
|
|
12
11
|
* * The base class holds capped flag for all derived classes.
|
|
13
12
|
* @public
|
|
14
13
|
*/
|
|
15
14
|
class SolidPrimitive extends GeometryQuery_1.GeometryQuery {
|
|
16
15
|
constructor(capped) {
|
|
17
16
|
super();
|
|
18
|
-
/** String name for schema properties */
|
|
17
|
+
/** String name for schema properties. */
|
|
19
18
|
this.geometryCategory = "solid";
|
|
20
19
|
this._capped = capped;
|
|
21
20
|
}
|
|
22
|
-
/** Whether this is a capped solid */
|
|
23
|
-
get capped() {
|
|
24
|
-
|
|
21
|
+
/** Whether this is a capped solid. */
|
|
22
|
+
get capped() {
|
|
23
|
+
return this._capped;
|
|
24
|
+
}
|
|
25
|
+
set capped(capped) {
|
|
26
|
+
this._capped = capped;
|
|
27
|
+
}
|
|
25
28
|
}
|
|
26
29
|
exports.SolidPrimitive = SolidPrimitive;
|
|
27
30
|
//# sourceMappingURL=SolidPrimitive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolidPrimitive.js","sourceRoot":"","sources":["../../../src/solid/SolidPrimitive.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,0DAAuD;
|
|
1
|
+
{"version":3,"file":"SolidPrimitive.js","sourceRoot":"","sources":["../../../src/solid/SolidPrimitive.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,0DAAuD;AA8BvD;;;;GAIG;AACH,MAAsB,cAAe,SAAQ,6BAAa;IAOxD,YAAsB,MAAe;QACnC,KAAK,EAAE,CAAC;QAPV,yCAAyC;QACzB,qBAAgB,GAAG,OAAO,CAAC;QAOzC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IACD,sCAAsC;IACtC,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IACD,IAAW,MAAM,CAAC,MAAe;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;CAgBF;AAjCD,wCAiCC","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 Solid\r\n */\r\n\r\nimport { CurveCollection } from \"../curve/CurveCollection\";\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Box } from \"./Box\";\r\nimport { Cone } from \"./Cone\";\r\nimport { LinearSweep } from \"./LinearSweep\";\r\nimport { RotationalSweep } from \"./RotationalSweep\";\r\nimport { RuledSweep } from \"./RuledSweep\";\r\nimport { Sphere } from \"./Sphere\";\r\nimport { TorusPipe } from \"./TorusPipe\";\r\n\r\n/**\r\n * Describes the concrete type of a [[SolidPrimitive]]. Each type name maps to a specific subclass and can be used for\r\n * type-switching in conditional statements.\r\n * - \"box\" => [[Box]]\r\n * - \"cone\" => [[Cone]]\r\n * - \"sphere\" => [[Sphere]]\r\n * - \"linearSweep\" => [[LinearSweep]]\r\n * - \"rotationalSweep\" => [[RotationalSweep]]\r\n * - \"ruledSweep\" => [[RuledSweep]]\r\n * - \"torusPipe\" => [[TorusPipe]]\r\n * @public\r\n */\r\nexport type SolidPrimitiveType = \"box\" | \"cone\" | \"sphere\" | \"linearSweep\" | \"rotationalSweep\" | \"ruledSweep\" | \"torusPipe\";\r\n\r\n/**\r\n * Union type of all subclasses of [[SolidPrimitive]].\r\n * @public\r\n */\r\nexport type AnySolidPrimitive = Box | Cone | Sphere | LinearSweep | RotationalSweep | RuledSweep | TorusPipe;\r\n\r\n/**\r\n * Base class for SolidPrimitive variants.\r\n * * The base class holds capped flag for all derived classes.\r\n * @public\r\n */\r\nexport abstract class SolidPrimitive extends GeometryQuery {\r\n /** String name for schema properties. */\r\n public readonly geometryCategory = \"solid\";\r\n /** String name for schema properties. */\r\n public abstract readonly solidPrimitiveType: SolidPrimitiveType;\r\n /** Flag indicating whether cap region is considered closed (i.e. a planar region, rather than just a wire in space). */\r\n protected _capped: boolean;\r\n protected constructor(capped: boolean) {\r\n super();\r\n this._capped = capped;\r\n }\r\n /** Whether this is a capped solid. */\r\n public get capped(): boolean {\r\n return this._capped;\r\n }\r\n public set capped(capped: boolean) {\r\n this._capped = capped;\r\n }\r\n /** Return a cross section at specified vFraction. */\r\n public abstract constantVSection(_vFraction: number): CurveCollection | undefined;\r\n /**\r\n * Return a Transform from the local system of the solid to world.\r\n * * The particulars of origin and orientation are specific to each SolidPrimitive type.\r\n */\r\n public abstract getConstructiveFrame(): Transform | undefined;\r\n /**\r\n * Return true if this is a closed volume\r\n * * LinearSweep, Box, Cone only depend on capped.\r\n * * Sphere affected by capped and latitude sweep\r\n * * TorusPipe and RotationalSweep affected by capped and sweep\r\n * * RuledSweep is affected by capped and match of first, last contour\r\n */\r\n public abstract get isClosedVolume(): boolean;\r\n}\r\n"]}
|
|
@@ -181,6 +181,16 @@ export declare abstract class CurveChain extends CurveCollection {
|
|
|
181
181
|
startPoint(result?: Point3d): Point3d | undefined;
|
|
182
182
|
/** Return the end point of the curve chain (end point of the last child). */
|
|
183
183
|
endPoint(result?: Point3d): Point3d | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* Return the start point and derivative of the first child of the curve chain.
|
|
186
|
+
* * For queries interior to the chain, use [[CurveChainWithDistanceIndex.fractionToPointAndDerivative]].
|
|
187
|
+
*/
|
|
188
|
+
startPointAndDerivative(result?: Ray3d): Ray3d | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* Return the end point and derivative of the last child of the curve chain.
|
|
191
|
+
* * For queries interior to the chain, use [[CurveChainWithDistanceIndex.fractionToPointAndDerivative]].
|
|
192
|
+
*/
|
|
193
|
+
endPointAndDerivative(result?: Ray3d): Ray3d | undefined;
|
|
184
194
|
/**
|
|
185
195
|
* Return the curve primitive at the given `index`, optionally using `modulo` to map `index` to the cyclic indexing.
|
|
186
196
|
* * In particular, `-1` is the final curve.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveCollection.d.ts","sourceRoot":"","sources":["../../../src/curve/CurveCollection.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAUhD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC,wGAAwG;AAExG;;;;;;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244
|
return undefined;
|
|
245
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Return the start point and derivative of the first child of the curve chain.
|
|
248
|
+
* * For queries interior to the chain, use [[CurveChainWithDistanceIndex.fractionToPointAndDerivative]].
|
|
249
|
+
*/
|
|
250
|
+
startPointAndDerivative(result) {
|
|
251
|
+
const firstChild = this.getChild(0);
|
|
252
|
+
if (firstChild)
|
|
253
|
+
return firstChild.fractionToPointAndDerivative(0.0, result);
|
|
254
|
+
else
|
|
255
|
+
return undefined;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Return the end point and derivative of the last child of the curve chain.
|
|
259
|
+
* * For queries interior to the chain, use [[CurveChainWithDistanceIndex.fractionToPointAndDerivative]].
|
|
260
|
+
*/
|
|
261
|
+
endPointAndDerivative(result) {
|
|
262
|
+
const lastChild = this.getChild(this._curves.length - 1);
|
|
263
|
+
if (lastChild)
|
|
264
|
+
return lastChild.fractionToPointAndDerivative(1.0, result);
|
|
265
|
+
else
|
|
266
|
+
return undefined;
|
|
267
|
+
}
|
|
246
268
|
/**
|
|
247
269
|
* Return the curve primitive at the given `index`, optionally using `modulo` to map `index` to the cyclic indexing.
|
|
248
270
|
* * In particular, `-1` is the final curve.
|
|
@@ -1 +1 @@
|
|
|
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,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAC;AAC/F,OAAO,EAAE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W,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","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 { VariantCurveExtendParameter } from \"./CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { AnyCurve, type AnyRegion } from \"./CurveTypes\";\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\nimport type { Path } from \"./Path\";\r\nimport type { Loop } from \"./Loop\";\r\n\r\n/** Note: CurveChain and BagOfCurves classes are located in this file to prevent circular dependency. */\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]] - 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 of curves. Does not have to be closed or planar. A closed `Path` is not treated as bounding a surface.\r\n * - [[Loop]] - a closed and planar chain of curves. A `Loop` is treated as bounding a planar area.\r\n * - [[ParityRegion]] - a collection of coplanar `Loop`, with \"in/out\" classification by parity rules.\r\n * - [[UnionRegion]] - a collection of coplanar `Loop` and/or `ParityRegion`, 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 /** Flag for inner loop status. Only used by `Loop`. */\r\n public isInner: boolean = false;\r\n /** Return the curve children. */\r\n public abstract override get children(): AnyCurve[];\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 /**\r\n * Return the closest point on the contained curves.\r\n * @param spacePoint point in space.\r\n * @param _extend unused here (pass false), but applicable to overrides in [[Path]] and [[BagOfCurves]].\r\n * @param result optional pre-allocated detail to populate and return.\r\n * @returns details of the closest point.\r\n */\r\n public closestPoint(\r\n spacePoint: Point3d, _extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n const detailB = new CurveLocationDetail();\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child.closestPoint(spacePoint, false, detailB))\r\n detailA = result = CurveLocationDetail.chooseSmallerA(detailA, detailB)!.clone(result);\r\n }\r\n }\r\n return detailA;\r\n }\r\n /** Reverse the collection's data so that each child curve's fractional stroking moves in the opposite direction. */\r\n public reverseInPlace(): void {\r\n for (const curve of this.children)\r\n curve.reverseInPlace();\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 broken down into multiple LineSegment3d. */\r\n public cloneWithExpandedLineStrings(): CurveCollection {\r\n return CloneWithExpandedLineStrings.clone(this);\r\n }\r\n /**\r\n * Push all CurvePrimitives contained in the instance onto the `results` array.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives\r\n * of the Loop are pushed onto `results`.\r\n */\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 all CurvePrimitives in the instance.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives of\r\n * the Loop are pushed onto the returned array.\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 * @see isAnyRegion\r\n */\r\n public get isAnyRegionType(): boolean {\r\n return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 4 || this.dgnBoundaryType() === 5;\r\n }\r\n /** Type guard for AnyRegion */\r\n public isAnyRegion(): this is AnyRegion {\r\n return this.isAnyRegionType;\r\n }\r\n /**\r\n * Return true for a `Path`, i.e. a chain of curves joined head-to-tail\r\n * @see isPath\r\n */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\r\n }\r\n /** Type guard for Path */\r\n public isPath(): this is Path {\r\n return this.isOpenPath;\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 * @see isLoop\r\n */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /** Type guard for Loop */\r\n public isLoop(): this is Loop {\r\n return this.isClosedPath;\r\n }\r\n\r\n /** Return a CurveCollection with the same structure but all curves replaced by strokes. */\r\n public abstract cloneStroked(options?: StrokeOptions): CurveCollection;\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 /**\r\n * Extend (increase) the given range as needed to encompass all curves in the curve collection.\r\n * @param rangeToExtend the given range.\r\n * @param transform if supplied, the range is extended with transformed curves.\r\n */\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 CurvePrimitive in the source and evaluate it at the given fraction.\r\n * * The first CurvePrimitive found is evaluated. Any other CurvePrimitives are ignored.\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 * * The specific derived classes are `Path` and `Loop`.\r\n * * `CurveChain` is an intermediate class. It is not instantiable on its own.\r\n * * The related class `CurveChainWithDistanceIndex` is a `CurvePrimitive` whose API presents well-defined mappings\r\n * from fraction to xyz over the entire chain, but in fact does all the calculations over multiple primitives.\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 /** Constructor */\r\n protected constructor() {\r\n super();\r\n this._curves = [];\r\n }\r\n /** Return the array of `CurvePrimitive` */\r\n public override get children(): CurvePrimitive[] {\r\n return this._curves;\r\n }\r\n /** Return the start point of the curve chain (start point of the first child). */\r\n public startPoint(result?: Point3d): Point3d | undefined {\r\n const firstChild = this.getChild(0);\r\n if (firstChild)\r\n return firstChild.fractionToPoint(0.0, result);\r\n else\r\n return undefined;\r\n }\r\n /** Return the end point of the curve chain (end point of the last child). */\r\n public endPoint(result?: Point3d): Point3d | undefined {\r\n const lastChild = this.getChild(this._curves.length - 1);\r\n if (lastChild)\r\n return lastChild.fractionToPoint(1.0, result);\r\n else\r\n return undefined;\r\n }\r\n /**\r\n * Return the curve primitive at the given `index`, 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 if (index >= 0 && index < n) // try simplest non-cyclic access first\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 /**\r\n * The object returned by \"cloneStroked\" has the same type (Loop or Path) but instead of a chain of\r\n * CurvePrimitives as children, it has a single LineString3d child. \"getPackedStrokes\" just returns\r\n * the points of that LineString3d using \"packedPoints\".\r\n */\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): CurveChain;\r\n /**\r\n * Add a child curve.\r\n * @param child curve to add to the chain. The curve is captured by this instance.\r\n * @return whether the child was added\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 array.\r\n */\r\n public reverseChildrenInPlace(): void {\r\n for (const curve of this._curves)\r\n curve.reverseInPlace();\r\n this._curves.reverse();\r\n }\r\n /** Same as [[reverseChildrenInPlace]]. */\r\n public override reverseInPlace(): void {\r\n this.reverseChildrenInPlace();\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() {\r\n super();\r\n this._children = [];\r\n }\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 /**\r\n * Return the closest point on the contained curves.\r\n * @param spacePoint point in space.\r\n * @param extend applicable only to children of type [[CurvePrimitive]], [[Path]], or [[BagOfCurves]]\r\n * @param result optional pre-allocated detail to populate and return.\r\n * @returns details of the closest point.\r\n */\r\n public override closestPoint(\r\n spacePoint: Point3d, extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n const detailB = new CurveLocationDetail();\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child.closestPoint(spacePoint, extend, detailB))\r\n detailA = result = CurveLocationDetail.chooseSmallerA(detailA, detailB)!.clone(result);\r\n }\r\n }\r\n return detailA;\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"]}
|
|
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,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAA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ACd,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD;;;;;;OAMG;IACa,YAAY,CAC1B,UAAmB,EAAE,SAAsC,KAAK,EAAE,MAA4B;QAE9F,IAAI,OAAwC,CAAC;QAC7C,MAAM,OAAO,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAC1C,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAClC,IAAI,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC;oBACjD,OAAO,GAAG,MAAM,GAAG,mBAAmB,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAC3F,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,oCAAoC;IAC7B,cAAc;QACnB,OAAO,IAAI,WAAW,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","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 { VariantCurveExtendParameter } from \"./CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { AnyCurve, type AnyRegion } from \"./CurveTypes\";\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\nimport type { Path } from \"./Path\";\r\nimport type { Loop } from \"./Loop\";\r\n\r\n/** Note: CurveChain and BagOfCurves classes are located in this file to prevent circular dependency. */\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]] - 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 of curves. Does not have to be closed or planar. A closed `Path` is not treated as bounding a surface.\r\n * - [[Loop]] - a closed and planar chain of curves. A `Loop` is treated as bounding a planar area.\r\n * - [[ParityRegion]] - a collection of coplanar `Loop`, with \"in/out\" classification by parity rules.\r\n * - [[UnionRegion]] - a collection of coplanar `Loop` and/or `ParityRegion`, 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 /** Flag for inner loop status. Only used by `Loop`. */\r\n public isInner: boolean = false;\r\n /** Return the curve children. */\r\n public abstract override get children(): AnyCurve[];\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 /**\r\n * Return the closest point on the contained curves.\r\n * @param spacePoint point in space.\r\n * @param _extend unused here (pass false), but applicable to overrides in [[Path]] and [[BagOfCurves]].\r\n * @param result optional pre-allocated detail to populate and return.\r\n * @returns details of the closest point.\r\n */\r\n public closestPoint(\r\n spacePoint: Point3d, _extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n const detailB = new CurveLocationDetail();\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child.closestPoint(spacePoint, false, detailB))\r\n detailA = result = CurveLocationDetail.chooseSmallerA(detailA, detailB)!.clone(result);\r\n }\r\n }\r\n return detailA;\r\n }\r\n /** Reverse the collection's data so that each child curve's fractional stroking moves in the opposite direction. */\r\n public reverseInPlace(): void {\r\n for (const curve of this.children)\r\n curve.reverseInPlace();\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 broken down into multiple LineSegment3d. */\r\n public cloneWithExpandedLineStrings(): CurveCollection {\r\n return CloneWithExpandedLineStrings.clone(this);\r\n }\r\n /**\r\n * Push all CurvePrimitives contained in the instance onto the `results` array.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives\r\n * of the Loop are pushed onto `results`.\r\n */\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 all CurvePrimitives in the instance.\r\n * * This method is recursive. For example, if the CurveCollection contains a Loop, all CurvePrimitives of\r\n * the Loop are pushed onto the returned array.\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 * @see isAnyRegion\r\n */\r\n public get isAnyRegionType(): boolean {\r\n return this.dgnBoundaryType() === 2 || this.dgnBoundaryType() === 4 || this.dgnBoundaryType() === 5;\r\n }\r\n /** Type guard for AnyRegion */\r\n public isAnyRegion(): this is AnyRegion {\r\n return this.isAnyRegionType;\r\n }\r\n /**\r\n * Return true for a `Path`, i.e. a chain of curves joined head-to-tail\r\n * @see isPath\r\n */\r\n public get isOpenPath(): boolean {\r\n return this.dgnBoundaryType() === 1;\r\n }\r\n /** Type guard for Path */\r\n public isPath(): this is Path {\r\n return this.isOpenPath;\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 * @see isLoop\r\n */\r\n public get isClosedPath(): boolean {\r\n return this.dgnBoundaryType() === 2;\r\n }\r\n /** Type guard for Loop */\r\n public isLoop(): this is Loop {\r\n return this.isClosedPath;\r\n }\r\n\r\n /** Return a CurveCollection with the same structure but all curves replaced by strokes. */\r\n public abstract cloneStroked(options?: StrokeOptions): CurveCollection;\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 /**\r\n * Extend (increase) the given range as needed to encompass all curves in the curve collection.\r\n * @param rangeToExtend the given range.\r\n * @param transform if supplied, the range is extended with transformed curves.\r\n */\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 CurvePrimitive in the source and evaluate it at the given fraction.\r\n * * The first CurvePrimitive found is evaluated. Any other CurvePrimitives are ignored.\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 * * The specific derived classes are `Path` and `Loop`.\r\n * * `CurveChain` is an intermediate class. It is not instantiable on its own.\r\n * * The related class `CurveChainWithDistanceIndex` is a `CurvePrimitive` whose API presents well-defined mappings\r\n * from fraction to xyz over the entire chain, but in fact does all the calculations over multiple primitives.\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 /** Constructor */\r\n protected constructor() {\r\n super();\r\n this._curves = [];\r\n }\r\n /** Return the array of `CurvePrimitive` */\r\n public override get children(): CurvePrimitive[] {\r\n return this._curves;\r\n }\r\n /** Return the start point of the curve chain (start point of the first child). */\r\n public startPoint(result?: Point3d): Point3d | undefined {\r\n const firstChild = this.getChild(0);\r\n if (firstChild)\r\n return firstChild.fractionToPoint(0.0, result);\r\n else\r\n return undefined;\r\n }\r\n /** Return the end point of the curve chain (end point of the last child). */\r\n public endPoint(result?: Point3d): Point3d | undefined {\r\n const lastChild = this.getChild(this._curves.length - 1);\r\n if (lastChild)\r\n return lastChild.fractionToPoint(1.0, result);\r\n else\r\n return undefined;\r\n }\r\n /**\r\n * Return the start point and derivative of the first child of the curve chain.\r\n * * For queries interior to the chain, use [[CurveChainWithDistanceIndex.fractionToPointAndDerivative]].\r\n */\r\n public startPointAndDerivative(result?: Ray3d): Ray3d | undefined {\r\n const firstChild = this.getChild(0);\r\n if (firstChild)\r\n return firstChild.fractionToPointAndDerivative(0.0, result);\r\n else\r\n return undefined;\r\n }\r\n /**\r\n * Return the end point and derivative of the last child of the curve chain.\r\n * * For queries interior to the chain, use [[CurveChainWithDistanceIndex.fractionToPointAndDerivative]].\r\n */\r\n public endPointAndDerivative(result?: Ray3d): Ray3d | undefined {\r\n const lastChild = this.getChild(this._curves.length - 1);\r\n if (lastChild)\r\n return lastChild.fractionToPointAndDerivative(1.0, result);\r\n else\r\n return undefined;\r\n }\r\n /**\r\n * Return the curve primitive at the given `index`, 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 if (index >= 0 && index < n) // try simplest non-cyclic access first\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 /**\r\n * The object returned by \"cloneStroked\" has the same type (Loop or Path) but instead of a chain of\r\n * CurvePrimitives as children, it has a single LineString3d child. \"getPackedStrokes\" just returns\r\n * the points of that LineString3d using \"packedPoints\".\r\n */\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): CurveChain;\r\n /**\r\n * Add a child curve.\r\n * @param child curve to add to the chain. The curve is captured by this instance.\r\n * @return whether the child was added\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 array.\r\n */\r\n public reverseChildrenInPlace(): void {\r\n for (const curve of this._curves)\r\n curve.reverseInPlace();\r\n this._curves.reverse();\r\n }\r\n /** Same as [[reverseChildrenInPlace]]. */\r\n public override reverseInPlace(): void {\r\n this.reverseChildrenInPlace();\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() {\r\n super();\r\n this._children = [];\r\n }\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 /**\r\n * Return the closest point on the contained curves.\r\n * @param spacePoint point in space.\r\n * @param extend applicable only to children of type [[CurvePrimitive]], [[Path]], or [[BagOfCurves]]\r\n * @param result optional pre-allocated detail to populate and return.\r\n * @returns details of the closest point.\r\n */\r\n public override closestPoint(\r\n spacePoint: Point3d, extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n const detailB = new CurveLocationDetail();\r\n if (this.children !== undefined) {\r\n for (const child of this.children) {\r\n if (child.closestPoint(spacePoint, extend, detailB))\r\n detailA = result = CurveLocationDetail.chooseSmallerA(detailA, detailB)!.clone(result);\r\n }\r\n }\r\n return detailA;\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"]}
|