@itwin/core-geometry 5.0.0-dev.92 → 5.0.0-dev.94

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 (105) hide show
  1. package/lib/cjs/curve/StrokeOptions.d.ts +6 -1
  2. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  3. package/lib/cjs/curve/StrokeOptions.js +7 -2
  4. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  5. package/lib/cjs/geometry3d/Ellipsoid.d.ts +8 -7
  6. package/lib/cjs/geometry3d/Ellipsoid.d.ts.map +1 -1
  7. package/lib/cjs/geometry3d/Ellipsoid.js +17 -16
  8. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  9. package/lib/cjs/geometry3d/PointHelpers.d.ts +11 -0
  10. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  11. package/lib/cjs/geometry3d/PointHelpers.js +21 -0
  12. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  13. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +1 -1
  14. package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  15. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +5 -3
  16. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  17. package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
  18. package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
  19. package/lib/cjs/polyface/Polyface.d.ts +27 -23
  20. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  21. package/lib/cjs/polyface/Polyface.js +47 -37
  22. package/lib/cjs/polyface/Polyface.js.map +1 -1
  23. package/lib/cjs/polyface/PolyfaceData.d.ts +8 -3
  24. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  25. package/lib/cjs/polyface/PolyfaceData.js +26 -4
  26. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  27. package/lib/cjs/serialization/BGFBAccessors.d.ts +35 -9
  28. package/lib/cjs/serialization/BGFBAccessors.d.ts.map +1 -1
  29. package/lib/cjs/serialization/BGFBAccessors.js +59 -15
  30. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  31. package/lib/cjs/serialization/BGFBReader.d.ts +2 -2
  32. package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
  33. package/lib/cjs/serialization/BGFBReader.js +53 -40
  34. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  35. package/lib/cjs/serialization/BGFBWriter.d.ts +5 -1
  36. package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
  37. package/lib/cjs/serialization/BGFBWriter.js +17 -3
  38. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  39. package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js +1 -0
  40. package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  41. package/lib/cjs/serialization/IModelJsonSchema.d.ts +8 -1
  42. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  43. package/lib/cjs/serialization/IModelJsonSchema.js +20 -9
  44. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  45. package/lib/cjs/serialization/SerializationHelpers.d.ts +36 -0
  46. package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -1
  47. package/lib/cjs/serialization/SerializationHelpers.js +117 -0
  48. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
  49. package/lib/cjs/solid/Sphere.d.ts +4 -2
  50. package/lib/cjs/solid/Sphere.d.ts.map +1 -1
  51. package/lib/cjs/solid/Sphere.js +4 -2
  52. package/lib/cjs/solid/Sphere.js.map +1 -1
  53. package/lib/esm/curve/StrokeOptions.d.ts +6 -1
  54. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  55. package/lib/esm/curve/StrokeOptions.js +7 -2
  56. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  57. package/lib/esm/geometry3d/Ellipsoid.d.ts +8 -7
  58. package/lib/esm/geometry3d/Ellipsoid.d.ts.map +1 -1
  59. package/lib/esm/geometry3d/Ellipsoid.js +17 -16
  60. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  61. package/lib/esm/geometry3d/PointHelpers.d.ts +11 -0
  62. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  63. package/lib/esm/geometry3d/PointHelpers.js +21 -0
  64. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  65. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +1 -1
  66. package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
  67. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +5 -3
  68. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  69. package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
  70. package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
  71. package/lib/esm/polyface/Polyface.d.ts +27 -23
  72. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  73. package/lib/esm/polyface/Polyface.js +47 -37
  74. package/lib/esm/polyface/Polyface.js.map +1 -1
  75. package/lib/esm/polyface/PolyfaceData.d.ts +8 -3
  76. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  77. package/lib/esm/polyface/PolyfaceData.js +26 -4
  78. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  79. package/lib/esm/serialization/BGFBAccessors.d.ts +35 -9
  80. package/lib/esm/serialization/BGFBAccessors.d.ts.map +1 -1
  81. package/lib/esm/serialization/BGFBAccessors.js +59 -15
  82. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  83. package/lib/esm/serialization/BGFBReader.d.ts +2 -2
  84. package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
  85. package/lib/esm/serialization/BGFBReader.js +53 -40
  86. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  87. package/lib/esm/serialization/BGFBWriter.d.ts +5 -1
  88. package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
  89. package/lib/esm/serialization/BGFBWriter.js +17 -3
  90. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  91. package/lib/esm/serialization/BentleyGeometryFlatBuffer.js +1 -0
  92. package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
  93. package/lib/esm/serialization/IModelJsonSchema.d.ts +8 -1
  94. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  95. package/lib/esm/serialization/IModelJsonSchema.js +20 -9
  96. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  97. package/lib/esm/serialization/SerializationHelpers.d.ts +36 -0
  98. package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -1
  99. package/lib/esm/serialization/SerializationHelpers.js +117 -0
  100. package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
  101. package/lib/esm/solid/Sphere.d.ts +4 -2
  102. package/lib/esm/solid/Sphere.d.ts.map +1 -1
  103. package/lib/esm/solid/Sphere.js +4 -2
  104. package/lib/esm/solid/Sphere.js.map +1 -1
  105. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"Polyface.js","sourceRoot":"","sources":["../../../src/polyface/Polyface.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,2BAA2B;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAW,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,i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,UAAU,CAAC,MAAM,IAAI,YAAY,CAAC;QAC1E,GAAG,CAAC;YACF,IAAI,aAAa,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;gBAC9C,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACnD,CAAC,QAAQ,OAAO,CAAC,eAAe,EAAE,IAAI,OAAO,CAAC,gBAAgB,EAAE,GAAG,aAAa,EAAE;QAClF,IAAI,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAM,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC,kBAAkB,CAAC,MAAM;YACxF,QAAQ,CAAC,oCAAoC,CAAC,IAAI,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;QACjF,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9B,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChD,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE;YAC/D,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC;IACd,CAAC;IACD,kFAAkF;IAC3E,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Polyface\n */\n\n// cspell:word internaldocs\n\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { Geometry } from \"../Geometry\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { GrowableXYArray } from \"../geometry3d/GrowableXYArray\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { FacetFaceData } from \"./FacetFaceData\";\nimport { IndexedPolyfaceVisitor } from \"./IndexedPolyfaceVisitor\";\nimport { PolyfaceData } from \"./PolyfaceData\";\n\n/**\n * A Polyface is an abstract mesh structure (of unspecified implementation) that provides a PolyfaceVisitor\n * to iterate over its facets.\n * @public\n */\nexport abstract class Polyface extends GeometryQuery {\n /** String name for schema properties */\n public readonly geometryCategory = \"polyface\";\n /** Underlying polyface data. */\n public data: PolyfaceData;\n /** Constructor */\n protected constructor(data: PolyfaceData) {\n super();\n this.data = data;\n }\n /**\n * Create and return a visitor for this concrete polyface.\n * @param numWrap the number of vertices to replicate in visitor arrays.\n */\n public abstract createVisitor(numWrap: number): PolyfaceVisitor;\n /** Flag indicating if the mesh display must assume both sides are visible. */\n public get twoSided() {\n return this.data.twoSided;\n }\n public set twoSided(value: boolean) {\n this.data.twoSided = value;\n }\n /**\n * Flag indicating if the mesh closure is unknown (0), open sheet (1), closed solid (2).\n * * A boundary edge of a mesh is defined as an edge with only one connected facet.\n * * Closed solid is a mesh with no boundary edge. Open sheet is a mesh that has boundary edge(s).\n */\n public get expectedClosure(): number {\n return this.data.expectedClosure;\n }\n public set expectedClosure(value: number) {\n this.data.expectedClosure = value;\n }\n /**\n * Check validity of indices into a data array.\n * * It is valid to have both indices and data undefined.\n * * It is NOT valid for just one to be defined.\n * * Index values at indices[indexPositionA <= i < indexPositionB] must be valid indices to the data array.\n * @param indices array of indices.\n * @param indexPositionA first index to test.\n * @param indexPositionB one past final index to test.\n * @param data data array.\n * @param dataLength length of data array.\n */\n public static areIndicesValid(\n indices: number[] | undefined,\n indexPositionA: number,\n indexPositionB: number,\n data: any,\n dataLength: number,\n ): boolean {\n if (indices === undefined && data === undefined)\n return true;\n if (indices === undefined || data === undefined)\n return false;\n if (indexPositionA < 0 || indexPositionA >= indices.length)\n return false;\n if (indexPositionB <= indexPositionA || indexPositionB > indices.length)\n return false;\n for (let i = indexPositionA; i < indexPositionB; i++)\n if (indices[i] < 0 || indices[i] >= dataLength)\n return false;\n return true;\n }\n /** Returns true if this polyface has no facets. */\n public abstract get isEmpty(): boolean;\n /** Returns the number of facets of this polyface. Subclasses should override. */\n public get facetCount(): number | undefined {\n return undefined;\n }\n}\n\n/**\n * An `IndexedPolyface` is a set of facets which can have normal, param, and color arrays with independent point,\n * normal, param, and color indices.\n * @public\n */\nexport class IndexedPolyface extends Polyface { // more info can be found at geometry/internaldocs/Polyface.md\n /**\n * Start indices of all facets of the polyface.\n * * Each element is an index to the `this.data.pointIndex` array entry for a specific facet.\n * * The facet count is `_facetStart.length - 1`.\n * * The face loop for the i_th facet consists of the entries in `this.data.pointIndex` at indices `_facetStart[i]`\n * up to (but not including) `_facetStart[i + 1]`.\n * * Note the array is initialized with one entry (value 0).\n */\n protected _facetStart: number[];\n /**\n * Index to the `this.data.face` array entry for a specific facet.\n * * `_facetToFaceData` has one entry per facet.\n */\n protected _facetToFaceData: number[];\n /**\n * Constructor for a new polyface.\n * @param data PolyfaceData arrays to capture.\n * @param facetStart optional array of facet start indices (e.g. known during clone)\n * @param facetToFacetData optional array of face identifiers (e.g. known during clone)\n */\n protected constructor(data: PolyfaceData, facetStart?: number[], facetToFaceData?: number[]) {\n super(data);\n if (facetStart)\n this._facetStart = facetStart.slice(); // deep copy\n else {\n this._facetStart = [];\n this._facetStart.push(0);\n }\n if (facetToFaceData)\n this._facetToFaceData = facetToFaceData.slice(); // deep copy\n else\n this._facetToFaceData = [];\n }\n\n /**\n * Given an array of strictly increasing numbers, find the index of the largest number that is less than or equal\n * to `value`.\n * * Get an initial estimate by proportions of `value` and the first and last entries.\n * * Linear search from there for final value.\n * * For regularly spaced numbers (e.g., `data` is the `_facetStart` indices for a triangulated mesh or a quad mesh),\n * the proportional estimate will be immediately correct.\n */\n public static searchStrictlyIncreasingNumbers(data: number[], value: number): number | undefined {\n const lastQ = data.length - 1;\n if (lastQ <= 0 || value < 0 || value >= data[lastQ])\n return undefined;\n let q = Math.floor((value * lastQ) / data[lastQ]);\n while (data[q] > value)\n q--;\n while (data[q + 1] <= value)\n q++;\n return q;\n }\n /** Given an edgeIndex (index into `data.pointIndex`), return the index of the facet containing the edge. */\n public edgeIndexToFacetIndex(k: number | undefined): number | undefined {\n if (k === undefined)\n return undefined;\n return IndexedPolyface.searchStrictlyIncreasingNumbers(this._facetStart, k);\n }\n /**\n * Given an edgeIndex (index into `data.pointIndex`), return the range of the edgeIndices of the containing facet.\n * * A \"face loop\" is a contiguous block of edgeIndices in the polyface index arrays representing a facet.\n * * If an edge with edgeIndex `k` is found in the facet with facetIndex `f`, then the returned range `r` satisfies\n * `r.low = this.facetIndex0(f) <= k < this.facetIndex1(f) = r.high` and can be used to iterate the facet's face\n * loop, e.g.:\n * ````\n * for (let k1 = r.low; k1 < r.high; k1++) {\n * const edgeIndex = myPolyface.data.pointIndex[k1];\n * // process this edge\n * }\n * ````\n */\n public edgeIndexToFaceLoop(k: number | undefined): Range1d | undefined {\n const q = this.edgeIndexToFacetIndex(k);\n if (q !== undefined)\n return Range1d.createXX(this.facetIndex0(q), this.facetIndex1(q));\n return undefined;\n }\n\n /** Test if other is an instance of `IndexedPolyface` */\n public isSameGeometryClass(other: any): boolean {\n return other instanceof IndexedPolyface;\n }\n /** Tests for equivalence between two IndexedPolyfaces. */\n public override isAlmostEqual(other: any): boolean {\n if (other instanceof IndexedPolyface) {\n return this.data.isAlmostEqual(other.data) &&\n NumberArray.isExactEqual(this._facetStart, other._facetStart) &&\n NumberArray.isExactEqual(this._facetToFaceData, other._facetToFaceData);\n }\n return false;\n }\n /** Returns true if either the point array or the point index array is empty. */\n public get isEmpty(): boolean {\n return this.data.pointCount === 0 || this.data.pointIndex.length === 0;\n }\n /**\n * Transform the mesh.\n * * If `transform` is a mirror, also reverse the index order around each facet.\n * * Note that this method always returns true. If transforming the normals fails (due to singular matrix or zero\n * normal), the original normal(s) are left unchanged.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n this.data.tryTransformInPlace(transform);\n if (transform.matrix.determinant() < 0)\n this.reverseIndices();\n return true;\n }\n /** Reverse indices for a single facet. */\n public reverseSingleFacet(facetId: number) {\n this.data.reverseIndicesSingleFacet(facetId, this._facetStart);\n }\n /** Return a deep clone. */\n public clone(): IndexedPolyface {\n return new IndexedPolyface(this.data.clone(), this._facetStart.slice(), this._facetToFaceData.slice());\n }\n /**\n * Return a deep clone with transformed points and normals.\n * @see [[IndexedPolyface.tryTransformInPlace]] for details of how transform is done.\n */\n public cloneTransformed(transform: Transform): IndexedPolyface { // we know tryTransformInPlace succeeds.\n const result = this.clone();\n result.tryTransformInPlace(transform);\n return result;\n }\n /** Reverse the order of indices around all facets. */\n public reverseIndices() {\n this.data.reverseIndices(this._facetStart);\n }\n /** Reverse the direction of all normal vectors. */\n public reverseNormals() {\n this.data.reverseNormals();\n }\n /**\n * Return face data using a facet index.\n * * Returns `undefined` if none found.\n * * This is the REFERENCE to the FacetFaceData not a copy.\n */\n public tryGetFaceData(i: number): FacetFaceData | undefined {\n if (i < 0 || i >= this._facetToFaceData.length)\n return undefined;\n const faceIndex = this._facetToFaceData[i];\n if (faceIndex < 0 || faceIndex >= this.data.face.length)\n return undefined;\n return this.data.face[faceIndex];\n }\n /**\n * Add facets from `source` to `this` polyface.\n * * Optionally reverse facet indices as per `PolyfaceData.reverseIndicesSingleFacet()` with `preserveStart = false` and\n * invert source normals.\n * * Optionally apply a `transform` to points and normals.\n * * Will only copy param, normal, color, and face data if we are already tracking them AND/OR the source contains them.\n */\n public addIndexedPolyface(source: IndexedPolyface, reversed: boolean, transform: Transform | undefined) {\n const numSourceFacets = source.facetCount;\n // add point, point index, and edge visibility data\n // note that there is no need to build an intermediate index map since all points are added\n const startOfNewPoints = this.data.point.length;\n const xyz = Point3d.create();\n for (let i = 0; i < source.data.point.length; i++) {\n source.data.point.getPoint3dAtUncheckedPointIndex(i, xyz);\n if (transform) {\n transform.multiplyPoint3d(xyz, xyz);\n this.addPoint(xyz);\n } else\n this.addPoint(xyz);\n }\n for (let i = 0; i < numSourceFacets; i++) {\n const i0 = source._facetStart[i];\n const i1 = source._facetStart[i + 1];\n if (reversed) {\n for (let j = i1; j-- > i0;) { // visibility is transferred from far vertex, e.g., -abc-d => dc-b-a\n this.addPointIndex(\n startOfNewPoints + source.data.pointIndex[j],\n source.data.edgeVisible[j > i0 ? j - 1 : i1 - 1],\n );\n }\n } else {\n for (let j = i0; j < i1; j++) {\n this.addPointIndex(\n startOfNewPoints + source.data.pointIndex[j],\n source.data.edgeVisible[j],\n );\n }\n }\n this.terminateFacet(false);\n }\n // add param and param index data\n if (undefined !== this.data.param && undefined !== source.data.param && undefined !== source.data.paramIndex) {\n const startOfNewParams = this.data.param.length;\n this.data.param.pushFromGrowableXYArray(source.data.param);\n for (let i = 0; i < numSourceFacets; i++) { // expect facet start and ends for points to match normals\n const i0 = source._facetStart[i];\n const i1 = source._facetStart[i + 1];\n if (reversed) {\n for (let j = i1; j-- > i0;)\n this.addParamIndex(startOfNewParams + source.data.paramIndex[j]);\n } else {\n for (let j = i0; j < i1; j++)\n this.addParamIndex(startOfNewParams + source.data.paramIndex[j]);\n }\n }\n }\n // add normal and normal index data\n if (undefined !== this.data.normal && undefined !== source.data.normal && undefined !== source.data.normalIndex) {\n const startOfNewNormals = this.data.normal.length;\n for (let i = 0; i < source.data.normal.length; i++) {\n const sourceNormal = source.data.normal.getVector3dAtCheckedVectorIndex(i)!;\n if (transform)\n transform.multiplyVector(sourceNormal, sourceNormal);\n if (reversed)\n sourceNormal.scaleInPlace(-1.0);\n this.addNormal(sourceNormal);\n }\n for (let i = 0; i < numSourceFacets; i++) { // expect facet start and ends for points to match normals\n const i0 = source._facetStart[i];\n const i1 = source._facetStart[i + 1];\n if (reversed) {\n for (let j = i1; j-- > i0;)\n this.addNormalIndex(startOfNewNormals + source.data.normalIndex[j]);\n } else {\n for (let j = i0; j < i1; j++)\n this.addNormalIndex(startOfNewNormals + source.data.normalIndex[j]);\n }\n }\n }\n // add color and color index data\n if (undefined !== this.data.color && undefined !== source.data.color && undefined !== source.data.colorIndex) {\n const startOfNewColors = this.data.color.length;\n for (const sourceColor of source.data.color)\n this.addColor(sourceColor);\n for (let i = 0; i < numSourceFacets; i++) { // expect facet start and ends for points to match colors\n const i0 = source._facetStart[i];\n const i1 = source._facetStart[i + 1];\n if (reversed) {\n for (let j = i1; j-- > i0;)\n this.addColorIndex(startOfNewColors + source.data.colorIndex[j]);\n } else {\n for (let j = i0; j < i1; j++)\n this.addColorIndex(startOfNewColors + source.data.colorIndex[j]);\n }\n }\n }\n // add face and facetToFace index data\n if (source.data.face.length !== 0) {\n const startOfNewFaceData = this.data.face.length;\n for (const face of source.data.face) {\n const sourceFaceData = face.clone();\n this.data.face.push(sourceFaceData);\n }\n for (const facetToFaceIdx of source._facetToFaceData) {\n this._facetToFaceData.push(startOfNewFaceData + facetToFaceIdx);\n }\n }\n }\n /**\n * Return the total number of indices in zero-terminated style, which includes\n * * all the indices in the packed zero-based table.\n * * one additional index for the zero-terminator of each facet.\n * @note Note that all index arrays (pointIndex, normalIndex, paramIndex, colorIndex) have the same counts, so there\n * is not a separate query for each of them.\n */\n public get zeroTerminatedIndexCount(): number {\n return this.data.pointIndex.length + this._facetStart.length - 1;\n }\n /**\n * Create an empty facet set with coordinate and index data to be supplied later.\n * @param needNormals `true` to allocate empty normal data and index arrays; `false` (default) to leave undefined.\n * @param needParams `true` to allocate empty uv parameter data and index arrays; `false` (default) to leave undefined.\n * @param needColors `true` to allocate empty color data and index arrays; `false` (default) to leave undefined.\n * @param twoSided `true` if the facets are to be considered viewable from the back; `false` (default) if not.\n */\n public static create(\n needNormals: boolean = false,\n needParams: boolean = false,\n needColors: boolean = false,\n twoSided: boolean = false,\n ): IndexedPolyface {\n return new IndexedPolyface(new PolyfaceData(needNormals, needParams, needColors, twoSided));\n }\n /**\n * Add (a clone of) a point to point array.\n * @param point the point.\n * @param priorIndex (optional) index of prior point to check for possible duplicate value.\n * @returns the zero-based index of the added or duplicate point.\n */\n public addPoint(point: Point3d, priorIndex?: number): number {\n if (priorIndex !== undefined) {\n const distance = this.data.point.distanceIndexToPoint(priorIndex, point);\n if (distance !== undefined && Geometry.isSmallMetricDistance(distance))\n return priorIndex;\n }\n this.data.point.pushXYZ(point.x, point.y, point.z);\n return this.data.point.length - 1;\n }\n /**\n * Add a point to point array.\n * @param x the x coordinate of point.\n * @param y the y coordinate of point.\n * @param z the z coordinate of point.\n * @returns the zero-based index of the added point.\n */\n public addPointXYZ(x: number, y: number, z: number): number {\n this.data.point.pushXYZ(x, y, z);\n return this.data.point.length - 1;\n }\n /**\n * Add (a clone of) a uv parameter to the parameter array.\n * @param param the parameter.\n * @returns zero-based index of the added param.\n */\n public addParam(param: Point2d): number {\n if (!this.data.param)\n this.data.param = new GrowableXYArray();\n this.data.param.push(param);\n return this.data.param.length - 1;\n }\n /**\n * Add a uv parameter to the parameter array.\n * @param u the u part of parameter.\n * @param v the v part of parameter.\n * @param priorIndexA first index to check for possible duplicate value.\n * @param priorIndexB second index to check for possible duplicate value.\n * @returns zero-based index of the added or duplicate parameter.\n */\n public addParamUV(u: number, v: number, priorIndexA?: number, priorIndexB?: number): number {\n if (!this.data.param)\n this.data.param = new GrowableXYArray();\n if (priorIndexA !== undefined && this.data.isAlmostEqualParamIndexUV(priorIndexA, u, v))\n return priorIndexA;\n if (priorIndexB !== undefined && this.data.isAlmostEqualParamIndexUV(priorIndexB, u, v))\n return priorIndexB;\n this.data.param.pushXY(u, v);\n return this.data.param.length - 1;\n }\n /**\n * Add (a clone of) a normal vector to the normal array.\n * @param normal the normal vector.\n * @param priorIndexA first index to check for possible duplicate value.\n * @param priorIndexB second index to check for possible duplicate value.\n * @returns zero-based index of the added or duplicate normal.\n */\n public addNormal(normal: Vector3d, priorIndexA?: number, priorIndexB?: number): number {\n // check if `normal` is duplicate of `dataNormal` at index `i`\n const normalIsDuplicate = (i: number) => {\n const distance = this.data.normal!.distanceIndexToPoint(i, normal);\n return distance !== undefined && Geometry.isSmallMetricDistance(distance);\n };\n if (this.data.normal !== undefined) {\n if (priorIndexA !== undefined && normalIsDuplicate(priorIndexA))\n return priorIndexA;\n if (priorIndexB !== undefined && normalIsDuplicate(priorIndexB))\n return priorIndexB;\n // check the tail index for possible duplicate\n if (priorIndexA !== undefined || priorIndexB !== undefined) {\n const tailIndex = this.data.normal.length - 1;\n if (normalIsDuplicate(tailIndex))\n return tailIndex;\n }\n }\n return this.addNormalXYZ(normal.x, normal.y, normal.z);\n }\n /**\n * Add a normal vector to the normal array.\n * @param x the x coordinate of normal.\n * @param y the y coordinate of normal.\n * @param z the z coordinate of normal.\n * @returns zero-based index of the added normal vector.\n */\n public addNormalXYZ(x: number, y: number, z: number): number {\n if (!this.data.normal)\n this.data.normal = new GrowableXYZArray();\n this.data.normal.pushXYZ(x, y, z);\n return this.data.normal.length - 1;\n }\n /**\n * Add a color to the color array\n * @param color the color.\n * @returns zero-based index of the added color.\n */\n public addColor(color: number): number {\n if (!this.data.color)\n this.data.color = [];\n this.data.color.push(color);\n return this.data.color.length - 1;\n }\n /** Add a point index with edge visibility flag. */\n public addPointIndex(index: number, visible: boolean = true): void {\n this.data.pointIndex.push(index);\n this.data.edgeVisible.push(visible);\n }\n /** Add a normal index. */\n public addNormalIndex(index: number): void {\n if (!this.data.normalIndex)\n this.data.normalIndex = [];\n this.data.normalIndex.push(index);\n }\n /** Add a param index. */\n public addParamIndex(index: number): void {\n if (!this.data.paramIndex)\n this.data.paramIndex = [];\n this.data.paramIndex.push(index);\n }\n /** Add a color index. */\n public addColorIndex(index: number): void {\n if (!this.data.colorIndex)\n this.data.colorIndex = [];\n this.data.colorIndex.push(index);\n }\n /**\n * Clean up the open facet.\n * @deprecated in 4.x to remove nebulous \"open facet\" concept from the API. Call [[PolyfaceData.trimAllIndexArrays]]\n * instead.\n */\n public cleanupOpenFacet(): void {\n this.data.trimAllIndexArrays(this.data.pointIndex.length);\n }\n\n /**\n * Validate (the tail of) the active index arrays: point, normal, param, color.\n * @param index0 optional offset into the index arrays at which to start validating indices. Default 0.\n * @param errors optional array appended with error message(s) if invalid indices are encountered\n * @return whether the indices are valid\n */\n public validateAllIndices(index0: number = 0, errors?: string[]): boolean {\n const numPointIndices = this.data.pointIndex.length;\n const messages = errors ?? [];\n if (this.data.normalIndex && this.data.normalIndex.length !== numPointIndices)\n messages.push(\"normalIndex count must match pointIndex count\");\n if (this.data.paramIndex && this.data.paramIndex.length !== numPointIndices)\n messages.push(\"paramIndex count must equal pointIndex count\");\n if (this.data.colorIndex && this.data.colorIndex.length !== numPointIndices)\n messages.push(\"colorIndex count must equal pointIndex count\");\n if (this.data.edgeVisible.length !== numPointIndices)\n messages.push(\"visibleIndex count must equal pointIndex count\");\n if (!Polyface.areIndicesValid(this.data.pointIndex, index0, numPointIndices, this.data.point, this.data.point ? this.data.point.length : 0))\n messages.push(\"invalid point indices in the last facet\");\n if (!Polyface.areIndicesValid(this.data.normalIndex, index0, numPointIndices, this.data.normal, this.data.normal ? this.data.normal.length : 0))\n messages.push(\"invalid normal indices in the last facet\");\n if (!Polyface.areIndicesValid(this.data.paramIndex, index0, numPointIndices, this.data.param, this.data.param ? this.data.param.length : 0))\n messages.push(\"invalid param indices in the last facet\");\n if (!Polyface.areIndicesValid(this.data.colorIndex, index0, numPointIndices, this.data.color, this.data.color ? this.data.color.length : 0))\n messages.push(\"invalid color indices in the last facet\");\n return 0 === messages.length;\n }\n\n /**\n * Announce the end of construction of a facet.\n * * Optionally check for:\n * * Same number of indices among all active index arrays -- point, normal, param, color\n * * All indices for the latest facet are within bounds of the respective data arrays.\n * * In error cases, all index arrays are trimmed back to the size when previous facet was terminated.\n * * A return value of `undefined` is normal. Otherwise, a string array of error messages is returned.\n */\n public terminateFacet(validateAllIndices: boolean = true): string[] | undefined {\n const numFacets = this._facetStart.length - 1;\n // number of indices in accepted facets\n const lengthA = this._facetStart[numFacets];\n // number of indices in all facets (accepted facet plus the last facet to be accepted)\n const lengthB = this.data.pointIndex.length;\n if (validateAllIndices) {\n const messages: string[] = [];\n if (lengthB < lengthA + 2)\n messages.push(\"Less than 3 indices in the last facet\");\n this.validateAllIndices(lengthA, messages);\n if (messages.length > 0) {\n this.data.trimAllIndexArrays(lengthA);\n return messages;\n }\n }\n this._facetStart.push(lengthB); // append start index of the future facet\n return undefined;\n }\n /** Number of facets (read-only property). */\n public override get facetCount(): number {\n return this._facetStart.length - 1;\n }\n /** Number of faces (read-only property). */\n public get faceCount(): number {\n return this.data.faceCount;\n }\n /** Number of points (read-only property). */\n public get pointCount(): number {\n return this.data.pointCount;\n }\n /** Number of colors (read-only property). */\n public get colorCount(): number {\n return this.data.colorCount;\n }\n /** Number of parameters (read-only property). */\n public get paramCount(): number {\n return this.data.paramCount;\n }\n /** Number of normals (read-only property). */\n public get normalCount(): number {\n return this.data.normalCount;\n }\n /** Test if `index` is a valid facet index. */\n public isValidFacetIndex(facetIndex: number): boolean {\n return facetIndex >= 0 && facetIndex < this.facetCount;\n }\n /** Return the number of edges in a particular facet. */\n public numEdgeInFacet(facetIndex: number): number {\n if (this.isValidFacetIndex(facetIndex))\n return this._facetStart[facetIndex + 1] - this._facetStart[facetIndex];\n return 0;\n }\n /** Given a valid facet index, return the index at which its face loop starts in the index arrays. */\n public facetIndex0(facetIndex: number): number {\n return this._facetStart[facetIndex];\n }\n /** Given a valid facet index, return one past the index at which its face loop ends in the index arrays. */\n public facetIndex1(facetIndex: number): number {\n return this._facetStart[facetIndex + 1];\n }\n /** create a visitor for this polyface */\n public createVisitor(numWrap: number = 0): IndexedPolyfaceVisitor {\n return IndexedPolyfaceVisitor.create(this, numWrap);\n }\n /** Return the range of (optionally transformed) points in this mesh. */\n public override range(transform?: Transform, result?: Range3d): Range3d {\n return this.data.range(result, transform);\n }\n /** Extend `range` with coordinates from this mesh. */\n public extendRange(range: Range3d, transform?: Transform): void {\n this.data.range(range, transform);\n }\n /**\n * Given the index of a facet, return the data pertaining to the face it is a part of.\n * @deprecated in 4.x. Use [[IndexedPolyface.tryGetFaceData]], which verifies the index is in range.\n */\n public getFaceDataByFacetIndex(facetIndex: number): FacetFaceData {\n return this.data.face[this._facetToFaceData[facetIndex]];\n }\n /**\n * Set new FacetFaceData.\n * * All terminated facets since the last face declaration will be mapped to a single new FacetFaceData object using\n * facetToFaceData[]. FacetFaceData holds the 2D range of the face. Returns `true` if successful, `false` otherwise.\n */\n public setNewFaceData(endFacetIndex: number = 0): boolean {\n const facetStart = this._facetToFaceData.length;\n if (facetStart >= this._facetStart.length)\n return false;\n if (0 === endFacetIndex) // the default for endFacetIndex is really the last facet\n endFacetIndex = this._facetStart.length; // last facet index corresponds to the future facet\n const faceData = FacetFaceData.createNull();\n const visitor = IndexedPolyfaceVisitor.create(this, 0);\n if (!visitor.moveToReadIndex(facetStart)) { // move visitor to first facet of new face\n return false;\n }\n // if parameter range is provided (by the polyface planeSet clipper) then use it\n const paramDefined = this.data.param !== undefined;\n const setParamRange: boolean = faceData.paramRange.isNull && paramDefined;\n do {\n if (setParamRange && visitor.param !== undefined)\n visitor.param.extendRange(faceData.paramRange);\n } while (visitor.moveToNextFacet() && visitor.currentReadIndex() < endFacetIndex);\n if (paramDefined && !(this.data.param!.length === 0) && faceData.paramDistanceRange.isNull)\n faceData.setParamDistanceRangeFromNewFaceData(this, facetStart, endFacetIndex);\n this.data.face.push(faceData);\n const faceDataIndex = this.data.face.length - 1;\n for (let i = this._facetToFaceData.length; i < endFacetIndex; i++)\n this._facetToFaceData.push(0 === this._facetStart[i] ? 0 : faceDataIndex);\n return true;\n }\n /** Second step of double dispatch: call `handler.handleIndexedPolyface(this)`. */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleIndexedPolyface(this);\n }\n}\n\n/**\n * A PolyfaceVisitor manages data while walking through facets.\n * * The polyface visitor holds data for one facet at a time.\n * * The caller can request the position in the addressed polyfaceData as a \"readIndex\".\n * * The readIndex values (as numbers) are not assumed to be sequential (i.e., they might be contiguous facet indices\n * or the indexing scheme might have gaps at the whim of the particular PolyfaceVisitor implementation).\n * @public\n */\nexport interface PolyfaceVisitor extends PolyfaceData {\n /** Load data for the facet with given index. */\n moveToReadIndex(index: number): boolean;\n /** Return the readIndex of the currently loaded facet. */\n currentReadIndex(): number;\n /** Load data for the next facet. */\n moveToNextFacet(): boolean;\n /** Reset to initial state for reading all facets sequentially with moveToNextFacet. */\n reset(): void;\n /** Return the point index of vertex i within the currently loaded facet. */\n clientPointIndex(i: number): number;\n /** Return the param index of vertex i within the currently loaded facet. */\n clientParamIndex(i: number): number;\n /** Return the normal index of vertex i within the currently loaded facet. */\n clientNormalIndex(i: number): number;\n /** Return the color index of vertex i within the currently loaded facet. */\n clientColorIndex(i: number): number;\n /** Return the aux data index of vertex i within the currently loaded facet. */\n clientAuxIndex(i: number): number;\n /** Return the client polyface. */\n clientPolyface(): Polyface | undefined;\n /**\n * Set the number of vertices replicated in visitor arrays (both data and index arrays).\n * * 0,1,2 are the most common as numWrap.\n * * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second\n * 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.\n * Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.\n * * Continuing this example, `numWrap = 2` (i.e., `[6,7,8,6,7]`) is useful when each vertex visit requires\n * the next two points, e.g., to form two adjacent vectors for a cross product.\n */\n setNumWrap(numWrap: number): void;\n /** Clear the contents of all arrays. Use this along with `pushDataFrom` to build up new facets. */\n clearArrays(): void;\n /** Transfer data from a specified index of the other visitor as new data in this visitor. */\n pushDataFrom(other: PolyfaceVisitor, index: number): void;\n /**\n * Transfer interpolated data from the other visitor.\n * * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.\n */\n pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void;\n /**\n * Return the number of facets this visitor is able to visit.\n * * Allows implementers to improve the efficiency of e.g., [[PolyfaceQuery.visitorClientFacetCount]].\n */\n getVisitableFacetCount?(): number;\n}\n"]}
