@itwin/core-geometry 3.2.0-dev.7 → 3.2.0-dev.72

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 (76) hide show
  1. package/CHANGELOG.md +38 -1
  2. package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
  3. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  4. package/lib/cjs/numerics/ClusterableArray.d.ts +29 -2
  5. package/lib/cjs/numerics/ClusterableArray.d.ts.map +1 -1
  6. package/lib/cjs/numerics/ClusterableArray.js +54 -2
  7. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  8. package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  9. package/lib/cjs/polyface/IndexedEdgeMatcher.js +0 -3
  10. package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
  11. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +1 -1
  12. package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  13. package/lib/cjs/polyface/Polyface.d.ts +4 -4
  14. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  15. package/lib/cjs/polyface/Polyface.js +30 -44
  16. package/lib/cjs/polyface/Polyface.js.map +1 -1
  17. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +58 -17
  18. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  19. package/lib/cjs/polyface/PolyfaceBuilder.js +235 -47
  20. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  21. package/lib/cjs/polyface/PolyfaceData.d.ts +3 -3
  22. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  23. package/lib/cjs/polyface/PolyfaceData.js +8 -3
  24. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  25. package/lib/cjs/polyface/PolyfaceQuery.d.ts +6 -4
  26. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  27. package/lib/cjs/polyface/PolyfaceQuery.js +20 -7
  28. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  29. package/lib/cjs/serialization/BGFBAccessors.d.ts +2 -2
  30. package/lib/cjs/serialization/BGFBAccessors.d.ts.map +1 -1
  31. package/lib/cjs/serialization/BGFBAccessors.js +2 -2
  32. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  33. package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
  34. package/lib/cjs/serialization/BGFBReader.js +0 -1
  35. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  36. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  37. package/lib/cjs/serialization/GeometrySamples.js +4 -3
  38. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  39. package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
  40. package/lib/esm/geometry3d/Angle.js.map +1 -1
  41. package/lib/esm/numerics/ClusterableArray.d.ts +29 -2
  42. package/lib/esm/numerics/ClusterableArray.d.ts.map +1 -1
  43. package/lib/esm/numerics/ClusterableArray.js +54 -2
  44. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  45. package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
  46. package/lib/esm/polyface/IndexedEdgeMatcher.js +0 -3
  47. package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
  48. package/lib/esm/polyface/IndexedPolyfaceVisitor.js +1 -1
  49. package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
  50. package/lib/esm/polyface/Polyface.d.ts +4 -4
  51. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  52. package/lib/esm/polyface/Polyface.js +30 -44
  53. package/lib/esm/polyface/Polyface.js.map +1 -1
  54. package/lib/esm/polyface/PolyfaceBuilder.d.ts +58 -17
  55. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  56. package/lib/esm/polyface/PolyfaceBuilder.js +235 -47
  57. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  58. package/lib/esm/polyface/PolyfaceData.d.ts +3 -3
  59. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  60. package/lib/esm/polyface/PolyfaceData.js +8 -3
  61. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  62. package/lib/esm/polyface/PolyfaceQuery.d.ts +6 -4
  63. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  64. package/lib/esm/polyface/PolyfaceQuery.js +20 -7
  65. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  66. package/lib/esm/serialization/BGFBAccessors.d.ts +2 -2
  67. package/lib/esm/serialization/BGFBAccessors.d.ts.map +1 -1
  68. package/lib/esm/serialization/BGFBAccessors.js +2 -2
  69. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  70. package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
  71. package/lib/esm/serialization/BGFBReader.js +0 -1
  72. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  73. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  74. package/lib/esm/serialization/GeometrySamples.js +4 -3
  75. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  76. package/package.json +4 -5
