@itwin/core-geometry 4.5.0-dev.8 → 4.6.0-dev.0

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 (89) hide show
  1. package/CHANGELOG.md +62 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/Geometry.d.ts +15 -0
  4. package/lib/cjs/Geometry.d.ts.map +1 -1
  5. package/lib/cjs/Geometry.js +27 -0
  6. package/lib/cjs/Geometry.js.map +1 -1
  7. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +1 -1
  8. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  9. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js +1 -1
  10. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  11. package/lib/cjs/geometry3d/FrameBuilder.d.ts.map +1 -1
  12. package/lib/cjs/geometry3d/FrameBuilder.js +3 -0
  13. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  14. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +8 -2
  15. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  16. package/lib/cjs/geometry3d/GrowableXYZArray.js +11 -2
  17. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  18. package/lib/cjs/geometry3d/XYZProps.d.ts +16 -8
  19. package/lib/cjs/geometry3d/XYZProps.d.ts.map +1 -1
  20. package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
  21. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +42 -50
  22. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  23. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +81 -105
  24. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  25. package/lib/cjs/polyface/Polyface.d.ts +19 -10
  26. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  27. package/lib/cjs/polyface/Polyface.js +17 -10
  28. package/lib/cjs/polyface/Polyface.js.map +1 -1
  29. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +18 -10
  30. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  31. package/lib/cjs/polyface/PolyfaceBuilder.js +27 -21
  32. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  33. package/lib/cjs/polyface/PolyfaceData.d.ts +137 -86
  34. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  35. package/lib/cjs/polyface/PolyfaceData.js +300 -166
  36. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  37. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  38. package/lib/cjs/topology/Graph.d.ts +2 -8
  39. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  40. package/lib/cjs/topology/Graph.js +0 -3
  41. package/lib/cjs/topology/Graph.js.map +1 -1
  42. package/lib/cjs/topology/Triangulation.d.ts +18 -7
  43. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  44. package/lib/cjs/topology/Triangulation.js +50 -9
  45. package/lib/cjs/topology/Triangulation.js.map +1 -1
  46. package/lib/esm/Geometry.d.ts +15 -0
  47. package/lib/esm/Geometry.d.ts.map +1 -1
  48. package/lib/esm/Geometry.js +27 -0
  49. package/lib/esm/Geometry.js.map +1 -1
  50. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +1 -1
  51. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  52. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js +1 -1
  53. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  54. package/lib/esm/geometry3d/FrameBuilder.d.ts.map +1 -1
  55. package/lib/esm/geometry3d/FrameBuilder.js +3 -0
  56. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  57. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +8 -2
  58. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  59. package/lib/esm/geometry3d/GrowableXYZArray.js +11 -2
  60. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  61. package/lib/esm/geometry3d/XYZProps.d.ts +16 -8
  62. package/lib/esm/geometry3d/XYZProps.d.ts.map +1 -1
  63. package/lib/esm/geometry3d/XYZProps.js.map +1 -1
  64. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +42 -50
  65. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  66. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +80 -103
  67. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  68. package/lib/esm/polyface/Polyface.d.ts +19 -10
  69. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  70. package/lib/esm/polyface/Polyface.js +17 -10
  71. package/lib/esm/polyface/Polyface.js.map +1 -1
  72. package/lib/esm/polyface/PolyfaceBuilder.d.ts +18 -10
  73. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  74. package/lib/esm/polyface/PolyfaceBuilder.js +27 -21
  75. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  76. package/lib/esm/polyface/PolyfaceData.d.ts +137 -86
  77. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  78. package/lib/esm/polyface/PolyfaceData.js +300 -166
  79. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  80. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  81. package/lib/esm/topology/Graph.d.ts +2 -8
  82. package/lib/esm/topology/Graph.d.ts.map +1 -1
  83. package/lib/esm/topology/Graph.js +0 -3
  84. package/lib/esm/topology/Graph.js.map +1 -1
  85. package/lib/esm/topology/Triangulation.d.ts +18 -7
  86. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  87. package/lib/esm/topology/Triangulation.js +50 -9
  88. package/lib/esm/topology/Triangulation.js.map +1 -1
  89. package/package.json +6 -4