1
+ {"version":3,"file":"Polyface.js","sourceRoot":"","sources":["../../../src/polyface/Polyface.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,2BAA2B;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,OAAO,EAAY,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAW,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,OAAgB,QAAS,SAAQ,aAAa;IAClD,wCAAwC;IACxB,gBAAgB,GAAG,UAAU,CAAC;IAC9C,gCAAgC;IACzB,IAAI,CAAe;IAC1B,kBAAkB;IAClB,YAAsB,IAAkB;QACtC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB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AAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACnD,CAAC,QAAQ,OAAO,CAAC,eAAe,EAAE,IAAI,OAAO,CAAC,gBAAgB,EAAE,GAAG,aAAa,EAAE;QAClF,IAAI,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAM,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC,kBAAkB,CAAC,MAAM;YACxF,QAAQ,CAAC,oCAAoC,CAAC,IAAI,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;QACjF,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9B,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChD,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE;YAC/D,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC;IACd,CAAC;IACD,kFAAkF;IAC3E,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Polyface\n */\n\n// cspell:word internaldocs\n\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { Geometry } from \"../Geometry\";\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { GrowableXYArray } from \"../geometry3d/GrowableXYArray\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { FacetFaceData } from \"./FacetFaceData\";\nimport { IndexedPolyfaceVisitor } from \"./IndexedPolyfaceVisitor\";\nimport { PolyfaceData } from \"./PolyfaceData\";\n\n/**\n * A Polyface is an abstract mesh structure (of unspecified implementation) that provides a PolyfaceVisitor\n * to iterate over its facets.\n * @public\n */\nexport abstract class Polyface extends GeometryQuery {\n /** String name for schema properties */\n public readonly geometryCategory = \"polyface\";\n /** Underlying polyface data. */\n public data: PolyfaceData;\n /** Constructor */\n protected constructor(data: PolyfaceData) {\n super();\n this.data = data;\n }\n /**\n * Create and return a visitor for this concrete polyface.\n * @param numWrap the number of vertices to replicate in visitor arrays.\n */\n public abstract createVisitor(numWrap: number): PolyfaceVisitor;\n /**\n * The [[PolyfaceData.twoSided]] flag.\n */\n public get twoSided() {\n return this.data.twoSided;\n }\n public set twoSided(value: boolean) {\n this.data.twoSided = value;\n }\n /**\n * Flag indicating if the mesh closure is unknown (0), open sheet (1), closed solid (2).\n * * A boundary edge of a mesh is defined as an edge with only one connected facet.\n * * Closed solid is a mesh with no boundary edge. Open sheet is a mesh that has boundary edge(s).\n */\n public get expectedClosure(): number {\n return this.data.expectedClosure;\n }\n public set expectedClosure(value: number) {\n this.data.expectedClosure = value;\n }\n /**\n * Check validity of indices into a data array.\n * * It is valid to have both indices and data undefined.\n * * It is NOT valid for just one to be defined.\n * * Index values at indices[indexPositionA <= i < indexPositionB] must be valid indices to the data array.\n * @param indices array of indices.\n * @param indexPositionA first index to test.\n * @param indexPositionB one past final index to test.\n * @param data data array.\n * @param dataLength length of data array.\n */\n public static areIndicesValid(\n indices: number[] | undefined,\n indexPositionA: number,\n indexPositionB: number,\n data: any,\n dataLength: number,\n ): boolean {\n if (indices === undefined && data === undefined)\n return true;\n if (indices === undefined || data === undefined)\n return false;\n if (indexPositionA < 0 || indexPositionA >= indices.length)\n return false;\n if (indexPositionB <= indexPositionA || indexPositionB > indices.length)\n return false;\n for (let i = indexPositionA; i < indexPositionB; i++)\n if (indices[i] < 0 || indices[i] >= dataLength)\n return false;\n return true;\n }\n /** Returns true if this polyface has no facets. */\n public abstract get isEmpty(): boolean;\n /** Returns the number of facets of this polyface. Subclasses should override. */\n public get facetCount(): number | undefined {\n return undefined;\n }\n}\n\n/**\n * An `IndexedPolyface` is a set of facets which can have normal, param, and color arrays with independent point,\n * normal, param, and color indices.\n * @public\n */\nexport class IndexedPolyface extends Polyface { // more info can be found at geometry/internaldocs/Polyface.md\n /**\n * Start indices of all facets of the polyface.\n * * Each element is an index to the `this.data.pointIndex` array entry for a specific facet.\n * * The facet count is `_facetStart.length - 1`.\n * * The face loop for the i_th facet consists of the entries in `this.data.pointIndex` at indices `_facetStart[i]`\n * up to (but not including) `_facetStart[i + 1]`.\n * * Note the array is initialized with one entry (value 0).\n */\n protected _facetStart: number[];\n /**\n * Index to the `this.data.face` array entry for a specific facet.\n * * `_facetToFaceData` has one entry per facet.\n */\n protected _facetToFaceData: number[];\n /**\n * Constructor for a new polyface.\n * @param data PolyfaceData arrays to capture.\n * @param facetStart optional array of facet start indices (e.g. known during clone)\n * @param facetToFacetData optional array of face identifiers (e.g. known during clone)\n */\n protected constructor(data: PolyfaceData, facetStart?: number[], facetToFaceData?: number[]) {\n super(data);\n if (facetStart)\n this._facetStart = facetStart.slice(); // deep copy\n else {\n this._facetStart = [];\n this._facetStart.push(0);\n }\n if (facetToFaceData)\n this._facetToFaceData = facetToFaceData.slice(); // deep copy\n else\n this._facetToFaceData = [];\n }\n\n /** Given an edgeIndex (index into `data.pointIndex`), return the index of the facet containing the edge. */\n public edgeIndexToFacetIndex(k: number | undefined): number | undefined {\n if (k === undefined)\n return undefined;\n return NumberArray.searchStrictlyIncreasingNumbers(this._facetStart, k);\n }\n /**\n * Given an edgeIndex (index into `data.pointIndex`), return the range of the edgeIndices of the containing facet.\n * * If an edge with edgeIndex `k` is found in the facet with facetIndex `f`, then the returned range `r` satisfies\n * `r.low = this.facetIndex0(f) <= k < this.facetIndex1(f) = r.high` and can be used to iterate the facet's face\n * loop. See [[facetIndex0]].\n */\n public edgeIndexToFaceLoop(k: number | undefined): Range1d | undefined {\n const q = this.edgeIndexToFacetIndex(k);\n if (q !== undefined)\n return Range1d.createXX(this.facetIndex0(q), this.facetIndex1(q));\n return undefined;\n }\n\n /** Test if other is an instance of `IndexedPolyface` */\n public isSameGeometryClass(other: any): boolean {\n return other instanceof IndexedPolyface;\n }\n /** Tests for equivalence between two IndexedPolyfaces. */\n public override isAlmostEqual(other: any): boolean {\n if (other instanceof IndexedPolyface) {\n return this.data.isAlmostEqual(other.data) &&\n NumberArray.isExactEqual(this._facetStart, other._facetStart) &&\n NumberArray.isExactEqual(this._facetToFaceData, other._facetToFaceData);\n }\n return false;\n }\n /** Returns true if either the point array or the point index array is empty. */\n public get isEmpty(): boolean {\n return this.data.pointCount === 0 || this.data.pointIndex.length === 0;\n }\n /**\n * Transform the mesh.\n * * If `transform` is a mirror, also reverse the index order around each facet.\n * * Note that this method always returns true. If transforming the normals fails (due to singular matrix or zero\n * normal), the original normal(s) are left unchanged.\n */\n public tryTransformInPlace(transform: Transform): boolean {\n this.data.tryTransformInPlace(transform);\n if (transform.matrix.determinant() < 0)\n this.reverseIndices();\n return true;\n }\n /** Reverse indices for a single facet. */\n public reverseSingleFacet(facetId: number) {\n this.data.reverseIndicesSingleFacet(facetId, this._facetStart);\n }\n /** Return a deep clone. */\n public clone(): IndexedPolyface {\n return new IndexedPolyface(this.data.clone(), this._facetStart.slice(), this._facetToFaceData.slice());\n }\n /**\n * Return a deep clone with transformed points and normals.\n * @see [[IndexedPolyface.tryTransformInPlace]] for details of how transform is done.\n */\n public cloneTransformed(transform: Transform): IndexedPolyface { // we know tryTransformInPlace succeeds.\n const result = this.clone();\n result.tryTransformInPlace(transform);\n return result;\n }\n /** Reverse the order of indices around all facets. */\n public reverseIndices() {\n this.data.reverseIndices(this._facetStart);\n }\n /** Reverse the direction of all normal vectors. */\n public reverseNormals() {\n this.data.reverseNormals();\n }\n /**\n * Return face data using a facet index.\n * * Returns `undefined` if none found.\n * * This is the REFERENCE to the FacetFaceData not a copy.\n */\n public tryGetFaceData(i: number): FacetFaceData | undefined {\n if (i < 0 || i >= this._facetToFaceData.length)\n return undefined;\n const faceIndex = this._facetToFaceData[i];\n if (faceIndex < 0 || faceIndex >= this.data.face.length)\n return undefined;\n return this.data.face[faceIndex];\n }\n /**\n * Add facets from `source` to `this` polyface.\n * * Optionally reverse facet indices as per `PolyfaceData.reverseIndicesSingleFacet()` with `preserveStart = false` and\n * invert source normals.\n * * Optionally apply a `transform` to points and normals.\n * * Will only copy param, normal, color, and face data if we are already tracking them AND/OR the source contains them.\n */\n public addIndexedPolyface(source: IndexedPolyface, reversed: boolean, transform: Transform | undefined) {\n const numSourceFacets = source.facetCount;\n // add point, point index, and edge visibility data\n // note that there is no need to build an intermediate index map since all points are added\n const startOfNewPoints = this.data.point.length;\n const xyz = Point3d.create();\n for (let i = 0; i < source.data.point.length; i++) {\n source.data.point.getPoint3dAtUncheckedPointIndex(i, xyz);\n if (transform) {\n transform.multiplyPoint3d(xyz, xyz);\n this.addPoint(xyz);\n } else\n this.addPoint(xyz);\n }\n for (let i = 0; i < numSourceFacets; i++) {\n const i0 = source._facetStart[i];\n const i1 = source._facetStart[i + 1];\n if (reversed) {\n for (let j = i1; j-- > i0;) { // visibility is transferred from far vertex, e.g., -abc-d => dc-b-a\n this.addPointIndex(\n startOfNewPoints + source.data.pointIndex[j],\n source.data.edgeVisible[j > i0 ? j - 1 : i1 - 1],\n );\n }\n } else {\n for (let j = i0; j < i1; j++) {\n this.addPointIndex(\n startOfNewPoints + source.data.pointIndex[j],\n source.data.edgeVisible[j],\n );\n }\n }\n this.terminateFacet(false);\n }\n // add param and param index data\n if (undefined !== this.data.param && undefined !== source.data.param && undefined !== source.data.paramIndex) {\n const startOfNewParams = this.data.param.length;\n this.data.param.pushFromGrowableXYArray(source.data.param);\n for (let i = 0; i < numSourceFacets; i++) { // expect facet start and ends for points to match normals\n const i0 = source._facetStart[i];\n const i1 = source._facetStart[i + 1];\n if (reversed) {\n for (let j = i1; j-- > i0;)\n this.addParamIndex(startOfNewParams + source.data.paramIndex[j]);\n } else {\n for (let j = i0; j < i1; j++)\n this.addParamIndex(startOfNewParams + source.data.paramIndex[j]);\n }\n }\n }\n // add normal and normal index data\n if (undefined !== this.data.normal && undefined !== source.data.normal && undefined !== source.data.normalIndex) {\n const startOfNewNormals = this.data.normal.length;\n for (let i = 0; i < source.data.normal.length; i++) {\n const sourceNormal = source.data.normal.getVector3dAtCheckedVectorIndex(i)!;\n if (transform)\n transform.multiplyVector(sourceNormal, sourceNormal);\n if (reversed)\n sourceNormal.scaleInPlace(-1.0);\n this.addNormal(sourceNormal);\n }\n for (let i = 0; i < numSourceFacets; i++) { // expect facet start and ends for points to match normals\n const i0 = source._facetStart[i];\n const i1 = source._facetStart[i + 1];\n if (reversed) {\n for (let j = i1; j-- > i0;)\n this.addNormalIndex(startOfNewNormals + source.data.normalIndex[j]);\n } else {\n for (let j = i0; j < i1; j++)\n this.addNormalIndex(startOfNewNormals + source.data.normalIndex[j]);\n }\n }\n }\n // add color and color index data\n if (undefined !== this.data.color && undefined !== source.data.color && undefined !== source.data.colorIndex) {\n const startOfNewColors = this.data.color.length;\n for (const sourceColor of source.data.color)\n this.addColor(sourceColor);\n for (let i = 0; i < numSourceFacets; i++) { // expect facet start and ends for points to match colors\n const i0 = source._facetStart[i];\n const i1 = source._facetStart[i + 1];\n if (reversed) {\n for (let j = i1; j-- > i0;)\n this.addColorIndex(startOfNewColors + source.data.colorIndex[j]);\n } else {\n for (let j = i0; j < i1; j++)\n this.addColorIndex(startOfNewColors + source.data.colorIndex[j]);\n }\n }\n }\n // add face and facetToFace index data\n if (source.data.face.length !== 0) {\n const startOfNewFaceData = this.data.face.length;\n for (const face of source.data.face) {\n const sourceFaceData = face.clone();\n this.data.face.push(sourceFaceData);\n }\n for (const facetToFaceIdx of source._facetToFaceData) {\n this._facetToFaceData.push(startOfNewFaceData + facetToFaceIdx);\n }\n }\n }\n /**\n * Return the total number of indices in zero-terminated style, which includes\n * * all the indices in the packed zero-based table.\n * * one additional index for the zero-terminator of each facet.\n * @note Note that all index arrays (pointIndex, normalIndex, paramIndex, colorIndex) have the same counts, so there\n * is not a separate query for each of them.\n */\n public get zeroTerminatedIndexCount(): number {\n return this.data.pointIndex.length + this._facetStart.length - 1;\n }\n /**\n * Create an empty facet set with coordinate and index data to be supplied later.\n * @param needNormals `true` to allocate empty normal data and index arrays; `false` (default) to leave undefined.\n * @param needParams `true` to allocate empty uv parameter data and index arrays; `false` (default) to leave undefined.\n * @param needColors `true` to allocate empty color data and index arrays; `false` (default) to leave undefined.\n * @param twoSided `true` (default) if the facets are to be considered viewable from the back; `false` if they are amenable to backface culling.\n */\n public static create(\n needNormals: boolean = false,\n needParams: boolean = false,\n needColors: boolean = false,\n twoSided: boolean = true,\n ): IndexedPolyface {\n return new IndexedPolyface(new PolyfaceData(needNormals, needParams, needColors, twoSided));\n }\n /**\n * Add (a clone of) a point to point array.\n * @param point the point.\n * @param priorIndex (optional) index of prior point to check for possible duplicate value.\n * @returns the zero-based index of the added or duplicate point.\n */\n public addPoint(point: Point3d, priorIndex?: number): number {\n if (priorIndex !== undefined) {\n const distance = this.data.point.distanceIndexToPoint(priorIndex, point);\n if (distance !== undefined && Geometry.isSmallMetricDistance(distance))\n return priorIndex;\n }\n this.data.point.pushXYZ(point.x, point.y, point.z);\n return this.data.point.length - 1;\n }\n /**\n * Add a point to point array.\n * @param x the x coordinate of point.\n * @param y the y coordinate of point.\n * @param z the z coordinate of point.\n * @returns the zero-based index of the added point.\n */\n public addPointXYZ(x: number, y: number, z: number): number {\n this.data.point.pushXYZ(x, y, z);\n return this.data.point.length - 1;\n }\n /**\n * Add (a clone of) a uv parameter to the parameter array.\n * @param param the parameter.\n * @returns zero-based index of the added param.\n */\n public addParam(param: Point2d): number {\n if (!this.data.param)\n this.data.param = new GrowableXYArray();\n this.data.param.push(param);\n return this.data.param.length - 1;\n }\n /**\n * Add a uv parameter to the parameter array.\n * @param u the u part of parameter.\n * @param v the v part of parameter.\n * @param priorIndexA first index to check for possible duplicate value.\n * @param priorIndexB second index to check for possible duplicate value.\n * @returns zero-based index of the added or duplicate parameter.\n */\n public addParamUV(u: number, v: number, priorIndexA?: number, priorIndexB?: number): number {\n if (!this.data.param)\n this.data.param = new GrowableXYArray();\n if (priorIndexA !== undefined && this.data.isAlmostEqualParamIndexUV(priorIndexA, u, v))\n return priorIndexA;\n if (priorIndexB !== undefined && this.data.isAlmostEqualParamIndexUV(priorIndexB, u, v))\n return priorIndexB;\n this.data.param.pushXY(u, v);\n return this.data.param.length - 1;\n }\n /**\n * Add (a clone of) a normal vector to the normal array.\n * @param normal the normal vector.\n * @param priorIndexA first index to check for possible duplicate value.\n * @param priorIndexB second index to check for possible duplicate value.\n * @returns zero-based index of the added or duplicate normal.\n */\n public addNormal(normal: Vector3d, priorIndexA?: number, priorIndexB?: number): number {\n // check if `normal` is duplicate of `dataNormal` at index `i`\n const normalIsDuplicate = (i: number) => {\n const distance = this.data.normal!.distanceIndexToPoint(i, normal);\n return distance !== undefined && Geometry.isSmallMetricDistance(distance);\n };\n if (this.data.normal !== undefined) {\n if (priorIndexA !== undefined && normalIsDuplicate(priorIndexA))\n return priorIndexA;\n if (priorIndexB !== undefined && normalIsDuplicate(priorIndexB))\n return priorIndexB;\n // check the tail index for possible duplicate\n if (priorIndexA !== undefined || priorIndexB !== undefined) {\n const tailIndex = this.data.normal.length - 1;\n if (normalIsDuplicate(tailIndex))\n return tailIndex;\n }\n }\n return this.addNormalXYZ(normal.x, normal.y, normal.z);\n }\n /**\n * Add a normal vector to the normal array.\n * @param x the x coordinate of normal.\n * @param y the y coordinate of normal.\n * @param z the z coordinate of normal.\n * @returns zero-based index of the added normal vector.\n */\n public addNormalXYZ(x: number, y: number, z: number): number {\n if (!this.data.normal)\n this.data.normal = new GrowableXYZArray();\n this.data.normal.pushXYZ(x, y, z);\n return this.data.normal.length - 1;\n }\n /**\n * Add a color to the color array\n * @param color the color.\n * @returns zero-based index of the added color.\n */\n public addColor(color: number): number {\n if (!this.data.color)\n this.data.color = [];\n this.data.color.push(color);\n return this.data.color.length - 1;\n }\n /** Add a point index with edge visibility flag. */\n public addPointIndex(index: number, visible: boolean = true): void {\n this.data.pointIndex.push(index);\n this.data.edgeVisible.push(visible);\n }\n /** Add a normal index. */\n public addNormalIndex(index: number): void {\n if (!this.data.normalIndex)\n this.data.normalIndex = [];\n this.data.normalIndex.push(index);\n }\n /** Add a param index. */\n public addParamIndex(index: number): void {\n if (!this.data.paramIndex)\n this.data.paramIndex = [];\n this.data.paramIndex.push(index);\n }\n /** Add a color index. */\n public addColorIndex(index: number): void {\n if (!this.data.colorIndex)\n this.data.colorIndex = [];\n this.data.colorIndex.push(index);\n }\n /**\n * Clean up the open facet.\n * @deprecated in 4.x to remove nebulous \"open facet\" concept from the API. Call [[PolyfaceData.trimAllIndexArrays]]\n * instead.\n */\n public cleanupOpenFacet(): void {\n this.data.trimAllIndexArrays(this.data.pointIndex.length);\n }\n\n /**\n * Validate (the tail of) the active index arrays: point, normal, param, color.\n * @param index0 optional offset into the index arrays at which to start validating indices. Default 0.\n * @param errors optional array appended with error message(s) if invalid indices are encountered\n * @return whether the indices are valid\n */\n public validateAllIndices(index0: number = 0, errors?: string[]): boolean {\n const numPointIndices = this.data.pointIndex.length;\n const messages = errors ?? [];\n if (0 === numPointIndices) {\n messages.push(\"empty pointIndex array\");\n return false;\n }\n if (index0 < 0 || index0 >= numPointIndices) {\n messages.push(\"invalid input offset\");\n return false;\n }\n if (this.data.normalIndex && this.data.normalIndex.length !== numPointIndices)\n messages.push(\"normalIndex count must match pointIndex count\");\n if (this.data.paramIndex && this.data.paramIndex.length !== numPointIndices)\n messages.push(\"paramIndex count must equal pointIndex count\");\n if (this.data.colorIndex && this.data.colorIndex.length !== numPointIndices)\n messages.push(\"colorIndex count must equal pointIndex count\");\n if (this.data.edgeVisible.length !== numPointIndices)\n messages.push(\"visibleIndex count must equal pointIndex count\");\n if (!Polyface.areIndicesValid(this.data.pointIndex, index0, numPointIndices, this.data.point, this.data.point ? this.data.point.length : 0))\n messages.push(\"invalid point index encountered\");\n if (!Polyface.areIndicesValid(this.data.normalIndex, index0, numPointIndices, this.data.normal, this.data.normal ? this.data.normal.length : 0))\n messages.push(\"invalid normal index encountered\");\n if (!Polyface.areIndicesValid(this.data.paramIndex, index0, numPointIndices, this.data.param, this.data.param ? this.data.param.length : 0))\n messages.push(\"invalid param index encountered\");\n if (!Polyface.areIndicesValid(this.data.colorIndex, index0, numPointIndices, this.data.color, this.data.color ? this.data.color.length : 0))\n messages.push(\"invalid color index encountered\");\n if (this.data.edgeMateIndex) {\n if (this.data.edgeMateIndex.length !== numPointIndices)\n messages.push(\"edgeMateIndex count must equal pointIndex count\");\n else if (!this.data.edgeMateIndex.every((i: number | undefined) => i === undefined || this.data.isValidEdgeIndex(i)))\n messages.push(\"invalid edgeMate encountered\");\n }\n return 0 === messages.length;\n }\n\n /**\n * Announce the end of construction of a facet.\n * * Optionally check for:\n * * Same number of indices among all active index arrays -- point, normal, param, color\n * * All indices for the latest facet are within bounds of the respective data arrays.\n * * In error cases, all index arrays are trimmed back to the size when previous facet was terminated.\n * * A return value of `undefined` is normal. Otherwise, a string array of error messages is returned.\n */\n public terminateFacet(validateAllIndices: boolean = true): string[] | undefined {\n const numFacets = this._facetStart.length - 1;\n // number of indices in accepted facets\n const lengthA = this._facetStart[numFacets];\n // number of indices in all facets (accepted facet plus the last facet to be accepted)\n const lengthB = this.data.pointIndex.length;\n if (validateAllIndices) {\n const messages: string[] = [];\n if (lengthB < lengthA + 2)\n messages.push(\"Less than 3 indices in the last facet\");\n this.validateAllIndices(lengthA, messages);\n if (messages.length > 0) {\n this.data.trimAllIndexArrays(lengthA);\n return messages;\n }\n }\n this._facetStart.push(lengthB); // append start index of the future facet\n return undefined;\n }\n /** Number of facets (read-only property). */\n public override get facetCount(): number {\n return this._facetStart.length - 1;\n }\n /** Number of faces (read-only property). */\n public get faceCount(): number {\n return this.data.faceCount;\n }\n /** Number of points (read-only property). */\n public get pointCount(): number {\n return this.data.pointCount;\n }\n /** Number of colors (read-only property). */\n public get colorCount(): number {\n return this.data.colorCount;\n }\n /** Number of parameters (read-only property). */\n public get paramCount(): number {\n return this.data.paramCount;\n }\n /** Number of normals (read-only property). */\n public get normalCount(): number {\n return this.data.normalCount;\n }\n /** Test if `index` is a valid facet index. */\n public isValidFacetIndex(facetIndex: number): boolean {\n return facetIndex >= 0 && facetIndex < this.facetCount;\n }\n /** Return the number of edges in a particular facet. */\n public numEdgeInFacet(facetIndex: number): number {\n if (this.isValidFacetIndex(facetIndex))\n return this._facetStart[facetIndex + 1] - this._facetStart[facetIndex];\n return 0;\n }\n /**\n * Given a valid facet index, return the index at which its face loop starts in the index arrays.\n * * A \"face loop\" is a contiguous block of indices into the parallel polyface index arrays.\n * * Each of these indices represents an edge of a facet, thus it is sometimes called an \"edgeIndex\".\n * * Together with [[facetIndex1]], this method can be used to iterate the face loop of the facet\n * with index `iFacet` as follows:\n * ````\n * for (let iEdge = this.facetIndex0(iFacet); iEdge < this.facetIndex1(iFacet); iEdge++) {\n * const iPoint = this.data.pointIndex[iEdge];\n * const p = this.data.point[iPoint];\n * // ... process the edge of this facet starting at point p\n * }\n * ````\n */\n public facetIndex0(facetIndex: number): number {\n return this._facetStart[facetIndex];\n }\n /**\n * Given a valid facet index, return one past the index at which its face loop ends in the index arrays.\n * * For details, see [[facetIndex0]].\n */\n public facetIndex1(facetIndex: number): number {\n return this._facetStart[facetIndex + 1];\n }\n /** Return a readonly reference to the facetStart array accessed by [[facetIndex0]] and [[facetIndex1]]. */\n public get facetStart(): ReadonlyArray<number> {\n return this._facetStart;\n }\n /** create a visitor for this polyface */\n public createVisitor(numWrap: number = 0): IndexedPolyfaceVisitor {\n return IndexedPolyfaceVisitor.create(this, numWrap);\n }\n /** Return the range of (optionally transformed) points in this mesh. */\n public override range(transform?: Transform, result?: Range3d): Range3d {\n return this.data.range(result, transform);\n }\n /** Extend `range` with coordinates from this mesh. */\n public extendRange(range: Range3d, transform?: Transform): void {\n this.data.range(range, transform);\n }\n /**\n * Given the index of a facet, return the data pertaining to the face it is a part of.\n * @deprecated in 4.x. Use [[IndexedPolyface.tryGetFaceData]], which verifies the index is in range.\n */\n public getFaceDataByFacetIndex(facetIndex: number): FacetFaceData {\n return this.data.face[this._facetToFaceData[facetIndex]];\n }\n /**\n * Set new FacetFaceData.\n * * All terminated facets since the last face declaration will be mapped to a single new FacetFaceData object using\n * facetToFaceData[]. FacetFaceData holds the 2D range of the face. Returns `true` if successful, `false` otherwise.\n */\n public setNewFaceData(endFacetIndex: number = 0): boolean {\n const facetStart = this._facetToFaceData.length;\n if (facetStart >= this._facetStart.length)\n return false;\n if (0 === endFacetIndex) // the default for endFacetIndex is really the last facet\n endFacetIndex = this._facetStart.length; // last facet index corresponds to the future facet\n const faceData = FacetFaceData.createNull();\n const visitor = IndexedPolyfaceVisitor.create(this, 0);\n if (!visitor.moveToReadIndex(facetStart)) { // move visitor to first facet of new face\n return false;\n }\n // if parameter range is provided (by the polyface planeSet clipper) then use it\n const paramDefined = this.data.param !== undefined;\n const setParamRange: boolean = faceData.paramRange.isNull && paramDefined;\n do {\n if (setParamRange && visitor.param !== undefined)\n visitor.param.extendRange(faceData.paramRange);\n } while (visitor.moveToNextFacet() && visitor.currentReadIndex() < endFacetIndex);\n if (paramDefined && !(this.data.param!.length === 0) && faceData.paramDistanceRange.isNull)\n faceData.setParamDistanceRangeFromNewFaceData(this, facetStart, endFacetIndex);\n this.data.face.push(faceData);\n const faceDataIndex = this.data.face.length - 1;\n for (let i = this._facetToFaceData.length; i < endFacetIndex; i++)\n this._facetToFaceData.push(0 === this._facetStart[i] ? 0 : faceDataIndex);\n return true;\n }\n /** Second step of double dispatch: call `handler.handleIndexedPolyface(this)`. */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleIndexedPolyface(this);\n }\n}\n\n/**\n * A PolyfaceVisitor manages data while walking through facets.\n * * The polyface visitor holds data for one facet at a time.\n * * The caller can request the position in the addressed polyfaceData as a \"readIndex\".\n * * The readIndex values (as numbers) are not assumed to be sequential (i.e., they might be contiguous facet indices\n * or the indexing scheme might have gaps at the whim of the particular PolyfaceVisitor implementation).\n * @public\n */\nexport interface PolyfaceVisitor extends PolyfaceData {\n /** Load data for the facet with given index. */\n moveToReadIndex(index: number): boolean;\n /** Return the readIndex of the currently loaded facet. */\n currentReadIndex(): number;\n /** Load data for the next facet. */\n moveToNextFacet(): boolean;\n /** Reset to initial state for reading all facets sequentially with moveToNextFacet. */\n reset(): void;\n /** Return the point index of vertex i within the currently loaded facet. */\n clientPointIndex(i: number): number;\n /** Return the param index of vertex i within the currently loaded facet. */\n clientParamIndex(i: number): number;\n /** Return the normal index of vertex i within the currently loaded facet. */\n clientNormalIndex(i: number): number;\n /** Return the color index of vertex i within the currently loaded facet. */\n clientColorIndex(i: number): number;\n /** Return the aux data index of vertex i within the currently loaded facet. */\n clientAuxIndex(i: number): number;\n /** Return the client polyface. */\n clientPolyface(): Polyface | undefined;\n /**\n * Set the number of vertices replicated in visitor arrays (both data and index arrays).\n * * 0,1,2 are the most common values.\n * * Example: suppose `[6,7,8]` is the pointIndex array representing a triangle. First edge would be `6,7`. Second\n * 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.\n * Therefore, it is useful to store `6` at the end of pointIndex array, i.e., `[6,7,8,6]` meaning `numWrap = 1`.\n * * Continuing this example, `numWrap = 2` (i.e., `[6,7,8,6,7]`) is useful when each vertex visit requires\n * the next two points, e.g., to form two adjacent vectors for a cross product.\n */\n setNumWrap(numWrap: number): void;\n /** Clear the contents of the data arrays. Use this along with `pushDataFrom` to build up new facets. */\n clearArrays(): void;\n /** Transfer data from a specified index of the other visitor as new data in this visitor. */\n pushDataFrom(other: PolyfaceVisitor, index: number): void;\n /**\n * Transfer interpolated data from the other visitor.\n * * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.\n */\n pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void;\n /**\n * Return the number of facets this visitor is able to visit.\n * * Allows implementers to improve the efficiency of e.g., [[PolyfaceQuery.visitorClientFacetCount]].\n */\n getVisitableFacetCount?(): number;\n}\n"]}
@@ -61,7 +61,7 @@ export declare class PolyfaceData {
61
61
  * shared edge is hidden, then the mesh has `edgeVisible = [true,true,false, false,true,true]`.
62
62
  */
63
63
  edgeVisible: boolean[];
64
- /** Boolean tag indicating if the facets are viewable from the back. */
64
+ /** The [[twoSided]] flag. */
65
65
  private _twoSided;
66
66
  /**
67
67
  * Flag indicating if the mesh closure is unknown (0), open sheet (1), closed solid (2).
@@ -102,7 +102,7 @@ export declare class PolyfaceData {
102
102
  * @param needNormals `true` to allocate empty normal data and index arrays; `false` (default) to leave undefined.
103
103
  * @param needParams `true` to allocate empty uv parameter data and index arrays; `false` (default) to leave undefined.
104
104
  * @param needColors `true` to allocate empty color data and index arrays; `false` (default) to leave undefined.
105
- * @param twoSided `true` if the facets are to be considered viewable from the back; `false` (default) if not.
105
+ * @param twoSided `true` (default) if the facets are to be considered viewable from the back; `false` if they are amenable to backface culling.
106
106
  */
107
107
  constructor(needNormals?: boolean, needParams?: boolean, needColors?: boolean, twoSided?: boolean);
108
108
  /** Return a deep clone. */
@@ -141,7 +141,12 @@ export declare class PolyfaceData {
141
141
  getColor(i: number): number;
142
142
  /** Return indexed visibility. at index `i`. Index `i` is not checked for validity. */
143
143
  getEdgeVisible(i: number): boolean;
144
- /** Get boolean tag indicating if the facets are to be considered viewable from the back. */
144
+ /**
145
+ * Boolean flag indicating if the facets are viewable from the back.
146
+ * * Default value is true.
147
+ * * Set to false only if the mesh is known to be a closed volume with outward normals,
148
+ * indicating it is amenable to backface culling for improved display performance.
149
+ */
145
150
  get twoSided(): boolean;
146
151
  set twoSided(value: boolean);
147
152
  /** Get flag indicating if the mesh closure is unknown (0), open sheet (1), closed solid (2). */
@@ -1 +1 @@
1
- {"version":3,"file":"PolyfaceData.d.ts","sourceRoot":"","sources":["../../../src/polyface/PolyfaceData.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD;;;;;;;;;GASG;AACH,qBAAa,YAAY;IACvB;;;MAGE;IACF,gBAAuB,oBAAoB,SAAW;IACtD,0FAA0F;IACnF,KAAK,EAAE,gBAAgB,CAAC;IAC/B,2CAA2C;IACpC,UAAU,EAAE,MAAM,EAAE,CAAC;IAC5B,+EAA+E;IACxE,MAAM,CAAC,EAAE,gBAAgB,CAAC;IACjC,4CAA4C;IACrC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,8EAA8E;IACvE,KAAK,CAAC,EAAE,eAAe,CAAC;IAC/B,2CAA2C;IACpC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B;;;OAGG;IACI,KAAK,CAAC,EAAE,MA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;IAC7D,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO;IAK9D;;;;;;;;;;;;;;OAcG;IACI,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;IAazD;;;;;;;OAOG;IACI,QAAQ,CAAC,SAAS,GAAE,MAAqC,GAAG,IAAI;IAmCvE;;;;;;OAMG;WACW,2BAA2B,CAAC,eAAe,EAAE,MAAM,EAAE,GAAG,OAAO;IAS7E;;;;;;;;OAQG;WACW,cAAc,CAAC,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,SAAS,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO;IAgCrH;;;;;;;;;;OAUG;WACW,yBAAyB,CAAC,CAAC,EACvC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,SAAS,EAAE,aAAa,EAAE,OAAO,GAC9F,OAAO;IA8BV;;;;;;;;MAQE;IACK,cAAc,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI;IAYvD;;;;;;;OAOG;IACI,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI;IAUrF,mCAAmC;IAC5B,cAAc;CAItB"}
@@ -70,7 +70,7 @@ export class PolyfaceData {
70
70
  * shared edge is hidden, then the mesh has `edgeVisible = [true,true,false, false,true,true]`.
71
71
  */
72
72
  edgeVisible;
73
- /** Boolean tag indicating if the facets are viewable from the back. */
73
+ /** The [[twoSided]] flag. */
74
74
  _twoSided;
75
75
  /**
76
76
  * Flag indicating if the mesh closure is unknown (0), open sheet (1), closed solid (2).
@@ -119,9 +119,9 @@ export class PolyfaceData {
119
119
  * @param needNormals `true` to allocate empty normal data and index arrays; `false` (default) to leave undefined.
120
120
  * @param needParams `true` to allocate empty uv parameter data and index arrays; `false` (default) to leave undefined.
121
121
  * @param needColors `true` to allocate empty color data and index arrays; `false` (default) to leave undefined.
122
- * @param twoSided `true` if the facets are to be considered viewable from the back; `false` (default) if not.
122
+ * @param twoSided `true` (default) if the facets are to be considered viewable from the back; `false` if they are amenable to backface culling.
123
123
  */
124
- constructor(needNormals = false, needParams = false, needColors = false, twoSided = false) {
124
+ constructor(needNormals = false, needParams = false, needColors = false, twoSided = true) {
125
125
  this.point = new GrowableXYZArray();
126
126
  this.pointIndex = [];
127
127
  if (needNormals) {
@@ -166,6 +166,8 @@ export class PolyfaceData {
166
166
  result.edgeVisible = this.edgeVisible.slice();
167
167
  result.twoSided = this.twoSided;
168
168
  result.expectedClosure = this.expectedClosure;
169
+ if (this.edgeMateIndex)
170
+ result.edgeMateIndex = this.edgeMateIndex.slice();
169
171
  return result;
170
172
  }
171
173
  /** Test for equal indices and nearly equal coordinates. */
@@ -196,6 +198,8 @@ export class PolyfaceData {
196
198
  return false;
197
199
  if (this.expectedClosure !== other.expectedClosure)
198
200
  return false;
201
+ if (!NumberArray.isExactEqual(this.edgeMateIndex, other.edgeMateIndex))
202
+ return false;
199
203
  return true;
200
204
  }
201
205
  /** Ask if normals are required in this mesh. */
@@ -258,7 +262,12 @@ export class PolyfaceData {
258
262
  getEdgeVisible(i) {
259
263
  return this.edgeVisible[i];
260
264
  }
261
- /** Get boolean tag indicating if the facets are to be considered viewable from the back. */
265
+ /**
266
+ * Boolean flag indicating if the facets are viewable from the back.
267
+ * * Default value is true.
268
+ * * Set to false only if the mesh is known to be a closed volume with outward normals,
269
+ * indicating it is amenable to backface culling for improved display performance.
270
+ */
262
271
  get twoSided() {
263
272
  return this._twoSided;
264
273
  }
@@ -387,6 +396,13 @@ export class PolyfaceData {
387
396
  for (let i = 0; i < numWrap; i++)
388
397
  this.auxData.indices[numEdge + i] = this.auxData.indices[i];
389
398
  }
399
+ // copy wrapped edgeMateIndex
400
+ if (this.edgeMateIndex && other.edgeMateIndex) {
401
+ for (let i = 0; i < numEdge; i++)
402
+ this.edgeMateIndex[i] = other.edgeMateIndex[index0 + i];
403
+ for (let i = 0; i < numWrap; i++)
404
+ this.edgeMateIndex[numEdge + i] = this.edgeMateIndex[i];
405
+ }
390
406
  }
391
407
  /** Trim the `data` arrays to the stated `length`. */
392
408
  static trimArray(data, length) {
@@ -410,6 +426,7 @@ export class PolyfaceData {
410
426
  PolyfaceData.trimArray(data.values, channel.entriesPerValue * length);
411
427
  }
412
428
  }
429
+ PolyfaceData.trimArray(this.edgeMateIndex, length);
413
430
  }
414
431
  /**
415
432
  * Resize all data and index arrays to the specified `length`.
@@ -451,6 +468,9 @@ export class PolyfaceData {
451
468
  if (this.auxData.indices)
452
469
  this.auxData.indices.push(-1);
453
470
  }
471
+ if (this.edgeMateIndex)
472
+ while (this.edgeMateIndex.length < length)
473
+ this.edgeMateIndex.push(undefined);
454
474
  }
455
475
  else if (length < this.point.length) {
456
476
  this.point.resize(length);
@@ -477,6 +497,8 @@ export class PolyfaceData {
477
497
  if (this.auxData.indices)
478
498
  this.auxData.indices.length = length;
479
499
  }
500
+ if (this.edgeMateIndex)
501
+ this.edgeMateIndex.length = length;
480
502
  }
481
503
  }
482
504
  /**