@@ -146,9 +146,9 @@ export declare class PolyfaceData {
146
146
  */
147
147
  tryTransformInPlace(transform: Transform): boolean;
148
148
  /**
149
- * * Search for duplication of coordinates within points, normals, and params.
150
- * * compress the coordinate arrays.
151
- * * revise all indexing for the relocated coordinates
149
+ * * Search for duplicates within points, normals, params, and colors.
150
+ * * compress the data arrays.
151
+ * * revise all indexing for the relocated data.
152
152
  */
153
153
  compress(): void;
154
154
  /**
@@ -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,M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OAGG;IACI,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;IAQzD;;;;OAIG;IACI,QAAQ;IAyBf;;;;;OAKG;WACW,2BAA2B,CAAC,eAAe,EAAE,MAAM,EAAE,GAAG,OAAO;IAS7E;;OAEG;WACW,cAAc,CAAC,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,SAAS,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO;IAiCrH;;OAEG;WACW,yBAAyB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,SAAS,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO;CA+BlJ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCE"}
@@ -366,9 +366,9 @@ export class PolyfaceData {
366
366
  return undefined === this.auxData || this.auxData.tryTransformInPlace(transform);
367
367
  }
368
368
  /**
369
- * * Search for duplication of coordinates within points, normals, and params.
370
- * * compress the coordinate arrays.
371
- * * revise all indexing for the relocated coordinates
369
+ * * Search for duplicates within points, normals, params, and colors.
370
+ * * compress the data arrays.
371
+ * * revise all indexing for the relocated data.
372
372
  */
373
373
  compress() {
374
374
  const packedPoints = ClusterableArray.clusterGrowablePoint3dArray(this.point);
@@ -385,6 +385,11 @@ export class PolyfaceData {
385
385
  this.param = packedParams.growablePackedPoints;
386
386
  packedParams.updateIndices(this.paramIndex);
387
387
  }
388
+ if (this.colorIndex && this.color) {
389
+ const packedColors = ClusterableArray.clusterNumberArray(this.color);
390
+ this.color = packedColors.packedNumbers;
391
+ packedColors.updateIndices(this.colorIndex);
392
+ }
388
393
  }
389
394
  /**
390
395
  * Test if facetStartIndex is (minimally!) valid:
@@ -1 +1 @@
1
- {"version":3,"file":"PolyfaceData.js","sourceRoot":"","sources":["../../../src/polyface/PolyfaceData.ts"],"names":[],"mappings":"AAAA;;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CAAC,GAAG,eAAe,CAAC,MAAM,EAAE;gBACzD,IAAI,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;gBACtC,IAAI,MAAM,GAAG,eAAe,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;gBAC1C,IAAI,aAAa,EAAE;oBACjB,+DAA+D;oBAC/D,OAAO,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE;wBAC1B,MAAM,EAAE,CAAC;wBAAC,MAAM,EAAE,CAAC;wBACnB,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;wBAC1B,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;wBAClC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;qBACrB;iBACF;qBAAM;oBACL,cAAc;oBACd,OAAO,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE;wBAC1B,MAAM,EAAE,CAAC;wBACT,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;wBAC1B,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;wBAClC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBACpB,MAAM,EAAE,CAAC;qBACV;iBACF;gBACD,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AA7dD,MAAM;AACN,iFAAiF;AACjF,8CAA8C;AAC9C,oFAAoF;AACpF,qDAAqD;AACrD,2CAA2C;AAC3C,sDAAsD;AACtD,0DAA0D;AAC1D,QAAQ;AACR;;GAEG;AACoB,iCAAoB,GAAG,OAAO,CAAC;AAodxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCE","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Polyface\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYArray } from \"../geometry3d/GrowableXYArray\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { ClusterableArray } from \"../numerics/ClusterableArray\";\r\nimport { PolyfaceAuxData } from \"./AuxData\";\r\nimport { FacetFaceData } from \"./FacetFaceData\";\r\nimport { TaggedNumericData } from \"./TaggedNumericData\";\r\n\r\n/**\r\n * PolyfaceData carries data arrays for point, normal, param, color and their indices.\r\n *\r\n * * IndexedPolyface carries a PolyfaceData as a member. (NOT as a base class -- it already has GeometryQuery as base)\r\n * * IndexedPolyfaceVisitor uses PolyfaceData as a base class. In this use there is only a single facet in the polyfaceData.\r\n * * PolyfaceData does not know (!!!) what indices range constitute a facet. That is managed by derived class or carrier class.\r\n * @public\r\n */\r\nexport class PolyfaceData {\r\n // <ul\r\n // <li>optional arrays (normal, uv, color) must be indicated at constructor time.\r\n // <li>all arrays are (independently) indexed.\r\n // <li>with regret, the point, param, normal, and color arrays are exposed publicly.\r\n // <li>getX methods are \"trusting\" -- no bounds check\r\n // <li>getX methods return references to X.\r\n // <li> EXCEPT -- for optional arrays, the return 000.\r\n // <li>copyX methods move data to caller-supplied result..\r\n // </ul>\r\n /** Relative tolerance used in tests for planar facets\r\n * @internal\r\n */\r\n public static readonly planarityLocalRelTol = 1.0e-13;\r\n /** Coordinate data for points in the facets, packed as numbers in a contiguous array. */\r\n public point: GrowableXYZArray;\r\n /** Indices of points at facet vertices. */\r\n public pointIndex: number[];\r\n /** booleans indicating visibility of corresponding edges */\r\n public edgeVisible: boolean[];\r\n /** Coordinates of normal vectors, packed as numbers in a contiguous array */\r\n public normal: GrowableXYZArray | undefined;\r\n /** indices of normals at facet vertices. */\r\n public normalIndex: number[] | undefined;\r\n /** Coordinates of uv parameters, packed as numbers in a contiguous array. */\r\n public param?: GrowableXYArray;\r\n /** Indics of params at facet vertices. */\r\n public paramIndex: number[] | undefined;\r\n /** Color values. These are carried around as simple numbers, but are probably\r\n * required (by display systems) map exactly to 32 bit integers.\r\n */\r\n public color: number[] | undefined;\r\n /** Indices of colors at facet vertices. */\r\n public colorIndex: number[] | undefined;\r\n /** Face data will remain empty until a face is specified. */\r\n public face: FacetFaceData[];\r\n /** Auxiliary data */\r\n public auxData: PolyfaceAuxData | undefined;\r\n /** Tagged geometry data */\r\n public taggedNumericData: TaggedNumericData | undefined;\r\n private _twoSided: boolean;\r\n /** boolean tag indicating if the facets are viewable from the back */\r\n public get twoSided(): boolean { return this._twoSided; }\r\n public set twoSided(value: boolean) { this._twoSided = value; }\r\n\r\n /** set the `taggedNumericData` member */\r\n public setTaggedNumericData(data: TaggedNumericData | undefined) {\r\n this.taggedNumericData = data;\r\n }\r\n private _expectedClosure: number;\r\n /** boolean tag indicating if the facets are viewable from the back */\r\n public get expectedClosure(): number { return this._expectedClosure; }\r\n public set expectedClosure(value: number) { this._expectedClosure = value; }\r\n /** Constructor for facets.\r\n * * The various params control whether respective arrays are to be allocated.\r\n * * If arrayData is provided, all other params are IGNORED.\r\n * *\r\n */\r\n public constructor(needNormals: boolean = false, needParams: boolean = false, needColors: boolean = false, twoSided: boolean = false) {\r\n this.face = [];\r\n this.point = new GrowableXYZArray();\r\n this.pointIndex = []; this.edgeVisible = [];\r\n if (needNormals) { this.normal = new GrowableXYZArray(); this.normalIndex = []; }\r\n if (needParams) { this.param = new GrowableXYArray(); this.paramIndex = []; }\r\n if (needColors) { this.color = []; this.colorIndex = []; }\r\n this._twoSided = twoSided;\r\n this._expectedClosure = 0;\r\n }\r\n /** Return a depp clone. */\r\n public clone(): PolyfaceData {\r\n const result = new PolyfaceData();\r\n result.point = this.point.clone();\r\n result.pointIndex = this.pointIndex.slice();\r\n result.edgeVisible = this.edgeVisible.slice();\r\n result.face = this.face.slice();\r\n result.twoSided = this.twoSided;\r\n result.expectedClosure = this.expectedClosure;\r\n if (this.normal)\r\n result.normal = this.normal.clone();\r\n if (this.param)\r\n result.param = this.param.clone();\r\n if (this.color)\r\n result.color = this.color.slice();\r\n\r\n if (this.normalIndex)\r\n result.normalIndex = this.normalIndex.slice();\r\n if (this.paramIndex)\r\n result.paramIndex = this.paramIndex.slice();\r\n if (this.colorIndex)\r\n result.colorIndex = this.colorIndex.slice();\r\n if (this.auxData)\r\n result.auxData = this.auxData.clone();\r\n if (this.taggedNumericData){\r\n result.taggedNumericData = this.taggedNumericData.clone();\r\n }\r\n return result;\r\n }\r\n /** Test for equal indices and nearly equal coordinates */\r\n public isAlmostEqual(other: PolyfaceData): boolean {\r\n if (!GrowableXYZArray.isAlmostEqual(this.point, other.point))\r\n return false;\r\n if (!NumberArray.isExactEqual(this.pointIndex, other.pointIndex))\r\n return false;\r\n\r\n if (!GrowableXYZArray.isAlmostEqual(this.normal, other.normal)) return false;\r\n if (!NumberArray.isExactEqual(this.normalIndex, other.normalIndex)) return false;\r\n\r\n if (!GrowableXYArray.isAlmostEqual(this.param, other.param)) return false;\r\n if (!NumberArray.isExactEqual(this.paramIndex, other.paramIndex)) return false;\r\n\r\n if (!NumberArray.isExactEqual(this.color, other.color)) return false;\r\n if (!NumberArray.isExactEqual(this.colorIndex, other.colorIndex)) return false;\r\n\r\n if (!NumberArray.isExactEqual(this.edgeVisible, other.edgeVisible)) return false;\r\n if (!PolyfaceAuxData.isAlmostEqual(this.auxData, other.auxData)) return false;\r\n\r\n if (this.twoSided !== other.twoSided)\r\n return false;\r\n\r\n if (this.expectedClosure !== other.expectedClosure)\r\n return false;\r\n if (!TaggedNumericData.areAlmostEqual(this.taggedNumericData, other.taggedNumericData))\r\n return false;\r\n return true;\r\n }\r\n /** Ask if normals are required in this mesh. */\r\n public get requireNormals(): boolean { return undefined !== this.normal; }\r\n /** Get the point count */\r\n public get pointCount() { return this.point.length; }\r\n /** Get the normal count */\r\n public get normalCount() { return this.normal ? this.normal.length : 0; }\r\n /** Get the param count */\r\n public get paramCount() { return this.param ? this.param.length : 0; }\r\n /** Get the color count */\r\n public get colorCount() { return this.color ? this.color.length : 0; }\r\n /** Get the index count. Note that there is one count, and all index arrays (point, normal, param, color) must match */\r\n public get indexCount() { return this.pointIndex.length; } // ALWAYS INDEXED ... all index vectors must have same length.\r\n /** Get the number of faces.\r\n * * Note that a \"face\" is not a facet.\r\n * * A \"face\" is a subset of facets grouped for application purposes.\r\n */\r\n public get faceCount() { return this.face.length; }\r\n\r\n /** return indexed point. This is a copy of the coordinates, not a reference. */\r\n public getPoint(i: number, out?: Point3d): Point3d | undefined {\r\n return this.point.getPoint3dAtCheckedPointIndex(i, out);\r\n }\r\n /** return indexed normal. This is the COPY to the normal, not a reference. */\r\n public getNormal(i: number): Vector3d | undefined { return this.normal ? this.normal.getVector3dAtCheckedVectorIndex(i) : undefined; }\r\n /** return indexed param. This is the COPY of the coordinates, not a reference. */\r\n public getParam(i: number): Point2d | undefined { return this.param ? this.param.getPoint2dAtCheckedPointIndex(i) : undefined; }\r\n /** return indexed color */\r\n public getColor(i: number): number { return this.color ? this.color[i] : 0; }\r\n /** return indexed visibility */\r\n public getEdgeVisible(i: number): boolean { return this.edgeVisible[i]; }\r\n /** Copy the contents (not pointer) of point[i] into dest. */\r\n public copyPointTo(i: number, dest: Point3d): void { this.point.getPoint3dAtUncheckedPointIndex(i, dest); }\r\n /** Copy the contents (not pointer) of normal[i] into dest. */\r\n public copyNormalTo(i: number, dest: Vector3d): void { if (this.normal) this.normal.getVector3dAtCheckedVectorIndex(i, dest); }\r\n /** Copy the contents (not pointer) of param[i] into dest. */\r\n public copyParamTo(i: number, dest: Point2d): void { if (this.param) this.param.getPoint2dAtCheckedPointIndex(i, dest); }\r\n /** test if normal at a specified index matches uv */\r\n public isAlmostEqualParamIndexUV(index: number, u: number, v: number): boolean {\r\n if (this.param !== undefined && index >= 0 && index < this.param.length)\r\n return Geometry.isSameCoordinate(u, this.param.getXAtUncheckedPointIndex(index))\r\n && Geometry.isSameCoordinate(v, this.param.getYAtUncheckedPointIndex(index));\r\n return false;\r\n }\r\n /**\r\n * * Copy data from other to this.\r\n * * This is the essence of transferring coordinates spread throughout a large polyface into a visitor's single facet.\r\n * * \"other\" is the large polyface\r\n * * \"this\" is the visitor\r\n * * does NOT copy face data - visitors reference the FacetFaceData array for the whole polyface!!\r\n * @param other polyface data being mined.\r\n * @param index0 start index in other's index arrays\r\n * @param index1 end index (one beyond last data accessed0 in other's index arrays\r\n * @param numWrap number of points to replicate as wraparound.\r\n */\r\n public gatherIndexedData(other: PolyfaceData, index0: number, index1: number, numWrap: number) {\r\n const numEdge = index1 - index0;\r\n const numTotal = numEdge + numWrap;\r\n this.resizeAllDataArrays(numTotal);\r\n // copy wrapped points\r\n for (let i = 0; i < numEdge; i++)\r\n this.point.transferFromGrowableXYZArray(i, other.point, other.pointIndex[index0 + i]);\r\n for (let i = 0; i < numWrap; i++)\r\n this.point.transferFromGrowableXYZArray(numEdge + i, this.point, i);\r\n\r\n // copy wrapped pointIndex\r\n for (let i = 0; i < numEdge; i++)\r\n this.pointIndex[i] = other.pointIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.pointIndex[numEdge + i] = this.pointIndex[i];\r\n // copy wrapped edge visibility\r\n for (let i = 0; i < numEdge; i++)\r\n this.edgeVisible[i] = other.edgeVisible[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.edgeVisible[numEdge + i] = this.edgeVisible[i];\r\n\r\n if (this.normal && this.normalIndex && other.normal && other.normalIndex) {\r\n for (let i = 0; i < numEdge; i++)\r\n this.normal.transferFromGrowableXYZArray(i, other.normal, other.normalIndex[index0 + i]);\r\n for (let i = 0; i < numWrap; i++)\r\n this.normal.transferFromGrowableXYZArray(numEdge + i, this.normal, i);\r\n\r\n for (let i = 0; i < numEdge; i++)\r\n this.normalIndex[i] = other.normalIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.normalIndex[numEdge + i] = this.normalIndex[i];\r\n }\r\n\r\n if (this.param && this.paramIndex && other.param && other.paramIndex) {\r\n for (let i = 0; i < numEdge; i++)\r\n this.param.transferFromGrowableXYArray(i, other.param, other.paramIndex[index0 + i]);\r\n for (let i = 0; i < numWrap; i++)\r\n this.param.transferFromGrowableXYArray(numEdge + i, this.param, i);\r\n\r\n for (let i = 0; i < numEdge; i++)\r\n this.paramIndex[i] = other.paramIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.paramIndex[numEdge + i] = this.paramIndex[i];\r\n }\r\n\r\n if (this.color && this.colorIndex && other.color && other.colorIndex) {\r\n for (let i = 0; i < numEdge; i++)\r\n this.color[i] = other.color[other.colorIndex[index0 + i]];\r\n for (let i = 0; i < numWrap; i++)\r\n this.color[numEdge + i] = this.color[i];\r\n\r\n for (let i = 0; i < numEdge; i++)\r\n this.colorIndex[i] = other.colorIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.colorIndex[numEdge + i] = this.colorIndex[i];\r\n }\r\n if (this.auxData && other.auxData && this.auxData.channels.length === other.auxData.channels.length) {\r\n for (let iChannel = 0; iChannel < this.auxData.channels.length; iChannel++) {\r\n const thisChannel = this.auxData.channels[iChannel];\r\n const otherChannel = other.auxData.channels[iChannel];\r\n const blockSize = thisChannel.entriesPerValue;\r\n if (thisChannel.data.length === otherChannel.data.length) {\r\n for (let iData = 0; iData < thisChannel.data.length; iData++) {\r\n const thisData = thisChannel.data[iData];\r\n const otherData = otherChannel.data[iData];\r\n for (let i = 0; i < numEdge; i++)\r\n thisData.copyValues(otherData, i, other.auxData.indices[index0 + i], blockSize);\r\n for (let i = 0; i < numWrap; i++)\r\n thisData.copyValues(thisData, other.auxData.indices[numEdge + i], i, blockSize);\r\n }\r\n }\r\n }\r\n for (let i = 0; i < numEdge; i++)\r\n this.auxData.indices[i] = other.auxData.indices[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.auxData.indices[numEdge + i] = this.auxData.indices[i];\r\n }\r\n }\r\n private static trimArray(data: any[] | undefined, length: number) { if (data && length < data.length) data.length = length; }\r\n /** Trim all index arrays to stated length.\r\n * * This is called by PolyfaceBuilder to clean up after an aborted construction sequence.\r\n */\r\n public trimAllIndexArrays(length: number): void {\r\n PolyfaceData.trimArray(this.pointIndex, length);\r\n PolyfaceData.trimArray(this.paramIndex, length);\r\n PolyfaceData.trimArray(this.normalIndex, length);\r\n PolyfaceData.trimArray(this.colorIndex, length);\r\n PolyfaceData.trimArray(this.edgeVisible, length);\r\n if (this.auxData) {\r\n PolyfaceData.trimArray(this.auxData.indices, length);\r\n for (const channel of this.auxData.channels) {\r\n for (const data of channel.data)\r\n PolyfaceData.trimArray(data.values, channel.entriesPerValue * length);\r\n }\r\n }\r\n }\r\n /** Resize all data arrays to specified length */\r\n public resizeAllDataArrays(length: number): void {\r\n if (length > this.point.length) {\r\n while (this.point.length < length) this.point.push(Point3d.create());\r\n while (this.pointIndex.length < length) this.pointIndex.push(-1);\r\n while (this.edgeVisible.length < length) this.edgeVisible.push(false);\r\n if (this.normal)\r\n while (this.normal.length < length) this.normal.push(Vector3d.create());\r\n if (this.param)\r\n while (this.param.length < length) this.param.push(Point2d.create());\r\n if (this.color)\r\n while (this.color.length < length) this.color.push(0);\r\n if (this.auxData) {\r\n for (const channel of this.auxData.channels) {\r\n for (const channelData of channel.data) {\r\n while (channelData.values.length < length * channel.entriesPerValue) channelData.values.push(0);\r\n }\r\n }\r\n }\r\n } else if (length < this.point.length) {\r\n this.point.resize(length);\r\n this.edgeVisible.length = length;\r\n this.pointIndex.length = length;\r\n if (this.normal) this.normal.resize(length);\r\n if (this.param) this.param.resize(length);\r\n if (this.color) this.color.length = length;\r\n if (this.auxData) {\r\n for (const channel of this.auxData.channels) {\r\n for (const channelData of channel.data) {\r\n channelData.values.length = length * channel.entriesPerValue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /** Return the range of the point array (optionally transformed) */\r\n public range(result?: Range3d, transform?: Transform): Range3d {\r\n result = result ? result : Range3d.createNull();\r\n result.extendArray(this.point, transform);\r\n return result;\r\n }\r\n /** reverse indices facet-by-facet, with the given facetStartIndex array delimiting faces.\r\n *\r\n * * facetStartIndex[0] == 0 always -- start of facet zero.\r\n * * facet k has indices from facetStartIndex[k] <= i < facetStartIndex[k+1]\r\n * * hence for \"internal\" k, facetStartIndex[k] is both the upper limit of facet k-1 and the start of facet k.\r\n * *\r\n */\r\n public reverseIndices(facetStartIndex?: number[]) {\r\n if (facetStartIndex && PolyfaceData.isValidFacetStartIndexArray(facetStartIndex)) {\r\n PolyfaceData.reverseIndices(facetStartIndex, this.pointIndex, true);\r\n if (this.normalIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndices(facetStartIndex, this.normalIndex, true);\r\n if (this.paramIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndices(facetStartIndex, this.paramIndex, true);\r\n if (this.colorIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndices(facetStartIndex, this.colorIndex, true);\r\n PolyfaceData.reverseIndices(facetStartIndex, this.edgeVisible, false);\r\n }\r\n }\r\n /** reverse indices facet-by-facet, with the given facetStartIndex array delimiting faces.\r\n *\r\n * * facetStartIndex[0] == 0 always -- start of facet zero.\r\n * * facet k has indices from facetStartIndex[k] <= i < facetStartIndex[k+1]\r\n * * hence for \"internal\" k, facetStartIndex[k] is both the upper limit of facet k-1 and the start of facet k.\r\n * *\r\n */\r\n public reverseIndicesSingleFacet(facetId: number, facetStartIndex: number[]) {\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.pointIndex, true);\r\n if (this.normalIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.normalIndex, true);\r\n if (this.paramIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.paramIndex, true);\r\n if (this.colorIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.colorIndex, true);\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.edgeVisible, false);\r\n }\r\n\r\n /** Scale all the normals by -1 */\r\n public reverseNormals() {\r\n if (this.normal)\r\n this.normal.scaleInPlace(-1.0);\r\n }\r\n /** Apply `transform` to point and normal arrays and to auxData.\r\n * * IMPORTANT This base class is just a data carrier. It does not know if the index order and normal directions have special meaning.\r\n * * i.e. caller must separately reverse index order and normal direction if needed.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n this.point.multiplyTransformInPlace(transform);\r\n\r\n if (this.normal && !transform.matrix.isIdentity)\r\n this.normal.multiplyAndRenormalizeMatrix3dInverseTransposeInPlace(transform.matrix);\r\n\r\n return undefined === this.auxData || this.auxData.tryTransformInPlace(transform);\r\n }\r\n /**\r\n * * Search for duplication of coordinates within points, normals, and params.\r\n * * compress the coordinate arrays.\r\n * * revise all indexing for the relocated coordinates\r\n */\r\n public compress() {\r\n const packedPoints = ClusterableArray.clusterGrowablePoint3dArray(this.point);\r\n this.point = packedPoints.growablePackedPoints!;\r\n packedPoints.updateIndices(this.pointIndex);\r\n // compressUnusedGrowableXYZArray(this.point, this.pointIndex);\r\n\r\n if (this.normalIndex && this.normal) {\r\n const packedNormals = ClusterableArray.clusterGrowablePoint3dArray(this.normal);\r\n this.normal = packedNormals.growablePackedPoints!;\r\n packedNormals.updateIndices(this.normalIndex);\r\n }\r\n\r\n if (this.paramIndex && this.param) {\r\n const packedParams = ClusterableArray.clusterGrowablePoint2dArray(this.param);\r\n this.param = packedParams.growablePackedPoints;\r\n packedParams.updateIndices(this.paramIndex);\r\n }\r\n }\r\n\r\n /**\r\n * Test if facetStartIndex is (minimally!) valid:\r\n * * length must be nonzero (recall that for \"no facets\" the facetStartIndexArray still must contain a 0)\r\n * * Each entry must be strictly smaller than the one that follows.\r\n * @param facetStartIndex array of facetStart data. facet `i` has indices at `facetsStartIndex[i]` to (one before) `facetStartIndex[i+1]`\r\n */\r\n public static isValidFacetStartIndexArray(facetStartIndex: number[]): boolean {\r\n // facetStartIndex for empty facets has a single entry \"0\" -- empty array is not allowed\r\n if (facetStartIndex.length === 0)\r\n return false;\r\n for (let i = 0; i + 1 < facetStartIndex.length; i++)\r\n if (facetStartIndex[i] >= facetStartIndex[i + 1])\r\n return false;\r\n return true;\r\n }\r\n /** Reverse data in entire facet indexing arrays.\r\n * * parameterized over type T so non-number data -- e.g. boolean visibility flags -- can be reversed.\r\n */\r\n public static reverseIndices<T>(facetStartIndex: number[], indices: T[] | undefined, preserveStart: boolean): boolean {\r\n if (!indices || indices.length === 0)\r\n return true; // empty case\r\n if (indices.length > 0) {\r\n if (facetStartIndex[facetStartIndex.length - 1] === indices.length) {\r\n for (let i = 0; i + 1 < facetStartIndex.length; i++) {\r\n let index0 = facetStartIndex[i];\r\n let index1 = facetStartIndex[i + 1];\r\n if (preserveStart) {\r\n // leave [index0] as is so reversed facet starts at same vertex\r\n while (index1 > index0 + 2) {\r\n index1--; index0++;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n }\r\n } else {\r\n // reverse all\r\n while (index1 > index0 + 1) {\r\n index1--;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n index0++;\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /** Reverse data in entire facet indexing arrays.\r\n * * parameterized over type T so non-number data -- e.g. boolean visibility flags -- can be reversed.\r\n */\r\n public static reverseIndicesSingleFacet<T>(facetId: number, facetStartIndex: number[], indices: T[] | undefined, preserveStart: boolean): boolean {\r\n if (!indices || indices.length === 0)\r\n return true; // empty case\r\n if (indices.length > 0) {\r\n if (facetStartIndex[facetStartIndex.length - 1] === indices.length\r\n && facetId >= 0 && facetId + 1 < facetStartIndex.length) {\r\n let index0 = facetStartIndex[facetId];\r\n let index1 = facetStartIndex[facetId + 1];\r\n if (preserveStart) {\r\n // leave [index0] as is so reversed facet starts at same vertex\r\n while (index1 > index0 + 2) {\r\n index1--; index0++;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n }\r\n } else {\r\n // reverse all\r\n while (index1 > index0 + 1) {\r\n index1--;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n index0++;\r\n }\r\n }\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * pack out data entries that are unreferenced.\r\n * @param data data to pack\r\n * @param indices indices into the data.\r\n\r\nfunction compressUnusedGrowableXYZArray(data: GrowableXYZArray, indices: number[]): boolean {\r\n // 1 entry per data[i]\r\n // pass 0: number of references\r\n // pass 1: post-compression index (or -1)\r\n const n0 = data.length;\r\n const work = new Int32Array(data.length);\r\n for (const k of indices) {\r\n if (k < 0 || k >= n0)\r\n return false;\r\n work[k]++;\r\n }\r\n let n1 = 0;\r\n for (let i = 0; i < n0; i++) {\r\n if (work[i] === 0)\r\n work[i] = -1;\r\n else\r\n work[i] = n1++;\r\n }\r\n const numIndex = indices.length;\r\n for (let i = 0; i < numIndex; i++) {\r\n indices[i] = work[indices[i]];\r\n }\r\n for (let i = 0; i < n0; i++) {\r\n const j = work[i];\r\n if (j >= 0)\r\n data.moveIndexToIndex(i, j);\r\n }\r\n data.length = n1;\r\n return true;\r\n}\r\n*/\r\n"]}
1
+ {"version":3,"file":"PolyfaceData.js","sourceRoot":"","sources":["../../../src/polyface/PolyfaceData.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE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,CAAC,CAAC,KAAK,OAAO,CAAC,MAAM;mBAC7D,OAAO,IAAI,CAAC,IAAI,OAAO,GAAG,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE;gBACzD,IAAI,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;gBACtC,IAAI,MAAM,GAAG,eAAe,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;gBAC1C,IAAI,aAAa,EAAE;oBACjB,+DAA+D;oBAC/D,OAAO,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE;wBAC1B,MAAM,EAAE,CAAC;wBAAC,MAAM,EAAE,CAAC;wBACnB,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;wBAC1B,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;wBAClC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;qBACrB;iBACF;qBAAM;oBACL,cAAc;oBACd,OAAO,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE;wBAC1B,MAAM,EAAE,CAAC;wBACT,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;wBAC1B,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;wBAClC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBACpB,MAAM,EAAE,CAAC;qBACV;iBACF;gBACD,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AAneD,MAAM;AACN,iFAAiF;AACjF,8CAA8C;AAC9C,oFAAoF;AACpF,qDAAqD;AACrD,2CAA2C;AAC3C,sDAAsD;AACtD,0DAA0D;AAC1D,QAAQ;AACR;;GAEG;AACoB,iCAAoB,GAAG,OAAO,CAAC;AA0dxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCE","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Polyface\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GrowableXYArray } from \"../geometry3d/GrowableXYArray\";\r\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\r\nimport { Point2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { NumberArray } from \"../geometry3d/PointHelpers\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { ClusterableArray } from \"../numerics/ClusterableArray\";\r\nimport { PolyfaceAuxData } from \"./AuxData\";\r\nimport { FacetFaceData } from \"./FacetFaceData\";\r\nimport { TaggedNumericData } from \"./TaggedNumericData\";\r\n\r\n/**\r\n * PolyfaceData carries data arrays for point, normal, param, color and their indices.\r\n *\r\n * * IndexedPolyface carries a PolyfaceData as a member. (NOT as a base class -- it already has GeometryQuery as base)\r\n * * IndexedPolyfaceVisitor uses PolyfaceData as a base class. In this use there is only a single facet in the polyfaceData.\r\n * * PolyfaceData does not know (!!!) what indices range constitute a facet. That is managed by derived class or carrier class.\r\n * @public\r\n */\r\nexport class PolyfaceData {\r\n // <ul\r\n // <li>optional arrays (normal, uv, color) must be indicated at constructor time.\r\n // <li>all arrays are (independently) indexed.\r\n // <li>with regret, the point, param, normal, and color arrays are exposed publicly.\r\n // <li>getX methods are \"trusting\" -- no bounds check\r\n // <li>getX methods return references to X.\r\n // <li> EXCEPT -- for optional arrays, the return 000.\r\n // <li>copyX methods move data to caller-supplied result..\r\n // </ul>\r\n /** Relative tolerance used in tests for planar facets\r\n * @internal\r\n */\r\n public static readonly planarityLocalRelTol = 1.0e-13;\r\n /** Coordinate data for points in the facets, packed as numbers in a contiguous array. */\r\n public point: GrowableXYZArray;\r\n /** Indices of points at facet vertices. */\r\n public pointIndex: number[];\r\n /** booleans indicating visibility of corresponding edges */\r\n public edgeVisible: boolean[];\r\n /** Coordinates of normal vectors, packed as numbers in a contiguous array */\r\n public normal: GrowableXYZArray | undefined;\r\n /** indices of normals at facet vertices. */\r\n public normalIndex: number[] | undefined;\r\n /** Coordinates of uv parameters, packed as numbers in a contiguous array. */\r\n public param?: GrowableXYArray;\r\n /** Indics of params at facet vertices. */\r\n public paramIndex: number[] | undefined;\r\n /** Color values. These are carried around as simple numbers, but are probably\r\n * required (by display systems) map exactly to 32 bit integers.\r\n */\r\n public color: number[] | undefined;\r\n /** Indices of colors at facet vertices. */\r\n public colorIndex: number[] | undefined;\r\n /** Face data will remain empty until a face is specified. */\r\n public face: FacetFaceData[];\r\n /** Auxiliary data */\r\n public auxData: PolyfaceAuxData | undefined;\r\n /** Tagged geometry data */\r\n public taggedNumericData: TaggedNumericData | undefined;\r\n private _twoSided: boolean;\r\n /** boolean tag indicating if the facets are viewable from the back */\r\n public get twoSided(): boolean { return this._twoSided; }\r\n public set twoSided(value: boolean) { this._twoSided = value; }\r\n\r\n /** set the `taggedNumericData` member */\r\n public setTaggedNumericData(data: TaggedNumericData | undefined) {\r\n this.taggedNumericData = data;\r\n }\r\n private _expectedClosure: number;\r\n /** boolean tag indicating if the facets are viewable from the back */\r\n public get expectedClosure(): number { return this._expectedClosure; }\r\n public set expectedClosure(value: number) { this._expectedClosure = value; }\r\n /** Constructor for facets.\r\n * * The various params control whether respective arrays are to be allocated.\r\n * * If arrayData is provided, all other params are IGNORED.\r\n * *\r\n */\r\n public constructor(needNormals: boolean = false, needParams: boolean = false, needColors: boolean = false, twoSided: boolean = false) {\r\n this.face = [];\r\n this.point = new GrowableXYZArray();\r\n this.pointIndex = []; this.edgeVisible = [];\r\n if (needNormals) { this.normal = new GrowableXYZArray(); this.normalIndex = []; }\r\n if (needParams) { this.param = new GrowableXYArray(); this.paramIndex = []; }\r\n if (needColors) { this.color = []; this.colorIndex = []; }\r\n this._twoSided = twoSided;\r\n this._expectedClosure = 0;\r\n }\r\n /** Return a depp clone. */\r\n public clone(): PolyfaceData {\r\n const result = new PolyfaceData();\r\n result.point = this.point.clone();\r\n result.pointIndex = this.pointIndex.slice();\r\n result.edgeVisible = this.edgeVisible.slice();\r\n result.face = this.face.slice();\r\n result.twoSided = this.twoSided;\r\n result.expectedClosure = this.expectedClosure;\r\n if (this.normal)\r\n result.normal = this.normal.clone();\r\n if (this.param)\r\n result.param = this.param.clone();\r\n if (this.color)\r\n result.color = this.color.slice();\r\n\r\n if (this.normalIndex)\r\n result.normalIndex = this.normalIndex.slice();\r\n if (this.paramIndex)\r\n result.paramIndex = this.paramIndex.slice();\r\n if (this.colorIndex)\r\n result.colorIndex = this.colorIndex.slice();\r\n if (this.auxData)\r\n result.auxData = this.auxData.clone();\r\n if (this.taggedNumericData){\r\n result.taggedNumericData = this.taggedNumericData.clone();\r\n }\r\n return result;\r\n }\r\n /** Test for equal indices and nearly equal coordinates */\r\n public isAlmostEqual(other: PolyfaceData): boolean {\r\n if (!GrowableXYZArray.isAlmostEqual(this.point, other.point))\r\n return false;\r\n if (!NumberArray.isExactEqual(this.pointIndex, other.pointIndex))\r\n return false;\r\n\r\n if (!GrowableXYZArray.isAlmostEqual(this.normal, other.normal)) return false;\r\n if (!NumberArray.isExactEqual(this.normalIndex, other.normalIndex)) return false;\r\n\r\n if (!GrowableXYArray.isAlmostEqual(this.param, other.param)) return false;\r\n if (!NumberArray.isExactEqual(this.paramIndex, other.paramIndex)) return false;\r\n\r\n if (!NumberArray.isExactEqual(this.color, other.color)) return false;\r\n if (!NumberArray.isExactEqual(this.colorIndex, other.colorIndex)) return false;\r\n\r\n if (!NumberArray.isExactEqual(this.edgeVisible, other.edgeVisible)) return false;\r\n if (!PolyfaceAuxData.isAlmostEqual(this.auxData, other.auxData)) return false;\r\n\r\n if (this.twoSided !== other.twoSided)\r\n return false;\r\n\r\n if (this.expectedClosure !== other.expectedClosure)\r\n return false;\r\n if (!TaggedNumericData.areAlmostEqual(this.taggedNumericData, other.taggedNumericData))\r\n return false;\r\n return true;\r\n }\r\n /** Ask if normals are required in this mesh. */\r\n public get requireNormals(): boolean { return undefined !== this.normal; }\r\n /** Get the point count */\r\n public get pointCount() { return this.point.length; }\r\n /** Get the normal count */\r\n public get normalCount() { return this.normal ? this.normal.length : 0; }\r\n /** Get the param count */\r\n public get paramCount() { return this.param ? this.param.length : 0; }\r\n /** Get the color count */\r\n public get colorCount() { return this.color ? this.color.length : 0; }\r\n /** Get the index count. Note that there is one count, and all index arrays (point, normal, param, color) must match */\r\n public get indexCount() { return this.pointIndex.length; } // ALWAYS INDEXED ... all index vectors must have same length.\r\n /** Get the number of faces.\r\n * * Note that a \"face\" is not a facet.\r\n * * A \"face\" is a subset of facets grouped for application purposes.\r\n */\r\n public get faceCount() { return this.face.length; }\r\n\r\n /** return indexed point. This is a copy of the coordinates, not a reference. */\r\n public getPoint(i: number, out?: Point3d): Point3d | undefined {\r\n return this.point.getPoint3dAtCheckedPointIndex(i, out);\r\n }\r\n /** return indexed normal. This is the COPY to the normal, not a reference. */\r\n public getNormal(i: number): Vector3d | undefined { return this.normal ? this.normal.getVector3dAtCheckedVectorIndex(i) : undefined; }\r\n /** return indexed param. This is the COPY of the coordinates, not a reference. */\r\n public getParam(i: number): Point2d | undefined { return this.param ? this.param.getPoint2dAtCheckedPointIndex(i) : undefined; }\r\n /** return indexed color */\r\n public getColor(i: number): number { return this.color ? this.color[i] : 0; }\r\n /** return indexed visibility */\r\n public getEdgeVisible(i: number): boolean { return this.edgeVisible[i]; }\r\n /** Copy the contents (not pointer) of point[i] into dest. */\r\n public copyPointTo(i: number, dest: Point3d): void { this.point.getPoint3dAtUncheckedPointIndex(i, dest); }\r\n /** Copy the contents (not pointer) of normal[i] into dest. */\r\n public copyNormalTo(i: number, dest: Vector3d): void { if (this.normal) this.normal.getVector3dAtCheckedVectorIndex(i, dest); }\r\n /** Copy the contents (not pointer) of param[i] into dest. */\r\n public copyParamTo(i: number, dest: Point2d): void { if (this.param) this.param.getPoint2dAtCheckedPointIndex(i, dest); }\r\n /** test if normal at a specified index matches uv */\r\n public isAlmostEqualParamIndexUV(index: number, u: number, v: number): boolean {\r\n if (this.param !== undefined && index >= 0 && index < this.param.length)\r\n return Geometry.isSameCoordinate(u, this.param.getXAtUncheckedPointIndex(index))\r\n && Geometry.isSameCoordinate(v, this.param.getYAtUncheckedPointIndex(index));\r\n return false;\r\n }\r\n /**\r\n * * Copy data from other to this.\r\n * * This is the essence of transferring coordinates spread throughout a large polyface into a visitor's single facet.\r\n * * \"other\" is the large polyface\r\n * * \"this\" is the visitor\r\n * * does NOT copy face data - visitors reference the FacetFaceData array for the whole polyface!!\r\n * @param other polyface data being mined.\r\n * @param index0 start index in other's index arrays\r\n * @param index1 end index (one beyond last data accessed0 in other's index arrays\r\n * @param numWrap number of points to replicate as wraparound.\r\n */\r\n public gatherIndexedData(other: PolyfaceData, index0: number, index1: number, numWrap: number) {\r\n const numEdge = index1 - index0;\r\n const numTotal = numEdge + numWrap;\r\n this.resizeAllDataArrays(numTotal);\r\n // copy wrapped points\r\n for (let i = 0; i < numEdge; i++)\r\n this.point.transferFromGrowableXYZArray(i, other.point, other.pointIndex[index0 + i]);\r\n for (let i = 0; i < numWrap; i++)\r\n this.point.transferFromGrowableXYZArray(numEdge + i, this.point, i);\r\n\r\n // copy wrapped pointIndex\r\n for (let i = 0; i < numEdge; i++)\r\n this.pointIndex[i] = other.pointIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.pointIndex[numEdge + i] = this.pointIndex[i];\r\n // copy wrapped edge visibility\r\n for (let i = 0; i < numEdge; i++)\r\n this.edgeVisible[i] = other.edgeVisible[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.edgeVisible[numEdge + i] = this.edgeVisible[i];\r\n\r\n if (this.normal && this.normalIndex && other.normal && other.normalIndex) {\r\n for (let i = 0; i < numEdge; i++)\r\n this.normal.transferFromGrowableXYZArray(i, other.normal, other.normalIndex[index0 + i]);\r\n for (let i = 0; i < numWrap; i++)\r\n this.normal.transferFromGrowableXYZArray(numEdge + i, this.normal, i);\r\n\r\n for (let i = 0; i < numEdge; i++)\r\n this.normalIndex[i] = other.normalIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.normalIndex[numEdge + i] = this.normalIndex[i];\r\n }\r\n\r\n if (this.param && this.paramIndex && other.param && other.paramIndex) {\r\n for (let i = 0; i < numEdge; i++)\r\n this.param.transferFromGrowableXYArray(i, other.param, other.paramIndex[index0 + i]);\r\n for (let i = 0; i < numWrap; i++)\r\n this.param.transferFromGrowableXYArray(numEdge + i, this.param, i);\r\n\r\n for (let i = 0; i < numEdge; i++)\r\n this.paramIndex[i] = other.paramIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.paramIndex[numEdge + i] = this.paramIndex[i];\r\n }\r\n\r\n if (this.color && this.colorIndex && other.color && other.colorIndex) {\r\n for (let i = 0; i < numEdge; i++)\r\n this.color[i] = other.color[other.colorIndex[index0 + i]];\r\n for (let i = 0; i < numWrap; i++)\r\n this.color[numEdge + i] = this.color[i];\r\n\r\n for (let i = 0; i < numEdge; i++)\r\n this.colorIndex[i] = other.colorIndex[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.colorIndex[numEdge + i] = this.colorIndex[i];\r\n }\r\n if (this.auxData && other.auxData && this.auxData.channels.length === other.auxData.channels.length) {\r\n for (let iChannel = 0; iChannel < this.auxData.channels.length; iChannel++) {\r\n const thisChannel = this.auxData.channels[iChannel];\r\n const otherChannel = other.auxData.channels[iChannel];\r\n const blockSize = thisChannel.entriesPerValue;\r\n if (thisChannel.data.length === otherChannel.data.length) {\r\n for (let iData = 0; iData < thisChannel.data.length; iData++) {\r\n const thisData = thisChannel.data[iData];\r\n const otherData = otherChannel.data[iData];\r\n for (let i = 0; i < numEdge; i++)\r\n thisData.copyValues(otherData, i, other.auxData.indices[index0 + i], blockSize);\r\n for (let i = 0; i < numWrap; i++)\r\n thisData.copyValues(thisData, other.auxData.indices[numEdge + i], i, blockSize);\r\n }\r\n }\r\n }\r\n for (let i = 0; i < numEdge; i++)\r\n this.auxData.indices[i] = other.auxData.indices[index0 + i];\r\n for (let i = 0; i < numWrap; i++)\r\n this.auxData.indices[numEdge + i] = this.auxData.indices[i];\r\n }\r\n }\r\n private static trimArray(data: any[] | undefined, length: number) { if (data && length < data.length) data.length = length; }\r\n /** Trim all index arrays to stated length.\r\n * * This is called by PolyfaceBuilder to clean up after an aborted construction sequence.\r\n */\r\n public trimAllIndexArrays(length: number): void {\r\n PolyfaceData.trimArray(this.pointIndex, length);\r\n PolyfaceData.trimArray(this.paramIndex, length);\r\n PolyfaceData.trimArray(this.normalIndex, length);\r\n PolyfaceData.trimArray(this.colorIndex, length);\r\n PolyfaceData.trimArray(this.edgeVisible, length);\r\n if (this.auxData) {\r\n PolyfaceData.trimArray(this.auxData.indices, length);\r\n for (const channel of this.auxData.channels) {\r\n for (const data of channel.data)\r\n PolyfaceData.trimArray(data.values, channel.entriesPerValue * length);\r\n }\r\n }\r\n }\r\n /** Resize all data arrays to specified length */\r\n public resizeAllDataArrays(length: number): void {\r\n if (length > this.point.length) {\r\n while (this.point.length < length) this.point.push(Point3d.create());\r\n while (this.pointIndex.length < length) this.pointIndex.push(-1);\r\n while (this.edgeVisible.length < length) this.edgeVisible.push(false);\r\n if (this.normal)\r\n while (this.normal.length < length) this.normal.push(Vector3d.create());\r\n if (this.param)\r\n while (this.param.length < length) this.param.push(Point2d.create());\r\n if (this.color)\r\n while (this.color.length < length) this.color.push(0);\r\n if (this.auxData) {\r\n for (const channel of this.auxData.channels) {\r\n for (const channelData of channel.data) {\r\n while (channelData.values.length < length * channel.entriesPerValue) channelData.values.push(0);\r\n }\r\n }\r\n }\r\n } else if (length < this.point.length) {\r\n this.point.resize(length);\r\n this.edgeVisible.length = length;\r\n this.pointIndex.length = length;\r\n if (this.normal) this.normal.resize(length);\r\n if (this.param) this.param.resize(length);\r\n if (this.color) this.color.length = length;\r\n if (this.auxData) {\r\n for (const channel of this.auxData.channels) {\r\n for (const channelData of channel.data) {\r\n channelData.values.length = length * channel.entriesPerValue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /** Return the range of the point array (optionally transformed) */\r\n public range(result?: Range3d, transform?: Transform): Range3d {\r\n result = result ? result : Range3d.createNull();\r\n result.extendArray(this.point, transform);\r\n return result;\r\n }\r\n /** reverse indices facet-by-facet, with the given facetStartIndex array delimiting faces.\r\n *\r\n * * facetStartIndex[0] == 0 always -- start of facet zero.\r\n * * facet k has indices from facetStartIndex[k] <= i < facetStartIndex[k+1]\r\n * * hence for \"internal\" k, facetStartIndex[k] is both the upper limit of facet k-1 and the start of facet k.\r\n * *\r\n */\r\n public reverseIndices(facetStartIndex?: number[]) {\r\n if (facetStartIndex && PolyfaceData.isValidFacetStartIndexArray(facetStartIndex)) {\r\n PolyfaceData.reverseIndices(facetStartIndex, this.pointIndex, true);\r\n if (this.normalIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndices(facetStartIndex, this.normalIndex, true);\r\n if (this.paramIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndices(facetStartIndex, this.paramIndex, true);\r\n if (this.colorIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndices(facetStartIndex, this.colorIndex, true);\r\n PolyfaceData.reverseIndices(facetStartIndex, this.edgeVisible, false);\r\n }\r\n }\r\n /** reverse indices facet-by-facet, with the given facetStartIndex array delimiting faces.\r\n *\r\n * * facetStartIndex[0] == 0 always -- start of facet zero.\r\n * * facet k has indices from facetStartIndex[k] <= i < facetStartIndex[k+1]\r\n * * hence for \"internal\" k, facetStartIndex[k] is both the upper limit of facet k-1 and the start of facet k.\r\n * *\r\n */\r\n public reverseIndicesSingleFacet(facetId: number, facetStartIndex: number[]) {\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.pointIndex, true);\r\n if (this.normalIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.normalIndex, true);\r\n if (this.paramIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.paramIndex, true);\r\n if (this.colorIndex !== this.pointIndex)\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.colorIndex, true);\r\n PolyfaceData.reverseIndicesSingleFacet(facetId, facetStartIndex, this.edgeVisible, false);\r\n }\r\n\r\n /** Scale all the normals by -1 */\r\n public reverseNormals() {\r\n if (this.normal)\r\n this.normal.scaleInPlace(-1.0);\r\n }\r\n /** Apply `transform` to point and normal arrays and to auxData.\r\n * * IMPORTANT This base class is just a data carrier. It does not know if the index order and normal directions have special meaning.\r\n * * i.e. caller must separately reverse index order and normal direction if needed.\r\n */\r\n public tryTransformInPlace(transform: Transform): boolean {\r\n this.point.multiplyTransformInPlace(transform);\r\n\r\n if (this.normal && !transform.matrix.isIdentity)\r\n this.normal.multiplyAndRenormalizeMatrix3dInverseTransposeInPlace(transform.matrix);\r\n\r\n return undefined === this.auxData || this.auxData.tryTransformInPlace(transform);\r\n }\r\n /**\r\n * * Search for duplicates within points, normals, params, and colors.\r\n * * compress the data arrays.\r\n * * revise all indexing for the relocated data.\r\n */\r\n public compress() {\r\n const packedPoints = ClusterableArray.clusterGrowablePoint3dArray(this.point);\r\n this.point = packedPoints.growablePackedPoints!;\r\n packedPoints.updateIndices(this.pointIndex);\r\n // compressUnusedGrowableXYZArray(this.point, this.pointIndex);\r\n\r\n if (this.normalIndex && this.normal) {\r\n const packedNormals = ClusterableArray.clusterGrowablePoint3dArray(this.normal);\r\n this.normal = packedNormals.growablePackedPoints!;\r\n packedNormals.updateIndices(this.normalIndex);\r\n }\r\n\r\n if (this.paramIndex && this.param) {\r\n const packedParams = ClusterableArray.clusterGrowablePoint2dArray(this.param);\r\n this.param = packedParams.growablePackedPoints;\r\n packedParams.updateIndices(this.paramIndex);\r\n }\r\n\r\n if (this.colorIndex && this.color) {\r\n const packedColors = ClusterableArray.clusterNumberArray(this.color);\r\n this.color = packedColors.packedNumbers;\r\n packedColors.updateIndices(this.colorIndex);\r\n }\r\n }\r\n\r\n /**\r\n * Test if facetStartIndex is (minimally!) valid:\r\n * * length must be nonzero (recall that for \"no facets\" the facetStartIndexArray still must contain a 0)\r\n * * Each entry must be strictly smaller than the one that follows.\r\n * @param facetStartIndex array of facetStart data. facet `i` has indices at `facetsStartIndex[i]` to (one before) `facetStartIndex[i+1]`\r\n */\r\n public static isValidFacetStartIndexArray(facetStartIndex: number[]): boolean {\r\n // facetStartIndex for empty facets has a single entry \"0\" -- empty array is not allowed\r\n if (facetStartIndex.length === 0)\r\n return false;\r\n for (let i = 0; i + 1 < facetStartIndex.length; i++)\r\n if (facetStartIndex[i] >= facetStartIndex[i + 1])\r\n return false;\r\n return true;\r\n }\r\n /** Reverse data in entire facet indexing arrays.\r\n * * parameterized over type T so non-number data -- e.g. boolean visibility flags -- can be reversed.\r\n */\r\n public static reverseIndices<T>(facetStartIndex: number[], indices: T[] | undefined, preserveStart: boolean): boolean {\r\n if (!indices || indices.length === 0)\r\n return true; // empty case\r\n if (indices.length > 0) {\r\n if (facetStartIndex[facetStartIndex.length - 1] === indices.length) {\r\n for (let i = 0; i + 1 < facetStartIndex.length; i++) {\r\n let index0 = facetStartIndex[i];\r\n let index1 = facetStartIndex[i + 1];\r\n if (preserveStart) {\r\n // leave [index0] as is so reversed facet starts at same vertex\r\n while (index1 > index0 + 2) {\r\n index1--; index0++;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n }\r\n } else {\r\n // reverse all\r\n while (index1 > index0 + 1) {\r\n index1--;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n index0++;\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /** Reverse data in entire facet indexing arrays.\r\n * * parameterized over type T so non-number data -- e.g. boolean visibility flags -- can be reversed.\r\n */\r\n public static reverseIndicesSingleFacet<T>(facetId: number, facetStartIndex: number[], indices: T[] | undefined, preserveStart: boolean): boolean {\r\n if (!indices || indices.length === 0)\r\n return true; // empty case\r\n if (indices.length > 0) {\r\n if (facetStartIndex[facetStartIndex.length - 1] === indices.length\r\n && facetId >= 0 && facetId + 1 < facetStartIndex.length) {\r\n let index0 = facetStartIndex[facetId];\r\n let index1 = facetStartIndex[facetId + 1];\r\n if (preserveStart) {\r\n // leave [index0] as is so reversed facet starts at same vertex\r\n while (index1 > index0 + 2) {\r\n index1--; index0++;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n }\r\n } else {\r\n // reverse all\r\n while (index1 > index0 + 1) {\r\n index1--;\r\n const a = indices[index0];\r\n indices[index0] = indices[index1];\r\n indices[index1] = a;\r\n index0++;\r\n }\r\n }\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * pack out data entries that are unreferenced.\r\n * @param data data to pack\r\n * @param indices indices into the data.\r\n\r\nfunction compressUnusedGrowableXYZArray(data: GrowableXYZArray, indices: number[]): boolean {\r\n // 1 entry per data[i]\r\n // pass 0: number of references\r\n // pass 1: post-compression index (or -1)\r\n const n0 = data.length;\r\n const work = new Int32Array(data.length);\r\n for (const k of indices) {\r\n if (k < 0 || k >= n0)\r\n return false;\r\n work[k]++;\r\n }\r\n let n1 = 0;\r\n for (let i = 0; i < n0; i++) {\r\n if (work[i] === 0)\r\n work[i] = -1;\r\n else\r\n work[i] = n1++;\r\n }\r\n const numIndex = indices.length;\r\n for (let i = 0; i < numIndex; i++) {\r\n indices[i] = work[indices[i]];\r\n }\r\n for (let i = 0; i < n0; i++) {\r\n const j = work[i];\r\n if (j >= 0)\r\n data.moveIndexToIndex(i, j);\r\n }\r\n data.length = n1;\r\n return true;\r\n}\r\n*/\r\n"]}
@@ -48,8 +48,10 @@ export declare class PolyfaceQuery {
48
48
  static visitorToLoop(visitor: PolyfaceVisitor): Loop;
49
49
  /** Create a linestring loop for each facet of the polyface. */
50
50
  static indexedPolyfaceToLoops(polyface: Polyface): BagOfCurves;
51
- /** Return the sum of all facets areas. */
52
- static sumFacetAreas(source: Polyface | PolyfaceVisitor | undefined): number;
51
+ /** Return the sum of all facet areas.
52
+ * @param vectorToEye compute facet area projected to a view plane perpendicular to this vector
53
+ */
54
+ static sumFacetAreas(source: Polyface | PolyfaceVisitor | undefined, vectorToEye?: Vector3d): number;
53
55
  /** sum volumes of tetrahedra from origin to all facets.
54
56
  * * if origin is omitted, the first point encountered (by the visitor) is used as origin.
55
57
  * * If the mesh is closed, this sum is the volume.
@@ -89,7 +91,7 @@ export declare class PolyfaceQuery {
89
91
  /** Test edges pairing in `source` mesh.
90
92
  * * for `allowSimpleBoundaries === false` true return means this is a closed 2-manifold surface
91
93
  * * for `allowSimpleBoundaries === true` true means this is a 2-manifold surface which may have boundary, but is still properly matched internally.
92
- * * Any edge with 3 ore more incident facets triggers `false` return.
94
+ * * Any edge with 3 or more incident facets triggers `false` return.
93
95
  * * Any edge with 2 incident facets in the same direction triggers a `false` return.
94
96
  */
95
97
  static isPolyfaceManifold(source: Polyface, allowSimpleBoundaries?: boolean): boolean;
@@ -105,7 +107,7 @@ export declare class PolyfaceQuery {
105
107
  */
106
108
  static announceSweepLinestringToConvexPolyfaceXY(linestringPoints: GrowableXYZArray, polyface: Polyface, announce: AnnounceDrapePanel): any;
107
109
  /** Execute context.projectToPolygon until its work estimates accumulate to workLimit */
108
- private static continueAnnouunceSweepLinestringToConvexPolyfaceXY;
110
+ private static continueAnnounceSweepLinestringToConvexPolyfaceXY;
109
111
  private static _asyncWorkLimit;
110
112
  /** Set the limit on work during an async time blocks, and return the old value.
111
113
  * * This should be a large number -- default is 1.0e6
@@ -1 +1 @@
1
- {"version":3,"file":"PolyfaceQuery.d.ts","sourceRoot":"","sources":["../../../src/polyface/PolyfaceQuery.ts"],"names":[],"mappings":"AAKA;;GAEG;AAIH,OAAO,EAAE,WAAW,E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E,eAAe,EAAE,cAAc,GAAE,KAAiC;CAI/G;AAED;;;;;;;;;GASG;AACH,oBAAY,kBAAkB,GAAG,CAAC,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAClF,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,GAAG,CAAC"}
@@ -12,6 +12,7 @@ import { LineSegment3d } from "../curve/LineSegment3d";
12
12
  import { LineString3d } from "../curve/LineString3d";
13
13
  import { Loop } from "../curve/Loop";
14
14
  import { StrokeOptions } from "../curve/StrokeOptions";
15
+ import { Geometry } from "../Geometry";
15
16
  import { Angle } from "../geometry3d/Angle";
16
17
  import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
17
18
  import { PolygonOps } from "../geometry3d/PolygonOps";
@@ -63,15 +64,27 @@ export class PolyfaceQuery {
63
64
  }
64
65
  return result;
65
66
  }
66
- /** Return the sum of all facets areas. */
67
- static sumFacetAreas(source) {
67
+ /** Return the sum of all facet areas.
68
+ * @param vectorToEye compute facet area projected to a view plane perpendicular to this vector
69
+ */
70
+ static sumFacetAreas(source, vectorToEye) {
68
71
  let s = 0;
69
72
  if (source !== undefined) {
70
73
  if (source instanceof Polyface)
71
- return PolyfaceQuery.sumFacetAreas(source.createVisitor(1));
74
+ return PolyfaceQuery.sumFacetAreas(source.createVisitor(1), vectorToEye);
75
+ let unitVectorToEye;
76
+ if (vectorToEye !== undefined)
77
+ unitVectorToEye = vectorToEye.normalize();
72
78
  source.reset();
73
79
  while (source.moveToNextFacet()) {
74
- s += PolygonOps.areaNormal(source.point.getPoint3dArray()).magnitude();
80
+ const scaledNormal = PolygonOps.areaNormal(source.point.getPoint3dArray());
81
+ let area = scaledNormal.magnitude();
82
+ if (unitVectorToEye !== undefined) {
83
+ const scale = Geometry.conditionalDivideCoordinate(1.0, area);
84
+ if (scale !== undefined)
85
+ area *= scaledNormal.dotProduct(unitVectorToEye) * scale;
86
+ }
87
+ s += area;
75
88
  }
76
89
  }
77
90
  return s;
@@ -225,7 +238,7 @@ export class PolyfaceQuery {
225
238
  /** Test edges pairing in `source` mesh.
226
239
  * * for `allowSimpleBoundaries === false` true return means this is a closed 2-manifold surface
227
240
  * * for `allowSimpleBoundaries === true` true means this is a 2-manifold surface which may have boundary, but is still properly matched internally.
228
- * * Any edge with 3 ore more incident facets triggers `false` return.
241
+ * * Any edge with 3 or more incident facets triggers `false` return.
229
242
  * * Any edge with 2 incident facets in the same direction triggers a `false` return.
230
243
  */
231
244
  static isPolyfaceManifold(source, allowSimpleBoundaries = false) {
@@ -301,7 +314,7 @@ export class PolyfaceQuery {
301
314
  }
302
315
  }
303
316
  /** Execute context.projectToPolygon until its work estimates accumulate to workLimit */
304
- static async continueAnnouunceSweepLinestringToConvexPolyfaceXY(context, visitor, announce) {
317
+ static async continueAnnounceSweepLinestringToConvexPolyfaceXY(context, visitor, announce) {
305
318
  let workCount = 0;
306
319
  while ((workCount < this.asyncWorkLimit) && visitor.moveToNextFacet()) {
307
320
  workCount += context.projectToPolygon(visitor.point, announce, visitor.clientPolyface(), visitor.currentReadIndex());
@@ -331,7 +344,7 @@ export class PolyfaceQuery {
331
344
  if (context) {
332
345
  const visitor = polyface.createVisitor(0);
333
346
  let workCount;
334
- while (0 < (workCount = await Promise.resolve(PolyfaceQuery.continueAnnouunceSweepLinestringToConvexPolyfaceXY(context, visitor, announce)))) {
347
+ while (0 < (workCount = await Promise.resolve(PolyfaceQuery.continueAnnounceSweepLinestringToConvexPolyfaceXY(context, visitor, announce)))) {
335
348
  workTotal += workCount;
336
349
  this.awaitBlockCount++;
337
350
  // console.log({ myWorkCount: workCount, myBlockCount: this.awaitBlockCount });