@@ -73,11 +73,25 @@ export declare namespace XYAndZ {
73
73
  * @public
74
74
  */
75
75
  export type LowAndHighXY = Readonly<WritableLowAndHighXY>;
76
+ /** JSON representation of [[LowAndHighXY]].
77
+ * @public
78
+ */
79
+ export interface LowAndHighXYProps {
80
+ low: XYProps;
81
+ high: XYProps;
82
+ }
76
83
  /**
77
84
  * Interface for type with readable `low` and `high` members which have `x`, `y`, and `z` number members.
78
85
  * @public
79
86
  */
80
87
  export type LowAndHighXYZ = Readonly<WritableLowAndHighXYZ>;
88
+ /** JSON representation of [[LowAndHighXYZ]].
89
+ * @public
90
+ */
91
+ export interface LowAndHighXYZProps {
92
+ low: XYZProps;
93
+ high: XYZProps;
94
+ }
81
95
  /**
82
96
  * Interface for variant json (one of)
83
97
  * * (individually optional) `x`, `y`, `z`
@@ -124,20 +138,14 @@ export type TransformProps = number[][] | number[] | {
124
138
  * * array of `XYZProps`
125
139
  * @public
126
140
  */
127
- export type Range3dProps = {
128
- low: XYZProps;
129
- high: XYZProps;
130
- } | XYZProps[];
141
+ export type Range3dProps = LowAndHighXYZProps | XYZProps[];
131
142
  /**
132
143
  * Interface for variant json representing a Range2d
133
144
  * * pair of `XYProps` named `low` and `high`
134
145
  * * array of `XYProps`
135
146
  * @public
136
147
  */
137
- export type Range2dProps = {
138
- low: XYProps;
139
- high: XYProps;
140
- } | XYProps[];
148
+ export type Range2dProps = LowAndHighXYProps | XYProps[];
141
149
  /**
142
150
  * Interface for variant json representing a Range1d
143
151
  * * pair of `number` named `low` and `high`
@@ -1 +1 @@
1
- {"version":3,"file":"XYZProps.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/XYZProps.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,mBAAmB;IACnB,CAAC,EAAE,MAAM,CAAC;CACX;AACD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,mBAAmB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AAG,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC;AAClD;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG;IACnD,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,aAAa,CAAC;CACvB,CAAC;AACF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG,QAAQ,EAAE,CAAC;AAC3D;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,OAAO,EAAE,CAAC;AACzD;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,MAAM,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"XYZProps.js","sourceRoot":"","sources":["../../../src/geometry3d/XYZProps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AA8DvC,cAAc;AACd,MAAM,KAAW,MAAM,CAatB;AAbD,WAAiB,MAAM;IACrB;;;;;;OAMG;IACH,SAAgB,WAAW,CAAC,CAAS,EAAE,CAAS,EAAE,GAAY;QAC5D,OAAO,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eAC1C,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eACxC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;IAJe,kBAAW,cAI1B,CAAA;AACH,CAAC,EAbgB,MAAM,KAAN,MAAM,QAatB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { Geometry } from \"../Geometry\";\n\n/**\n * Interface for class with `x` and `y` as number properties.\n * @public\n */\nexport interface WritableXAndY {\n /** x coordinate */\n x: number;\n /** y coordinate */\n y: number;\n}\n/**\n * Interface for class with `z` as number property.\n * @public\n */\nexport interface WriteableHasZ {\n /** z coordinate */\n z: number;\n}\n/**\n * Interface for class with `x`, `y`, `z` as number property.\n * @public\n */\nexport interface WritableXYAndZ extends WritableXAndY, WriteableHasZ {\n}\n/**\n * Interface for class with named properties `low` and `high`, both being `WriteableXAndY`\n * @public\n */\nexport interface WritableLowAndHighXY {\n /** Low x,y coordinates */\n low: WritableXAndY;\n /** High x,y,z coordinates */\n high: WritableXAndY;\n}\n/**\n * Interface for class with named properties `low` and `high`, both being `WriteableXYAndZ`\n * @public\n */\nexport interface WritableLowAndHighXYZ {\n /** Low x,y,z coordinates */\n low: WritableXYAndZ;\n /** High x,y,z coordinates */\n high: WritableXYAndZ;\n}\n/**\n * Interface for readable `z` number members.\n * @public\n */\nexport type HasZ = Readonly<WriteableHasZ>;\n/**\n * Interface for readable `x` and `y` number members.\n * @public\n */\nexport type XAndY = Readonly<WritableXAndY>;\n/**\n * Interface for type with readable `x`, `y`, `z` number members.\n * @public\n */\nexport type XYAndZ = Readonly<WritableXYAndZ>;\n\n/** @public */\nexport namespace XYAndZ { // eslint-disable-line @typescript-eslint/no-redeclare\n /**\n * Return true if two XYAndZs have equal x,y,z parts within a specified tolerance.\n * @param a The first XYAndZ to compare\n * @param b The second XYAndZ to compare\n * @param The tolerance for comparison. If undefined, [[Geometry.smallMetricDistance]] is used.\n * @returns true if the difference in each coordinate of `a` and `b` is smaller than `tol`.\n */\n export function almostEqual(a: XYAndZ, b: XYAndZ, tol?: number): boolean {\n return Geometry.isSameCoordinate(a.x, b.x, tol)\n && Geometry.isSameCoordinate(a.y, b.y, tol)\n && Geometry.isSameCoordinate(a.z, b.z, tol);\n }\n}\n\n/**\n * Interface for type with readable `low` and `high` members which have `x` and `y` number members.\n * @public\n */\nexport type LowAndHighXY = Readonly<WritableLowAndHighXY>;\n/**\n * Interface for type with readable `low` and `high` members which have `x`, `y`, and `z` number members.\n * @public\n */\nexport type LowAndHighXYZ = Readonly<WritableLowAndHighXYZ>;\n/**\n * Interface for variant json (one of)\n * * (individually optional) `x`, `y`, `z`\n * * number array\n * @public\n */\nexport type XYZProps = {\n x?: number;\n y?: number;\n z?: number;\n} | number[];\n/**\n * Interface for variant json (one of)\n * * (individually optional) `x`, `y`\n * * number array\n * @public\n */\nexport type XYProps = {\n x?: number;\n y?: number;\n} | number[];\n/**\n * Interface for variant json (one of)\n * * array of number arrays, with one matrix row in each array\n * * flat array of numbers, in row-mor order\n * * `Matrix3d` object\n * @public\n */\nexport type Matrix3dProps = number[][] | number[];\n/**\n * Interface for variant json (one of)\n * * array of number arrays, with each low level array containing 4 numbers of a transform row (qx, qy, qz, ax)\n * * flat array of 12 numbers, in row-major order for the 3 rows of 4 values\n * * `Transform` object\n * @public\n */\nexport type TransformProps = number[][] | number[] | {\n origin: XYZProps;\n matrix: Matrix3dProps;\n};\n/**\n * Interface for variant json representing a Range3d\n * * pair of `XYZProps` named `low` and `high`\n * * array of `XYZProps`\n * @public\n */\nexport type Range3dProps = {\n low: XYZProps;\n high: XYZProps;\n} | XYZProps[];\n/**\n * Interface for variant json representing a Range2d\n * * pair of `XYProps` named `low` and `high`\n * * array of `XYProps`\n * @public\n */\nexport type Range2dProps = {\n low: XYProps;\n high: XYProps;\n} | XYProps[];\n/**\n * Interface for variant json representing a Range1d\n * * pair of `number` named `low` and `high`\n * * array of `number`\n * @public\n */\nexport type Range1dProps = {\n low: number;\n high: number;\n} | number[];\n"]}
1
+ {"version":3,"file":"XYZProps.js","sourceRoot":"","sources":["../../../src/geometry3d/XYZProps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AA8DvC,cAAc;AACd,MAAM,KAAW,MAAM,CAatB;AAbD,WAAiB,MAAM;IACrB;;;;;;OAMG;IACH,SAAgB,WAAW,CAAC,CAAS,EAAE,CAAS,EAAE,GAAY;QAC5D,OAAO,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eAC1C,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eACxC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;IAJe,kBAAW,cAI1B,CAAA;AACH,CAAC,EAbgB,MAAM,KAAN,MAAM,QAatB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { Geometry } from \"../Geometry\";\n\n/**\n * Interface for class with `x` and `y` as number properties.\n * @public\n */\nexport interface WritableXAndY {\n /** x coordinate */\n x: number;\n /** y coordinate */\n y: number;\n}\n/**\n * Interface for class with `z` as number property.\n * @public\n */\nexport interface WriteableHasZ {\n /** z coordinate */\n z: number;\n}\n/**\n * Interface for class with `x`, `y`, `z` as number property.\n * @public\n */\nexport interface WritableXYAndZ extends WritableXAndY, WriteableHasZ {\n}\n/**\n * Interface for class with named properties `low` and `high`, both being `WriteableXAndY`\n * @public\n */\nexport interface WritableLowAndHighXY {\n /** Low x,y coordinates */\n low: WritableXAndY;\n /** High x,y,z coordinates */\n high: WritableXAndY;\n}\n/**\n * Interface for class with named properties `low` and `high`, both being `WriteableXYAndZ`\n * @public\n */\nexport interface WritableLowAndHighXYZ {\n /** Low x,y,z coordinates */\n low: WritableXYAndZ;\n /** High x,y,z coordinates */\n high: WritableXYAndZ;\n}\n/**\n * Interface for readable `z` number members.\n * @public\n */\nexport type HasZ = Readonly<WriteableHasZ>;\n/**\n * Interface for readable `x` and `y` number members.\n * @public\n */\nexport type XAndY = Readonly<WritableXAndY>;\n/**\n * Interface for type with readable `x`, `y`, `z` number members.\n * @public\n */\nexport type XYAndZ = Readonly<WritableXYAndZ>;\n\n/** @public */\nexport namespace XYAndZ { // eslint-disable-line @typescript-eslint/no-redeclare\n /**\n * Return true if two XYAndZs have equal x,y,z parts within a specified tolerance.\n * @param a The first XYAndZ to compare\n * @param b The second XYAndZ to compare\n * @param The tolerance for comparison. If undefined, [[Geometry.smallMetricDistance]] is used.\n * @returns true if the difference in each coordinate of `a` and `b` is smaller than `tol`.\n */\n export function almostEqual(a: XYAndZ, b: XYAndZ, tol?: number): boolean {\n return Geometry.isSameCoordinate(a.x, b.x, tol)\n && Geometry.isSameCoordinate(a.y, b.y, tol)\n && Geometry.isSameCoordinate(a.z, b.z, tol);\n }\n}\n\n/**\n * Interface for type with readable `low` and `high` members which have `x` and `y` number members.\n * @public\n */\nexport type LowAndHighXY = Readonly<WritableLowAndHighXY>;\n\n/** JSON representation of [[LowAndHighXY]].\n * @public\n */\nexport interface LowAndHighXYProps { low: XYProps, high: XYProps }\n\n/**\n * Interface for type with readable `low` and `high` members which have `x`, `y`, and `z` number members.\n * @public\n */\nexport type LowAndHighXYZ = Readonly<WritableLowAndHighXYZ>;\n\n/** JSON representation of [[LowAndHighXYZ]].\n * @public\n */\nexport interface LowAndHighXYZProps { low: XYZProps, high: XYZProps }\n\n/**\n * Interface for variant json (one of)\n * * (individually optional) `x`, `y`, `z`\n * * number array\n * @public\n */\nexport type XYZProps = {\n x?: number;\n y?: number;\n z?: number;\n} | number[];\n/**\n * Interface for variant json (one of)\n * * (individually optional) `x`, `y`\n * * number array\n * @public\n */\nexport type XYProps = {\n x?: number;\n y?: number;\n} | number[];\n/**\n * Interface for variant json (one of)\n * * array of number arrays, with one matrix row in each array\n * * flat array of numbers, in row-mor order\n * * `Matrix3d` object\n * @public\n */\nexport type Matrix3dProps = number[][] | number[];\n/**\n * Interface for variant json (one of)\n * * array of number arrays, with each low level array containing 4 numbers of a transform row (qx, qy, qz, ax)\n * * flat array of 12 numbers, in row-major order for the 3 rows of 4 values\n * * `Transform` object\n * @public\n */\nexport type TransformProps = number[][] | number[] | {\n origin: XYZProps;\n matrix: Matrix3dProps;\n};\n/**\n * Interface for variant json representing a Range3d\n * * pair of `XYZProps` named `low` and `high`\n * * array of `XYZProps`\n * @public\n */\nexport type Range3dProps = LowAndHighXYZProps | XYZProps[];\n/**\n * Interface for variant json representing a Range2d\n * * pair of `XYProps` named `low` and `high`\n * * array of `XYProps`\n * @public\n */\nexport type Range2dProps = LowAndHighXYProps | XYProps[];\n/**\n * Interface for variant json representing a Range1d\n * * pair of `number` named `low` and `high`\n * * array of `number`\n * @public\n */\nexport type Range1dProps = {\n low: number;\n high: number;\n} | number[];\n"]}
@@ -3,7 +3,7 @@ import { IndexedPolyface, Polyface, PolyfaceVisitor } from "./Polyface";
3
3
  import { PolyfaceData } from "./PolyfaceData";
4
4
  /**
5
5
  * An `IndexedPolyfaceVisitor` is an iterator-like object that "visits" facets of a mesh.
6
- * * The visitor extends a `PolyfaceData ` class, so it can at any time hold all the data of a single facet.
6
+ * * The visitor extends `PolyfaceData`, so it can at any time hold all the data of a single facet.
7
7
  * @public
8
8
  */
9
9
  export declare class IndexedPolyfaceVisitor extends PolyfaceData implements PolyfaceVisitor {
@@ -12,95 +12,87 @@ export declare class IndexedPolyfaceVisitor extends PolyfaceData implements Poly
12
12
  private _numWrap;
13
13
  private _numEdges;
14
14
  private _polyface;
15
- protected constructor(facets: IndexedPolyface, numWrap: number);
15
+ protected constructor(polyface: IndexedPolyface, numWrap: number);
16
16
  /** Return the client polyface object. */
17
17
  clientPolyface(): Polyface;
18
- /** Set the number of vertices duplicated (e.g. 1 for start and end) in arrays in the visitor. */
18
+ /**
19
+ * Set the number of vertices replicated in visitor arrays (both data and index arrays).
20
+ * * 0,1,2 are the most common as numWrap.
21
+ * * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second
22
+ * edge is `7,8`. Third edge is `8,6`. To access `6` for the third edge, we have to go back to the start of array.
23
+ * Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.
24
+ * * `numWrap = 2` is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
25
+ */
19
26
  setNumWrap(numWrap: number): void;
20
- /** Return the number of edges in the current facet.
21
- * * Note that if this visitor has `numWrap` greater than zero, the number of edges is smaller than the number of points.
27
+ /**
28
+ * Return the number of edges in the current facet.
29
+ * * If `numWrap > 0` for this visitor, the number of edges is smaller than the number of points.
22
30
  */
23
31
  get numEdgesThisFacet(): number;
24
- /** Create a visitor for iterating the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays
25
- * Typical wrap counts are:
26
- * * 0 -- leave the point arrays with "missing final edge"
27
- * * 1 -- add point 0 as closure point
28
- * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
29
- */
32
+ /** Create a visitor for iterating the facets of `polyface`. */
30
33
  static create(polyface: IndexedPolyface, numWrap: number): IndexedPolyfaceVisitor;
31
- /** Advance the iterator to a particular facet in the client polyface */
34
+ /** Advance the iterator to a particular facet in the client polyface. */
32
35
  moveToReadIndex(facetIndex: number): boolean;
33
- /** Advance the iterator to a the 'next' facet in the client polyface */
36
+ /** Advance the iterator to a the 'next' facet in the client polyface. */
34
37
  moveToNextFacet(): boolean;
35
38
  /** Reset the iterator to start at the first facet of the polyface. */
36
39
  reset(): void;
37
40
  /**
38
- * Attempts to extract the distance parameter for the given vertex index on the current facet
39
- * Returns the distance parameter as a point. Returns undefined on failure.
41
+ * Attempts to extract the distance parameter for the given vertex `index` on the current facet.
42
+ * Returns the distance parameter as a point. Returns `undefined` on failure.
40
43
  */
41
44
  tryGetDistanceParameter(index: number, result?: Point2d): Point2d | undefined;
42
45
  /**
43
- * Attempts to extract the normalized parameter (0,1) for the given vertex index on the current facet.
44
- * Returns the normalized parameter as a point. Returns undefined on failure.
46
+ * Attempts to extract the normalized parameter (0,1) for the given vertex `index` on the current facet.
47
+ * Returns the normalized parameter as a point. Returns `undefined` on failure.
45
48
  */
46
49
  tryGetNormalizedParameter(index: number, result?: Point2d): Point2d | undefined;
47
- /** Return the index (in the client polyface) of the current facet */
50
+ /** Return the index (in the client polyface) of the current facet. */
48
51
  currentReadIndex(): number;
49
- /** Return the point index of vertex i within the currently loaded facet */
52
+ /** Return the point index of vertex `i` within the currently loaded facet. */
50
53
  clientPointIndex(i: number): number;
51
- /** Return the param index of vertex i within the currently loaded facet */
54
+ /** Return the param index of vertex `i` within the currently loaded facet. */
52
55
  clientParamIndex(i: number): number;
53
- /** Return the normal index of vertex i within the currently loaded facet */
56
+ /** Return the normal index of vertex `i` within the currently loaded facet. */
54
57
  clientNormalIndex(i: number): number;
55
- /** Return the color index of vertex i within the currently loaded facet */
58
+ /** Return the color index of vertex `i` within the currently loaded facet. */
56
59
  clientColorIndex(i: number): number;
57
- /** Return the aux data index of vertex i within the currently loaded facet */
60
+ /** Return the aux data index of vertex `i` within the currently loaded facet. */
58
61
  clientAuxIndex(i: number): number;
59
- /** clear the contents of all arrays. Use this along with transferDataFrom methods to build up new facets */
62
+ /** Clear the contents of all arrays. */
60
63
  clearArrays(): void;
61
- /** transfer data from a specified index of the other visitor as new data in this visitor. */
64
+ /** Transfer data from a specified `index` of the `other` visitor as new data in this visitor. */
62
65
  pushDataFrom(other: PolyfaceVisitor, index: number): void;
63
- /** transfer interpolated data from the other visitor.
64
- * * all data values are interpolated at `fraction` between `other` values at index0 and index1.
66
+ /**
67
+ * Transfer interpolated data from the other visitor.
68
+ * * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.
65
69
  */
66
70
  pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void;
67
71
  }
68
72
  /**
69
- * Interpolate each byte of color0 and color1 as integers.
70
- * @param color0 32 bit color (e.g. rgb+transparency)
71
- * @param fraction fractional position. This is clamped to 0..1 to prevent byte values outside their 0..255 range.
72
- * @param color1
73
- * @param shiftBits
74
- * @internal
75
- */
76
- export declare function interpolateColor(color0: number, fraction: number, color1: number): number;
77
- /**
78
- * An `IndexedPolyfaceSubsetVisitor` is an IndexedPolyfaceVisitor which only visits a subset of facets in the polyface.
73
+ * An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface.
79
74
  * * The subset is defined by an array of facet indices provided when this visitor is created.
80
- * * Within the subset visitor, "facetIndex" is understood as index within the subset array:
81
- * * moveToNextFacet moves only within the subset
82
- * * moveToReadIndex(i) moves underlying visitor's parentFacetIndex(i)
75
+ * * Within the subset visitor, `facetIndex` is understood as index within the subset array:
76
+ * * `moveToNextFacet` moves only within the subset.
77
+ * * `moveToReadIndex(i)` moves underlying visitor's `parentFacetIndex(i)`.
83
78
  * @public
84
79
  */
85
80
  export declare class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
86
81
  private _parentFacetIndices;
87
82
  private _nextActiveIndex;
88
83
  private constructor();
89
- /** Create a visitor for iterating a subset of the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays
90
- * * Typical wrap counts are:
91
- * * 0 -- leave the point arrays with "missing final edge"
92
- * * 1 -- add point 0 as closure point
93
- * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
94
- * * The activeFacetIndices array indicates all facets to be visited.
84
+ /**
85
+ * Create a visitor for iterating a subset of the facets of `polyface`.
86
+ * * The `activeFacetIndices` array indicates all facets to be visited.
95
87
  */
96
88
  static createSubsetVisitor(polyface: IndexedPolyface, activeFacetIndices: number[], numWrap: number): IndexedPolyfaceSubsetVisitor;
97
- /** Advance the iterator to a particular facet in the client polyface */
89
+ /** Advance the iterator to a particular facet in the client polyface. */
98
90
  moveToReadIndex(activeIndex: number): boolean;
99
- /** Advance the iterator to a the 'next' facet in the client polyface */
91
+ /** Advance the iterator to the next facet in the client polyface. */
100
92
  moveToNextFacet(): boolean;
101
- /** Reset the iterator to start at the first facet of the polyface. */
93
+ /** Reset the iterator to start at the first active facet in the polyface. */
102
94
  reset(): void;
103
- /** return the parent facet index of the indicated index within the active facets */
95
+ /** Return the parent facet index of the indicated index within the active facets. */
104
96
  parentFacetIndex(activeIndex: number): number | undefined;
105
97
  }
106
98
  //# sourceMappingURL=IndexedPolyfaceVisitor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IndexedPolyfaceVisitor.d.ts","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceVisitor.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,YAAa,YAAW,eAAe;IACjF,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAkB;IAEnC,SAAS,aAAa,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM;IAa9D,yCAAyC;IAClC,cAAc,IAAI,QAAQ;IACjC,iGAAiG;IAC1F,UAAU,CAAC,OAAO,EAAE,MAAM;IAEjC;;OAEG;IACH,IAAW,iBAAiB,IAAI,MAAM,CAA2B;IACjE;;;;;OAKG;WACW,MAAM,CAAC,QAAQ,EAAE,eAAe,EAAE,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B;IAG/B,yEAAyE;IACzD,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAO7D,qEAAqE;IACrD,eAAe,IAAI,OAAO;IAU1C,6EAA6E;IAC7D,KAAK,IAAI,IAAI;IAG7B,qFAAqF;IAC9E,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAMjE"}
@@ -10,51 +10,60 @@ import { PolyfaceData } from "./PolyfaceData";
10
10
  /* eslint-disable @itwin/prefer-get */
11
11
  /**
12
12
  * An `IndexedPolyfaceVisitor` is an iterator-like object that "visits" facets of a mesh.
13
- * * The visitor extends a `PolyfaceData ` class, so it can at any time hold all the data of a single facet.
13
+ * * The visitor extends `PolyfaceData`, so it can at any time hold all the data of a single facet.
14
14
  * @public
15
15
  */
16
16
  export class IndexedPolyfaceVisitor extends PolyfaceData {
17
- // to be called from static factory method that validates the polyface ...
18
- constructor(facets, numWrap) {
19
- super(facets.data.normalCount > 0, facets.data.paramCount > 0, facets.data.colorCount > 0, facets.twoSided);
20
- this._polyface = facets;
17
+ // to be called from static factory method that validates the polyface
18
+ constructor(polyface, numWrap) {
19
+ super(polyface.data.normalCount > 0, polyface.data.paramCount > 0, polyface.data.colorCount > 0, polyface.twoSided);
20
+ this._polyface = polyface;
21
21
  this._numWrap = numWrap;
22
- if (facets.data.auxData)
23
- this.auxData = facets.data.auxData.createForVisitor();
22
+ if (polyface.data.auxData)
23
+ this.auxData = polyface.data.auxData.createForVisitor();
24
24
  this.reset();
25
25
  this._numEdges = 0;
26
26
  this._nextFacetIndex = 0;
27
27
  this._currentFacetIndex = -1;
28
28
  }
29
29
  /** Return the client polyface object. */
30
- clientPolyface() { return this._polyface; }
31
- /** Set the number of vertices duplicated (e.g. 1 for start and end) in arrays in the visitor. */
32
- setNumWrap(numWrap) { this._numWrap = numWrap; }
33
- /** Return the number of edges in the current facet.
34
- * * Note that if this visitor has `numWrap` greater than zero, the number of edges is smaller than the number of points.
30
+ clientPolyface() {
31
+ return this._polyface;
32
+ }
33
+ /**
34
+ * Set the number of vertices replicated in visitor arrays (both data and index arrays).
35
+ * * 0,1,2 are the most common as numWrap.
36
+ * * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second
37
+ * edge is `7,8`. Third edge is `8,6`. To access `6` for the third edge, we have to go back to the start of array.
38
+ * Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.
39
+ * * `numWrap = 2` is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
35
40
  */
36
- get numEdgesThisFacet() { return this._numEdges; }
37
- /** Create a visitor for iterating the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays
38
- * Typical wrap counts are:
39
- * * 0 -- leave the point arrays with "missing final edge"
40
- * * 1 -- add point 0 as closure point
41
- * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
41
+ setNumWrap(numWrap) {
42
+ this._numWrap = numWrap;
43
+ }
44
+ /**
45
+ * Return the number of edges in the current facet.
46
+ * * If `numWrap > 0` for this visitor, the number of edges is smaller than the number of points.
42
47
  */
48
+ get numEdgesThisFacet() {
49
+ return this._numEdges;
50
+ }
51
+ /** Create a visitor for iterating the facets of `polyface`. */
43
52
  static create(polyface, numWrap) {
44
53
  return new IndexedPolyfaceVisitor(polyface, numWrap);
45
54
  }
46
- /** Advance the iterator to a particular facet in the client polyface */
55
+ /** Advance the iterator to a particular facet in the client polyface. */
47
56
  moveToReadIndex(facetIndex) {
48
57
  if (!this._polyface.isValidFacetIndex(facetIndex))
49
58
  return false;
50
59
  this._currentFacetIndex = facetIndex;
51
60
  this._nextFacetIndex = facetIndex + 1;
52
61
  this._numEdges = this._polyface.numEdgeInFacet(facetIndex);
53
- this.resizeAllDataArrays(this._numEdges + this._numWrap);
62
+ this.resizeAllArrays(this._numEdges + this._numWrap);
54
63
  this.gatherIndexedData(this._polyface.data, this._polyface.facetIndex0(this._currentFacetIndex), this._polyface.facetIndex1(this._currentFacetIndex), this._numWrap);
55
64
  return true;
56
65
  }
57
- /** Advance the iterator to a the 'next' facet in the client polyface */
66
+ /** Advance the iterator to a the 'next' facet in the client polyface. */
58
67
  moveToNextFacet() {
59
68
  if (this._nextFacetIndex !== this._currentFacetIndex)
60
69
  return this.moveToReadIndex(this._nextFacetIndex);
@@ -67,11 +76,11 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
67
76
  this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.
68
77
  }
69
78
  /**
70
- * Attempts to extract the distance parameter for the given vertex index on the current facet
71
- * Returns the distance parameter as a point. Returns undefined on failure.
79
+ * Attempts to extract the distance parameter for the given vertex `index` on the current facet.
80
+ * Returns the distance parameter as a point. Returns `undefined` on failure.
72
81
  */
73
82
  tryGetDistanceParameter(index, result) {
74
- if (index >= this.numEdgesThisFacet)
83
+ if (index < 0 || index >= this.numEdgesThisFacet)
75
84
  return undefined;
76
85
  if (this.param === undefined || this._polyface.data.face.length === 0)
77
86
  return undefined;
@@ -81,11 +90,11 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
81
90
  return faceData.convertParamXYToDistance(this.param.getXAtUncheckedPointIndex(index), this.param.getYAtUncheckedPointIndex(index), result);
82
91
  }
83
92
  /**
84
- * Attempts to extract the normalized parameter (0,1) for the given vertex index on the current facet.
85
- * Returns the normalized parameter as a point. Returns undefined on failure.
93
+ * Attempts to extract the normalized parameter (0,1) for the given vertex `index` on the current facet.
94
+ * Returns the normalized parameter as a point. Returns `undefined` on failure.
86
95
  */
87
96
  tryGetNormalizedParameter(index, result) {
88
- if (index >= this.numEdgesThisFacet)
97
+ if (index < 0 || index >= this.numEdgesThisFacet)
89
98
  return undefined;
90
99
  if (this.param === undefined || this._polyface.data.face.length === 0)
91
100
  return undefined;
@@ -94,19 +103,31 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
94
103
  return undefined;
95
104
  return faceData.convertParamXYToNormalized(this.param.getXAtUncheckedPointIndex(index), this.param.getYAtUncheckedPointIndex(index), result);
96
105
  }
97
- /** Return the index (in the client polyface) of the current facet */
98
- currentReadIndex() { return this._currentFacetIndex; }
99
- /** Return the point index of vertex i within the currently loaded facet */
100
- clientPointIndex(i) { return this.pointIndex[i]; }
101
- /** Return the param index of vertex i within the currently loaded facet */
102
- clientParamIndex(i) { return this.paramIndex ? this.paramIndex[i] : -1; }
103
- /** Return the normal index of vertex i within the currently loaded facet */
104
- clientNormalIndex(i) { return this.normalIndex ? this.normalIndex[i] : -1; }
105
- /** Return the color index of vertex i within the currently loaded facet */
106
- clientColorIndex(i) { return this.colorIndex ? this.colorIndex[i] : -1; }
107
- /** Return the aux data index of vertex i within the currently loaded facet */
108
- clientAuxIndex(i) { return this.auxData ? this.auxData.indices[i] : -1; }
109
- /** clear the contents of all arrays. Use this along with transferDataFrom methods to build up new facets */
106
+ /** Return the index (in the client polyface) of the current facet. */
107
+ currentReadIndex() {
108
+ return this._currentFacetIndex;
109
+ }
110
+ /** Return the point index of vertex `i` within the currently loaded facet. */
111
+ clientPointIndex(i) {
112
+ return this.pointIndex[i];
113
+ }
114
+ /** Return the param index of vertex `i` within the currently loaded facet. */
115
+ clientParamIndex(i) {
116
+ return this.paramIndex ? this.paramIndex[i] : -1;
117
+ }
118
+ /** Return the normal index of vertex `i` within the currently loaded facet. */
119
+ clientNormalIndex(i) {
120
+ return this.normalIndex ? this.normalIndex[i] : -1;
121
+ }
122
+ /** Return the color index of vertex `i` within the currently loaded facet. */
123
+ clientColorIndex(i) {
124
+ return this.colorIndex ? this.colorIndex[i] : -1;
125
+ }
126
+ /** Return the aux data index of vertex `i` within the currently loaded facet. */
127
+ clientAuxIndex(i) {
128
+ return this.auxData ? this.auxData.indices[i] : -1;
129
+ }
130
+ /** Clear the contents of all arrays. */
110
131
  clearArrays() {
111
132
  if (this.point !== undefined)
112
133
  this.point.length = 0;
@@ -117,77 +138,36 @@ export class IndexedPolyfaceVisitor extends PolyfaceData {
117
138
  if (this.color !== undefined)
118
139
  this.color.length = 0;
119
140
  }
120
- /** transfer data from a specified index of the other visitor as new data in this visitor. */
141
+ /** Transfer data from a specified `index` of the `other` visitor as new data in this visitor. */
121
142
  pushDataFrom(other, index) {
122
143
  this.point.pushFromGrowableXYZArray(other.point, index);
123
- if (this.color && other.color && index < other.color.length)
124
- this.color.push(other.color[index]);
125
144
  if (this.param && other.param && index < other.param.length)
126
145
  this.param.pushFromGrowableXYArray(other.param, index);
127
146
  if (this.normal && other.normal && index < other.normal.length)
128
147
  this.normal.pushFromGrowableXYZArray(other.normal, index);
148
+ if (this.color && other.color && index < other.color.length)
149
+ this.color.push(other.color[index]);
129
150
  }
130
- /** transfer interpolated data from the other visitor.
131
- * * all data values are interpolated at `fraction` between `other` values at index0 and index1.
151
+ /**
152
+ * Transfer interpolated data from the other visitor.
153
+ * * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.
132
154
  */
133
155
  pushInterpolatedDataFrom(other, index0, fraction, index1) {
134
156
  this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);
135
- if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)
136
- this.color.push(interpolateColor(other.color[index0], fraction, other.color[index1]));
137
157
  if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)
138
158
  this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);
139
159
  if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)
