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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/lib/cjs/curve/Arc3d.d.ts +70 -86
  2. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  3. package/lib/cjs/curve/Arc3d.js +109 -96
  4. package/lib/cjs/curve/Arc3d.js.map +1 -1
  5. package/lib/cjs/curve/CurveCollection.d.ts +47 -30
  6. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  7. package/lib/cjs/curve/CurveCollection.js +63 -34
  8. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  9. package/lib/cjs/curve/CurveLocationDetail.d.ts +40 -41
  10. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  11. package/lib/cjs/curve/CurveLocationDetail.js +31 -35
  12. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  13. package/lib/cjs/curve/CurvePrimitive.d.ts +137 -92
  14. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  15. package/lib/cjs/curve/CurvePrimitive.js +114 -75
  16. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  17. package/lib/cjs/curve/GeometryQuery.d.ts +26 -20
  18. package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
  19. package/lib/cjs/curve/GeometryQuery.js +11 -9
  20. package/lib/cjs/curve/GeometryQuery.js.map +1 -1
  21. package/lib/cjs/curve/LineSegment3d.d.ts +34 -25
  22. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  23. package/lib/cjs/curve/LineSegment3d.js +76 -38
  24. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  25. package/lib/cjs/curve/LineString3d.d.ts +70 -51
  26. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  27. package/lib/cjs/curve/LineString3d.js +120 -71
  28. package/lib/cjs/curve/LineString3d.js.map +1 -1
  29. package/lib/cjs/curve/Query/StrokeCountMap.d.ts +14 -13
  30. package/lib/cjs/curve/Query/StrokeCountMap.d.ts.map +1 -1
  31. package/lib/cjs/curve/Query/StrokeCountMap.js +9 -8
  32. package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
  33. package/lib/cjs/curve/StrokeOptions.d.ts +29 -21
  34. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  35. package/lib/cjs/curve/StrokeOptions.js +44 -22
  36. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  37. package/lib/cjs/geometry3d/Matrix3d.d.ts +2 -2
  38. package/lib/cjs/geometry3d/Matrix3d.js +2 -2
  39. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  40. package/lib/esm/curve/Arc3d.d.ts +70 -86
  41. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  42. package/lib/esm/curve/Arc3d.js +109 -96
  43. package/lib/esm/curve/Arc3d.js.map +1 -1
  44. package/lib/esm/curve/CurveCollection.d.ts +47 -30
  45. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  46. package/lib/esm/curve/CurveCollection.js +63 -34
  47. package/lib/esm/curve/CurveCollection.js.map +1 -1
  48. package/lib/esm/curve/CurveLocationDetail.d.ts +40 -41
  49. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  50. package/lib/esm/curve/CurveLocationDetail.js +31 -35
  51. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  52. package/lib/esm/curve/CurvePrimitive.d.ts +137 -92
  53. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  54. package/lib/esm/curve/CurvePrimitive.js +114 -75
  55. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  56. package/lib/esm/curve/GeometryQuery.d.ts +26 -20
  57. package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
  58. package/lib/esm/curve/GeometryQuery.js +11 -9
  59. package/lib/esm/curve/GeometryQuery.js.map +1 -1
  60. package/lib/esm/curve/LineSegment3d.d.ts +34 -25
  61. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  62. package/lib/esm/curve/LineSegment3d.js +76 -38
  63. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  64. package/lib/esm/curve/LineString3d.d.ts +70 -51
  65. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  66. package/lib/esm/curve/LineString3d.js +120 -71
  67. package/lib/esm/curve/LineString3d.js.map +1 -1
  68. package/lib/esm/curve/Query/StrokeCountMap.d.ts +14 -13
  69. package/lib/esm/curve/Query/StrokeCountMap.d.ts.map +1 -1
  70. package/lib/esm/curve/Query/StrokeCountMap.js +9 -8
  71. package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
  72. package/lib/esm/curve/StrokeOptions.d.ts +29 -21
  73. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  74. package/lib/esm/curve/StrokeOptions.js +44 -22
  75. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  76. package/lib/esm/geometry3d/Matrix3d.d.ts +2 -2
  77. package/lib/esm/geometry3d/Matrix3d.js +2 -2
  78. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  79. package/package.json +3 -3
@@ -3,32 +3,32 @@
3
3
  */
4
4
  import { CurvePrimitive } from "../CurvePrimitive";
