@itwin/core-geometry 4.1.0-dev.2 → 4.1.0-dev.21
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/CHANGELOG.md +32 -1
- package/lib/cjs/curve/Arc3d.d.ts +70 -86
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +109 -96
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +61 -41
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +69 -46
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +47 -30
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +63 -34
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.d.ts +40 -41
- package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js +31 -35
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +137 -92
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +114 -75
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.d.ts +26 -20
- package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js +11 -9
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts +34 -25
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +76 -38
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +70 -51
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +120 -71
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.d.ts +7 -5
- package/lib/cjs/curve/Loop.d.ts.map +1 -1
- package/lib/cjs/curve/Loop.js +18 -6
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/ParityRegion.d.ts +7 -7
- package/lib/cjs/curve/ParityRegion.d.ts.map +1 -1
- package/lib/cjs/curve/ParityRegion.js +19 -11
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Path.d.ts +6 -6
- package/lib/cjs/curve/Path.d.ts.map +1 -1
- package/lib/cjs/curve/Path.js +15 -9
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.d.ts +4 -6
- package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js +7 -7
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.d.ts +14 -13
- package/lib/cjs/curve/Query/StrokeCountMap.d.ts.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.js +9 -8
- package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +70 -43
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +71 -43
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts +29 -21
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js +44 -22
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.d.ts +6 -5
- package/lib/cjs/curve/UnionRegion.d.ts.map +1 -1
- package/lib/cjs/curve/UnionRegion.js +17 -8
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts +2 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.js +6 -2
- package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js +4 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +2 -2
- package/lib/cjs/geometry3d/Matrix3d.js +2 -2
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +133 -93
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +296 -144
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +70 -86
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +109 -96
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +61 -41
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +69 -46
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +47 -30
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +63 -34
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.d.ts +40 -41
- package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js +31 -35
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +137 -92
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +114 -75
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.d.ts +26 -20
- package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/esm/curve/GeometryQuery.js +11 -9
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts +34 -25
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +76 -38
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +70 -51
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +120 -71
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.d.ts +7 -5
- package/lib/esm/curve/Loop.d.ts.map +1 -1
- package/lib/esm/curve/Loop.js +18 -6
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/ParityRegion.d.ts +7 -7
- package/lib/esm/curve/ParityRegion.d.ts.map +1 -1
- package/lib/esm/curve/ParityRegion.js +19 -11
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Path.d.ts +6 -6
- package/lib/esm/curve/Path.d.ts.map +1 -1
- package/lib/esm/curve/Path.js +15 -9
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.d.ts +4 -6
- package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
- package/lib/esm/curve/ProxyCurve.js +7 -7
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.d.ts +14 -13
- package/lib/esm/curve/Query/StrokeCountMap.d.ts.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.js +9 -8
- package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +70 -43
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +71 -43
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts +29 -21
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js +44 -22
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/UnionRegion.d.ts +6 -5
- package/lib/esm/curve/UnionRegion.d.ts.map +1 -1
- package/lib/esm/curve/UnionRegion.js +17 -8
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.d.ts +2 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.js +6 -2
- package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts +14 -8
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js +14 -8
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js +4 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +2 -2
- package/lib/esm/geometry3d/Matrix3d.js +2 -2
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +133 -93
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +296 -144
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Angle } from "../geometry3d/Angle";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Tolerance blob for various stroking methods.
|
|
3
4
|
*
|
|
4
5
|
* * Across many applications, the critical concepts are: chordTol, angleTol, maxEdgeLength
|
|
5
6
|
* * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.
|
|
@@ -21,17 +22,17 @@ import { Angle } from "../geometry3d/Angle";
|
|
|
21
22
|
* @public
|
|
22
23
|
*/
|
|
23
24
|
export declare class StrokeOptions {
|
|
24
|
-
/**
|
|
25
|
+
/** Distance from stroke to actual geometry */
|
|
25
26
|
chordTol?: number;
|
|
26
|
-
/**
|
|
27
|
+
/** Turning angle between strokes. */
|
|
27
28
|
angleTol?: Angle;
|
|
28
|
-
/**
|
|
29
|
+
/** Maximum length of a single stroke. */
|
|
29
30
|
maxEdgeLength?: number;
|
|
30
|
-
/**
|
|
31
|
+
/** Caller expects convex facets. */
|
|
31
32
|
needConvexFacets?: boolean;
|
|
32
|
-
/**
|
|
33
|
+
/** Minimum strokes on a primitive */
|
|
33
34
|
minStrokesPerPrimitive?: number;
|
|
34
|
-
/**
|
|
35
|
+
/** Whether or not to triangulate each added facet */
|
|
35
36
|
shouldTriangulate: boolean;
|
|
36
37
|
private _needNormals?;
|
|
37
38
|
private _needTwoSided?;
|
|
@@ -45,27 +46,29 @@ export declare class StrokeOptions {
|
|
|
45
46
|
/** Whether twoSided is requested. */
|
|
46
47
|
get needTwoSided(): boolean;
|
|
47
48
|
set needTwoSided(value: boolean);
|
|
48
|
-
/**
|
|
49
|
+
/** Optional color request flag */
|
|
49
50
|
needColors?: boolean;
|
|
50
|
-
/**
|
|
51
|
+
/** Default number of strokes for a circle. */
|
|
51
52
|
defaultCircleStrokes: number;
|
|
52
|
-
/**
|
|
53
|
+
/** Ask if angleTol is specified */
|
|
53
54
|
get hasAngleTol(): boolean;
|
|
54
|
-
/**
|
|
55
|
+
/** Ask if chordTol is specified */
|
|
55
56
|
get hasChordTol(): boolean;
|
|
56
|
-
/**
|
|
57
|
+
/** Ask if maxEdgeLength is specified */
|
|
57
58
|
get hasMaxEdgeLength(): boolean;
|
|
58
59
|
/** Return a deep clone */
|
|
59
60
|
clone(): StrokeOptions;
|
|
60
|
-
/**
|
|
61
|
+
/** Return stroke count which is the larger of the minCount or count needed for edge length condition. */
|
|
61
62
|
applyMaxEdgeLength(minCount: number, totalLength: number): number;
|
|
62
63
|
/**
|
|
63
|
-
*
|
|
64
|
+
* Return stroke count which is the larger of the existing count or count needed for angle condition for given
|
|
65
|
+
* sweepRadians.
|
|
64
66
|
* * defaultStepRadians is assumed to be larger than zero.
|
|
65
67
|
*/
|
|
66
68
|
applyAngleTol(minCount: number, sweepRadians: number, defaultStepRadians: number): number;
|
|
67
69
|
/**
|
|
68
|
-
*
|
|
70
|
+
* Return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance
|
|
71
|
+
* from the options.
|
|
69
72
|
*/
|
|
70
73
|
static applyAngleTol(options: StrokeOptions | undefined, minCount: number, sweepRadians: number, defaultStepRadians?: number): number;
|
|
71
74
|
/**
|
|
@@ -76,22 +79,27 @@ export declare class StrokeOptions {
|
|
|
76
79
|
*/
|
|
77
80
|
static applyMaxEdgeLength(options: StrokeOptions | undefined, minCount: number, edgeLength: number): number;
|
|
78
81
|
/**
|
|
79
|
-
* Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength,
|
|
82
|
+
* Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength,
|
|
83
|
+
* chord, and minimum stroke.
|
|
80
84
|
*/
|
|
81
85
|
applyTolerancesToArc(radius: number, sweepRadians?: number): number;
|
|
82
|
-
/**
|
|
86
|
+
/** Return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */
|
|
83
87
|
applyChordTol(minCount: number, radius: number, sweepRadians: number): number;
|
|
84
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* Return stroke count which is the larger of existing count or count needed for circular arc chord tol with given
|
|
90
|
+
* arc length and radians
|
|
85
91
|
*/
|
|
86
92
|
applyChordTolToLengthAndRadians(minCount: number, length: number, sweepRadians: number): number;
|
|
87
|
-
/**
|
|
93
|
+
/** Return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */
|
|
88
94
|
applyMinStrokesPerPrimitive(minCount: number): number;
|
|
89
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* Create `StrokeOptions` with defaults appropriate for curves.
|
|
90
97
|
* * angle tolerance of 15 degrees.
|
|
91
98
|
* * all others inactive.
|
|
92
99
|
*/
|
|
93
100
|
static createForCurves(): StrokeOptions;
|
|
94
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* Create `StrokeOptions` with defaults appropriate for surfaces facets
|
|
95
103
|
* * angle tolerance of 22.5 degrees.
|
|
96
104
|
* * all others inactive.
|
|
97
105
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StrokeOptions.d.ts","sourceRoot":"","sources":["../../../src/curve/StrokeOptions.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C
|
|
1
|
+
{"version":3,"file":"StrokeOptions.d.ts","sourceRoot":"","sources":["../../../src/curve/StrokeOptions.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,aAAa;IACxB,8CAA8C;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IACzB,qCAAqC;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC;IACxB,yCAAyC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IAC9B,qCAAqC;IAC9B,gBAAgB,CAAC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G,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GACvE,MAAM;IAUT;;;OAGG;IACI,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,GAAE,MAAoB,GAAG,MAAM;IAQvF,4HAA4H;IACrH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM;IAQpF;;;OAGG;IACI,+BAA+B,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM;IAQtG,iGAAiG;IAC1F,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAM5D;;;;OAIG;WACW,eAAe,IAAI,aAAa;IAK9C;;;;OAIG;WACW,eAAe,IAAI,aAAa;CAK/C"}
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
import { Geometry } from "../Geometry";
|
|
9
9
|
import { Angle } from "../geometry3d/Angle";
|
|
10
10
|
/* eslint-disable @typescript-eslint/naming-convention, no-empty */
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Tolerance blob for various stroking methods.
|
|
12
13
|
*
|
|
13
14
|
* * Across many applications, the critical concepts are: chordTol, angleTol, maxEdgeLength
|
|
14
15
|
* * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.
|
|
@@ -31,26 +32,40 @@ import { Angle } from "../geometry3d/Angle";
|
|
|
31
32
|
*/
|
|
32
33
|
export class StrokeOptions {
|
|
33
34
|
constructor() {
|
|
34
|
-
/**
|
|
35
|
+
/** Whether or not to triangulate each added facet */
|
|
35
36
|
this.shouldTriangulate = false;
|
|
36
|
-
/**
|
|
37
|
+
/** Default number of strokes for a circle. */
|
|
37
38
|
this.defaultCircleStrokes = 16;
|
|
38
39
|
}
|
|
39
40
|
/** Whether params are requested. */
|
|
40
|
-
get needParams() {
|
|
41
|
-
|
|
41
|
+
get needParams() {
|
|
42
|
+
return this._needParams !== undefined ? this._needParams : false;
|
|
43
|
+
}
|
|
44
|
+
set needParams(value) {
|
|
45
|
+
this._needParams = value;
|
|
46
|
+
}
|
|
42
47
|
/** Whether normals are requested */
|
|
43
|
-
get needNormals() {
|
|
48
|
+
get needNormals() {
|
|
49
|
+
return this._needNormals !== undefined ? this._needNormals : false;
|
|
50
|
+
}
|
|
44
51
|
set needNormals(value) { this._needNormals = value; }
|
|
45
52
|
/** Whether twoSided is requested. */
|
|
46
|
-
get needTwoSided() {
|
|
53
|
+
get needTwoSided() {
|
|
54
|
+
return this._needTwoSided !== undefined ? this._needTwoSided : false;
|
|
55
|
+
}
|
|
47
56
|
set needTwoSided(value) { this._needTwoSided = value; }
|
|
48
|
-
/**
|
|
49
|
-
get hasAngleTol() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
get
|
|
57
|
+
/** Ask if angleTol is specified */
|
|
58
|
+
get hasAngleTol() {
|
|
59
|
+
return this.angleTol !== undefined && Math.abs(this.angleTol.radians) > 0.0;
|
|
60
|
+
}
|
|
61
|
+
/** Ask if chordTol is specified */
|
|
62
|
+
get hasChordTol() {
|
|
63
|
+
return this.chordTol !== undefined && this.chordTol > 0.0;
|
|
64
|
+
}
|
|
65
|
+
/** Ask if maxEdgeLength is specified */
|
|
66
|
+
get hasMaxEdgeLength() {
|
|
67
|
+
return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0;
|
|
68
|
+
}
|
|
54
69
|
/** Return a deep clone */
|
|
55
70
|
clone() {
|
|
56
71
|
const options = new StrokeOptions();
|
|
@@ -67,7 +82,7 @@ export class StrokeOptions {
|
|
|
67
82
|
options.defaultCircleStrokes = this.defaultCircleStrokes;
|
|
68
83
|
return options;
|
|
69
84
|
}
|
|
70
|
-
/**
|
|
85
|
+
/** Return stroke count which is the larger of the minCount or count needed for edge length condition. */
|
|
71
86
|
applyMaxEdgeLength(minCount, totalLength) {
|
|
72
87
|
totalLength = Math.abs(totalLength);
|
|
73
88
|
if (this.maxEdgeLength && this.maxEdgeLength > 0.0 && minCount * this.maxEdgeLength < totalLength) {
|
|
@@ -76,14 +91,16 @@ export class StrokeOptions {
|
|
|
76
91
|
return minCount;
|
|
77
92
|
}
|
|
78
93
|
/**
|
|
79
|
-
*
|
|
94
|
+
* Return stroke count which is the larger of the existing count or count needed for angle condition for given
|
|
95
|
+
* sweepRadians.
|
|
80
96
|
* * defaultStepRadians is assumed to be larger than zero.
|
|
81
97
|
*/
|
|
82
98
|
applyAngleTol(minCount, sweepRadians, defaultStepRadians) {
|
|
83
99
|
return StrokeOptions.applyAngleTol(this, minCount, sweepRadians, defaultStepRadians);
|
|
84
100
|
}
|
|
85
101
|
/**
|
|
86
|
-
*
|
|
102
|
+
* Return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance
|
|
103
|
+
* from the options.
|
|
87
104
|
*/
|
|
88
105
|
static applyAngleTol(options, minCount, sweepRadians, defaultStepRadians) {
|
|
89
106
|
sweepRadians = Math.abs(sweepRadians);
|
|
@@ -111,7 +128,8 @@ export class StrokeOptions {
|
|
|
111
128
|
return minCount;
|
|
112
129
|
}
|
|
113
130
|
/**
|
|
114
|
-
* Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength,
|
|
131
|
+
* Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength,
|
|
132
|
+
* chord, and minimum stroke.
|
|
115
133
|
*/
|
|
116
134
|
applyTolerancesToArc(radius, sweepRadians = Math.PI * 2) {
|
|
117
135
|
let numStrokes = 1;
|
|
@@ -121,7 +139,7 @@ export class StrokeOptions {
|
|
|
121
139
|
numStrokes = this.applyMinStrokesPerPrimitive(numStrokes);
|
|
122
140
|
return numStrokes;
|
|
123
141
|
}
|
|
124
|
-
/**
|
|
142
|
+
/** Return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */
|
|
125
143
|
applyChordTol(minCount, radius, sweepRadians) {
|
|
126
144
|
if (this.chordTol && this.chordTol > 0.0 && this.chordTol < radius) {
|
|
127
145
|
const a = this.chordTol;
|
|
@@ -130,7 +148,9 @@ export class StrokeOptions {
|
|
|
130
148
|
}
|
|
131
149
|
return minCount;
|
|
132
150
|
}
|
|
133
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* Return stroke count which is the larger of existing count or count needed for circular arc chord tol with given
|
|
153
|
+
* arc length and radians
|
|
134
154
|
*/
|
|
135
155
|
applyChordTolToLengthAndRadians(minCount, length, sweepRadians) {
|
|
136
156
|
if (this.chordTol && this.chordTol > 0.0) {
|
|
@@ -140,14 +160,15 @@ export class StrokeOptions {
|
|
|
140
160
|
}
|
|
141
161
|
return minCount;
|
|
142
162
|
}
|
|
143
|
-
/**
|
|
163
|
+
/** Return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */
|
|
144
164
|
applyMinStrokesPerPrimitive(minCount) {
|
|
145
165
|
if (this.minStrokesPerPrimitive !== undefined && Number.isFinite(this.minStrokesPerPrimitive)
|
|
146
166
|
&& this.minStrokesPerPrimitive > minCount)
|
|
147
167
|
minCount = this.minStrokesPerPrimitive;
|
|
148
168
|
return minCount;
|
|
149
169
|
}
|
|
150
|
-
/**
|
|
170
|
+
/**
|
|
171
|
+
* Create `StrokeOptions` with defaults appropriate for curves.
|
|
151
172
|
* * angle tolerance of 15 degrees.
|
|
152
173
|
* * all others inactive.
|
|
153
174
|
*/
|
|
@@ -156,7 +177,8 @@ export class StrokeOptions {
|
|
|
156
177
|
options.angleTol = Angle.createDegrees(15.0);
|
|
157
178
|
return options;
|
|
158
179
|
}
|
|
159
|
-
/**
|
|
180
|
+
/**
|
|
181
|
+
* Create `StrokeOptions` with defaults appropriate for surfaces facets
|
|
160
182
|
* * angle tolerance of 22.5 degrees.
|
|
161
183
|
* * all others inactive.
|
|
162
184
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StrokeOptions.js","sourceRoot":"","sources":["../../../src/curve/StrokeOptions.ts"],"names":[],"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AM,MAAM,GAAG,QAAQ,CAAC,yBAAyB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YACxE,IAAI,MAAM,KAAK,SAAS;gBACtB,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;SAC7D;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,iGAAiG;IAC1F,2BAA2B,CAAC,QAAgB;QACjD,IAAI,IAAI,CAAC,sBAAsB,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC;eACxF,IAAI,CAAC,sBAAsB,GAAG,QAAQ;YACzC,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC;QACzC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,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\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n\r\n/** tolerance blob for various stroking methods.\r\n *\r\n * * Across many applications, the critical concepts are: chordTol, angleTol, maxEdgeLength\r\n * * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.\r\n * * angle is the angle between two contiguous strokes or across a facet edge.\r\n * * maxEdgeLength is the length of a stroke or a edge of a facet.\r\n *\r\n * It is rare for all three to be active at once:\r\n * * Nearly all stroke and facet use cases will apply an angle tolerance.\r\n * * * For curves, 15 degrees is typical\r\n * * * For facets, 22.5 degrees is typical.\r\n * * * Halving the angle tolerance will (roughly) make curves get twice as many strokes, and surfaces get 4 times as many facets.\r\n * * * The angle tolerance has the useful property that its effect is independent of scale of that data. If data is suddenly scaled into millimeters rather than meters, the facet counts remain the same.\r\n * * When creating output for devices such as 3D printing will want a chord tolerance.\r\n * * For graphics display, use an angle tolerance of around 15 degrees and an chord tolerance which is the size of several pixels.\r\n * * Analysis meshes (e.g. Finite Elements) commonly need to apply maxEdgeLength.\r\n * * * Using maxEdgeLength for graphics probably produces too many facets. For example, it causes long cylinders to get many nearly-square facets instead of the small number of long quads usually used for graphics.\r\n * * Facet tolerances are, as the Pirates' Code, guidelines, not absolute rules. Facet and stroke code may ignore tolerances in awkward situations.\r\n * * If multiple tolerances are in effect, the actual count will usually be based on the one that demands the most strokes or facets, unless it is so high that it violates some upper limit on the number of facets on an arc or a section of a curve.\r\n * @public\r\n */\r\nexport class StrokeOptions {\r\n\r\n /** distance from stroke to actual geometry */\r\n public chordTol?: number;\r\n /** turning angle between strokes. */\r\n public angleTol?: Angle;\r\n /** maximum length of a single stroke. */\r\n public maxEdgeLength?: number;\r\n /** caller expects convex facets. */\r\n public needConvexFacets?: boolean;\r\n /** minimum strokes on a primitive */\r\n public minStrokesPerPrimitive?: number;\r\n /** whether or not to triangulate each added facet */\r\n public shouldTriangulate: boolean = false;\r\n private _needNormals?: boolean;\r\n private _needTwoSided?: boolean;\r\n private _needParams?: boolean;\r\n /** Whether params are requested. */\r\n public get needParams(): boolean { return this._needParams !== undefined ? this._needParams : false; }\r\n public set needParams(value: boolean) { this._needParams = value; }\r\n /** Whether normals are requested */\r\n public get needNormals(): boolean { return this._needNormals !== undefined ? this._needNormals : false; }\r\n public set needNormals(value: boolean) { this._needNormals = value; }\r\n /** Whether twoSided is requested. */\r\n public get needTwoSided(): boolean { return this._needTwoSided !== undefined ? this._needTwoSided : false; }\r\n public set needTwoSided(value: boolean) { this._needTwoSided = value; }\r\n /** optional color request flag */\r\n public needColors?: boolean;\r\n /** default number of strokes for a circle. */\r\n public defaultCircleStrokes = 16;\r\n /** ask if angleTol is specified */\r\n public get hasAngleTol(): boolean { return this.angleTol !== undefined && Math.abs(this.angleTol.radians) > 0.0; }\r\n /** ask if chordTol is specified */\r\n public get hasChordTol(): boolean { return this.chordTol !== undefined && this.chordTol > 0.0; }\r\n /** ask if maxEdgeLength is specified */\r\n public get hasMaxEdgeLength(): boolean { return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0; }\r\n\r\n /** Return a deep clone */\r\n public clone(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.chordTol = this.chordTol;\r\n options.angleTol = this.angleTol?.clone();\r\n options.maxEdgeLength = this.maxEdgeLength;\r\n options.needConvexFacets = this.needConvexFacets;\r\n options.minStrokesPerPrimitive = this.minStrokesPerPrimitive;\r\n options.shouldTriangulate = this.shouldTriangulate;\r\n options._needNormals = this._needNormals;\r\n options._needTwoSided = this._needTwoSided;\r\n options._needParams = this._needParams;\r\n options.needColors = this.needColors;\r\n options.defaultCircleStrokes = this.defaultCircleStrokes;\r\n return options;\r\n }\r\n\r\n /** return stroke count which is the larger of the minCount or count needed for edge length condition. */\r\n public applyMaxEdgeLength(minCount: number, totalLength: number): number {\r\n totalLength = Math.abs(totalLength);\r\n if (this.maxEdgeLength && this.maxEdgeLength > 0.0 && minCount * this.maxEdgeLength < totalLength) {\r\n minCount = Geometry.stepCount(this.maxEdgeLength, totalLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n\r\n /**\r\n * return stroke count which is the larger of the existing count or count needed for angle condition for given sweepRadians\r\n * * defaultStepRadians is assumed to be larger than zero.\r\n */\r\n public applyAngleTol(minCount: number, sweepRadians: number, defaultStepRadians: number): number {\r\n return StrokeOptions.applyAngleTol(this, minCount, sweepRadians, defaultStepRadians);\r\n }\r\n /**\r\n * return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance from the options.\r\n */\r\n public static applyAngleTol(options: StrokeOptions | undefined, minCount: number, sweepRadians: number, defaultStepRadians?: number): number {\r\n sweepRadians = Math.abs(sweepRadians);\r\n let stepRadians = defaultStepRadians ? defaultStepRadians : Math.PI / 8.0;\r\n if (options && options.angleTol && options.angleTol.radians > 0.0)\r\n stepRadians = options.angleTol.radians;\r\n if (minCount * stepRadians < sweepRadians)\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n return minCount;\r\n }\r\n /**\r\n * Return the number of strokes needed for given edgeLength curve.\r\n * @param options\r\n * @param minCount smallest allowed count\r\n * @param edgeLength\r\n */\r\n public static applyMaxEdgeLength(options: StrokeOptions | undefined, minCount: number, edgeLength: number): number {\r\n if (edgeLength < 0)\r\n edgeLength = - edgeLength;\r\n if (minCount < 1)\r\n minCount = 1;\r\n if (options && options.maxEdgeLength && options.maxEdgeLength * minCount < edgeLength) {\r\n minCount = Geometry.stepCount(options.maxEdgeLength, edgeLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength, chord, and minimum stroke.\r\n */\r\n public applyTolerancesToArc(radius: number, sweepRadians: number = Math.PI * 2): number {\r\n let numStrokes = 1;\r\n numStrokes = this.applyAngleTol(numStrokes, sweepRadians, Math.PI * 0.25);\r\n numStrokes = this.applyMaxEdgeLength(numStrokes, sweepRadians * radius);\r\n numStrokes = this.applyChordTol(numStrokes, radius, sweepRadians);\r\n numStrokes = this.applyMinStrokesPerPrimitive(numStrokes);\r\n return numStrokes;\r\n }\r\n\r\n /** return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */\r\n public applyChordTol(minCount: number, radius: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0 && this.chordTol < radius) {\r\n const a = this.chordTol;\r\n const stepRadians = 2.0 * Math.acos((1.0 - a / radius));\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n }\r\n return minCount;\r\n }\r\n /** return stroke count which is the larger of existing count or count needed for circular arc chord tol with given arc length and radians\r\n */\r\n public applyChordTolToLengthAndRadians(minCount: number, length: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0) {\r\n const radius = Geometry.conditionalDivideFraction(length, sweepRadians);\r\n if (radius !== undefined)\r\n return this.applyChordTol(minCount, radius, sweepRadians);\r\n }\r\n return minCount;\r\n }\r\n\r\n /** return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */\r\n public applyMinStrokesPerPrimitive(minCount: number): number {\r\n if (this.minStrokesPerPrimitive !== undefined && Number.isFinite(this.minStrokesPerPrimitive)\r\n && this.minStrokesPerPrimitive > minCount)\r\n minCount = this.minStrokesPerPrimitive;\r\n return minCount;\r\n }\r\n\r\n /** create `StrokeOptions` with defaults appropriate for curves.\r\n * * angle tolerance of 15 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForCurves(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(15.0);\r\n return options;\r\n }\r\n /** create `StrokeOptions` with defaults appropriate for surfaces facets\r\n * * angle tolerance of 22.5 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForFacets(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(22.5);\r\n return options;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"StrokeOptions.js","sourceRoot":"","sources":["../../../src/curve/StrokeOptions.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CA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AAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;SAC7D;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,iGAAiG;IAC1F,2BAA2B,CAAC,QAAgB;QACjD,IAAI,IAAI,CAAC,sBAAsB,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC;eACxF,IAAI,CAAC,sBAAsB,GAAG,QAAQ;YACzC,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC;QACzC,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,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\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\n\r\n/**\r\n * Tolerance blob for various stroking methods.\r\n *\r\n * * Across many applications, the critical concepts are: chordTol, angleTol, maxEdgeLength\r\n * * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.\r\n * * angle is the angle between two contiguous strokes or across a facet edge.\r\n * * maxEdgeLength is the length of a stroke or a edge of a facet.\r\n *\r\n * It is rare for all three to be active at once:\r\n * * Nearly all stroke and facet use cases will apply an angle tolerance.\r\n * * * For curves, 15 degrees is typical\r\n * * * For facets, 22.5 degrees is typical.\r\n * * * Halving the angle tolerance will (roughly) make curves get twice as many strokes, and surfaces get 4 times as many facets.\r\n * * * The angle tolerance has the useful property that its effect is independent of scale of that data. If data is suddenly scaled into millimeters rather than meters, the facet counts remain the same.\r\n * * When creating output for devices such as 3D printing will want a chord tolerance.\r\n * * For graphics display, use an angle tolerance of around 15 degrees and an chord tolerance which is the size of several pixels.\r\n * * Analysis meshes (e.g. Finite Elements) commonly need to apply maxEdgeLength.\r\n * * * Using maxEdgeLength for graphics probably produces too many facets. For example, it causes long cylinders to get many nearly-square facets instead of the small number of long quads usually used for graphics.\r\n * * Facet tolerances are, as the Pirates' Code, guidelines, not absolute rules. Facet and stroke code may ignore tolerances in awkward situations.\r\n * * If multiple tolerances are in effect, the actual count will usually be based on the one that demands the most strokes or facets, unless it is so high that it violates some upper limit on the number of facets on an arc or a section of a curve.\r\n * @public\r\n */\r\nexport class StrokeOptions {\r\n /** Distance from stroke to actual geometry */\r\n public chordTol?: number;\r\n /** Turning angle between strokes. */\r\n public angleTol?: Angle;\r\n /** Maximum length of a single stroke. */\r\n public maxEdgeLength?: number;\r\n /** Caller expects convex facets. */\r\n public needConvexFacets?: boolean;\r\n /** Minimum strokes on a primitive */\r\n public minStrokesPerPrimitive?: number;\r\n /** Whether or not to triangulate each added facet */\r\n public shouldTriangulate: boolean = false;\r\n private _needNormals?: boolean;\r\n private _needTwoSided?: boolean;\r\n private _needParams?: boolean;\r\n /** Whether params are requested. */\r\n public get needParams(): boolean {\r\n return this._needParams !== undefined ? this._needParams : false;\r\n }\r\n public set needParams(value: boolean) {\r\n this._needParams = value;\r\n }\r\n /** Whether normals are requested */\r\n public get needNormals(): boolean {\r\n return this._needNormals !== undefined ? this._needNormals : false;\r\n }\r\n public set needNormals(value: boolean) { this._needNormals = value; }\r\n /** Whether twoSided is requested. */\r\n public get needTwoSided(): boolean {\r\n return this._needTwoSided !== undefined ? this._needTwoSided : false;\r\n }\r\n public set needTwoSided(value: boolean) { this._needTwoSided = value; }\r\n /** Optional color request flag */\r\n public needColors?: boolean;\r\n /** Default number of strokes for a circle. */\r\n public defaultCircleStrokes = 16;\r\n /** Ask if angleTol is specified */\r\n public get hasAngleTol(): boolean {\r\n return this.angleTol !== undefined && Math.abs(this.angleTol.radians) > 0.0;\r\n }\r\n /** Ask if chordTol is specified */\r\n public get hasChordTol(): boolean {\r\n return this.chordTol !== undefined && this.chordTol > 0.0;\r\n }\r\n /** Ask if maxEdgeLength is specified */\r\n public get hasMaxEdgeLength(): boolean {\r\n return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0;\r\n }\r\n /** Return a deep clone */\r\n public clone(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.chordTol = this.chordTol;\r\n options.angleTol = this.angleTol?.clone();\r\n options.maxEdgeLength = this.maxEdgeLength;\r\n options.needConvexFacets = this.needConvexFacets;\r\n options.minStrokesPerPrimitive = this.minStrokesPerPrimitive;\r\n options.shouldTriangulate = this.shouldTriangulate;\r\n options._needNormals = this._needNormals;\r\n options._needTwoSided = this._needTwoSided;\r\n options._needParams = this._needParams;\r\n options.needColors = this.needColors;\r\n options.defaultCircleStrokes = this.defaultCircleStrokes;\r\n return options;\r\n }\r\n /** Return stroke count which is the larger of the minCount or count needed for edge length condition. */\r\n public applyMaxEdgeLength(minCount: number, totalLength: number): number {\r\n totalLength = Math.abs(totalLength);\r\n if (this.maxEdgeLength && this.maxEdgeLength > 0.0 && minCount * this.maxEdgeLength < totalLength) {\r\n minCount = Geometry.stepCount(this.maxEdgeLength, totalLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Return stroke count which is the larger of the existing count or count needed for angle condition for given\r\n * sweepRadians.\r\n * * defaultStepRadians is assumed to be larger than zero.\r\n */\r\n public applyAngleTol(minCount: number, sweepRadians: number, defaultStepRadians: number): number {\r\n return StrokeOptions.applyAngleTol(this, minCount, sweepRadians, defaultStepRadians);\r\n }\r\n /**\r\n * Return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance\r\n * from the options.\r\n */\r\n public static applyAngleTol(\r\n options: StrokeOptions | undefined, minCount: number, sweepRadians: number, defaultStepRadians?: number\r\n ): number {\r\n sweepRadians = Math.abs(sweepRadians);\r\n let stepRadians = defaultStepRadians ? defaultStepRadians : Math.PI / 8.0;\r\n if (options && options.angleTol && options.angleTol.radians > 0.0)\r\n stepRadians = options.angleTol.radians;\r\n if (minCount * stepRadians < sweepRadians)\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n return minCount;\r\n }\r\n /**\r\n * Return the number of strokes needed for given edgeLength curve.\r\n * @param options\r\n * @param minCount smallest allowed count\r\n * @param edgeLength\r\n */\r\n public static applyMaxEdgeLength(\r\n options: StrokeOptions | undefined, minCount: number, edgeLength: number\r\n ): number {\r\n if (edgeLength < 0)\r\n edgeLength = - edgeLength;\r\n if (minCount < 1)\r\n minCount = 1;\r\n if (options && options.maxEdgeLength && options.maxEdgeLength * minCount < edgeLength) {\r\n minCount = Geometry.stepCount(options.maxEdgeLength, edgeLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength,\r\n * chord, and minimum stroke.\r\n */\r\n public applyTolerancesToArc(radius: number, sweepRadians: number = Math.PI * 2): number {\r\n let numStrokes = 1;\r\n numStrokes = this.applyAngleTol(numStrokes, sweepRadians, Math.PI * 0.25);\r\n numStrokes = this.applyMaxEdgeLength(numStrokes, sweepRadians * radius);\r\n numStrokes = this.applyChordTol(numStrokes, radius, sweepRadians);\r\n numStrokes = this.applyMinStrokesPerPrimitive(numStrokes);\r\n return numStrokes;\r\n }\r\n /** Return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */\r\n public applyChordTol(minCount: number, radius: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0 && this.chordTol < radius) {\r\n const a = this.chordTol;\r\n const stepRadians = 2.0 * Math.acos((1.0 - a / radius));\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Return stroke count which is the larger of existing count or count needed for circular arc chord tol with given\r\n * arc length and radians\r\n */\r\n public applyChordTolToLengthAndRadians(minCount: number, length: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0) {\r\n const radius = Geometry.conditionalDivideFraction(length, sweepRadians);\r\n if (radius !== undefined)\r\n return this.applyChordTol(minCount, radius, sweepRadians);\r\n }\r\n return minCount;\r\n }\r\n /** Return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */\r\n public applyMinStrokesPerPrimitive(minCount: number): number {\r\n if (this.minStrokesPerPrimitive !== undefined && Number.isFinite(this.minStrokesPerPrimitive)\r\n && this.minStrokesPerPrimitive > minCount)\r\n minCount = this.minStrokesPerPrimitive;\r\n return minCount;\r\n }\r\n /**\r\n * Create `StrokeOptions` with defaults appropriate for curves.\r\n * * angle tolerance of 15 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForCurves(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(15.0);\r\n return options;\r\n }\r\n /**\r\n * Create `StrokeOptions` with defaults appropriate for surfaces facets\r\n * * angle tolerance of 22.5 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForFacets(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(22.5);\r\n return options;\r\n }\r\n}\r\n"]}
|
|
@@ -19,9 +19,9 @@ import { StrokeOptions } from "./StrokeOptions";
|
|
|
19
19
|
export declare class UnionRegion extends CurveCollection {
|
|
20
20
|
/** String name for schema properties */
|
|
21
21
|
readonly curveCollectionType = "unionRegion";
|
|
22
|
-
/**
|
|
22
|
+
/** Test if `other` is a `UnionRegion` */
|
|
23
23
|
isSameGeometryClass(other: GeometryQuery): boolean;
|
|
24
|
-
/**
|
|
24
|
+
/** Collection of Loop and ParityRegion children. */
|
|
25
25
|
protected _children: Array<ParityRegion | Loop>;
|
|
26
26
|
/** Return the array of regions */
|
|
27
27
|
get children(): Array<ParityRegion | Loop>;
|
|
@@ -29,15 +29,16 @@ export declare class UnionRegion extends CurveCollection {
|
|
|
29
29
|
constructor();
|
|
30
30
|
/** Create a `UnionRegion` with given region children */
|
|
31
31
|
static create(...data: Array<ParityRegion | Loop>): UnionRegion;
|
|
32
|
-
/** Return the boundary type (5) of a corresponding
|
|
32
|
+
/** Return the boundary type (5) of a corresponding MicroStation CurveVector */
|
|
33
33
|
dgnBoundaryType(): number;
|
|
34
|
-
/**
|
|
34
|
+
/** Dispatch to more strongly typed `processor.announceUnionRegion(this, indexInParent)` */
|
|
35
35
|
announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent?: number): void;
|
|
36
36
|
/** Return structural clone with stroked primitives. */
|
|
37
37
|
cloneStroked(options?: StrokeOptions): UnionRegion;
|
|
38
38
|
/** Return new empty `UnionRegion` */
|
|
39
39
|
cloneEmptyPeer(): UnionRegion;
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Try to add a child.
|
|
41
42
|
* * Returns false if the `AnyCurve` child is not a region type.
|
|
42
43
|
*/
|
|
43
44
|
tryAddChild(child: AnyCurve): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnionRegion.d.ts","sourceRoot":"","sources":["../../../src/curve/UnionRegion.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,i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AA+E;IACxE,eAAe,IAAI,MAAM;IAGhC,2FAA2F;IACpF,wBAAwB,CAAC,SAAS,EAAE,uBAAuB,EAAE,aAAa,GAAE,MAAW,GAAG,IAAI;IAGrG,uDAAuD;IAChD,YAAY,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,WAAW;IAUzD,qCAAqC;IAC9B,cAAc,IAAI,WAAW;IAGpC;;;OAGG;IACI,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;IAO5C,0CAA0C;IACnC,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,YAAY,GAAG,SAAS;IAK3D,8EAA8E;IACvE,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;CAGhE"}
|
|
@@ -13,10 +13,14 @@ import { ParityRegion } from "./ParityRegion";
|
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
15
|
export class UnionRegion extends CurveCollection {
|
|
16
|
-
/**
|
|
17
|
-
isSameGeometryClass(other) {
|
|
16
|
+
/** Test if `other` is a `UnionRegion` */
|
|
17
|
+
isSameGeometryClass(other) {
|
|
18
|
+
return other instanceof UnionRegion;
|
|
19
|
+
}
|
|
18
20
|
/** Return the array of regions */
|
|
19
|
-
get children() {
|
|
21
|
+
get children() {
|
|
22
|
+
return this._children;
|
|
23
|
+
}
|
|
20
24
|
/** Constructor -- initialize with no children */
|
|
21
25
|
constructor() {
|
|
22
26
|
super();
|
|
@@ -32,9 +36,11 @@ export class UnionRegion extends CurveCollection {
|
|
|
32
36
|
}
|
|
33
37
|
return result;
|
|
34
38
|
}
|
|
35
|
-
/** Return the boundary type (5) of a corresponding
|
|
36
|
-
dgnBoundaryType() {
|
|
37
|
-
|
|
39
|
+
/** Return the boundary type (5) of a corresponding MicroStation CurveVector */
|
|
40
|
+
dgnBoundaryType() {
|
|
41
|
+
return 5;
|
|
42
|
+
}
|
|
43
|
+
/** Dispatch to more strongly typed `processor.announceUnionRegion(this, indexInParent)` */
|
|
38
44
|
announceToCurveProcessor(processor, indexInParent = -1) {
|
|
39
45
|
return processor.announceUnionRegion(this, indexInParent);
|
|
40
46
|
}
|
|
@@ -50,8 +56,11 @@ export class UnionRegion extends CurveCollection {
|
|
|
50
56
|
return clone;
|
|
51
57
|
}
|
|
52
58
|
/** Return new empty `UnionRegion` */
|
|
53
|
-
cloneEmptyPeer() {
|
|
54
|
-
|
|
59
|
+
cloneEmptyPeer() {
|
|
60
|
+
return new UnionRegion();
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Try to add a child.
|
|
55
64
|
* * Returns false if the `AnyCurve` child is not a region type.
|
|
56
65
|
*/
|
|
57
66
|
tryAddChild(child) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnionRegion.js","sourceRoot":"","sources":["../../../src/curve/UnionRegion.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAO/F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C;;;;;;GAMG;AACH,MAAM,OAAO,WAAY,SAAQ,eAAe;
|
|
1
|
+
{"version":3,"file":"UnionRegion.js","sourceRoot":"","sources":["../../../src/curve/UnionRegion.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAO/F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C;;;;;;GAMG;AACH,MAAM,OAAO,WAAY,SAAQ,eAAe;IAG9C,yCAAyC;IAClC,mBAAmB,CAAC,KAAoB;QAC7C,OAAO,KAAK,YAAY,WAAW,CAAC;IACtC,CAAC;IAGD,kCAAkC;IAClC,IAAoB,QAAQ;QAC1B,OAAO,IAAI,CAAC,SAA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ACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,0CAA0C;IACnC,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 { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { AnyCurve } from \"./CurveChain\";\r\nimport { CurveCollection } from \"./CurveCollection\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { Loop } from \"./Loop\";\r\nimport { ParityRegion } from \"./ParityRegion\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * * A `UnionRegion` is a collection of other planar region types -- `Loop` and `ParityRegion`.\r\n * * The composite is the union of the contained regions.\r\n * * A point is \"in\" the composite if it is \"in\" one or more of the contained regions.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport class UnionRegion extends CurveCollection {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"unionRegion\";\r\n /** Test if `other` is a `UnionRegion` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof UnionRegion;\r\n }\r\n /** Collection of Loop and ParityRegion children. */\r\n protected _children: Array<ParityRegion | Loop>;\r\n /** Return the array of regions */\r\n public override get children(): Array<ParityRegion | Loop> {\r\n return this._children;\r\n }\r\n /** Constructor -- initialize with no children */\r\n public constructor() {\r\n super();\r\n this._children = [];\r\n }\r\n /** Create a `UnionRegion` with given region children */\r\n public static create(...data: Array<ParityRegion | Loop>): UnionRegion {\r\n const result = new UnionRegion();\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 (5) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 5;\r\n }\r\n /** Dispatch to more strongly typed `processor.announceUnionRegion(this, indexInParent)` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceUnionRegion(this, indexInParent);\r\n }\r\n /** Return structural clone with stroked primitives. */\r\n public cloneStroked(options?: StrokeOptions): UnionRegion {\r\n const clone = new UnionRegion();\r\n let child;\r\n for (child of this._children) {\r\n const childStrokes = child.cloneStroked(options) as ParityRegion | Loop;\r\n if (childStrokes)\r\n clone.children.push(childStrokes);\r\n }\r\n return clone;\r\n }\r\n /** Return new empty `UnionRegion` */\r\n public cloneEmptyPeer(): UnionRegion {\r\n return new UnionRegion();\r\n }\r\n /**\r\n * Try to add a child.\r\n * * Returns false if the `AnyCurve` child is not a region type.\r\n */\r\n public tryAddChild(child: AnyCurve): boolean {\r\n if (child && child instanceof ParityRegion || child instanceof Loop) {\r\n this._children.push(child);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Return a child identified by index. */\r\n public getChild(i: number): Loop | ParityRegion | 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.handleUnionRegion(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleUnionRegion(this);\r\n }\r\n}\r\n"]}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
import { CurveCollection } from "../CurveCollection";
|
|
5
5
|
import { CurvePrimitive } from "../CurvePrimitive";
|
|
6
6
|
import { RecursiveCurveProcessorWithStack } from "../CurveProcessor";
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Algorithmic class: Accumulate maximum gap between adjacent primitives of CurveChain.
|
|
8
9
|
* @internal
|
|
9
10
|
*/
|
|
10
11
|
export declare class GapSearchContext extends RecursiveCurveProcessorWithStack {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GapSearchContext.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/GapSearchContext.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAc,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAGrE
|
|
1
|
+
{"version":3,"file":"GapSearchContext.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/GapSearchContext.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAc,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAGrE;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,gCAAgC;IAC7D,MAAM,EAAE,MAAM,CAAC;;WAKR,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM;IAKrC,sBAAsB,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI;CAY5F"}
|
|
@@ -8,11 +8,15 @@
|
|
|
8
8
|
import { CurveChain } from "../CurveCollection";
|
|
9
9
|
import { RecursiveCurveProcessorWithStack } from "../CurveProcessor";
|
|
10
10
|
// import { SumLengthsContext, GapSearchContext, CountLinearPartsSearchContext, CloneCurvesContext, TransformInPlaceContext } from "./CurveSearches";
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Algorithmic class: Accumulate maximum gap between adjacent primitives of CurveChain.
|
|
12
13
|
* @internal
|
|
13
14
|
*/
|
|
14
15
|
export class GapSearchContext extends RecursiveCurveProcessorWithStack {
|
|
15
|
-
constructor() {
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
this.maxGap = 0.0;
|
|
19
|
+
}
|
|
16
20
|
static maxGap(target) {
|
|
17
21
|
const context = new GapSearchContext();
|
|
18
22
|
target.announceToCurveProcessor(context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GapSearchContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/GapSearchContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,UAAU,EAAmB,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAErE,qJAAqJ;AACrJ
|
|
1
|
+
{"version":3,"file":"GapSearchContext.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/GapSearchContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,UAAU,EAAmB,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAErE,qJAAqJ;AACrJ;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,gCAAgC;IAEpE;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;IACpB,CAAC;IACM,MAAM,CAAC,MAAM,CAAC,MAAuB;QAC1C,MAAM,OAAO,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACvC,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC;IACe,sBAAsB,CAAC,KAAqB,EAAE,cAAsB;QAClF,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACnD,IAAI,MAAM,YAAY,UAAU,EAAE;gBAChC,MAAM,KAAK,GAAG,MAAM,CAAC;gBACrB,MAAM,SAAS,GAAG,KAAK,CAAC,oBAAoB,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;gBACjE,IAAI,KAAK,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,EAAE;oBAClD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;iBACxF;aACF;SACF;IACH,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 { CurveChain, CurveCollection } from \"../CurveCollection\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { RecursiveCurveProcessorWithStack } from \"../CurveProcessor\";\r\n\r\n// import { SumLengthsContext, GapSearchContext, CountLinearPartsSearchContext, CloneCurvesContext, TransformInPlaceContext } from \"./CurveSearches\";\r\n/**\r\n * Algorithmic class: Accumulate maximum gap between adjacent primitives of CurveChain.\r\n * @internal\r\n */\r\nexport class GapSearchContext extends RecursiveCurveProcessorWithStack {\r\n public maxGap: number;\r\n constructor() {\r\n super();\r\n this.maxGap = 0.0;\r\n }\r\n public static maxGap(target: CurveCollection): number {\r\n const context = new GapSearchContext();\r\n target.announceToCurveProcessor(context);\r\n return context.maxGap;\r\n }\r\n public override announceCurvePrimitive(curve: CurvePrimitive, _indexInParent: number): void {\r\n if (this._stack.length > 0) {\r\n const parent = this._stack[this._stack.length - 1];\r\n if (parent instanceof CurveChain) {\r\n const chain = parent;\r\n const nextCurve = chain.cyclicCurvePrimitive(_indexInParent + 1);\r\n if (curve !== undefined && nextCurve !== undefined) {\r\n this.maxGap = Math.max(this.maxGap, curve.endPoint().distance(nextCurve.startPoint()));\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -37,23 +37,29 @@ export declare class PlaneAltitudeRangeContext extends RecurseToCurvesGeometryHa
|
|
|
37
37
|
private _workPoint?;
|
|
38
38
|
handleArc3d(g: Arc3d): void;
|
|
39
39
|
private static findExtremesInDirection;
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
40
|
+
/**
|
|
41
|
+
* Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction, and
|
|
42
|
+
* return points at min and max altitude, packed into a `LineSegment3d`.
|
|
42
43
|
* @param geometry geometry to project
|
|
43
|
-
* @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with
|
|
44
|
+
* @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with
|
|
45
|
+
* zero origin.
|
|
44
46
|
* @param lowHigh optional receiver for output
|
|
45
47
|
*/
|
|
46
48
|
static findExtremePointsInDirection(geometry: GeometryQuery | GrowableXYZArray | Point3d[], direction: Vector3d | Ray3d, lowHigh?: LineSegment3d): LineSegment3d | undefined;
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
+
/**
|
|
50
|
+
* Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction, and return
|
|
51
|
+
* the min and max altitudes, packed into a Range1d.
|
|
49
52
|
* @param geometry geometry to project
|
|
50
|
-
* @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with
|
|
53
|
+
* @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with
|
|
54
|
+
* zero origin.
|
|
51
55
|
* @param lowHigh optional receiver for output
|
|
52
56
|
*/
|
|
53
57
|
static findExtremeAltitudesInDirection(geometry: GeometryQuery | GrowableXYZArray | Point3d[], direction: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined;
|
|
54
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Project geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.
|
|
55
60
|
* @param geometry geometry to project
|
|
56
|
-
* @param direction vector or ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with
|
|
61
|
+
* @param direction vector or ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with
|
|
62
|
+
* zero origin.
|
|
57
63
|
* @param lowHigh optional receiver for output
|
|
58
64
|
*/
|
|
59
65
|
static findExtremeFractionsAlongDirection(geometry: GeometryQuery | GrowableXYZArray | Point3d[], direction: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaneAltitudeRangeContext.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PlaneAltitudeRangeContext.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAY,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OA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,EAAE,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,GACrG,OAAO,GAAG,SAAS;CAavB"}
|
|
@@ -107,10 +107,12 @@ export class PlaneAltitudeRangeContext extends RecurseToCurvesGeometryHandler {
|
|
|
107
107
|
}
|
|
108
108
|
return undefined;
|
|
109
109
|
}
|
|
110
|
-
/**
|
|
111
|
-
*
|
|
110
|
+
/**
|
|
111
|
+
* Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction, and
|
|
112
|
+
* return points at min and max altitude, packed into a `LineSegment3d`.
|
|
112
113
|
* @param geometry geometry to project
|
|
113
|
-
* @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with
|
|
114
|
+
* @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with
|
|
115
|
+
* zero origin.
|
|
114
116
|
* @param lowHigh optional receiver for output
|
|
115
117
|
*/
|
|
116
118
|
static findExtremePointsInDirection(geometry, direction, lowHigh) {
|
|
@@ -119,10 +121,12 @@ export class PlaneAltitudeRangeContext extends RecurseToCurvesGeometryHandler {
|
|
|
119
121
|
return LineSegment3d.create(context.lowPoint, context.highPoint, lowHigh);
|
|
120
122
|
return undefined;
|
|
121
123
|
}
|
|
122
|
-
/**
|
|
123
|
-
*
|
|
124
|
+
/**
|
|
125
|
+
* Compute altitudes for the geometry (via dispatch) over the plane defined by the given direction, and return
|
|
126
|
+
* the min and max altitudes, packed into a Range1d.
|
|
124
127
|
* @param geometry geometry to project
|
|
125
|
-
* @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with
|
|
128
|
+
* @param direction vector or ray on which to project the instance. A `Vector3d` is treated as a `Ray3d` with
|
|
129
|
+
* zero origin.
|
|
126
130
|
* @param lowHigh optional receiver for output
|
|
127
131
|
*/
|
|
128
132
|
static findExtremeAltitudesInDirection(geometry, direction, lowHigh) {
|
|
@@ -131,9 +135,11 @@ export class PlaneAltitudeRangeContext extends RecurseToCurvesGeometryHandler {
|
|
|
131
135
|
return Range1d.createFrom(context.range, lowHigh);
|
|
132
136
|
return undefined;
|
|
133
137
|
}
|
|
134
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* Project geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of projection.
|
|
135
140
|
* @param geometry geometry to project
|
|
136
|
-
* @param direction vector or ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with
|
|
141
|
+
* @param direction vector or ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with
|
|
142
|
+
* zero origin.
|
|
137
143
|
* @param lowHigh optional receiver for output
|
|
138
144
|
*/
|
|
139
145
|
static findExtremeFractionsAlongDirection(geometry, direction, lowHigh) {
|