140
160
  this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);
161
+ if (this.color && other.color && index0 < other.color.length && index1 < other.color.length)
162
+ this.color.push(Geometry.interpolateColor(other.color[index0], fraction, other.color[index1]));
141
163
  }
142
164
  }
143
165
  /**
144
- * * shift to right by shiftBits.
145
- * * mask off the low 8 bits
146
- * * interpolate the number
147
- * * truncate to floor
148
- * * shift left
149
- * * Hence all numbers in and out of the floating point are 0..255.
150
- * @param color0
151
- * @param fraction
152
- * @param color1
153
- * @param shiftBits
154
- */
155
- function interpolateByte(color0, fraction, color1, shiftBits) {
156
- color0 = (color0 >>> shiftBits) & 0xFF;
157
- color1 = (color1 >>> shiftBits) & 0xFF;
158
- const color = Math.floor(color0 + fraction * (color1 - color0)) & 0xFF;
159
- return color << shiftBits;
160
- }
161
- /**
162
- * Interpolate each byte of color0 and color1 as integers.
163
- * @param color0 32 bit color (e.g. rgb+transparency)
164
- * @param fraction fractional position. This is clamped to 0..1 to prevent byte values outside their 0..255 range.
165
- * @param color1
166
- * @param shiftBits
167
- * @internal
168
- */
169
- export function interpolateColor(color0, fraction, color1) {
170
- // don't allow fractions outside the individual byte ranges.
171
- fraction = Geometry.clamp(fraction, 0, 1);
172
- // interpolate each byte in place ....
173
- /*
174
- const byte0 = interpolateLowByte(color0 & 0xFF, fraction, color1 & 0xFF);
175
- const byte1 = interpolateLowByte((color0 & 0xFF00) >>> 8, fraction, (color1 & 0xFF00) >>> 8) << 8;
176
- const byte2 = interpolateLowByte((color0 & 0xFF0000) >>> 16, fraction, (color1 & 0xFF0000) >>> 16) << 16;
177
- const byte3 = interpolateLowByte((color0 & 0xFF000000) >>> 24, fraction, (color1 & 0xFF000000) >>> 24) << 24;
178
- */
179
- const byte0 = interpolateByte(color0, fraction, color1, 0);
180
- const byte1 = interpolateByte(color0, fraction, color1, 8);
181
- const byte2 = interpolateByte(color0, fraction, color1, 16);
182
- const byte3 = interpolateByte(color0, fraction, color1, 24);
183
- return (byte0 | byte1 | byte2 | byte3);
184
- }
185
- /**
186
- * An `IndexedPolyfaceSubsetVisitor` is an IndexedPolyfaceVisitor which only visits a subset of facets in the polyface.
166
+ * An `IndexedPolyfaceSubsetVisitor` is an `IndexedPolyfaceVisitor` which only visits a subset of facets in the polyface.
187
167
  * * The subset is defined by an array of facet indices provided when this visitor is created.
188
- * * Within the subset visitor, "facetIndex" is understood as index within the subset array:
189
- * * moveToNextFacet moves only within the subset
190
- * * moveToReadIndex(i) moves underlying visitor's parentFacetIndex(i)
168
+ * * Within the subset visitor, `facetIndex` is understood as index within the subset array:
169
+ * * `moveToNextFacet` moves only within the subset.
170
+ * * `moveToReadIndex(i)` moves underlying visitor's `parentFacetIndex(i)`.
191
171
  * @public
192
172
  */
