@itwin/core-geometry 5.0.0-dev.97 → 5.0.0-dev.98
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/solid/RotationalSweep.d.ts +17 -17
- package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RotationalSweep.js +33 -23
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.d.ts +17 -17
- package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/esm/solid/RotationalSweep.js +33 -23
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/package.json +3 -3
|
@@ -12,10 +12,10 @@ import { Transform } from "../geometry3d/Transform";
|
|
|
12
12
|
import { SolidPrimitive } from "./SolidPrimitive";
|
|
13
13
|
import { SweepContour } from "./SweepContour";
|
|
14
14
|
/**
|
|
15
|
-
* A
|
|
16
|
-
* * A planar contour (any Loop, Path, or parityRegion)
|
|
15
|
+
* A RotationalSweep is
|
|
16
|
+
* * A planar contour (any Loop, Path, or parityRegion).
|
|
17
17
|
* * An axis vector.
|
|
18
|
-
* * The planar contour is expected to be in the plane of the axis vector
|
|
18
|
+
* * The planar contour is expected to be in the plane of the axis vector.
|
|
19
19
|
* * The contour may have points and/or lines that are on the axis, but otherwise is entirely on one side of the axis.
|
|
20
20
|
* * A sweep angle.
|
|
21
21
|
* @public
|
|
@@ -27,20 +27,22 @@ export declare class RotationalSweep extends SolidPrimitive {
|
|
|
27
27
|
private _normalizedAxis;
|
|
28
28
|
private _sweepAngle;
|
|
29
29
|
private constructor();
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
30
|
+
/**
|
|
31
|
+
* Create a rotational sweep.
|
|
32
|
+
* @param contour profile to sweep, coplanar with axis (CAPTURED).
|
|
33
|
+
* @param axis rotation axis.
|
|
34
|
+
* @param sweepAngle signed angular sweep.
|
|
35
|
+
* @param capped whether to cap the surface to make a solid.
|
|
35
36
|
*/
|
|
36
37
|
static create(contour: AnyCurve, axis: Ray3d, sweepAngle: Angle, capped: boolean): RotationalSweep | undefined;
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
38
|
+
/**
|
|
39
|
+
* Return a coordinate frame (right handed unit vectors).
|
|
40
|
+
* * origin at origin of rotation ray.
|
|
39
41
|
* * z direction along the rotation ray.
|
|
40
|
-
* * y direction perpendicular to the base contour plane
|
|
42
|
+
* * y direction perpendicular to the base contour plane.
|
|
41
43
|
*/
|
|
42
44
|
getConstructiveFrame(): Transform | undefined;
|
|
43
|
-
/**
|
|
45
|
+
/** Return clone of (not reference to) the axis vector. */
|
|
44
46
|
cloneAxisRay(): Ray3d;
|
|
45
47
|
/** Return (REFERENCE TO) the swept curves. */
|
|
46
48
|
getCurves(): CurveCollection;
|
|
@@ -52,7 +54,7 @@ export declare class RotationalSweep extends SolidPrimitive {
|
|
|
52
54
|
isSameGeometryClass(other: any): boolean;
|
|
53
55
|
/** Test for same axis, capping, and swept geometry. */
|
|
54
56
|
isAlmostEqual(other: GeometryQuery): boolean;
|
|
55
|
-
/**
|
|
57
|
+
/** Return a deep clone */
|
|
56
58
|
clone(): RotationalSweep;
|
|
57
59
|
/**
|
|
58
60
|
* Transform the contour and axis.
|
|
@@ -64,7 +66,7 @@ export declare class RotationalSweep extends SolidPrimitive {
|
|
|
64
66
|
* * This fails if the transformation is singular.
|
|
65
67
|
*/
|
|
66
68
|
cloneTransformed(transform: Transform): RotationalSweep | undefined;
|
|
67
|
-
/** Dispatch to strongly typed handler
|
|
69
|
+
/** Dispatch to strongly typed handler `handler.handleRotationalSweep(this)`. */
|
|
68
70
|
dispatchToGeometryHandler(handler: GeometryHandler): any;
|
|
69
71
|
/** Return a transform that rotates around the rotational axis by a fraction of the total sweep. */
|
|
70
72
|
getFractionalRotationTransform(vFraction: number, result?: Transform): Transform;
|
|
@@ -75,9 +77,7 @@ export declare class RotationalSweep extends SolidPrimitive {
|
|
|
75
77
|
constantVSection(vFraction: number): CurveCollection | undefined;
|
|
76
78
|
/** Extend range using sampled points on the surface. */
|
|
77
79
|
extendRange(range: Range3d, transform?: Transform): void;
|
|
78
|
-
/**
|
|
79
|
-
* @return true if this is a closed volume.
|
|
80
|
-
*/
|
|
80
|
+
/** Specify if the sweep forms a closed volume. */
|
|
81
81
|
get isClosedVolume(): boolean;
|
|
82
82
|
}
|
|
83
83
|
//# sourceMappingURL=RotationalSweep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RotationalSweep.d.ts","sourceRoot":"","sources":["../../../src/solid/RotationalSweep.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,cAAc;IACjD,wCAAwC;IACxC,SAAgB,kBAAkB,qBAAqB;IAEvD,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,eAAe,CAAQ;IAC/B,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO;
|
|
1
|
+
{"version":3,"file":"RotationalSweep.d.ts","sourceRoot":"","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vC,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAS5D,0BAA0B;IACnB,KAAK,IAAI,eAAe;IAG/B;;;OAGG;IACI,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;IAWzD;;;OAGG;IACI,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,eAAe,GAAG,SAAS;IAI1E,gFAAgF;IACzE,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;IAG/D,mGAAmG;IAC5F,8BAA8B,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS;IAOvF;;;OAGG;IACI,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAOvE,wDAAwD;IACjD,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS;IAoBxD,kDAAkD;IAClD,IAAW,cAAc,IAAI,OAAO,CAEnC;CACF"}
|
|
@@ -13,10 +13,10 @@ const Transform_1 = require("../geometry3d/Transform");
|
|
|
13
13
|
const SolidPrimitive_1 = require("./SolidPrimitive");
|
|
14
14
|
const SweepContour_1 = require("./SweepContour");
|
|
15
15
|
/**
|
|
16
|
-
* A
|
|
17
|
-
* * A planar contour (any Loop, Path, or parityRegion)
|
|
16
|
+
* A RotationalSweep is
|
|
17
|
+
* * A planar contour (any Loop, Path, or parityRegion).
|
|
18
18
|
* * An axis vector.
|
|
19
|
-
* * The planar contour is expected to be in the plane of the axis vector
|
|
19
|
+
* * The planar contour is expected to be in the plane of the axis vector.
|
|
20
20
|
* * The contour may have points and/or lines that are on the axis, but otherwise is entirely on one side of the axis.
|
|
21
21
|
* * A sweep angle.
|
|
22
22
|
* @public
|
|
@@ -31,14 +31,14 @@ class RotationalSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
|
31
31
|
super(capped);
|
|
32
32
|
this._contour = contour;
|
|
33
33
|
this._normalizedAxis = normalizedAxis;
|
|
34
|
-
this.capped = capped;
|
|
35
34
|
this._sweepAngle = sweepAngle;
|
|
36
35
|
}
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* @param
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
36
|
+
/**
|
|
37
|
+
* Create a rotational sweep.
|
|
38
|
+
* @param contour profile to sweep, coplanar with axis (CAPTURED).
|
|
39
|
+
* @param axis rotation axis.
|
|
40
|
+
* @param sweepAngle signed angular sweep.
|
|
41
|
+
* @param capped whether to cap the surface to make a solid.
|
|
42
42
|
*/
|
|
43
43
|
static create(contour, axis, sweepAngle, capped) {
|
|
44
44
|
if (!axis.direction.normalizeInPlace())
|
|
@@ -48,10 +48,11 @@ class RotationalSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
|
48
48
|
return undefined;
|
|
49
49
|
return new RotationalSweep(sweepable, axis, sweepAngle.clone(), capped);
|
|
50
50
|
}
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
51
|
+
/**
|
|
52
|
+
* Return a coordinate frame (right handed unit vectors).
|
|
53
|
+
* * origin at origin of rotation ray.
|
|
53
54
|
* * z direction along the rotation ray.
|
|
54
|
-
* * y direction perpendicular to the base contour plane
|
|
55
|
+
* * y direction perpendicular to the base contour plane.
|
|
55
56
|
*/
|
|
56
57
|
getConstructiveFrame() {
|
|
57
58
|
const contourPerpendicular = this._contour.localToWorld.matrix.columnZ();
|
|
@@ -61,26 +62,37 @@ class RotationalSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
|
61
62
|
}
|
|
62
63
|
return undefined;
|
|
63
64
|
}
|
|
64
|
-
/**
|
|
65
|
-
cloneAxisRay() {
|
|
65
|
+
/** Return clone of (not reference to) the axis vector. */
|
|
66
|
+
cloneAxisRay() {
|
|
67
|
+
return this._normalizedAxis.clone();
|
|
68
|
+
}
|
|
66
69
|
/** Return (REFERENCE TO) the swept curves. */
|
|
67
|
-
getCurves() {
|
|
70
|
+
getCurves() {
|
|
71
|
+
return this._contour.curves;
|
|
72
|
+
}
|
|
68
73
|
/** Return (REFERENCE TO) the swept curves with containing plane markup. */
|
|
69
|
-
getSweepContourRef() {
|
|
74
|
+
getSweepContourRef() {
|
|
75
|
+
return this._contour;
|
|
76
|
+
}
|
|
70
77
|
/** Return the sweep angle. */
|
|
71
|
-
getSweep() {
|
|
78
|
+
getSweep() {
|
|
79
|
+
return this._sweepAngle.clone();
|
|
80
|
+
}
|
|
72
81
|
/** Test if `other` is a `RotationalSweep` */
|
|
73
|
-
isSameGeometryClass(other) {
|
|
82
|
+
isSameGeometryClass(other) {
|
|
83
|
+
return other instanceof RotationalSweep;
|
|
84
|
+
}
|
|
74
85
|
/** Test for same axis, capping, and swept geometry. */
|
|
75
86
|
isAlmostEqual(other) {
|
|
76
87
|
if (other instanceof RotationalSweep) {
|
|
77
88
|
return this._contour.isAlmostEqual(other._contour)
|
|
78
89
|
&& this._normalizedAxis.isAlmostEqual(other._normalizedAxis)
|
|
90
|
+
&& this._sweepAngle.isAlmostEqual(other._sweepAngle)
|
|
79
91
|
&& this.capped === other.capped;
|
|
80
92
|
}
|
|
81
93
|
return false;
|
|
82
94
|
}
|
|
83
|
-
/**
|
|
95
|
+
/** Return a deep clone */
|
|
84
96
|
clone() {
|
|
85
97
|
return new RotationalSweep(this._contour.clone(), this._normalizedAxis.clone(), this._sweepAngle.clone(), this.capped);
|
|
86
98
|
}
|
|
@@ -107,7 +119,7 @@ class RotationalSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
|
107
119
|
const result = this.clone();
|
|
108
120
|
return result.tryTransformInPlace(transform) ? result : undefined;
|
|
109
121
|
}
|
|
110
|
-
/** Dispatch to strongly typed handler
|
|
122
|
+
/** Dispatch to strongly typed handler `handler.handleRotationalSweep(this)`. */
|
|
111
123
|
dispatchToGeometryHandler(handler) {
|
|
112
124
|
return handler.handleRotationalSweep(this);
|
|
113
125
|
}
|
|
@@ -148,9 +160,7 @@ class RotationalSweep extends SolidPrimitive_1.SolidPrimitive {
|
|
|
148
160
|
strokes.extendRange(range, this.getFractionalRotationTransform(i / numStep, stepTransform));
|
|
149
161
|
}
|
|
150
162
|
}
|
|
151
|
-
/**
|
|
152
|
-
* @return true if this is a closed volume.
|
|
153
|
-
*/
|
|
163
|
+
/** Specify if the sweep forms a closed volume. */
|
|
154
164
|
get isClosedVolume() {
|
|
155
165
|
return this.capped || this._sweepAngle.isFullCircle;
|
|
156
166
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RotationalSweep.js","sourceRoot":"","sources":["../../../src/solid/RotationalSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAS/F,0DAAuD;AACvD,0CAAkD;AAClD,+CAA4C;AAE5C,qDAAkD;AAGlD,uDAAoD;AACpD,qDAAkD;AAClD,iDAA8C;AAE9C;;;;;;;;GAQG;AACH,MAAa,eAAgB,SAAQ,+BAAc;IACjD,wCAAwC;IACxB,kBAAkB,GAAG,iBAAiB,CAAC;IAE/C,QAAQ,CAAe;IACvB,eAAe,CAAQ;IACvB,WAAW,CAAQ;IAC3B,YAAoB,OAAqB,EAAE,cAAqB,EAAE,UAAiB,EAAE,MAAe;QAClG,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,OAAiB,EAAE,IAAW,EAAE,UAAiB,EAAE,MAAe;QACrF,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE;YACpC,OAAO,SAAS,CAAC;QACnB,MAAM,SAAS,GAAG,2BAAY,CAAC,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB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YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;gBAClC,SAAS,CAAC,0BAA0B,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,CAAC,EAAE,kBAAkB,CAAC,CAAC;gBAC1H,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;YACjD,CAAC;QAEH,CAAC;aAAM,CAAC;YACN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,EAAE;gBAC/B,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,8BAA8B,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;QAChG,CAAC;IACH,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC;IACtD,CAAC;CACF;AAzID,0CAyIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { AnyCurve } from \"../curve/CurveTypes\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\nimport { SweepContour } from \"./SweepContour\";\n\n/**\n * A LinearSweep is\n * * A planar contour (any Loop, Path, or parityRegion)\n * * An axis vector.\n * * The planar contour is expected to be in the plane of the axis vector\n * * The contour may have points and/or lines that are on the axis, but otherwise is entirely on one side of the axis.\n * * A sweep angle.\n * @public\n */\nexport class RotationalSweep extends SolidPrimitive {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"rotationalSweep\";\n\n private _contour: SweepContour;\n private _normalizedAxis: Ray3d;\n private _sweepAngle: Angle;\n private constructor(contour: SweepContour, normalizedAxis: Ray3d, sweepAngle: Angle, capped: boolean) {\n super(capped);\n this._contour = contour;\n this._normalizedAxis = normalizedAxis;\n this.capped = capped;\n this._sweepAngle = sweepAngle;\n }\n /** Create a rotational sweep.\n * @param contour profile to sweep, coplanar with axis. CAPTURED\n * @param axis rotation axis\n * @param sweepAngle signed angular sweep\n * @param capped whether to cap the surface to make a solid\n */\n public static create(contour: AnyCurve, axis: Ray3d, sweepAngle: Angle, capped: boolean): RotationalSweep | undefined {\n if (!axis.direction.normalizeInPlace())\n return undefined;\n const sweepable = SweepContour.createForRotation(contour, axis);\n if (!sweepable)\n return undefined;\n return new RotationalSweep(sweepable, axis, sweepAngle.clone(), capped);\n }\n\n /** Return a coordinate frame (right handed unit vectors)\n * * origin at origin of rotation ray\n * * z direction along the rotation ray.\n * * y direction perpendicular to the base contour plane\n */\n public getConstructiveFrame(): Transform | undefined {\n const contourPerpendicular = this._contour.localToWorld.matrix.columnZ();\n const axes = Matrix3d.createRigidFromColumns(contourPerpendicular, this._normalizedAxis.direction, AxisOrder.YZX);\n if (axes) {\n return Transform.createOriginAndMatrix(this._normalizedAxis.origin, axes);\n }\n return undefined;\n }\n /** return clone of (not reference to) the axis vector. */\n public cloneAxisRay(): Ray3d { return this._normalizedAxis.clone(); }\n /** Return (REFERENCE TO) the swept curves. */\n public getCurves(): CurveCollection { return this._contour.curves; }\n /** Return (REFERENCE TO) the swept curves with containing plane markup. */\n public getSweepContourRef(): SweepContour { return this._contour; }\n /** Return the sweep angle. */\n public getSweep(): Angle { return this._sweepAngle.clone(); }\n /** Test if `other` is a `RotationalSweep` */\n public isSameGeometryClass(other: any): boolean { return other instanceof RotationalSweep; }\n /** Test for same axis, capping, and swept geometry. */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof RotationalSweep) {\n return this._contour.isAlmostEqual(other._contour)\n && this._normalizedAxis.isAlmostEqual(other._normalizedAxis)\n && this.capped === other.capped;\n }\n return false;\n }\n /** return a deep clone */\n public clone(): RotationalSweep {\n return new RotationalSweep(this._contour.clone(), this._normalizedAxis.clone(), this._sweepAngle.clone(), this.capped);\n }\n /**\n * Transform the contour and axis.\n * * This fails if the transformation is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n if (this._contour.tryTransformInPlace(transform)) {\n this._normalizedAxis.transformInPlace(transform);\n if (transform.matrix.determinant() < 0.0)\n this._sweepAngle.setRadians(-this._sweepAngle.radians);\n return this._normalizedAxis.direction.normalizeInPlace();\n }\n return false;\n }\n /**\n * Return a transformed clone.\n * * This fails if the transformation is singular.\n */\n public cloneTransformed(transform: Transform): RotationalSweep | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /** Dispatch to strongly typed handler `handler.handleRotationalSweep(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleRotationalSweep(this);\n }\n /** Return a transform that rotates around the rotational axis by a fraction of the total sweep. */\n public getFractionalRotationTransform(vFraction: number, result?: Transform): Transform {\n const radians = this._sweepAngle.radians * vFraction;\n const rotation = Transform.createFixedPointAndMatrix(this._normalizedAxis.origin,\n Matrix3d.createRotationAroundVector(this._normalizedAxis.direction, Angle.createRadians(radians),\n result ? result.matrix : undefined) as Matrix3d);\n return rotation;\n }\n /**\n * Return the curves of a constant-v section of the solid.\n * @param vFraction fractional position along the sweep direction\n */\n public constantVSection(vFraction: number): CurveCollection | undefined {\n const section = this._contour.curves.clone();\n if (section) {\n section.tryTransformInPlace(this.getFractionalRotationTransform(vFraction));\n }\n return section;\n }\n /** Extend range using sampled points on the surface. */\n public extendRange(range: Range3d, transform?: Transform) {\n const degreeStep = 360 / 32;\n const options = StrokeOptions.createForCurves();\n options.angleTol = Angle.createDegrees(degreeStep);\n const strokes = this._contour.curves.cloneStroked(options);\n const numStep = Geometry.stepCount(degreeStep, this._sweepAngle.degrees, 4, 32);\n const stepTransform = Transform.createIdentity();\n if (transform) {\n const compositeTransform = Transform.createIdentity();\n for (let i = 0; i <= numStep; i++) {\n transform.multiplyTransformTransform(this.getFractionalRotationTransform(i / numStep, stepTransform), compositeTransform);\n strokes.extendRange(range, compositeTransform);\n }\n\n } else {\n for (let i = 0; i <= numStep; i++)\n strokes.extendRange(range, this.getFractionalRotationTransform(i / numStep, stepTransform));\n }\n }\n /**\n * @return true if this is a closed volume.\n */\n public get isClosedVolume(): boolean {\n return this.capped || this._sweepAngle.isFullCircle;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RotationalSweep.js","sourceRoot":"","sources":["../../../src/solid/RotationalSweep.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAS/F,0DAAuD;AACvD,0CAAkD;AAClD,+CAA4C;AAE5C,qDAAkD;AAGlD,uDAAoD;AACpD,qDAAkD;AAClD,iDAA8C;AAE9C;;;;;;;;GAQG;AACH,MAAa,eAAgB,SAAQ,+BAAc;IACjD,wCAAwC;IACxB,kBAAkB,GAAG,iBAAiB,CAAC;IAE/C,QAAQ,CAAe;IACvB,eAAe,CAAQ;IACvB,WAAW,CAAQ;IAC3B,YAAoB,OAAqB,EAAE,cAAqB,EAAE,UAAiB,EAAE,MAAe;QAClG,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IACD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D,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC3D,MAAM,OAAO,GAAG,mBAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAChF,MAAM,aAAa,GAAG,qBAAS,CAAC,cAAc,EAAE,CAAC;QACjD,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,kBAAkB,GAAG,qBAAS,CAAC,cAAc,EAAE,CAAC;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;gBAClC,SAAS,CAAC,0BAA0B,CAClC,IAAI,CAAC,8BAA8B,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,CAAC,EAAE,kBAAkB,CACpF,CAAC;gBACF,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,EAAE;gBAC/B,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,8BAA8B,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;QAChG,CAAC;IACH,CAAC;IACD,kDAAkD;IAClD,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC;IACtD,CAAC;CACF;AAnJD,0CAmJC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { AnyCurve } from \"../curve/CurveTypes\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\nimport { SweepContour } from \"./SweepContour\";\n\n/**\n * A RotationalSweep is\n * * A planar contour (any Loop, Path, or parityRegion).\n * * An axis vector.\n * * The planar contour is expected to be in the plane of the axis vector.\n * * The contour may have points and/or lines that are on the axis, but otherwise is entirely on one side of the axis.\n * * A sweep angle.\n * @public\n */\nexport class RotationalSweep extends SolidPrimitive {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"rotationalSweep\";\n\n private _contour: SweepContour;\n private _normalizedAxis: Ray3d;\n private _sweepAngle: Angle;\n private constructor(contour: SweepContour, normalizedAxis: Ray3d, sweepAngle: Angle, capped: boolean) {\n super(capped);\n this._contour = contour;\n this._normalizedAxis = normalizedAxis;\n this._sweepAngle = sweepAngle;\n }\n /**\n * Create a rotational sweep.\n * @param contour profile to sweep, coplanar with axis (CAPTURED).\n * @param axis rotation axis.\n * @param sweepAngle signed angular sweep.\n * @param capped whether to cap the surface to make a solid.\n */\n public static create(contour: AnyCurve, axis: Ray3d, sweepAngle: Angle, capped: boolean): RotationalSweep | undefined {\n if (!axis.direction.normalizeInPlace())\n return undefined;\n const sweepable = SweepContour.createForRotation(contour, axis);\n if (!sweepable)\n return undefined;\n return new RotationalSweep(sweepable, axis, sweepAngle.clone(), capped);\n }\n /**\n * Return a coordinate frame (right handed unit vectors).\n * * origin at origin of rotation ray.\n * * z direction along the rotation ray.\n * * y direction perpendicular to the base contour plane.\n */\n public getConstructiveFrame(): Transform | undefined {\n const contourPerpendicular = this._contour.localToWorld.matrix.columnZ();\n const axes = Matrix3d.createRigidFromColumns(contourPerpendicular, this._normalizedAxis.direction, AxisOrder.YZX);\n if (axes) {\n return Transform.createOriginAndMatrix(this._normalizedAxis.origin, axes);\n }\n return undefined;\n }\n /** Return clone of (not reference to) the axis vector. */\n public cloneAxisRay(): Ray3d {\n return this._normalizedAxis.clone();\n }\n /** Return (REFERENCE TO) the swept curves. */\n public getCurves(): CurveCollection {\n return this._contour.curves;\n }\n /** Return (REFERENCE TO) the swept curves with containing plane markup. */\n public getSweepContourRef(): SweepContour {\n return this._contour;\n }\n /** Return the sweep angle. */\n public getSweep(): Angle {\n return this._sweepAngle.clone();\n }\n /** Test if `other` is a `RotationalSweep` */\n public isSameGeometryClass(other: any): boolean {\n return other instanceof RotationalSweep;\n }\n /** Test for same axis, capping, and swept geometry. */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof RotationalSweep) {\n return this._contour.isAlmostEqual(other._contour)\n && this._normalizedAxis.isAlmostEqual(other._normalizedAxis)\n && this._sweepAngle.isAlmostEqual(other._sweepAngle)\n && this.capped === other.capped;\n }\n return false;\n }\n /** Return a deep clone */\n public clone(): RotationalSweep {\n return new RotationalSweep(this._contour.clone(), this._normalizedAxis.clone(), this._sweepAngle.clone(), this.capped);\n }\n /**\n * Transform the contour and axis.\n * * This fails if the transformation is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n if (this._contour.tryTransformInPlace(transform)) {\n this._normalizedAxis.transformInPlace(transform);\n if (transform.matrix.determinant() < 0.0)\n this._sweepAngle.setRadians(-this._sweepAngle.radians);\n return this._normalizedAxis.direction.normalizeInPlace();\n }\n return false;\n }\n /**\n * Return a transformed clone.\n * * This fails if the transformation is singular.\n */\n public cloneTransformed(transform: Transform): RotationalSweep | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /** Dispatch to strongly typed handler `handler.handleRotationalSweep(this)`. */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleRotationalSweep(this);\n }\n /** Return a transform that rotates around the rotational axis by a fraction of the total sweep. */\n public getFractionalRotationTransform(vFraction: number, result?: Transform): Transform {\n const radians = this._sweepAngle.radians * vFraction;\n const rotation = Transform.createFixedPointAndMatrix(this._normalizedAxis.origin,\n Matrix3d.createRotationAroundVector(this._normalizedAxis.direction, Angle.createRadians(radians),\n result ? result.matrix : undefined) as Matrix3d);\n return rotation;\n }\n /**\n * Return the curves of a constant-v section of the solid.\n * @param vFraction fractional position along the sweep direction\n */\n public constantVSection(vFraction: number): CurveCollection | undefined {\n const section = this._contour.curves.clone();\n if (section) {\n section.tryTransformInPlace(this.getFractionalRotationTransform(vFraction));\n }\n return section;\n }\n /** Extend range using sampled points on the surface. */\n public extendRange(range: Range3d, transform?: Transform) {\n const degreeStep = 360 / 32;\n const options = StrokeOptions.createForCurves();\n options.angleTol = Angle.createDegrees(degreeStep);\n const strokes = this._contour.curves.cloneStroked(options);\n const numStep = Geometry.stepCount(degreeStep, this._sweepAngle.degrees, 4, 32);\n const stepTransform = Transform.createIdentity();\n if (transform) {\n const compositeTransform = Transform.createIdentity();\n for (let i = 0; i <= numStep; i++) {\n transform.multiplyTransformTransform(\n this.getFractionalRotationTransform(i / numStep, stepTransform), compositeTransform,\n );\n strokes.extendRange(range, compositeTransform);\n }\n } else {\n for (let i = 0; i <= numStep; i++)\n strokes.extendRange(range, this.getFractionalRotationTransform(i / numStep, stepTransform));\n }\n }\n /** Specify if the sweep forms a closed volume. */\n public get isClosedVolume(): boolean {\n return this.capped || this._sweepAngle.isFullCircle;\n }\n}\n"]}
|
|
@@ -12,10 +12,10 @@ import { Transform } from "../geometry3d/Transform";
|
|
|
12
12
|
import { SolidPrimitive } from "./SolidPrimitive";
|
|
13
13
|
import { SweepContour } from "./SweepContour";
|
|
14
14
|
/**
|
|
15
|
-
* A
|
|
16
|
-
* * A planar contour (any Loop, Path, or parityRegion)
|
|
15
|
+
* A RotationalSweep is
|
|
16
|
+
* * A planar contour (any Loop, Path, or parityRegion).
|
|
17
17
|
* * An axis vector.
|
|
18
|
-
* * The planar contour is expected to be in the plane of the axis vector
|
|
18
|
+
* * The planar contour is expected to be in the plane of the axis vector.
|
|
19
19
|
* * The contour may have points and/or lines that are on the axis, but otherwise is entirely on one side of the axis.
|
|
20
20
|
* * A sweep angle.
|
|
21
21
|
* @public
|
|
@@ -27,20 +27,22 @@ export declare class RotationalSweep extends SolidPrimitive {
|
|
|
27
27
|
private _normalizedAxis;
|
|
28
28
|
private _sweepAngle;
|
|
29
29
|
private constructor();
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
30
|
+
/**
|
|
31
|
+
* Create a rotational sweep.
|
|
32
|
+
* @param contour profile to sweep, coplanar with axis (CAPTURED).
|
|
33
|
+
* @param axis rotation axis.
|
|
34
|
+
* @param sweepAngle signed angular sweep.
|
|
35
|
+
* @param capped whether to cap the surface to make a solid.
|
|
35
36
|
*/
|
|
36
37
|
static create(contour: AnyCurve, axis: Ray3d, sweepAngle: Angle, capped: boolean): RotationalSweep | undefined;
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
38
|
+
/**
|
|
39
|
+
* Return a coordinate frame (right handed unit vectors).
|
|
40
|
+
* * origin at origin of rotation ray.
|
|
39
41
|
* * z direction along the rotation ray.
|
|
40
|
-
* * y direction perpendicular to the base contour plane
|
|
42
|
+
* * y direction perpendicular to the base contour plane.
|
|
41
43
|
*/
|
|
42
44
|
getConstructiveFrame(): Transform | undefined;
|
|
43
|
-
/**
|
|
45
|
+
/** Return clone of (not reference to) the axis vector. */
|
|
44
46
|
cloneAxisRay(): Ray3d;
|
|
45
47
|
/** Return (REFERENCE TO) the swept curves. */
|
|
46
48
|
getCurves(): CurveCollection;
|
|
@@ -52,7 +54,7 @@ export declare class RotationalSweep extends SolidPrimitive {
|
|
|
52
54
|
isSameGeometryClass(other: any): boolean;
|
|
53
55
|
/** Test for same axis, capping, and swept geometry. */
|
|
54
56
|
isAlmostEqual(other: GeometryQuery): boolean;
|
|
55
|
-
/**
|
|
57
|
+
/** Return a deep clone */
|
|
56
58
|
clone(): RotationalSweep;
|
|
57
59
|
/**
|
|
58
60
|
* Transform the contour and axis.
|
|
@@ -64,7 +66,7 @@ export declare class RotationalSweep extends SolidPrimitive {
|
|
|
64
66
|
* * This fails if the transformation is singular.
|
|
65
67
|
*/
|
|
66
68
|
cloneTransformed(transform: Transform): RotationalSweep | undefined;
|
|
67
|
-
/** Dispatch to strongly typed handler
|
|
69
|
+
/** Dispatch to strongly typed handler `handler.handleRotationalSweep(this)`. */
|
|
68
70
|
dispatchToGeometryHandler(handler: GeometryHandler): any;
|
|
69
71
|
/** Return a transform that rotates around the rotational axis by a fraction of the total sweep. */
|
|
70
72
|
getFractionalRotationTransform(vFraction: number, result?: Transform): Transform;
|
|
@@ -75,9 +77,7 @@ export declare class RotationalSweep extends SolidPrimitive {
|
|
|
75
77
|
constantVSection(vFraction: number): CurveCollection | undefined;
|
|
76
78
|
/** Extend range using sampled points on the surface. */
|
|
77
79
|
extendRange(range: Range3d, transform?: Transform): void;
|
|
78
|
-
/**
|
|
79
|
-
* @return true if this is a closed volume.
|
|
80
|
-
*/
|
|
80
|
+
/** Specify if the sweep forms a closed volume. */
|
|
81
81
|
get isClosedVolume(): boolean;
|
|
82
82
|
}
|
|
83
83
|
//# sourceMappingURL=RotationalSweep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RotationalSweep.d.ts","sourceRoot":"","sources":["../../../src/solid/RotationalSweep.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AA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|
@@ -10,10 +10,10 @@ import { Transform } from "../geometry3d/Transform";
|
|
|
10
10
|
import { SolidPrimitive } from "./SolidPrimitive";
|
|
11
11
|
import { SweepContour } from "./SweepContour";
|
|
12
12
|
/**
|
|
13
|
-
* A
|
|
14
|
-
* * A planar contour (any Loop, Path, or parityRegion)
|
|
13
|
+
* A RotationalSweep is
|
|
14
|
+
* * A planar contour (any Loop, Path, or parityRegion).
|
|
15
15
|
* * An axis vector.
|
|
16
|
-
* * The planar contour is expected to be in the plane of the axis vector
|
|
16
|
+
* * The planar contour is expected to be in the plane of the axis vector.
|
|
17
17
|
* * The contour may have points and/or lines that are on the axis, but otherwise is entirely on one side of the axis.
|
|
18
18
|
* * A sweep angle.
|
|
19
19
|
* @public
|
|
@@ -28,14 +28,14 @@ export class RotationalSweep extends SolidPrimitive {
|
|
|
28
28
|
super(capped);
|
|
29
29
|
this._contour = contour;
|
|
30
30
|
this._normalizedAxis = normalizedAxis;
|
|
31
|
-
this.capped = capped;
|
|
32
31
|
this._sweepAngle = sweepAngle;
|
|
33
32
|
}
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
33
|
+
/**
|
|
34
|
+
* Create a rotational sweep.
|
|
35
|
+
* @param contour profile to sweep, coplanar with axis (CAPTURED).
|
|
36
|
+
* @param axis rotation axis.
|
|
37
|
+
* @param sweepAngle signed angular sweep.
|
|
38
|
+
* @param capped whether to cap the surface to make a solid.
|
|
39
39
|
*/
|
|
40
40
|
static create(contour, axis, sweepAngle, capped) {
|
|
41
41
|
if (!axis.direction.normalizeInPlace())
|
|
@@ -45,10 +45,11 @@ export class RotationalSweep extends SolidPrimitive {
|
|
|
45
45
|
return undefined;
|
|
46
46
|
return new RotationalSweep(sweepable, axis, sweepAngle.clone(), capped);
|
|
47
47
|
}
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
48
|
+
/**
|
|
49
|
+
* Return a coordinate frame (right handed unit vectors).
|
|
50
|
+
* * origin at origin of rotation ray.
|
|
50
51
|
* * z direction along the rotation ray.
|
|
51
|
-
* * y direction perpendicular to the base contour plane
|
|
52
|
+
* * y direction perpendicular to the base contour plane.
|
|
52
53
|
*/
|
|
53
54
|
getConstructiveFrame() {
|
|
54
55
|
const contourPerpendicular = this._contour.localToWorld.matrix.columnZ();
|
|
@@ -58,26 +59,37 @@ export class RotationalSweep extends SolidPrimitive {
|
|
|
58
59
|
}
|
|
59
60
|
return undefined;
|
|
60
61
|
}
|
|
61
|
-
/**
|
|
62
|
-
cloneAxisRay() {
|
|
62
|
+
/** Return clone of (not reference to) the axis vector. */
|
|
63
|
+
cloneAxisRay() {
|
|
64
|
+
return this._normalizedAxis.clone();
|
|
65
|
+
}
|
|
63
66
|
/** Return (REFERENCE TO) the swept curves. */
|
|
64
|
-
getCurves() {
|
|
67
|
+
getCurves() {
|
|
68
|
+
return this._contour.curves;
|
|
69
|
+
}
|
|
65
70
|
/** Return (REFERENCE TO) the swept curves with containing plane markup. */
|
|
66
|
-
getSweepContourRef() {
|
|
71
|
+
getSweepContourRef() {
|
|
72
|
+
return this._contour;
|
|
73
|
+
}
|
|
67
74
|
/** Return the sweep angle. */
|
|
68
|
-
getSweep() {
|
|
75
|
+
getSweep() {
|
|
76
|
+
return this._sweepAngle.clone();
|
|
77
|
+
}
|
|
69
78
|
/** Test if `other` is a `RotationalSweep` */
|
|
70
|
-
isSameGeometryClass(other) {
|
|
79
|
+
isSameGeometryClass(other) {
|
|
80
|
+
return other instanceof RotationalSweep;
|
|
81
|
+
}
|
|
71
82
|
/** Test for same axis, capping, and swept geometry. */
|
|
72
83
|
isAlmostEqual(other) {
|
|
73
84
|
if (other instanceof RotationalSweep) {
|
|
74
85
|
return this._contour.isAlmostEqual(other._contour)
|
|
75
86
|
&& this._normalizedAxis.isAlmostEqual(other._normalizedAxis)
|
|
87
|
+
&& this._sweepAngle.isAlmostEqual(other._sweepAngle)
|
|
76
88
|
&& this.capped === other.capped;
|
|
77
89
|
}
|
|
78
90
|
return false;
|
|
79
91
|
}
|
|
80
|
-
/**
|
|
92
|
+
/** Return a deep clone */
|
|
81
93
|
clone() {
|
|
82
94
|
return new RotationalSweep(this._contour.clone(), this._normalizedAxis.clone(), this._sweepAngle.clone(), this.capped);
|
|
83
95
|
}
|
|
@@ -104,7 +116,7 @@ export class RotationalSweep extends SolidPrimitive {
|
|
|
104
116
|
const result = this.clone();
|
|
105
117
|
return result.tryTransformInPlace(transform) ? result : undefined;
|
|
106
118
|
}
|
|
107
|
-
/** Dispatch to strongly typed handler
|
|
119
|
+
/** Dispatch to strongly typed handler `handler.handleRotationalSweep(this)`. */
|
|
108
120
|
dispatchToGeometryHandler(handler) {
|
|
109
121
|
return handler.handleRotationalSweep(this);
|
|
110
122
|
}
|
|
@@ -145,9 +157,7 @@ export class RotationalSweep extends SolidPrimitive {
|
|
|
145
157
|
strokes.extendRange(range, this.getFractionalRotationTransform(i / numStep, stepTransform));
|
|
146
158
|
}
|
|
147
159
|
}
|
|
148
|
-
/**
|
|
149
|
-
* @return true if this is a closed volume.
|
|
150
|
-
*/
|
|
160
|
+
/** Specify if the sweep forms a closed volume. */
|
|
151
161
|
get isClosedVolume() {
|
|
152
162
|
return this.capped || this._sweepAngle.isFullCircle;
|
|
153
163
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RotationalSweep.js","sourceRoot":"","sources":["../../../src/solid/RotationalSweep.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAS/F,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,M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AK,EAAE,IAAI,CAAC,8BAA8B,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;QAChG,CAAC;IACH,CAAC;IACD;;OAEG;IACH,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC;IACtD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { AnyCurve } from \"../curve/CurveTypes\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\nimport { SweepContour } from \"./SweepContour\";\n\n/**\n * A LinearSweep is\n * * A planar contour (any Loop, Path, or parityRegion)\n * * An axis vector.\n * * The planar contour is expected to be in the plane of the axis vector\n * * The contour may have points and/or lines that are on the axis, but otherwise is entirely on one side of the axis.\n * * A sweep angle.\n * @public\n */\nexport class RotationalSweep extends SolidPrimitive {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"rotationalSweep\";\n\n private _contour: SweepContour;\n private _normalizedAxis: Ray3d;\n private _sweepAngle: Angle;\n private constructor(contour: SweepContour, normalizedAxis: Ray3d, sweepAngle: Angle, capped: boolean) {\n super(capped);\n this._contour = contour;\n this._normalizedAxis = normalizedAxis;\n this.capped = capped;\n this._sweepAngle = sweepAngle;\n }\n /** Create a rotational sweep.\n * @param contour profile to sweep, coplanar with axis. CAPTURED\n * @param axis rotation axis\n * @param sweepAngle signed angular sweep\n * @param capped whether to cap the surface to make a solid\n */\n public static create(contour: AnyCurve, axis: Ray3d, sweepAngle: Angle, capped: boolean): RotationalSweep | undefined {\n if (!axis.direction.normalizeInPlace())\n return undefined;\n const sweepable = SweepContour.createForRotation(contour, axis);\n if (!sweepable)\n return undefined;\n return new RotationalSweep(sweepable, axis, sweepAngle.clone(), capped);\n }\n\n /** Return a coordinate frame (right handed unit vectors)\n * * origin at origin of rotation ray\n * * z direction along the rotation ray.\n * * y direction perpendicular to the base contour plane\n */\n public getConstructiveFrame(): Transform | undefined {\n const contourPerpendicular = this._contour.localToWorld.matrix.columnZ();\n const axes = Matrix3d.createRigidFromColumns(contourPerpendicular, this._normalizedAxis.direction, AxisOrder.YZX);\n if (axes) {\n return Transform.createOriginAndMatrix(this._normalizedAxis.origin, axes);\n }\n return undefined;\n }\n /** return clone of (not reference to) the axis vector. */\n public cloneAxisRay(): Ray3d { return this._normalizedAxis.clone(); }\n /** Return (REFERENCE TO) the swept curves. */\n public getCurves(): CurveCollection { return this._contour.curves; }\n /** Return (REFERENCE TO) the swept curves with containing plane markup. */\n public getSweepContourRef(): SweepContour { return this._contour; }\n /** Return the sweep angle. */\n public getSweep(): Angle { return this._sweepAngle.clone(); }\n /** Test if `other` is a `RotationalSweep` */\n public isSameGeometryClass(other: any): boolean { return other instanceof RotationalSweep; }\n /** Test for same axis, capping, and swept geometry. */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof RotationalSweep) {\n return this._contour.isAlmostEqual(other._contour)\n && this._normalizedAxis.isAlmostEqual(other._normalizedAxis)\n && this.capped === other.capped;\n }\n return false;\n }\n /** return a deep clone */\n public clone(): RotationalSweep {\n return new RotationalSweep(this._contour.clone(), this._normalizedAxis.clone(), this._sweepAngle.clone(), this.capped);\n }\n /**\n * Transform the contour and axis.\n * * This fails if the transformation is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n if (this._contour.tryTransformInPlace(transform)) {\n this._normalizedAxis.transformInPlace(transform);\n if (transform.matrix.determinant() < 0.0)\n this._sweepAngle.setRadians(-this._sweepAngle.radians);\n return this._normalizedAxis.direction.normalizeInPlace();\n }\n return false;\n }\n /**\n * Return a transformed clone.\n * * This fails if the transformation is singular.\n */\n public cloneTransformed(transform: Transform): RotationalSweep | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /** Dispatch to strongly typed handler `handler.handleRotationalSweep(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleRotationalSweep(this);\n }\n /** Return a transform that rotates around the rotational axis by a fraction of the total sweep. */\n public getFractionalRotationTransform(vFraction: number, result?: Transform): Transform {\n const radians = this._sweepAngle.radians * vFraction;\n const rotation = Transform.createFixedPointAndMatrix(this._normalizedAxis.origin,\n Matrix3d.createRotationAroundVector(this._normalizedAxis.direction, Angle.createRadians(radians),\n result ? result.matrix : undefined) as Matrix3d);\n return rotation;\n }\n /**\n * Return the curves of a constant-v section of the solid.\n * @param vFraction fractional position along the sweep direction\n */\n public constantVSection(vFraction: number): CurveCollection | undefined {\n const section = this._contour.curves.clone();\n if (section) {\n section.tryTransformInPlace(this.getFractionalRotationTransform(vFraction));\n }\n return section;\n }\n /** Extend range using sampled points on the surface. */\n public extendRange(range: Range3d, transform?: Transform) {\n const degreeStep = 360 / 32;\n const options = StrokeOptions.createForCurves();\n options.angleTol = Angle.createDegrees(degreeStep);\n const strokes = this._contour.curves.cloneStroked(options);\n const numStep = Geometry.stepCount(degreeStep, this._sweepAngle.degrees, 4, 32);\n const stepTransform = Transform.createIdentity();\n if (transform) {\n const compositeTransform = Transform.createIdentity();\n for (let i = 0; i <= numStep; i++) {\n transform.multiplyTransformTransform(this.getFractionalRotationTransform(i / numStep, stepTransform), compositeTransform);\n strokes.extendRange(range, compositeTransform);\n }\n\n } else {\n for (let i = 0; i <= numStep; i++)\n strokes.extendRange(range, this.getFractionalRotationTransform(i / numStep, stepTransform));\n }\n }\n /**\n * @return true if this is a closed volume.\n */\n public get isClosedVolume(): boolean {\n return this.capped || this._sweepAngle.isFullCircle;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RotationalSweep.js","sourceRoot":"","sources":["../../../src/solid/RotationalSweep.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAS/F,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAgB,SAAQ,cAAc;IACjD,wCAAwC;IACxB,kBAAkB,GAAG,iBAAiB,CAAC;IAE/C,QAAQ,CAAe;IACvB,eAAe,CAAQ;IACvB,WAAW,CAAQ;IAC3B,YAAoB,OAAqB,EAAE,cAAqB,EAAE,UAAiB,EAAE,MAAe;QAClG,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IACD;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,OAAiB,EAAE,IAAW,EAAE,UAAiB,EAAE,MAAe;QACrF,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE;YACpC,OAAO,SAAS,CAAC;QACnB,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AAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAChF,MAAM,aAAa,GAAG,SAAS,CAAC,cAAc,EAAE,CAAC;QACjD,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,EAAE,CAAC;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;gBAClC,SAAS,CAAC,0BAA0B,CAClC,IAAI,CAAC,8BAA8B,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,CAAC,EAAE,kBAAkB,CACpF,CAAC;gBACF,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,EAAE;gBAC/B,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,8BAA8B,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;QAChG,CAAC;IACH,CAAC;IACD,kDAAkD;IAClD,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC;IACtD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Solid\n */\n\nimport { AnyCurve } from \"../curve/CurveTypes\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { StrokeOptions } from \"../curve/StrokeOptions\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Range3d } from \"../geometry3d/Range\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { SolidPrimitive } from \"./SolidPrimitive\";\nimport { SweepContour } from \"./SweepContour\";\n\n/**\n * A RotationalSweep is\n * * A planar contour (any Loop, Path, or parityRegion).\n * * An axis vector.\n * * The planar contour is expected to be in the plane of the axis vector.\n * * The contour may have points and/or lines that are on the axis, but otherwise is entirely on one side of the axis.\n * * A sweep angle.\n * @public\n */\nexport class RotationalSweep extends SolidPrimitive {\n /** String name for schema properties */\n public readonly solidPrimitiveType = \"rotationalSweep\";\n\n private _contour: SweepContour;\n private _normalizedAxis: Ray3d;\n private _sweepAngle: Angle;\n private constructor(contour: SweepContour, normalizedAxis: Ray3d, sweepAngle: Angle, capped: boolean) {\n super(capped);\n this._contour = contour;\n this._normalizedAxis = normalizedAxis;\n this._sweepAngle = sweepAngle;\n }\n /**\n * Create a rotational sweep.\n * @param contour profile to sweep, coplanar with axis (CAPTURED).\n * @param axis rotation axis.\n * @param sweepAngle signed angular sweep.\n * @param capped whether to cap the surface to make a solid.\n */\n public static create(contour: AnyCurve, axis: Ray3d, sweepAngle: Angle, capped: boolean): RotationalSweep | undefined {\n if (!axis.direction.normalizeInPlace())\n return undefined;\n const sweepable = SweepContour.createForRotation(contour, axis);\n if (!sweepable)\n return undefined;\n return new RotationalSweep(sweepable, axis, sweepAngle.clone(), capped);\n }\n /**\n * Return a coordinate frame (right handed unit vectors).\n * * origin at origin of rotation ray.\n * * z direction along the rotation ray.\n * * y direction perpendicular to the base contour plane.\n */\n public getConstructiveFrame(): Transform | undefined {\n const contourPerpendicular = this._contour.localToWorld.matrix.columnZ();\n const axes = Matrix3d.createRigidFromColumns(contourPerpendicular, this._normalizedAxis.direction, AxisOrder.YZX);\n if (axes) {\n return Transform.createOriginAndMatrix(this._normalizedAxis.origin, axes);\n }\n return undefined;\n }\n /** Return clone of (not reference to) the axis vector. */\n public cloneAxisRay(): Ray3d {\n return this._normalizedAxis.clone();\n }\n /** Return (REFERENCE TO) the swept curves. */\n public getCurves(): CurveCollection {\n return this._contour.curves;\n }\n /** Return (REFERENCE TO) the swept curves with containing plane markup. */\n public getSweepContourRef(): SweepContour {\n return this._contour;\n }\n /** Return the sweep angle. */\n public getSweep(): Angle {\n return this._sweepAngle.clone();\n }\n /** Test if `other` is a `RotationalSweep` */\n public isSameGeometryClass(other: any): boolean {\n return other instanceof RotationalSweep;\n }\n /** Test for same axis, capping, and swept geometry. */\n public override isAlmostEqual(other: GeometryQuery): boolean {\n if (other instanceof RotationalSweep) {\n return this._contour.isAlmostEqual(other._contour)\n && this._normalizedAxis.isAlmostEqual(other._normalizedAxis)\n && this._sweepAngle.isAlmostEqual(other._sweepAngle)\n && this.capped === other.capped;\n }\n return false;\n }\n /** Return a deep clone */\n public clone(): RotationalSweep {\n return new RotationalSweep(this._contour.clone(), this._normalizedAxis.clone(), this._sweepAngle.clone(), this.capped);\n }\n /**\n * Transform the contour and axis.\n * * This fails if the transformation is singular.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n if (transform.matrix.isSingular())\n return false;\n if (this._contour.tryTransformInPlace(transform)) {\n this._normalizedAxis.transformInPlace(transform);\n if (transform.matrix.determinant() < 0.0)\n this._sweepAngle.setRadians(-this._sweepAngle.radians);\n return this._normalizedAxis.direction.normalizeInPlace();\n }\n return false;\n }\n /**\n * Return a transformed clone.\n * * This fails if the transformation is singular.\n */\n public cloneTransformed(transform: Transform): RotationalSweep | undefined {\n const result = this.clone();\n return result.tryTransformInPlace(transform) ? result : undefined;\n }\n /** Dispatch to strongly typed handler `handler.handleRotationalSweep(this)`. */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleRotationalSweep(this);\n }\n /** Return a transform that rotates around the rotational axis by a fraction of the total sweep. */\n public getFractionalRotationTransform(vFraction: number, result?: Transform): Transform {\n const radians = this._sweepAngle.radians * vFraction;\n const rotation = Transform.createFixedPointAndMatrix(this._normalizedAxis.origin,\n Matrix3d.createRotationAroundVector(this._normalizedAxis.direction, Angle.createRadians(radians),\n result ? result.matrix : undefined) as Matrix3d);\n return rotation;\n }\n /**\n * Return the curves of a constant-v section of the solid.\n * @param vFraction fractional position along the sweep direction\n */\n public constantVSection(vFraction: number): CurveCollection | undefined {\n const section = this._contour.curves.clone();\n if (section) {\n section.tryTransformInPlace(this.getFractionalRotationTransform(vFraction));\n }\n return section;\n }\n /** Extend range using sampled points on the surface. */\n public extendRange(range: Range3d, transform?: Transform) {\n const degreeStep = 360 / 32;\n const options = StrokeOptions.createForCurves();\n options.angleTol = Angle.createDegrees(degreeStep);\n const strokes = this._contour.curves.cloneStroked(options);\n const numStep = Geometry.stepCount(degreeStep, this._sweepAngle.degrees, 4, 32);\n const stepTransform = Transform.createIdentity();\n if (transform) {\n const compositeTransform = Transform.createIdentity();\n for (let i = 0; i <= numStep; i++) {\n transform.multiplyTransformTransform(\n this.getFractionalRotationTransform(i / numStep, stepTransform), compositeTransform,\n );\n strokes.extendRange(range, compositeTransform);\n }\n } else {\n for (let i = 0; i <= numStep; i++)\n strokes.extendRange(range, this.getFractionalRotationTransform(i / numStep, stepTransform));\n }\n }\n /** Specify if the sweep forms a closed volume. */\n public get isClosedVolume(): boolean {\n return this.capped || this._sweepAngle.isFullCircle;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-geometry",
|
|
3
|
-
"version": "5.0.0-dev.
|
|
3
|
+
"version": "5.0.0-dev.98",
|
|
4
4
|
"description": "iTwin.js Core Geometry library",
|
|
5
5
|
"main": "lib/cjs/core-geometry.js",
|
|
6
6
|
"module": "lib/esm/core-geometry.js",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"rimraf": "^6.0.1",
|
|
32
32
|
"typescript": "~5.6.2",
|
|
33
33
|
"vitest": "^3.0.6",
|
|
34
|
-
"@itwin/build-tools": "5.0.0-dev.
|
|
34
|
+
"@itwin/build-tools": "5.0.0-dev.98"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"flatbuffers": "~1.12.0",
|
|
38
|
-
"@itwin/core-bentley": "5.0.0-dev.
|
|
38
|
+
"@itwin/core-bentley": "5.0.0-dev.98"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "npm run -s build:cjs && npm run -s build:esm",
|