5
5
  /**
6
- * data carrier interface for per-primitive stroke counts and distances used by PolyfaceBuilder.
7
- * * For a simple primitive (Line segment or arc) that is stroked with uniform fraction, the members are:
6
+ * Data carrier interface for per-primitive stroke counts and distances used by PolyfaceBuilder.
7
+ * * For a simple primitive (line segment or arc) that is stroked with uniform fraction, the members are:
8
8
  * * `numStroke` = total number of strokes
9
9
  * * `curveLength` = length of this curve
10
10
  * * `a0` = external mapped coordinate for fraction 0 on this primitive or component
11
11
  * * `a1` = external mapped coordinate for fraction 1 on this primitive or component
12
12
  *
13
13
  * * For linestring and bspline curve, those numbers are totals for the overall curve, and breakdown within
14
- * the components (line segments or bezier spans) is recorded on the optional array `componentData[]`
14
+ * the components (line segments or bezier spans) is recorded on the optional array `componentData[]`
15
15
  * * Members of the array are annotated with componentIndex within the linestring or bspline curve
16
16
  * @public
17
17
  */
18
18
  export declare class StrokeCountMap {
19
- /** number of strokes expected in this interval. */
19
+ /** Number of strokes expected in this interval. */
20
20
  numStroke: number;
21
21
  /** Length of the curve interval. */
22
22
  curveLength: number;
23
- /** start coordinate (in user-defined space) for fraction 0 on this primitive or component */
23
+ /** Start coordinate (in user-defined space) for fraction 0 on this primitive or component */
24
24
  a0: number;
25
- /** end coordinate (in user-defined space) for fraction 0 on this primitive or component */
25
+ /** End coordinate (in user-defined space) for fraction 0 on this primitive or component */
26
26
  a1: number;
27
- /** further StrokeCountMap's within this interval (e.g. for individual segments of a linestring.) */
27
+ /** Further StrokeCountMap's within this interval (e.g. for individual segments of a linestring.) */
28
28
  componentData?: StrokeCountMap[];
29
29
  /** The curve that this map represents */
30
30
  primitive?: CurvePrimitive;
31
- /** this curve's index within its parent. */
31
+ /** This curve's index within its parent. */
32
32
  componentIndex?: number;
33
33
  /**
34
34
  * Constructor. Initialize all fields from arguments.
@@ -61,7 +61,7 @@ export declare class StrokeCountMap {
61
61
  */
62
62
  static createWithComponentIndex(componentIndex?: number, numStroke?: number, curveLength?: number, a0?: number, a1?: number): StrokeCountMap;
63
63
  /**
64
- * create a StrokeCountMap, optionally
64
+ * Create a StrokeCountMap, optionally
65
65
  * * (a) use parent a1 as new a0
66
66
  * * (b) attach a (usually empty) array for component counts.
67
67
  * @param parentMap optional map whose a1 becomes a0 in the new map.
@@ -76,17 +76,18 @@ export declare class StrokeCountMap {
76
76
  * @param curveLength curve length for new child curve.
77
77
  */
78
78
  addToCountAndLength(numStroke: number, curveLength: number): void;
79
- /** return true if `other` has the same component structure as `this`
80
- * * testing recurses through corresponding members of componentData arrays.
79
+ /**
80
+ * Return true if `other` has the same component structure as `this`
81
+ * * Testing recurses through corresponding members of componentData arrays.
81
82
  */
82
83
  isCompatibleComponentStructure(other: StrokeCountMap, enforceCounts: boolean): boolean;
83
84
  /**
84
- * * clone all data from root.
85
+ * Clone all data from root.
85
86
  * * clone componentData arrays recursively.
86
87
  */
87
88
  clone(): StrokeCountMap;
88
89
  /**
89
- * interpolate in the a0,a1 mapping.
90
+ * Interpolate in the a0,a1 mapping.
90
91
  * @param fraction fractional position between a0 and a1
91
92
  */
92
93
  fractionToA(fraction: number): number;
@@ -1 +1 @@
1
- {"version":3,"file":"StrokeCountMap.d.ts","sourceRoot":"","sources":["../../../../src/curve/Query/StrokeCountMap.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,qBAAa,cAAc;IACzB,mDAAmD;IAC5C,SAAS,EAAE,MAAM,CAAC;IACzB,oCAAoC;IAC7B,WAAW,EAAE,MAAM,CAAC;IAC3B,6FAA6F;IACtF,EAAE,EAAE,MAAM,CAAC;IAClB,2FAA2F;IACpF,EAAE,EAAE,MAAM,CAAC;IAClB,oGAAoG;IAC7F,aAAa,CAAC,EAAE,cAAc,EAAE,CAAC;IACxC,yCAAyC;IAClC,SAAS,CAAC,EAAE,cAAc,CAAC;IAClC,4CAA4C;IACrC,cAAc,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;;;OASG;IACH,OAAO;IAOP;;;;;;;;OAQG;WACW,wBAAwB,CAAC,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,cAAc,EAAE;IAKlK;;;;;;;OAOG;WACW,wBAAwB,CAAC,cAAc,GAAE,MAAU,EAAE,SAAS,GAAE,MAAU,EAAE,WAAW,GAAE,MAAU,EAAE,EAAE,GAAE,MAAU,EAAE,EAAE,GAAE,MAAU;IAMjJ;;;;;;OAMG;WACW,yCAAyC,CAAC,cAAc,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,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AAE,EAAE,GAAE,MAAU,GACzG,cAAc;IAKjB;;;;;;OAMG;WACW,yCAAyC,CACrD,cAAc,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE,cAAc,EAAE,GAC3F,cAAc;IAMjB;;;;;;OAMG;IACI,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAUxE;;;OAGG;IACI,8BAA8B,CAAC,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO;IAkB7F;;;OAGG;IACI,KAAK,IAAI,cAAc;IAS9B;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM;CAGpC"}
@@ -7,15 +7,15 @@
7
7
  */
8
8
  import { Geometry } from "../../Geometry";
9
9
  /**
10
- * data carrier interface for per-primitive stroke counts and distances used by PolyfaceBuilder.
11
- * * For a simple primitive (Line segment or arc) that is stroked with uniform fraction, the members are:
10
+ * Data carrier interface for per-primitive stroke counts and distances used by PolyfaceBuilder.
11
+ * * For a simple primitive (line segment or arc) that is stroked with uniform fraction, the members are:
12
12
  * * `numStroke` = total number of strokes
13
13
  * * `curveLength` = length of this curve
14
14
  * * `a0` = external mapped coordinate for fraction 0 on this primitive or component
15
15
  * * `a1` = external mapped coordinate for fraction 1 on this primitive or component
16
16
  *
17
17
  * * For linestring and bspline curve, those numbers are totals for the overall curve, and breakdown within
18
- * the components (line segments or bezier spans) is recorded on the optional array `componentData[]`
18
+ * the components (line segments or bezier spans) is recorded on the optional array `componentData[]`
19
19
  * * Members of the array are annotated with componentIndex within the linestring or bspline curve
20
20
  * @public
21
21
  */
@@ -65,7 +65,7 @@ export class StrokeCountMap {
65
65
  return result;
66
66
  }
67
67
  /**
68
- * create a StrokeCountMap, optionally
68
+ * Create a StrokeCountMap, optionally
69
69
  * * (a) use parent a1 as new a0
70
70
  * * (b) attach a (usually empty) array for component counts.
71
71
  * @param parentMap optional map whose a1 becomes a0 in the new map.
@@ -93,8 +93,9 @@ export class StrokeCountMap {
93
93
  this.curveLength += curveLength;
94
94
  this.a1 = a2;
95
95
  }
96
- /** return true if `other` has the same component structure as `this`
97
- * * testing recurses through corresponding members of componentData arrays.
96
+ /**
97
+ * Return true if `other` has the same component structure as `this`
98
+ * * Testing recurses through corresponding members of componentData arrays.
98
99
  */
99
100
  isCompatibleComponentStructure(other, enforceCounts) {
100
101
  if (enforceCounts && this.numStroke !== other.numStroke)
@@ -115,7 +116,7 @@ export class StrokeCountMap {
115
116
  return false;
116
117
  }
117
118
  /**
118
- * * clone all data from root.
119
+ * Clone all data from root.
119
120
  * * clone componentData arrays recursively.
120
121
  */
121
122
  clone() {
@@ -128,7 +129,7 @@ export class StrokeCountMap {
128
129
  return a;
129
130
  }
130
131
  /**
131
- * interpolate in the a0,a1 mapping.
132
+ * Interpolate in the a0,a1 mapping.
132
133
  * @param fraction fractional position between a0 and a1
133
134
  */
134
135
  fractionToA(fraction) {
@@ -1 +1 @@
1
- {"version":3,"file":"StrokeCountMap.js","sourceRoot":"","sources":["../../../../src/curve/Query/StrokeCountMap.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,cAAc;IAezB;;;;;;;;;OASG;IACH,YAAoB,SAAiB,EAAE,WAAmB,EAAE,EAAU,EAAE,EAAU,EAAE,aAAgC;QAClH,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IACD;;;;;;;;OAQG;IACI,MAAM,CAAC,wBAAwB,CAAC,SAAyB,EAAE,SAAiB,EAAE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,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;SACvC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IACD;;;OAGG;IACI,WAAW,CAAC,QAAgB;QACjC,OAAO,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\n\r\n/**\r\n * data carrier interface for per-primitive stroke counts and distances used by PolyfaceBuilder.\r\n * * For a simple primitive (Line segment or arc) that is stroked with uniform fraction, the members are:\r\n * * `numStroke` = total number of strokes\r\n * * `curveLength` = length of this curve\r\n * * `a0` = external mapped coordinate for fraction 0 on this primitive or component\r\n * * `a1` = external mapped coordinate for fraction 1 on this primitive or component\r\n *\r\n * * For linestring and bspline curve, those numbers are totals for the overall curve, and breakdown within\r\n * the components (line segments or bezier spans) is recorded on the optional array `componentData[]`\r\n * * Members of the array are annotated with componentIndex within the linestring or bspline curve\r\n * @public\r\n */\r\nexport class StrokeCountMap {\r\n /** number of strokes expected in this interval. */\r\n public numStroke: number;\r\n /** Length of the curve interval. */\r\n public curveLength: number;\r\n /** start coordinate (in user-defined space) for fraction 0 on this primitive or component */\r\n public a0: number;\r\n /** end coordinate (in user-defined space) for fraction 0 on this primitive or component */\r\n public a1: number;\r\n /** further StrokeCountMap's within this interval (e.g. for individual segments of a linestring.) */\r\n public componentData?: StrokeCountMap[];\r\n /** The curve that this map represents */\r\n public primitive?: CurvePrimitive;\r\n /** this curve's index within its parent. */\r\n public componentIndex?: number;\r\n /**\r\n * Constructor. Initialize all fields from arguments.\r\n * * Callers that expect to announce numStroke and curveLength for multiple components send an empty componentData array.\r\n * * Callers that do not have multiple components send undefined component data.\r\n * @param numStroke\r\n * @param curveLength\r\n * @param a0\r\n * @param a1\r\n * @param componentData\r\n */\r\n private constructor(numStroke: number, curveLength: number, a0: number, a1: number, componentData?: StrokeCountMap[]) {\r\n this.numStroke = numStroke;\r\n this.curveLength = curveLength;\r\n this.a0 = a0;\r\n this.a1 = a1;\r\n this.componentData = componentData;\r\n }\r\n /**\r\n * Create a `StrokeCountMap` with curve primitive and optional componentData array.\r\n * @param primitive\r\n * @param numStroke\r\n * @param curveLength\r\n * @param a0\r\n * @param a1\r\n * @param componentData\r\n */\r\n public static createWithCurvePrimitive(primitive: CurvePrimitive, numStroke: number, curveLength: number, a0: number, a1: number, componentData?: StrokeCountMap[]) {\r\n const result = new StrokeCountMap(numStroke, curveLength, a0, a1, componentData);\r\n result.primitive = primitive;\r\n return result;\r\n }\r\n /**\r\n * Create a `StrokeCountMap` with `componentIndex` (but no primitive or componentData array)\r\n * @param index\r\n * @param numStroke\r\n * @param curveLength\r\n * @param a0\r\n * @param a1\r\n */\r\n public static createWithComponentIndex(componentIndex: number = 0, numStroke: number = 0, curveLength: number = 0, a0: number = 0, a1: number = 0) {\r\n const result = new StrokeCountMap(numStroke, curveLength, a0, a1);\r\n result.componentIndex = componentIndex;\r\n return result;\r\n }\r\n\r\n /**\r\n * create a StrokeCountMap, optionally\r\n * * (a) use parent a1 as new a0\r\n * * (b) attach a (usually empty) array for component counts.\r\n * @param parentMap optional map whose a1 becomes a0 in the new map.\r\n * @param componentData optional array of component StrokeCountMaps.\r\n */\r\n public static createWithCurvePrimitiveAndOptionalParent(curvePrimitive: CurvePrimitive, parentMap?: StrokeCountMap, componentData?: StrokeCountMap[]): StrokeCountMap {\r\n const a0 = parentMap ? parentMap.a1 : 0.0;\r\n const result = new StrokeCountMap(0, 0, a0, a0, componentData);\r\n result.primitive = curvePrimitive;\r\n return result;\r\n\r\n }\r\n /**\r\n * Apply stroke count and curve length from a component to a parent map.\r\n * If componentData is present, install the new count and length with distance limits\r\n * @param parentMap map to be updated.\r\n * @param numStroke number of strokes on new child curve\r\n * @param curveLength curve length for new child curve.\r\n */\r\n public addToCountAndLength(numStroke: number, curveLength: number) {\r\n const a2 = this.a1 + curveLength;\r\n if (this.componentData) {\r\n this.componentData.push(\r\n new StrokeCountMap(numStroke, curveLength, this.a1, a2));\r\n }\r\n this.numStroke += numStroke;\r\n this.curveLength += curveLength;\r\n this.a1 = a2;\r\n }\r\n /** return true if `other` has the same component structure as `this`\r\n * * testing recurses through corresponding members of componentData arrays.\r\n */\r\n public isCompatibleComponentStructure(other: StrokeCountMap, enforceCounts: boolean): boolean {\r\n if (enforceCounts && this.numStroke !== other.numStroke)\r\n return false;\r\n if (this.componentData === undefined && other.componentData === undefined)\r\n return true;\r\n if (this.componentData && other.componentData) {\r\n // both have components. Recurse . . ..\r\n if (this.componentData.length !== other.componentData.length)\r\n return false;\r\n const n = this.componentData.length;\r\n for (let i = 0; i < n; i++)\r\n if (!this.componentData[i].isCompatibleComponentStructure(other.componentData[i], enforceCounts))\r\n return false;\r\n return true;\r\n }\r\n // one has componentData, the other not.\r\n return false;\r\n }\r\n /**\r\n * * clone all data from root.\r\n * * clone componentData arrays recursively.\r\n */\r\n public clone(): StrokeCountMap {\r\n const a = new StrokeCountMap(this.numStroke, this.curveLength, this.a0, this.a1);\r\n if (this.componentData) {\r\n a.componentData = [];\r\n for (const child of this.componentData)\r\n a.componentData.push(child.clone());\r\n }\r\n return a;\r\n }\r\n /**\r\n * interpolate in the a0,a1 mapping.\r\n * @param fraction fractional position between a0 and a1\r\n */\r\n public fractionToA(fraction: number) {\r\n return Geometry.interpolate(this.a0, fraction, this.a1);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"StrokeCountMap.js","sourceRoot":"","sources":["../../../../src/curve/Query/StrokeCountMap.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAE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CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC;oBAC9F,OAAO,KAAK,CAAC;YACjB,OAAO,IAAI,CAAC;SACb;QACD,wCAAwC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD;;;OAGG;IACI,KAAK;QACV,MAAM,CAAC,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACjF,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,CAAC,CAAC,aAAa,GAAG,EAAE,CAAC;YACrB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,aAAa;gBACpC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;SACvC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IACD;;;OAGG;IACI,WAAW,CAAC,QAAgB;QACjC,OAAO,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\n\r\n/**\r\n * Data carrier interface for per-primitive stroke counts and distances used by PolyfaceBuilder.\r\n * * For a simple primitive (line segment or arc) that is stroked with uniform fraction, the members are:\r\n * * `numStroke` = total number of strokes\r\n * * `curveLength` = length of this curve\r\n * * `a0` = external mapped coordinate for fraction 0 on this primitive or component\r\n * * `a1` = external mapped coordinate for fraction 1 on this primitive or component\r\n *\r\n * * For linestring and bspline curve, those numbers are totals for the overall curve, and breakdown within\r\n * the components (line segments or bezier spans) is recorded on the optional array `componentData[]`\r\n * * Members of the array are annotated with componentIndex within the linestring or bspline curve\r\n * @public\r\n */\r\nexport class StrokeCountMap {\r\n /** Number of strokes expected in this interval. */\r\n public numStroke: number;\r\n /** Length of the curve interval. */\r\n public curveLength: number;\r\n /** Start coordinate (in user-defined space) for fraction 0 on this primitive or component */\r\n public a0: number;\r\n /** End coordinate (in user-defined space) for fraction 0 on this primitive or component */\r\n public a1: number;\r\n /** Further StrokeCountMap's within this interval (e.g. for individual segments of a linestring.) */\r\n public componentData?: StrokeCountMap[];\r\n /** The curve that this map represents */\r\n public primitive?: CurvePrimitive;\r\n /** This curve's index within its parent. */\r\n public componentIndex?: number;\r\n /**\r\n * Constructor. Initialize all fields from arguments.\r\n * * Callers that expect to announce numStroke and curveLength for multiple components send an empty componentData array.\r\n * * Callers that do not have multiple components send undefined component data.\r\n * @param numStroke\r\n * @param curveLength\r\n * @param a0\r\n * @param a1\r\n * @param componentData\r\n */\r\n private constructor(numStroke: number, curveLength: number, a0: number, a1: number, componentData?: StrokeCountMap[]) {\r\n this.numStroke = numStroke;\r\n this.curveLength = curveLength;\r\n this.a0 = a0;\r\n this.a1 = a1;\r\n this.componentData = componentData;\r\n }\r\n /**\r\n * Create a `StrokeCountMap` with curve primitive and optional componentData array.\r\n * @param primitive\r\n * @param numStroke\r\n * @param curveLength\r\n * @param a0\r\n * @param a1\r\n * @param componentData\r\n */\r\n public static createWithCurvePrimitive(\r\n primitive: CurvePrimitive, numStroke: number, curveLength: number, a0: number, a1: number, componentData?: StrokeCountMap[]\r\n ): StrokeCountMap {\r\n const result = new StrokeCountMap(numStroke, curveLength, a0, a1, componentData);\r\n result.primitive = primitive;\r\n return result;\r\n }\r\n /**\r\n * Create a `StrokeCountMap` with `componentIndex` (but no primitive or componentData array)\r\n * @param index\r\n * @param numStroke\r\n * @param curveLength\r\n * @param a0\r\n * @param a1\r\n */\r\n public static createWithComponentIndex(\r\n componentIndex: number = 0, numStroke: number = 0, curveLength: number = 0, a0: number = 0, a1: number = 0\r\n ): StrokeCountMap {\r\n const result = new StrokeCountMap(numStroke, curveLength, a0, a1);\r\n result.componentIndex = componentIndex;\r\n return result;\r\n }\r\n /**\r\n * Create a StrokeCountMap, optionally\r\n * * (a) use parent a1 as new a0\r\n * * (b) attach a (usually empty) array for component counts.\r\n * @param parentMap optional map whose a1 becomes a0 in the new map.\r\n * @param componentData optional array of component StrokeCountMaps.\r\n */\r\n public static createWithCurvePrimitiveAndOptionalParent(\r\n curvePrimitive: CurvePrimitive, parentMap?: StrokeCountMap, componentData?: StrokeCountMap[]\r\n ): StrokeCountMap {\r\n const a0 = parentMap ? parentMap.a1 : 0.0;\r\n const result = new StrokeCountMap(0, 0, a0, a0, componentData);\r\n result.primitive = curvePrimitive;\r\n return result;\r\n }\r\n /**\r\n * Apply stroke count and curve length from a component to a parent map.\r\n * If componentData is present, install the new count and length with distance limits\r\n * @param parentMap map to be updated.\r\n * @param numStroke number of strokes on new child curve\r\n * @param curveLength curve length for new child curve.\r\n */\r\n public addToCountAndLength(numStroke: number, curveLength: number): void {\r\n const a2 = this.a1 + curveLength;\r\n if (this.componentData) {\r\n this.componentData.push(\r\n new StrokeCountMap(numStroke, curveLength, this.a1, a2));\r\n }\r\n this.numStroke += numStroke;\r\n this.curveLength += curveLength;\r\n this.a1 = a2;\r\n }\r\n /**\r\n * Return true if `other` has the same component structure as `this`\r\n * * Testing recurses through corresponding members of componentData arrays.\r\n */\r\n public isCompatibleComponentStructure(other: StrokeCountMap, enforceCounts: boolean): boolean {\r\n if (enforceCounts && this.numStroke !== other.numStroke)\r\n return false;\r\n if (this.componentData === undefined && other.componentData === undefined)\r\n return true;\r\n if (this.componentData && other.componentData) {\r\n // both have components. Recurse . . ..\r\n if (this.componentData.length !== other.componentData.length)\r\n return false;\r\n const n = this.componentData.length;\r\n for (let i = 0; i < n; i++)\r\n if (!this.componentData[i].isCompatibleComponentStructure(other.componentData[i], enforceCounts))\r\n return false;\r\n return true;\r\n }\r\n // one has componentData, the other not.\r\n return false;\r\n }\r\n /**\r\n * Clone all data from root.\r\n * * clone componentData arrays recursively.\r\n */\r\n public clone(): StrokeCountMap {\r\n const a = new StrokeCountMap(this.numStroke, this.curveLength, this.a0, this.a1);\r\n if (this.componentData) {\r\n a.componentData = [];\r\n for (const child of this.componentData)\r\n a.componentData.push(child.clone());\r\n }\r\n return a;\r\n }\r\n /**\r\n * Interpolate in the a0,a1 mapping.\r\n * @param fraction fractional position between a0 and a1\r\n */\r\n public fractionToA(fraction: number) {\r\n return Geometry.interpolate(this.a0, fraction, this.a1);\r\n }\r\n}\r\n"]}
@@ -1,5 +1,6 @@
1
1
  import { Angle } from "../geometry3d/Angle";
2
- /** tolerance blob for various stroking methods.
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
- /** distance from stroke to actual geometry */
25
+ /** Distance from stroke to actual geometry */
25
26
  chordTol?: number;
26
- /** turning angle between strokes. */
27
+ /** Turning angle between strokes. */
27
28
  angleTol?: Angle;
28
- /** maximum length of a single stroke. */
29
+ /** Maximum length of a single stroke. */
29
30
  maxEdgeLength?: number;
30
- /** caller expects convex facets. */
31
+ /** Caller expects convex facets. */
31
32
  needConvexFacets?: boolean;
32
- /** minimum strokes on a primitive */
33
+ /** Minimum strokes on a primitive */
33
34
  minStrokesPerPrimitive?: number;
34
- /** whether or not to triangulate each added facet */
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
- /** optional color request flag */
49
+ /** Optional color request flag */
49
50
  needColors?: boolean;
50
- /** default number of strokes for a circle. */
51
+ /** Default number of strokes for a circle. */
51
52
  defaultCircleStrokes: number;
52
- /** ask if angleTol is specified */
53
+ /** Ask if angleTol is specified */
53
54
  get hasAngleTol(): boolean;
54
- /** ask if chordTol is specified */
55
+ /** Ask if chordTol is specified */
55
56
  get hasChordTol(): boolean;
56
- /** ask if maxEdgeLength is specified */
57
+ /** Ask if maxEdgeLength is specified */
57
58
  get hasMaxEdgeLength(): boolean;
58
59
  /** Return a deep clone */
59
60
  clone(): StrokeOptions;
60
- /** return stroke count which is the larger of the minCount or count needed for edge length condition. */
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
- * return stroke count which is the larger of the existing count or count needed for angle condition for given sweepRadians
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
- * return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance from the options.
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, chord, and minimum stroke.
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
- /** return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */
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
- /** return stroke count which is the larger of existing count or count needed for circular arc chord tol with given arc length and radians
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
- /** return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */
93
+ /** Return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */
88
94
  applyMinStrokesPerPrimitive(minCount: number): number;
89
- /** create `StrokeOptions` with defaults appropriate for curves.
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
- /** create `StrokeOptions` with defaults appropriate for surfaces facets
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;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,aAAa;IAExB,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,EAAE,OAAO,CAAC;IAClC,qCAAqC;IAC9B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACvC,qDAAqD;IAC9C,iB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iG;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
- /** tolerance blob for various stroking methods.
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
- /** whether or not to triangulate each added facet */
35
+ /** Whether or not to triangulate each added facet */
35
36
  this.shouldTriangulate = false;
36
- /** default number of strokes for a circle. */
37
+ /** Default number of strokes for a circle. */
37
38
  this.defaultCircleStrokes = 16;
38
39
  }
39
40
  /** Whether params are requested. */
40
- get needParams() { return this._needParams !== undefined ? this._needParams : false; }
41
- set needParams(value) { this._needParams = value; }
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() { return this._needNormals !== undefined ? this._needNormals : false; }
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() { return this._needTwoSided !== undefined ? this._needTwoSided : false; }
53
+ get needTwoSided() {
54
+ return this._needTwoSided !== undefined ? this._needTwoSided : false;
55
+ }
47
56
  set needTwoSided(value) { this._needTwoSided = value; }
48
- /** ask if angleTol is specified */
49
- get hasAngleTol() { return this.angleTol !== undefined && Math.abs(this.angleTol.radians) > 0.0; }
50
- /** ask if chordTol is specified */
51
- get hasChordTol() { return this.chordTol !== undefined && this.chordTol > 0.0; }
52
- /** ask if maxEdgeLength is specified */
53
- get hasMaxEdgeLength() { return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0; }
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
- /** return stroke count which is the larger of the minCount or count needed for edge length condition. */
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
- * return stroke count which is the larger of the existing count or count needed for angle condition for given sweepRadians
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
- * return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance from the options.
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, chord, and minimum stroke.
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
- /** return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */
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
- /** return stroke count which is the larger of existing count or count needed for circular arc chord tol with given arc length and radians
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
- /** return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */
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
- /** create `StrokeOptions` with defaults appropriate for curves.
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
- /** create `StrokeOptions` with defaults appropriate for surfaces facets
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":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,mEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,aAAa;IAA1B;QAYE,qDAAqD;QAC9C,sBAAiB,GAAY,KAAK,CAAC;QAe1C,8CAA8C;QACvC,yBAAoB,GAAG,EAAE,CAAC;IA+HnC,CAAC;IA3IC,oCAAoC;IACpC,IAAW,UAAU,KAAc,OAAO,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACtG,IAAW,UAAU,CAAC,KAAc,IAAI,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC;IACnE,oCAAoC;IACpC,IAAW,WAAW,KAAc,OAAO,IAAI,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACzG,IAAW,WAAW,CAAC,KAAc,IAAI,IAAI,CAAC,YAAY,GAAG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,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,CAAC;AAE5C,mEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,aAAa;IAA1B;QAWE,qDAAqD;QAC9C,sBAAiB,GAAY,KAAK,CAAC;QAuB1C,8CAA8C;QACvC,yBAAoB,GAAG,EAAE,CAAC;IA0InC,CAAC;IA9JC,oCAAoC;IACpC,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC;IACnE,CAAC;IACD,IAAW,UAAU,CAAC,KAAc;QAClC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC3B,CAAC;IACD,oCAAoC;IACpC,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC;IACrE,CAAC;IACD,IAAW,WAAW,CAAC,KAAc,IAAI,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC;IACrE,qCAAqC;IACrC,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,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------------------------------------\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"]}
@@ -327,8 +327,8 @@ export declare class Matrix3d implements BeJSONFunctions {
327
327
  static createPerpendicularVectorFavorPlaneContainingZ(vectorA: Vector3d, result?: Vector3d): Vector3d;
328
328
  /**
329
329
  * Create a matrix from column vectors, shuffled into place per axisOrder
330
- * For example, if axisOrder = XYZ then it returns [vectorU, vectorV, vectorW]
331
- * Another example, if axisOrder = YZX then it returns [vectorW, vectorU, vectorV] because
330
+ * * For example, if axisOrder = XYZ then it returns [vectorU, vectorV, vectorW]
331
+ * * Another example, if axisOrder = YZX then it returns [vectorW, vectorU, vectorV] because
332
332
  * Y is at index 0 so vectorU goes to the column Y (column 2), Z is at index 1 so vectorV goes
333
333
  * to the column Z (column 3), and X is at index 2 so vectorW goes to the column X (column 1)
334
334
  */
@@ -613,8 +613,8 @@ class Matrix3d {
613
613
  }
614
614
  /**
615
615
  * Create a matrix from column vectors, shuffled into place per axisOrder
616
- * For example, if axisOrder = XYZ then it returns [vectorU, vectorV, vectorW]
617
- * Another example, if axisOrder = YZX then it returns [vectorW, vectorU, vectorV] because
616
+ * * For example, if axisOrder = XYZ then it returns [vectorU, vectorV, vectorW]
617
+ * * Another example, if axisOrder = YZX then it returns [vectorW, vectorU, vectorV] because
618
618
  * Y is at index 0 so vectorU goes to the column Y (column 2), Z is at index 1 so vectorV goes
619
619
  * to the column Z (column 3), and X is at index 2 so vectorW goes to the column X (column 1)
620
620
  */