193
173
  export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
@@ -196,17 +176,14 @@ export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
196
176
  this._parentFacetIndices = activeFacetIndices.slice();
197
177
  this._nextActiveIndex = 0;
198
178
  }
199
- /** Create a visitor for iterating a subset of the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays
200
- * * Typical wrap counts are:
201
- * * 0 -- leave the point arrays with "missing final edge"
202
- * * 1 -- add point 0 as closure point
203
- * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.
204
- * * The activeFacetIndices array indicates all facets to be visited.
179
+ /**
180
+ * Create a visitor for iterating a subset of the facets of `polyface`.
181
+ * * The `activeFacetIndices` array indicates all facets to be visited.
205
182
  */
206
183
  static createSubsetVisitor(polyface, activeFacetIndices, numWrap) {
207
184
  return new IndexedPolyfaceSubsetVisitor(polyface, activeFacetIndices, numWrap);
208
185
  }
209
- /** Advance the iterator to a particular facet in the client polyface */
186
+ /** Advance the iterator to a particular facet in the client polyface. */
210
187
  moveToReadIndex(activeIndex) {
211
188
  if (activeIndex >= 0 && activeIndex <= this._parentFacetIndices.length) {
212
189
  this._nextActiveIndex = activeIndex;
@@ -214,7 +191,7 @@ export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
214
191
  }
215
192
  return false;
216
193
  }
217
- /** Advance the iterator to a the 'next' facet in the client polyface */
194
+ /** Advance the iterator to the next facet in the client polyface. */
218
195
  moveToNextFacet() {
219
196
  if (this._nextActiveIndex < this._parentFacetIndices.length) {
220
197
  const result = this.moveToReadIndex(this._nextActiveIndex);
@@ -225,11 +202,11 @@ export class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
225
202
  }
226
203
  return false;
227
204
  }
228
- /** Reset the iterator to start at the first facet of the polyface. */
205
+ /** Reset the iterator to start at the first active facet in the polyface. */
229
206
  reset() {
230
207
  this._nextActiveIndex = 0;
231
208
  }
232
- /** return the parent facet index of the indicated index within the active facets */
209
+ /** Return the parent facet index of the indicated index within the active facets. */
233
210
  parentFacetIndex(activeIndex) {
234
211
  if (activeIndex >= 0 && activeIndex <= this._nextActiveIndex) {
235
212
  return this._parentFacetIndices[activeIndex];