@itwin/core-geometry 4.5.0-dev.4 → 4.5.0-dev.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/curve/CoordinateXYZ.d.ts +10 -13
- package/lib/cjs/curve/CoordinateXYZ.d.ts.map +1 -1
- package/lib/cjs/curve/CoordinateXYZ.js +16 -15
- package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.d.ts +17 -17
- package/lib/cjs/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js +16 -15
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/PointString3d.d.ts +17 -13
- package/lib/cjs/curve/PointString3d.d.ts.map +1 -1
- package/lib/cjs/curve/PointString3d.js +35 -20
- package/lib/cjs/curve/PointString3d.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +155 -118
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +244 -162
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +12 -7
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +13 -6
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/curve/CoordinateXYZ.d.ts +10 -13
- package/lib/esm/curve/CoordinateXYZ.d.ts.map +1 -1
- package/lib/esm/curve/CoordinateXYZ.js +16 -15
- package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.d.ts +17 -17
- package/lib/esm/curve/GeometryQuery.d.ts.map +1 -1
- package/lib/esm/curve/GeometryQuery.js +16 -15
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/PointString3d.d.ts +17 -13
- package/lib/esm/curve/PointString3d.d.ts.map +1 -1
- package/lib/esm/curve/PointString3d.js +35 -20
- package/lib/esm/curve/PointString3d.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +155 -118
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +244 -162
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +12 -7
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +13 -6
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- 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,mEAAmE;AACnE,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;AAGzD,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;IAMlD,YAAsB,IAAkB;QACtC,KAAK,EAAE,CAAC;QANV,wCAAwC;QACxB,qBAAgB,GAAG,UAAU,CAAC;QAM5C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAGD,8EAA8E;IAC9E,IAAW,QAAQ,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CA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AI,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;QAE5E,OAAO,IAAI,CAAC;IACd,CAAC;IACD,kFAAkF;IAC3E,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Polyface\r\n */\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\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 { FacetFaceData } from \"./FacetFaceData\";\r\nimport { IndexedPolyfaceVisitor } from \"./IndexedPolyfaceVisitor\";\r\nimport { PolyfaceData } from \"./PolyfaceData\";\r\n\r\n/**\r\n * A Polyface is an abstract mesh structure (of unspecified implementation) that provides a PolyfaceVisitor\r\n * to iterate over its facets.\r\n * @public\r\n */\r\nexport abstract class Polyface extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"polyface\";\r\n\r\n /** Underlying polyface data. */\r\n public data: PolyfaceData;\r\n protected constructor(data: PolyfaceData) {\r\n super();\r\n this.data = data;\r\n }\r\n /** create and return a visitor for this concrete polyface. */\r\n public abstract createVisitor(numWrap: number): PolyfaceVisitor;\r\n /** Flag indicating if the mesh display must assume both sides are visible. */\r\n public get twoSided() { return this.data.twoSided; }\r\n public set twoSided(value: boolean) { this.data.twoSided = value; }\r\n /** Flag indicating if the mesh closure is unknown (0), open sheet (1), closed (2) */\r\n public get expectedClosure(): number { return this.data.expectedClosure; }\r\n public set expectedClosure(value: number) { this.data.expectedClosure = value; }\r\n /**\r\n * Check validity of indices into a data array.\r\n * * It is valid to have both indices and data undefined.\r\n * * It is NOT valid for just one to be defined.\r\n * * Index values at indices[indexPositionA <= i < indexPositionB] must be valid indices to the data array.\r\n * @param indices array of indices.\r\n * @param indexPositionA first index to test\r\n * @param indexPositionB one past final index to test\r\n * @param data data array\r\n * @param dataLength length of data array\r\n */\r\n public static areIndicesValid(indices: number[] | undefined, indexPositionA: number, indexPositionB: number, data: any | undefined, dataLength: number): boolean {\r\n if (indices === undefined && data === undefined)\r\n return true;\r\n if (!indices || !data)\r\n return false;\r\n if (indexPositionA < 0 || indexPositionA >= indices.length)\r\n return false;\r\n if (indexPositionB < indexPositionA || indexPositionB > indices.length)\r\n return false;\r\n for (let i = indexPositionA; i < indexPositionB; i++)\r\n if (indices[i] < 0 || indices[i] >= dataLength)\r\n return false;\r\n return true;\r\n }\r\n /**\r\n * Returns true if this polyface has no facets.\r\n */\r\n public abstract get isEmpty(): boolean;\r\n /**\r\n * Returns the number of facets of this polyface. Subclasses should override.\r\n */\r\n public get facetCount(): number | undefined {\r\n return undefined;\r\n }\r\n}\r\n/**\r\n * An `IndexedPolyface` is a set of facets which can have normal, param, and color arrays with independent point, normal, param, and color indices.\r\n * @public\r\n */\r\nexport class IndexedPolyface extends Polyface {\r\n /** Test if other is an instance of `IndexedPolyface` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof IndexedPolyface; }\r\n /** Tests for equivalence between two IndexedPolyfaces. */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof IndexedPolyface) {\r\n return this.data.isAlmostEqual(other.data) && NumberArray.isExactEqual(this._facetStart, other._facetStart) &&\r\n NumberArray.isExactEqual(this._facetToFaceData, other._facetToFaceData);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Returns true if either the point array or the point index array is empty.\r\n */\r\n public get isEmpty(): boolean { return this.data.pointCount === 0 || this.data.pointIndex.length === 0; }\r\n /**\r\n * * apply the transform to points\r\n * * apply the (inverse transpose of) the matrix part to normals\r\n * * If determinant is negative, also\r\n * * negate normals\r\n * * reverse index order around each facet.\r\n * @param transform\r\n */\r\n public tryTransformInPlace(transform: Transform) {\r\n if (!this.data.tryTransformInPlace(transform))\r\n return false;\r\n\r\n const determinant = transform.matrix.determinant();\r\n if (determinant < 0) {\r\n this.reverseIndices();\r\n this.reverseNormals();\r\n }\r\n\r\n return true;\r\n }\r\n /** Reverse indices for a single facet. */\r\n public reverseSingleFacet(facetId: number) {\r\n this.data.reverseIndicesSingleFacet(facetId, this._facetStart);\r\n }\r\n /** Return a deep clone. */\r\n public clone(): IndexedPolyface {\r\n const result = new IndexedPolyface(this.data.clone(), this._facetStart.slice(), this._facetToFaceData.slice());\r\n return result;\r\n }\r\n /** Return a deep clone with transformed points and normals */\r\n public cloneTransformed(transform: Transform): IndexedPolyface {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform);\r\n return result;\r\n }\r\n /** Reverse the order of indices around all facets. */\r\n public reverseIndices() { this.data.reverseIndices(this._facetStart); }\r\n /** Reverse the direction of all normal vectors. */\r\n public reverseNormals() { this.data.reverseNormals(); }\r\n /**\r\n * * index to the index array entries for a specific facet.\r\n * * the facet count is facetStart.length - 1\r\n * * facet [f] indices run from facetStart[f] to upper limit facetStart[f+1].\r\n * * Note the array is initialized with one entry.\r\n */\r\n protected _facetStart: number[];\r\n\r\n /**\r\n * * For facet i, _facetToFaceData[i] is the index of the faceData entry for the facet.\r\n * * _facetToFaceData has one entry per facet.\r\n */\r\n protected _facetToFaceData: number[];\r\n\r\n /** return face data using a facet index. This is the REFERENCE to the FacetFaceData, not a copy. Returns undefined if none found. */\r\n public tryGetFaceData(i: number): FacetFaceData | undefined {\r\n const faceIndex = this._facetToFaceData[i];\r\n if (faceIndex >= this.data.face.length)\r\n return undefined;\r\n return this.data.face[faceIndex];\r\n }\r\n /**\r\n * Constructor for a new polyface.\r\n * @param data PolyfaceData arrays to capture.\r\n * @param facetStart optional array of facet start indices (e.g. known during clone)\r\n * @param facetToFacetData optional array of face identifiers (e.g. known during clone)\r\n */\r\n protected constructor(data: PolyfaceData, facetStart?: number[], facetToFaceData?: number[]) {\r\n super(data);\r\n if (facetStart)\r\n this._facetStart = facetStart.slice();\r\n else {\r\n this._facetStart = [];\r\n this._facetStart.push(0);\r\n }\r\n if (facetToFaceData)\r\n this._facetToFaceData = facetToFaceData.slice();\r\n else\r\n this._facetToFaceData = [];\r\n }\r\n /**\r\n * * Add facets from source to this polyface.\r\n * * Optionally reverse facet indices as per PolyfaceData.reverseIndicesSingleFacet() with preserveStart = false, and invert source normals.\r\n * * Optionally apply a transform to points and normals.\r\n * * Will only copy param, normal, color, and face data if we are already tracking them AND/OR the source contains them.\r\n */\r\n public addIndexedPolyface(source: IndexedPolyface, reversed: boolean, transform: Transform | undefined) {\r\n const numSourceFacets = source.facetCount;\r\n\r\n // Add point, point index, and edge visibility data\r\n // Note: there is no need to build an intermediate index map since all points are added\r\n const startOfNewPoints = this.data.point.length;\r\n const xyz = Point3d.create();\r\n for (let i = 0; i < source.data.point.length; i++) {\r\n source.data.point.getPoint3dAtUncheckedPointIndex(i, xyz);\r\n if (transform) {\r\n transform.multiplyPoint3d(xyz, xyz);\r\n this.addPoint(xyz);\r\n } else\r\n this.addPoint(xyz);\r\n }\r\n for (let i = 0; i < numSourceFacets; i++) {\r\n const i0 = source._facetStart[i];\r\n const i1 = source._facetStart[i + 1];\r\n if (reversed) {\r\n for (let j = i1; j-- > i0;) { // visibility is transferred from far vertex, e.g., -abc-d => dc-b-a\r\n this.addPointIndex(startOfNewPoints + source.data.pointIndex[j], source.data.edgeVisible[j > i0 ? j - 1 : i1 - 1]);\r\n }\r\n } else {\r\n for (let j = i0; j < i1; j++) {\r\n this.addPointIndex(startOfNewPoints + source.data.pointIndex[j], source.data.edgeVisible[j]);\r\n }\r\n }\r\n this.terminateFacet(false);\r\n }\r\n\r\n // Add param and param index data\r\n if (undefined !== this.data.param && undefined !== source.data.param && undefined !== source.data.paramIndex) {\r\n const startOfNewParams = this.data.param.length;\r\n this.data.param.pushFromGrowableXYArray(source.data.param);\r\n for (let i = 0; i < numSourceFacets; i++) { // Expect facet start and ends for points to match normals\r\n const i0 = source._facetStart[i];\r\n const i1 = source._facetStart[i + 1];\r\n if (reversed) {\r\n for (let j = i1; j-- > i0;)\r\n this.addParamIndex(startOfNewParams + source.data.paramIndex[j]);\r\n } else {\r\n for (let j = i0; j < i1; j++)\r\n this.addParamIndex(startOfNewParams + source.data.paramIndex[j]);\r\n }\r\n }\r\n }\r\n\r\n // Add normal and normal index data\r\n if (undefined !== this.data.normal && undefined !== source.data.normal && undefined !== source.data.normalIndex) {\r\n const startOfNewNormals = this.data.normal.length;\r\n for (let i = 0; i < source.data.normal.length; i++) {\r\n const sourceNormal = source.data.normal.getVector3dAtCheckedVectorIndex(i)!;\r\n if (transform)\r\n transform.multiplyVector(sourceNormal, sourceNormal);\r\n if (reversed)\r\n sourceNormal.scaleInPlace(-1.0);\r\n this.addNormal(sourceNormal);\r\n }\r\n for (let i = 0; i < numSourceFacets; i++) { // Expect facet start and ends for points to match normals\r\n const i0 = source._facetStart[i];\r\n const i1 = source._facetStart[i + 1];\r\n if (reversed) {\r\n for (let j = i1; j-- > i0;)\r\n this.addNormalIndex(startOfNewNormals + source.data.normalIndex[j]);\r\n } else {\r\n for (let j = i0; j < i1; j++)\r\n this.addNormalIndex(startOfNewNormals + source.data.normalIndex[j]);\r\n }\r\n }\r\n }\r\n\r\n // Add color and color index data\r\n if (undefined !== this.data.color && undefined !== source.data.color && undefined !== source.data.colorIndex) {\r\n const startOfNewColors = this.data.color.length;\r\n for (const sourceColor of source.data.color)\r\n this.addColor(sourceColor);\r\n for (let i = 0; i < numSourceFacets; i++) { // Expect facet start and ends for points to match colors\r\n const i0 = source._facetStart[i];\r\n const i1 = source._facetStart[i + 1];\r\n if (reversed) {\r\n for (let j = i1; j-- > i0;)\r\n this.addColorIndex(startOfNewColors + source.data.colorIndex[j]);\r\n } else {\r\n for (let j = i0; j < i1; j++)\r\n this.addColorIndex(startOfNewColors + source.data.colorIndex[j]);\r\n }\r\n }\r\n }\r\n\r\n // Add face and facetToFace index data\r\n if (source.data.face.length !== 0) {\r\n const startOfNewFaceData = this.data.face.length;\r\n for (const face of source.data.face) {\r\n const sourceFaceData = face.clone();\r\n this.data.face.push(sourceFaceData);\r\n }\r\n for (const facetToFaceIdx of source._facetToFaceData) {\r\n this._facetToFaceData.push(startOfNewFaceData + facetToFaceIdx);\r\n }\r\n }\r\n }\r\n\r\n /** Return the total number of param indices in zero-terminated style, which includes\r\n * * all the indices in the packed zero-based table\r\n * * one additional index for the zero-terminator of each facet.\r\n * @note Note that all index arrays (point, normal, param, color) have the same counts, so there\r\n * is not a separate query for each of them.\r\n */\r\n public get zeroTerminatedIndexCount(): number { return this.data.pointIndex.length + this._facetStart.length - 1; }\r\n /** Create an empty facet set, with coordinate and index data to be supplied later.\r\n * @param needNormals true if normals will be constructed\r\n * @param needParams true if uv parameters will be constructed\r\n * @param needColors true if colors will e constructed.\r\n */\r\n public static create(needNormals: boolean = false, needParams: boolean = false, needColors: boolean = false, twoSided: boolean = false): IndexedPolyface {\r\n return new IndexedPolyface(new PolyfaceData(needNormals, needParams, needColors, twoSided));\r\n }\r\n /** add (a clone of ) a point. return its 0 based index.\r\n * @param point point coordinates\r\n * @param priorIndex optional index of prior point to check for repeated coordinates\r\n * @returns Returns the zero-based index of the added or reused point.\r\n */\r\n public addPoint(point: Point3d, priorIndex?: number): number {\r\n if (priorIndex !== undefined) {\r\n const distance = this.data.point.distanceIndexToPoint(priorIndex, point);\r\n if (distance !== undefined && Geometry.isSmallMetricDistance(distance))\r\n return priorIndex;\r\n }\r\n this.data.point.pushXYZ(point.x, point.y, point.z);\r\n return this.data.point.length - 1;\r\n }\r\n\r\n /** add a point.\r\n * @returns Returns the zero-based index of the added point.\r\n */\r\n public addPointXYZ(x: number, y: number, z: number): number { this.data.point.pushXYZ(x, y, z); return this.data.point.length - 1; }\r\n /** Add a uv param.\r\n * @returns 0-based index of the added param.\r\n */\r\n public addParam(param: Point2d): number {\r\n if (!this.data.param) this.data.param = new GrowableXYArray();\r\n this.data.param.push(param);\r\n return this.data.param.length - 1;\r\n }\r\n /** Add a uv parameter to the parameter array.\r\n * @param priorIndexA first index to check for possible duplicate value.\r\n * @param priorIndexB second index to check for possible duplicate value.\r\n * @returns 0-based index of the added or reused param.\r\n */\r\n public addParamUV(u: number, v: number, priorIndexA?: number, priorIndexB?: number): number {\r\n if (!this.data.param) this.data.param = new GrowableXYArray();\r\n if (priorIndexA !== undefined && this.data.isAlmostEqualParamIndexUV(priorIndexA, u, v))\r\n return priorIndexA;\r\n if (priorIndexB !== undefined && this.data.isAlmostEqualParamIndexUV(priorIndexB, u, v))\r\n return priorIndexB;\r\n this.data.param.pushXY(u, v);\r\n return this.data.param.length - 1;\r\n }\r\n\r\n /** Add a normal vector\r\n * @param priorIndexA first index to check for possible duplicate value.\r\n * @param priorIndexB second index to check for possible duplicate value.\r\n * @returns 0-based index of the added or reused normal.\r\n */\r\n public addNormal(normal: Vector3d, priorIndexA?: number, priorIndexB?: number): number {\r\n if (this.data.normal !== undefined) {\r\n let distance;\r\n\r\n if (priorIndexA !== undefined) {\r\n distance = this.data.normal.distanceIndexToPoint(priorIndexA, normal);\r\n if (distance !== undefined && Geometry.isSmallMetricDistance(distance))\r\n return priorIndexA;\r\n }\r\n if (priorIndexB !== undefined) {\r\n distance = this.data.normal.distanceIndexToPoint(priorIndexB, normal);\r\n if (distance !== undefined && Geometry.isSmallMetricDistance(distance))\r\n return priorIndexB;\r\n }\r\n // Note: Do NOT attempt to chain to tail if no prior indices given.\r\n // But if they are, look also to the tail.\r\n if (priorIndexA !== undefined || priorIndexB !== undefined) {\r\n const tailIndex = this.data.normal.length - 1;\r\n distance = this.data.normal.distanceIndexToPoint(tailIndex, normal);\r\n if (distance !== undefined && Geometry.isSmallMetricDistance(distance))\r\n return tailIndex;\r\n }\r\n }\r\n\r\n return this.addNormalXYZ(normal.x, normal.y, normal.z);\r\n }\r\n\r\n /** Add a normal vector given by direct coordinates\r\n * @returns 0-based index of the added or reused param.\r\n */\r\n public addNormalXYZ(x: number, y: number, z: number): number {\r\n if (!this.data.normal) this.data.normal = new GrowableXYZArray();\r\n this.data.normal.pushXYZ(x, y, z);\r\n return this.data.normal.length - 1;\r\n }\r\n\r\n /** Add a color\r\n * @returns 0-based index of the added or reused color.\r\n */\r\n public addColor(color: number): number {\r\n if (!this.data.color) this.data.color = [];\r\n this.data.color.push(color);\r\n return this.data.color.length - 1;\r\n }\r\n /** Add a point index with edge visibility flag. */\r\n public addPointIndex(index: number, visible: boolean = true): void { this.data.pointIndex.push(index); this.data.edgeVisible.push(visible); }\r\n /** Add a normal index */\r\n public addNormalIndex(index: number): void {\r\n if (!this.data.normalIndex)\r\n this.data.normalIndex = [];\r\n this.data.normalIndex.push(index);\r\n }\r\n /** Add a param index */\r\n public addParamIndex(index: number): void {\r\n if (!this.data.paramIndex)\r\n this.data.paramIndex = [];\r\n this.data.paramIndex.push(index);\r\n }\r\n /** Add a color index */\r\n public addColorIndex(index: number): void {\r\n if (!this.data.colorIndex)\r\n this.data.colorIndex = [];\r\n this.data.colorIndex.push(index);\r\n }\r\n\r\n /** clean up the open facet. return the returnValue (so caller can easily return cleanupOpenFacet(\"message\")) */\r\n public cleanupOpenFacet(): void {\r\n this.data.trimAllIndexArrays(this.data.pointIndex.length);\r\n }\r\n /** announce the end of construction of a facet.\r\n *\r\n * * The \"open\" facet is checked for:\r\n *\r\n * ** Same number of indices among all active index arrays -- point, normal, param, color\r\n * ** All indices are within bounds of the respective data arrays.\r\n * * in error cases, all index arrays are trimmed back to the size when previous facet was terminated.\r\n * * \"undefined\" return is normal. Any other return is a description of an error.\r\n */\r\n public terminateFacet(validateAllIndices: boolean = true): any {\r\n const numFacets = this._facetStart.length - 1;\r\n const lengthA = this._facetStart[numFacets]; // number of indices in accepted facets\r\n const lengthB = this.data.pointIndex.length; // number of indices including the open facet\r\n if (validateAllIndices) {\r\n const messages: any[] = [];\r\n\r\n if (lengthB < lengthA + 2)\r\n messages.push(\"Less than 3 indices in open facet\");\r\n if (this.data.normalIndex && this.data.normalIndex.length !== lengthB)\r\n messages.push(\"normalIndex count must match pointIndex count\");\r\n if (this.data.paramIndex && this.data.paramIndex.length !== lengthB)\r\n messages.push(\"paramIndex count must equal pointIndex count\");\r\n if (this.data.colorIndex && this.data.colorIndex.length !== lengthB)\r\n messages.push(\"colorIndex count must equal pointIndex count\");\r\n if (this.data.edgeVisible.length !== lengthB)\r\n messages.push(\"visibleIndex count must equal pointIndex count\");\r\n\r\n if (!Polyface.areIndicesValid(this.data.normalIndex, lengthA, lengthB, this.data.normal, this.data.normal ? this.data.normal.length : 0))\r\n messages.push(\"invalid normal indices in open facet\");\r\n if (messages.length > 0) {\r\n this.cleanupOpenFacet();\r\n return messages;\r\n }\r\n }\r\n // appending to facetStart accepts the facet !!!\r\n this._facetStart.push(lengthB);\r\n return undefined;\r\n }\r\n /**\r\n * All terminated facets added since the declaration of the previous face\r\n * will be grouped into a new face with their own 2D range.\r\n */\r\n /** (read-only property) number of facets */\r\n public override get facetCount(): number { return this._facetStart.length - 1; }\r\n /** (read-only property) number of faces */\r\n public get faceCount(): number { return this.data.faceCount; }\r\n /** (read-only property) number of points */\r\n public get pointCount(): number { return this.data.pointCount; }\r\n /** (read-only property) number of colors */\r\n public get colorCount(): number { return this.data.colorCount; }\r\n /** (read-only property) number of parameters */\r\n public get paramCount(): number { return this.data.paramCount; }\r\n /** (read-only property) number of normals */\r\n public get normalCount(): number { return this.data.normalCount; }\r\n /** Return the number of edges in a particular facet. */\r\n public numEdgeInFacet(facetIndex: number): number {\r\n if (this.isValidFacetIndex(facetIndex))\r\n return this._facetStart[facetIndex + 1] - this._facetStart[facetIndex];\r\n return 0;\r\n }\r\n /** test if `index` is a valid facet index. */\r\n public isValidFacetIndex(index: number): boolean { return index >= 0 && index + 1 < this._facetStart.length; }\r\n /** ASSUME valid facet index . .. return its start index in index arrays. */\r\n public facetIndex0(index: number): number { return this._facetStart[index]; }\r\n /** ASSUME valid facet index . .. return its end index in index arrays. */\r\n public facetIndex1(index: number): number { return this._facetStart[index + 1]; }\r\n /** create a visitor for this polyface */\r\n public createVisitor(numWrap: number = 0): PolyfaceVisitor { return IndexedPolyfaceVisitor.create(this, numWrap); }\r\n /** Return the range of (optionally transformed) points in this mesh. */\r\n public override range(transform?: Transform, result?: Range3d): Range3d { return this.data.range(result, transform); }\r\n /** Extend `range` with coordinates from this mesh */\r\n public extendRange(range: Range3d, transform?: Transform): void { this.data.range(range, transform); }\r\n\r\n /** Given the index of a facet, return the data pertaining to the face it is a part of. */\r\n public getFaceDataByFacetIndex(facetIndex: number): FacetFaceData {\r\n return this.data.face[this._facetToFaceData[facetIndex]];\r\n }\r\n\r\n /**\r\n * All terminated facets since the last face declaration will be mapped to a single new FacetFaceData object\r\n * using facetToFaceData[]. FacetFaceData holds the 2D range of the face. Returns true if successful, false otherwise.\r\n */\r\n public setNewFaceData(endFacetIndex: number = 0): boolean {\r\n const facetStart = this._facetToFaceData.length;\r\n if (facetStart >= this._facetStart.length)\r\n return false;\r\n\r\n if (0 === endFacetIndex) // The default for endFacetIndex is really the last facet\r\n endFacetIndex = this._facetStart.length; // Last facetStart index corresponds to the next facet if we were to create one\r\n\r\n const faceData = FacetFaceData.createNull();\r\n const visitor = IndexedPolyfaceVisitor.create(this, 0);\r\n\r\n if (!visitor.moveToReadIndex(facetStart)) { // Move visitor to first facet of new face\r\n return false;\r\n }\r\n\r\n // If parameter range is provided (by the polyface planeSet clipper) then use it\r\n const paramDefined = this.data.param !== undefined;\r\n const setParamRange: boolean = faceData.paramRange.isNull && paramDefined;\r\n\r\n do {\r\n if (setParamRange && visitor.param !== undefined)\r\n visitor.param.extendRange(faceData.paramRange);\r\n } while (visitor.moveToNextFacet() && visitor.currentReadIndex() < endFacetIndex);\r\n\r\n if (paramDefined && !(this.data.param!.length === 0) && faceData.paramDistanceRange.isNull)\r\n faceData.setParamDistanceRangeFromNewFaceData(this, facetStart, endFacetIndex);\r\n\r\n this.data.face.push(faceData);\r\n const faceDataIndex = this.data.face.length - 1;\r\n for (let i = this._facetToFaceData.length; i < endFacetIndex; i++)\r\n this._facetToFaceData.push(0 === this._facetStart[i] ? 0 : faceDataIndex);\r\n\r\n return true;\r\n }\r\n /** Second step of double dispatch: call `handler.handleIndexedPolyface(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleIndexedPolyface(this);\r\n }\r\n}\r\n\r\n/**\r\n * A PolyfaceVisitor manages data while walking through facets.\r\n *\r\n * * The polyface visitor holds data for one facet at a time.\r\n * * The caller can request the position in the addressed facets as a \"readIndex.\"\r\n * * The readIndex value (as a number) is not promised to be sequential. (I.e. it might be a simple facet count or might be\r\n * @public\r\n */\r\nexport interface PolyfaceVisitor extends PolyfaceData {\r\n /** Load data for the facet with given index. */\r\n moveToReadIndex(index: number): boolean;\r\n /** Return the readIndex of the currently loaded facet */\r\n currentReadIndex(): number;\r\n /** Load data for the next facet. */\r\n moveToNextFacet(): boolean;\r\n /** Reset to initial state for reading all facets sequentially with moveToNextFacet */\r\n reset(): void;\r\n /** Return the point index of vertex i within the currently loaded facet */\r\n clientPointIndex(i: number): number;\r\n /** Return the param index of vertex i within the currently loaded facet */\r\n clientParamIndex(i: number): number;\r\n /** Return the normal index of vertex i within the currently loaded facet */\r\n clientNormalIndex(i: number): number;\r\n /** Return the color index of vertex i within the currently loaded facet */\r\n clientColorIndex(i: number): number;\r\n /** Return the aux data index of vertex i within the currently loaded facet */\r\n clientAuxIndex(i: number): number;\r\n /** return the client polyface */\r\n clientPolyface(): Polyface | undefined;\r\n /** Set the number of vertices to replicate in visitor arrays. */\r\n setNumWrap(numWrap: number): void;\r\n /** clear the contents of all arrays. Use this along with `pushDataFrom` to build up new facets. */\r\n clearArrays(): void;\r\n /** transfer data from a specified index of the other visitor as new data in this visitor. */\r\n pushDataFrom(other: PolyfaceVisitor, index: number): void;\r\n /** transfer interpolated data from the other visitor.\r\n * * all data values are interpolated at `fraction` between `other` values at index0 and index1.\r\n */\r\n pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void;\r\n}\r\n\r\n"]}
|
|
1
|
+
{"version":3,"file":"Polyface.js","sourceRoot":"","sources":["../../../src/polyface/Polyface.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,mEAAmE;AACnE,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;AAGzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CA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AK,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;SAClD,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":["/*---------------------------------------------------------------------------------------------\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\n/* eslint-disable @typescript-eslint/naming-convention, no-empty */\r\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\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 { FacetFaceData } from \"./FacetFaceData\";\r\nimport { IndexedPolyfaceVisitor } from \"./IndexedPolyfaceVisitor\";\r\nimport { PolyfaceData } from \"./PolyfaceData\";\r\n\r\n/**\r\n * A Polyface is an abstract mesh structure (of unspecified implementation) that provides a PolyfaceVisitor\r\n * to iterate over its facets.\r\n * @public\r\n */\r\nexport abstract class Polyface extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"polyface\";\r\n /** Underlying polyface data. */\r\n public data: PolyfaceData;\r\n /** Constructor */\r\n protected constructor(data: PolyfaceData) {\r\n super();\r\n this.data = data;\r\n }\r\n /**\r\n * Create and return a visitor for this concrete polyface.\r\n * @param numWrap the number of vertices to replicate in visitor arrays.\r\n */\r\n public abstract createVisitor(numWrap: number): PolyfaceVisitor;\r\n /** Flag indicating if the mesh display must assume both sides are visible. */\r\n public get twoSided() {\r\n return this.data.twoSided;\r\n }\r\n public set twoSided(value: boolean) {\r\n this.data.twoSided = value;\r\n }\r\n /**\r\n * Flag indicating if the mesh closure is unknown (0), open sheet (1), closed solid (2).\r\n * * A boundary edge of a mesh is defined as an edge with only one connected facet.\r\n * * Closed solid is a mesh with no boundary edge. Open sheet is a mesh that has boundary edge(s).\r\n */\r\n public get expectedClosure(): number {\r\n return this.data.expectedClosure;\r\n }\r\n public set expectedClosure(value: number) {\r\n this.data.expectedClosure = value;\r\n }\r\n /**\r\n * Check validity of indices into a data array.\r\n * * It is valid to have both indices and data undefined.\r\n * * It is NOT valid for just one to be defined.\r\n * * Index values at indices[indexPositionA <= i < indexPositionB] must be valid indices to the data array.\r\n * @param indices array of indices.\r\n * @param indexPositionA first index to test.\r\n * @param indexPositionB one past final index to test.\r\n * @param data data array.\r\n * @param dataLength length of data array.\r\n */\r\n public static areIndicesValid(\r\n indices: number[] | undefined,\r\n indexPositionA: number,\r\n indexPositionB: number,\r\n data: any | undefined,\r\n dataLength: number,\r\n ): boolean {\r\n if (indices === undefined && data === undefined)\r\n return true;\r\n if (indices === undefined || data === undefined)\r\n return false;\r\n if (indexPositionA < 0 || indexPositionA >= indices.length)\r\n return false;\r\n if (indexPositionB <= indexPositionA || indexPositionB > indices.length)\r\n return false;\r\n for (let i = indexPositionA; i < indexPositionB; i++)\r\n if (indices[i] < 0 || indices[i] >= dataLength)\r\n return false;\r\n return true;\r\n }\r\n /** Returns true if this polyface has no facets. */\r\n public abstract get isEmpty(): boolean;\r\n /** Returns the number of facets of this polyface. Subclasses should override. */\r\n public get facetCount(): number | undefined {\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * An `IndexedPolyface` is a set of facets which can have normal, param, and color arrays with independent point,\r\n * normal, param, and color indices.\r\n * @public\r\n */\r\nexport class IndexedPolyface extends Polyface { // more info can be found at geometry/internaldocs/Polyface.md\r\n /**\r\n * Index to the `this.data.pointIndex` array entry for a specific facet.\r\n * * The facet count is `facetStart.length - 1`.\r\n * * The face loop for the i_th facet consists of the entries in `this.data.pointIndex` at indices `_facetStart[i]`\r\n * up to (but not including) `_facetStart[i + 1]`.\r\n * * Note the array is initialized with one entry (value 0).\r\n */\r\n protected _facetStart: number[];\r\n /**\r\n * Index to the `this.data.face` array entry for a specific facet.\r\n * * `_facetToFaceData` has one entry per facet.\r\n */\r\n protected _facetToFaceData: number[];\r\n /**\r\n * Constructor for a new polyface.\r\n * @param data PolyfaceData arrays to capture.\r\n * @param facetStart optional array of facet start indices (e.g. known during clone)\r\n * @param facetToFacetData optional array of face identifiers (e.g. known during clone)\r\n */\r\n protected constructor(data: PolyfaceData, facetStart?: number[], facetToFaceData?: number[]) {\r\n super(data);\r\n if (facetStart)\r\n this._facetStart = facetStart.slice(); // deep copy\r\n else {\r\n this._facetStart = [];\r\n this._facetStart.push(0);\r\n }\r\n if (facetToFaceData)\r\n this._facetToFaceData = facetToFaceData.slice(); // deep copy\r\n else\r\n this._facetToFaceData = [];\r\n }\r\n /** Test if other is an instance of `IndexedPolyface` */\r\n public isSameGeometryClass(other: any): boolean {\r\n return other instanceof IndexedPolyface;\r\n }\r\n /** Tests for equivalence between two IndexedPolyfaces. */\r\n public override isAlmostEqual(other: any): boolean {\r\n if (other instanceof IndexedPolyface) {\r\n return this.data.isAlmostEqual(other.data) &&\r\n NumberArray.isExactEqual(this._facetStart, other._facetStart) &&\r\n NumberArray.isExactEqual(this._facetToFaceData, other._facetToFaceData);\r\n }\r\n return false;\r\n }\r\n /** Returns true if either the point array or the point index array is empty. */\r\n public get isEmpty(): boolean {\r\n return this.data.pointCount === 0 || this.data.pointIndex.length === 0;\r\n }\r\n /**\r\n * Transform the mesh.\r\n * * Apply the transform to points.\r\n * * Apply the (inverse transpose of the) matrix part to normals.\r\n * * If determinant of the transform matrix is negative, also\r\n * * negate normals\r\n * * reverse index order around each facet.\r\n */\r\n public tryTransformInPlace(transform: Transform) {\r\n if (!this.data.tryTransformInPlace(transform))\r\n return false;\r\n const determinant = transform.matrix.determinant();\r\n if (determinant < 0) {\r\n this.reverseIndices();\r\n this.reverseNormals();\r\n }\r\n return true;\r\n }\r\n /** Reverse indices for a single facet. */\r\n public reverseSingleFacet(facetId: number) {\r\n this.data.reverseIndicesSingleFacet(facetId, this._facetStart);\r\n }\r\n /** Return a deep clone. */\r\n public clone(): IndexedPolyface {\r\n const result = new IndexedPolyface(this.data.clone(), this._facetStart.slice(), this._facetToFaceData.slice());\r\n return result;\r\n }\r\n /**\r\n * Return a deep clone with transformed points and normals.\r\n * @see [[IndexedPolyface.tryTransformInPlace]] for details of how transform is done.\r\n */\r\n public cloneTransformed(transform: Transform): IndexedPolyface {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform);\r\n return result;\r\n }\r\n /** Reverse the order of indices around all facets. */\r\n public reverseIndices() {\r\n this.data.reverseIndices(this._facetStart);\r\n }\r\n /** Reverse the direction of all normal vectors. */\r\n public reverseNormals() {\r\n this.data.reverseNormals();\r\n }\r\n /**\r\n * Return face data using a facet index.\r\n * * Returns `undefined` if none found.\r\n * * This is the REFERENCE to the FacetFaceData not a copy.\r\n */\r\n public tryGetFaceData(i: number): FacetFaceData | undefined {\r\n if (i < 0 || i >= this._facetToFaceData.length)\r\n return undefined;\r\n const faceIndex = this._facetToFaceData[i];\r\n if (faceIndex < 0 || faceIndex >= this.data.face.length)\r\n return undefined;\r\n return this.data.face[faceIndex];\r\n }\r\n /**\r\n * Add facets from `source` to `this` polyface.\r\n * * Optionally reverse facet indices as per `PolyfaceData.reverseIndicesSingleFacet()` with `preserveStart = false` and\r\n * invert source normals.\r\n * * Optionally apply a `transform` to points and normals.\r\n * * Will only copy param, normal, color, and face data if we are already tracking them AND/OR the source contains them.\r\n */\r\n public addIndexedPolyface(source: IndexedPolyface, reversed: boolean, transform: Transform | undefined) {\r\n const numSourceFacets = source.facetCount;\r\n // add point, point index, and edge visibility data\r\n // note that there is no need to build an intermediate index map since all points are added\r\n const startOfNewPoints = this.data.point.length;\r\n const xyz = Point3d.create();\r\n for (let i = 0; i < source.data.point.length; i++) {\r\n source.data.point.getPoint3dAtUncheckedPointIndex(i, xyz);\r\n if (transform) {\r\n transform.multiplyPoint3d(xyz, xyz);\r\n this.addPoint(xyz);\r\n } else\r\n this.addPoint(xyz);\r\n }\r\n for (let i = 0; i < numSourceFacets; i++) {\r\n const i0 = source._facetStart[i];\r\n const i1 = source._facetStart[i + 1];\r\n if (reversed) {\r\n for (let j = i1; j-- > i0;) { // visibility is transferred from far vertex, e.g., -abc-d => dc-b-a\r\n this.addPointIndex(\r\n startOfNewPoints + source.data.pointIndex[j],\r\n source.data.edgeVisible[j > i0 ? j - 1 : i1 - 1],\r\n );\r\n }\r\n } else {\r\n for (let j = i0; j < i1; j++) {\r\n this.addPointIndex(\r\n startOfNewPoints + source.data.pointIndex[j],\r\n source.data.edgeVisible[j],\r\n );\r\n }\r\n }\r\n this.terminateFacet(false);\r\n }\r\n // add param and param index data\r\n if (undefined !== this.data.param && undefined !== source.data.param && undefined !== source.data.paramIndex) {\r\n const startOfNewParams = this.data.param.length;\r\n this.data.param.pushFromGrowableXYArray(source.data.param);\r\n for (let i = 0; i < numSourceFacets; i++) { // expect facet start and ends for points to match normals\r\n const i0 = source._facetStart[i];\r\n const i1 = source._facetStart[i + 1];\r\n if (reversed) {\r\n for (let j = i1; j-- > i0;)\r\n this.addParamIndex(startOfNewParams + source.data.paramIndex[j]);\r\n } else {\r\n for (let j = i0; j < i1; j++)\r\n this.addParamIndex(startOfNewParams + source.data.paramIndex[j]);\r\n }\r\n }\r\n }\r\n // add normal and normal index data\r\n if (undefined !== this.data.normal && undefined !== source.data.normal && undefined !== source.data.normalIndex) {\r\n const startOfNewNormals = this.data.normal.length;\r\n for (let i = 0; i < source.data.normal.length; i++) {\r\n const sourceNormal = source.data.normal.getVector3dAtCheckedVectorIndex(i)!;\r\n if (transform)\r\n transform.multiplyVector(sourceNormal, sourceNormal);\r\n if (reversed)\r\n sourceNormal.scaleInPlace(-1.0);\r\n this.addNormal(sourceNormal);\r\n }\r\n for (let i = 0; i < numSourceFacets; i++) { // expect facet start and ends for points to match normals\r\n const i0 = source._facetStart[i];\r\n const i1 = source._facetStart[i + 1];\r\n if (reversed) {\r\n for (let j = i1; j-- > i0;)\r\n this.addNormalIndex(startOfNewNormals + source.data.normalIndex[j]);\r\n } else {\r\n for (let j = i0; j < i1; j++)\r\n this.addNormalIndex(startOfNewNormals + source.data.normalIndex[j]);\r\n }\r\n }\r\n }\r\n // add color and color index data\r\n if (undefined !== this.data.color && undefined !== source.data.color && undefined !== source.data.colorIndex) {\r\n const startOfNewColors = this.data.color.length;\r\n for (const sourceColor of source.data.color)\r\n this.addColor(sourceColor);\r\n for (let i = 0; i < numSourceFacets; i++) { // expect facet start and ends for points to match colors\r\n const i0 = source._facetStart[i];\r\n const i1 = source._facetStart[i + 1];\r\n if (reversed) {\r\n for (let j = i1; j-- > i0;)\r\n this.addColorIndex(startOfNewColors + source.data.colorIndex[j]);\r\n } else {\r\n for (let j = i0; j < i1; j++)\r\n this.addColorIndex(startOfNewColors + source.data.colorIndex[j]);\r\n }\r\n }\r\n }\r\n // add face and facetToFace index data\r\n if (source.data.face.length !== 0) {\r\n const startOfNewFaceData = this.data.face.length;\r\n for (const face of source.data.face) {\r\n const sourceFaceData = face.clone();\r\n this.data.face.push(sourceFaceData);\r\n }\r\n for (const facetToFaceIdx of source._facetToFaceData) {\r\n this._facetToFaceData.push(startOfNewFaceData + facetToFaceIdx);\r\n }\r\n }\r\n }\r\n /**\r\n * Return the total number of indices in zero-terminated style, which includes\r\n * * all the indices in the packed zero-based table.\r\n * * one additional index for the zero-terminator of each facet.\r\n * @note Note that all index arrays (pointIndex, normalIndex, paramIndex, colorIndex) have the same counts, so there\r\n * is not a separate query for each of them.\r\n */\r\n public get zeroTerminatedIndexCount(): number {\r\n return this.data.pointIndex.length + this._facetStart.length - 1;\r\n }\r\n /**\r\n * Create an empty facet set with coordinate and index data to be supplied later.\r\n * @param needNormals true if normals will be constructed.\r\n * @param needParams true if uv parameters will be constructed.\r\n * @param needColors true if colors will be constructed.\r\n * @param twoSided true if the facets are to be considered viewable from the back.\r\n */\r\n public static create(\r\n needNormals: boolean = false,\r\n needParams: boolean = false,\r\n needColors: boolean = false,\r\n twoSided: boolean = false,\r\n ): IndexedPolyface {\r\n return new IndexedPolyface(new PolyfaceData(needNormals, needParams, needColors, twoSided));\r\n }\r\n /**\r\n * Add (a clone of) a point to point array.\r\n * @param point the point.\r\n * @param priorIndex (optional) index of prior point to check for possible duplicate value.\r\n * @returns the zero-based index of the added or duplicate point.\r\n */\r\n public addPoint(point: Point3d, priorIndex?: number): number {\r\n if (priorIndex !== undefined) {\r\n const distance = this.data.point.distanceIndexToPoint(priorIndex, point);\r\n if (distance !== undefined && Geometry.isSmallMetricDistance(distance))\r\n return priorIndex;\r\n }\r\n this.data.point.pushXYZ(point.x, point.y, point.z);\r\n return this.data.point.length - 1;\r\n }\r\n /**\r\n * Add a point to point array.\r\n * @param x the x coordinate of point.\r\n * @param y the y coordinate of point.\r\n * @param z the z coordinate of point.\r\n * @returns the zero-based index of the added point.\r\n */\r\n public addPointXYZ(x: number, y: number, z: number): number {\r\n this.data.point.pushXYZ(x, y, z);\r\n return this.data.point.length - 1;\r\n }\r\n /**\r\n * Add (a clone of) a uv parameter to the parameter array.\r\n * @param param the parameter.\r\n * @returns zero-based index of the added param.\r\n */\r\n public addParam(param: Point2d): number {\r\n if (!this.data.param)\r\n this.data.param = new GrowableXYArray();\r\n this.data.param.push(param);\r\n return this.data.param.length - 1;\r\n }\r\n /**\r\n * Add a uv parameter to the parameter array.\r\n * @param u the u part of parameter.\r\n * @param v the v part of parameter.\r\n * @param priorIndexA first index to check for possible duplicate value.\r\n * @param priorIndexB second index to check for possible duplicate value.\r\n * @returns zero-based index of the added or duplicate parameter.\r\n */\r\n public addParamUV(u: number, v: number, priorIndexA?: number, priorIndexB?: number): number {\r\n if (!this.data.param)\r\n this.data.param = new GrowableXYArray();\r\n if (priorIndexA !== undefined && this.data.isAlmostEqualParamIndexUV(priorIndexA, u, v))\r\n return priorIndexA;\r\n if (priorIndexB !== undefined && this.data.isAlmostEqualParamIndexUV(priorIndexB, u, v))\r\n return priorIndexB;\r\n this.data.param.pushXY(u, v);\r\n return this.data.param.length - 1;\r\n }\r\n /**\r\n * Add (a clone of) a normal vector to the normal array.\r\n * @param normal the normal vector.\r\n * @param priorIndexA first index to check for possible duplicate value.\r\n * @param priorIndexB second index to check for possible duplicate value.\r\n * @returns zero-based index of the added or duplicate normal.\r\n */\r\n public addNormal(normal: Vector3d, priorIndexA?: number, priorIndexB?: number): number {\r\n // check if `normal` is duplicate of `dataNormal` at index `i`\r\n const normalIsDuplicate = (dataNormal: GrowableXYZArray, i: number) => {\r\n const distance = dataNormal.distanceIndexToPoint(i, normal);\r\n return distance !== undefined && Geometry.isSmallMetricDistance(distance);\r\n };\r\n if (this.data.normal !== undefined) {\r\n if (priorIndexA !== undefined && normalIsDuplicate(this.data.normal, priorIndexA))\r\n return priorIndexA;\r\n if (priorIndexB !== undefined && normalIsDuplicate(this.data.normal, priorIndexB))\r\n return priorIndexB;\r\n // check the tail index for possible duplicate\r\n if (priorIndexA !== undefined || priorIndexB !== undefined) {\r\n const tailIndex = this.data.normal.length - 1;\r\n if (normalIsDuplicate(this.data.normal, tailIndex))\r\n return tailIndex;\r\n }\r\n }\r\n return this.addNormalXYZ(normal.x, normal.y, normal.z);\r\n }\r\n /**\r\n * Add a normal vector to the normal array.\r\n * @param x the x coordinate of normal.\r\n * @param y the y coordinate of normal.\r\n * @param z the z coordinate of normal.\r\n * @returns zero-based index of the added normal vector.\r\n */\r\n public addNormalXYZ(x: number, y: number, z: number): number {\r\n if (!this.data.normal)\r\n this.data.normal = new GrowableXYZArray();\r\n this.data.normal.pushXYZ(x, y, z);\r\n return this.data.normal.length - 1;\r\n }\r\n /**\r\n * Add a color to the color array\r\n * @param color the color.\r\n * @returns zero-based index of the added color.\r\n */\r\n public addColor(color: number): number {\r\n if (!this.data.color)\r\n this.data.color = [];\r\n this.data.color.push(color);\r\n return this.data.color.length - 1;\r\n }\r\n /** Add a point index with edge visibility flag. */\r\n public addPointIndex(index: number, visible: boolean = true): void {\r\n this.data.pointIndex.push(index);\r\n this.data.edgeVisible.push(visible);\r\n }\r\n /** Add a normal index. */\r\n public addNormalIndex(index: number): void {\r\n if (!this.data.normalIndex)\r\n this.data.normalIndex = [];\r\n this.data.normalIndex.push(index);\r\n }\r\n /** Add a param index. */\r\n public addParamIndex(index: number): void {\r\n if (!this.data.paramIndex)\r\n this.data.paramIndex = [];\r\n this.data.paramIndex.push(index);\r\n }\r\n /** Add a color index. */\r\n public addColorIndex(index: number): void {\r\n if (!this.data.colorIndex)\r\n this.data.colorIndex = [];\r\n this.data.colorIndex.push(index);\r\n }\r\n /**\r\n * Clean up the open facet.\r\n * @deprecated in 4.x to remove nebulous \"open facet\" concept from the API. Call [[PolyfaceData.trimAllIndexArrays]]\r\n * instead.\r\n */\r\n public cleanupOpenFacet(): void {\r\n this.data.trimAllIndexArrays(this.data.pointIndex.length);\r\n }\r\n /**\r\n * Announce the end of construction of a facet.\r\n * * Optionally check for:\r\n * * Same number of indices among all active index arrays -- point, normal, param, color\r\n * * All indices are within bounds of the respective data arrays.\r\n * * In error cases, all index arrays are trimmed back to the size when previous facet was terminated.\r\n * * A return value of `undefined` is normal. Otherwise, a string array of error messages is returned.\r\n */\r\n public terminateFacet(validateAllIndices: boolean = true): String[] | undefined {\r\n const numFacets = this._facetStart.length - 1;\r\n // number of indices in accepted facets\r\n const lengthA = this._facetStart[numFacets];\r\n // number of indices in all facets (accepted facet plus the last facet to be accepted)\r\n const lengthB = this.data.pointIndex.length;\r\n if (validateAllIndices) {\r\n const messages: String[] = [];\r\n if (lengthB < lengthA + 2)\r\n messages.push(\"Less than 3 indices in the last facet\");\r\n if (this.data.normalIndex && this.data.normalIndex.length !== lengthB)\r\n messages.push(\"normalIndex count must match pointIndex count\");\r\n if (this.data.paramIndex && this.data.paramIndex.length !== lengthB)\r\n messages.push(\"paramIndex count must equal pointIndex count\");\r\n if (this.data.colorIndex && this.data.colorIndex.length !== lengthB)\r\n messages.push(\"colorIndex count must equal pointIndex count\");\r\n if (this.data.edgeVisible.length !== lengthB)\r\n messages.push(\"visibleIndex count must equal pointIndex count\");\r\n if (!Polyface.areIndicesValid(\r\n this.data.normalIndex, lengthA, lengthB, this.data.normal, this.data.normal ? this.data.normal.length : 0,\r\n ))\r\n messages.push(\"invalid normal indices in the last facet\");\r\n if (messages.length > 0) {\r\n this.data.trimAllIndexArrays(lengthB);\r\n return messages;\r\n }\r\n }\r\n this._facetStart.push(lengthB); // append start index of the future facet\r\n return undefined;\r\n }\r\n /** Number of facets (read-only property). */\r\n public override get facetCount(): number {\r\n return this._facetStart.length - 1;\r\n }\r\n /** Number of faces (read-only property). */\r\n public get faceCount(): number {\r\n return this.data.faceCount;\r\n }\r\n /** Number of points (read-only property). */\r\n public get pointCount(): number {\r\n return this.data.pointCount;\r\n }\r\n /** Number of colors (read-only property). */\r\n public get colorCount(): number {\r\n return this.data.colorCount;\r\n }\r\n /** Number of parameters (read-only property). */\r\n public get paramCount(): number {\r\n return this.data.paramCount;\r\n }\r\n /** Number of normals (read-only property). */\r\n public get normalCount(): number {\r\n return this.data.normalCount;\r\n }\r\n /** Test if `index` is a valid facet index. */\r\n public isValidFacetIndex(index: number): boolean {\r\n return index >= 0 && index < this.facetCount;\r\n }\r\n /** Return the number of edges in a particular facet. */\r\n public numEdgeInFacet(facetIndex: number): number {\r\n if (this.isValidFacetIndex(facetIndex))\r\n return this._facetStart[facetIndex + 1] - this._facetStart[facetIndex];\r\n return 0;\r\n }\r\n /** ASSUME valid facet index. Return start index of facet in pointIndex arrays. */\r\n public facetIndex0(index: number): number {\r\n return this._facetStart[index];\r\n }\r\n /** ASSUME valid facet index. Return one past end index of facet in pointIndex arrays. */\r\n public facetIndex1(index: number): number {\r\n return this._facetStart[index + 1];\r\n }\r\n /** Create a visitor for this polyface */\r\n public createVisitor(numWrap: number = 0): PolyfaceVisitor {\r\n return IndexedPolyfaceVisitor.create(this, numWrap);\r\n }\r\n /** Return the range of (optionally transformed) points in this mesh. */\r\n public override range(transform?: Transform, result?: Range3d): Range3d {\r\n return this.data.range(result, transform);\r\n }\r\n /** Extend `range` with coordinates from this mesh. */\r\n public extendRange(range: Range3d, transform?: Transform): void {\r\n this.data.range(range, transform);\r\n }\r\n /**\r\n * Given the index of a facet, return the data pertaining to the face it is a part of.\r\n * @deprecated in 4.x. Use [[IndexedPolyface.tryGetFaceData]], which verifies the index is in range.\r\n */\r\n public getFaceDataByFacetIndex(facetIndex: number): FacetFaceData {\r\n return this.data.face[this._facetToFaceData[facetIndex]];\r\n }\r\n /**\r\n * Set new FacetFaceData.\r\n * * All terminated facets since the last face declaration will be mapped to a single new FacetFaceData object using\r\n * facetToFaceData[]. FacetFaceData holds the 2D range of the face. Returns `true` if successful, `false` otherwise.\r\n */\r\n public setNewFaceData(endFacetIndex: number = 0): boolean {\r\n const facetStart = this._facetToFaceData.length;\r\n if (facetStart >= this._facetStart.length)\r\n return false;\r\n if (0 === endFacetIndex) // the default for endFacetIndex is really the last facet\r\n endFacetIndex = this._facetStart.length; // last facet index corresponds to the future facet\r\n const faceData = FacetFaceData.createNull();\r\n const visitor = IndexedPolyfaceVisitor.create(this, 0);\r\n if (!visitor.moveToReadIndex(facetStart)) { // move visitor to first facet of new face\r\n return false;\r\n }\r\n // if parameter range is provided (by the polyface planeSet clipper) then use it\r\n const paramDefined = this.data.param !== undefined;\r\n const setParamRange: boolean = faceData.paramRange.isNull && paramDefined;\r\n do {\r\n if (setParamRange && visitor.param !== undefined)\r\n visitor.param.extendRange(faceData.paramRange);\r\n } while (visitor.moveToNextFacet() && visitor.currentReadIndex() < endFacetIndex);\r\n if (paramDefined && !(this.data.param!.length === 0) && faceData.paramDistanceRange.isNull)\r\n faceData.setParamDistanceRangeFromNewFaceData(this, facetStart, endFacetIndex);\r\n this.data.face.push(faceData);\r\n const faceDataIndex = this.data.face.length - 1;\r\n for (let i = this._facetToFaceData.length; i < endFacetIndex; i++)\r\n this._facetToFaceData.push(0 === this._facetStart[i] ? 0 : faceDataIndex);\r\n return true;\r\n }\r\n /** Second step of double dispatch: call `handler.handleIndexedPolyface(this)`. */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleIndexedPolyface(this);\r\n }\r\n}\r\n\r\n/**\r\n * A PolyfaceVisitor manages data while walking through facets.\r\n * * The polyface visitor holds data for one facet at a time.\r\n * * The caller can request the position in the addressed polyfaceData as a \"readIndex.\"\r\n * * The readIndex values (as numbers) are not promised to be sequential. (I.e. it might be a simple facet count\r\n * or might have \"gaps\" at the whim of the particular PolyfaceVisitor implementation).\r\n * @public\r\n */\r\nexport interface PolyfaceVisitor extends PolyfaceData {\r\n /** Load data for the facet with given index. */\r\n moveToReadIndex(index: number): boolean;\r\n /** Return the readIndex of the currently loaded facet. */\r\n currentReadIndex(): number;\r\n /** Load data for the next facet. */\r\n moveToNextFacet(): boolean;\r\n /** Reset to initial state for reading all facets sequentially with moveToNextFacet. */\r\n reset(): void;\r\n /** Return the point index of vertex i within the currently loaded facet. */\r\n clientPointIndex(i: number): number;\r\n /** Return the param index of vertex i within the currently loaded facet. */\r\n clientParamIndex(i: number): number;\r\n /** Return the normal index of vertex i within the currently loaded facet. */\r\n clientNormalIndex(i: number): number;\r\n /** Return the color index of vertex i within the currently loaded facet. */\r\n clientColorIndex(i: number): number;\r\n /** Return the aux data index of vertex i within the currently loaded facet. */\r\n clientAuxIndex(i: number): number;\r\n /** Return the client polyface. */\r\n clientPolyface(): Polyface | undefined;\r\n /** Set the number of vertices to replicate in visitor arrays. */\r\n setNumWrap(numWrap: number): void;\r\n /** Clear the contents of all arrays. Use this along with `pushDataFrom` to build up new facets. */\r\n clearArrays(): void;\r\n /** Transfer data from a specified index of the other visitor as new data in this visitor. */\r\n pushDataFrom(other: PolyfaceVisitor, index: number): void;\r\n /**\r\n * Transfer interpolated data from the other visitor.\r\n * * All data values are interpolated at `fraction` between `other` values at `index0` and `index1`.\r\n */\r\n pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void;\r\n}\r\n"]}
|
|
@@ -24,11 +24,11 @@ export declare class PolyfaceData {
|
|
|
24
24
|
point: GrowableXYZArray;
|
|
25
25
|
/** Indices of points at facet vertices. */
|
|
26
26
|
pointIndex: number[];
|
|
27
|
-
/**
|
|
27
|
+
/** Booleans indicating visibility of corresponding edges. */
|
|
28
28
|
edgeVisible: boolean[];
|
|
29
|
-
/** Coordinates of normal vectors, packed as numbers in a contiguous array */
|
|
29
|
+
/** Coordinates of normal vectors, packed as numbers in a contiguous array. */
|
|
30
30
|
normal: GrowableXYZArray | undefined;
|
|
31
|
-
/**
|
|
31
|
+
/** Indices of normals at facet vertices. */
|
|
32
32
|
normalIndex: number[] | undefined;
|
|
33
33
|
/** Coordinates of uv parameters, packed as numbers in a contiguous array. */
|
|
34
34
|
param?: GrowableXYArray;
|
|
@@ -47,13 +47,17 @@ export declare class PolyfaceData {
|
|
|
47
47
|
/** Tagged geometry data */
|
|
48
48
|
taggedNumericData: TaggedNumericData | undefined;
|
|
49
49
|
private _twoSided;
|
|
50
|
-
/** boolean tag indicating if the facets are viewable from the back */
|
|
50
|
+
/** boolean tag indicating if the facets are to be considered viewable from the back */
|
|
51
51
|
get twoSided(): boolean;
|
|
52
52
|
set twoSided(value: boolean);
|
|
53
53
|
/** set the `taggedNumericData` member */
|
|
54
54
|
setTaggedNumericData(data: TaggedNumericData | undefined): void;
|
|
55
55
|
private _expectedClosure;
|
|
56
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Flag indicating if the mesh closure is unknown (0), open sheet (1), closed solid (2).
|
|
58
|
+
* * A boundary edge of a mesh is defined as an edge with only one connected facet.
|
|
59
|
+
* * Closed solid is a mesh with no boundary edge. Open sheet is a mesh that has boundary edge(s).
|
|
60
|
+
*/
|
|
57
61
|
get expectedClosure(): number;
|
|
58
62
|
set expectedClosure(value: number);
|
|
59
63
|
/** Constructor for facets.
|
|
@@ -114,8 +118,9 @@ export declare class PolyfaceData {
|
|
|
114
118
|
*/
|
|
115
119
|
gatherIndexedData(other: PolyfaceData, index0: number, index1: number, numWrap: number): void;
|
|
116
120
|
private static trimArray;
|
|
117
|
-
/**
|
|
118
|
-
*
|
|
121
|
+
/**
|
|
122
|
+
* Trim all index arrays to the stated length.
|
|
123
|
+
* This is called by PolyfaceBuilder to clean up after an aborted construction sequence.
|
|
119
124
|
*/
|
|
120
125
|
trimAllIndexArrays(length: number): void;
|
|
121
126
|
/** Resize all data arrays to specified length */
|
|
@@ -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;AAExD;;;;;;;GAOG;AACH,qBAAa,YAAY;IAUvB;;OAEG;IACH,gBAAuB,oBAAoB,SAAW;IACtD,yFAAyF;IAClF,KAAK,EAAE,gBAAgB,CAAC;IAC/B,2CAA2C;IACpC,UAAU,EAAE,MAAM,EAAE,CAAC;IAC5B,
|
|
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,C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25
|
*/
|
|
26
26
|
class PolyfaceData {
|
|
27
|
-
/** boolean tag indicating if the facets are viewable from the back */
|
|
27
|
+
/** boolean tag indicating if the facets are to be considered viewable from the back */
|
|
28
28
|
get twoSided() { return this._twoSided; }
|
|
29
29
|
set twoSided(value) { this._twoSided = value; }
|
|
30
30
|
/** set the `taggedNumericData` member */
|
|
31
31
|
setTaggedNumericData(data) {
|
|
32
32
|
this.taggedNumericData = data;
|
|
33
33
|
}
|
|
34
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Flag indicating if the mesh closure is unknown (0), open sheet (1), closed solid (2).
|
|
36
|
+
* * A boundary edge of a mesh is defined as an edge with only one connected facet.
|
|
37
|
+
* * Closed solid is a mesh with no boundary edge. Open sheet is a mesh that has boundary edge(s).
|
|
38
|
+
*/
|
|
35
39
|
get expectedClosure() { return this._expectedClosure; }
|
|
36
40
|
set expectedClosure(value) { this._expectedClosure = value; }
|
|
37
41
|
/** Constructor for facets.
|
|
@@ -243,10 +247,13 @@ class PolyfaceData {
|
|
|
243
247
|
this.auxData.indices[numEdge + i] = this.auxData.indices[i];
|
|
244
248
|
}
|
|
245
249
|
}
|
|
246
|
-
static trimArray(data, length) {
|
|
247
|
-
data
|
|
248
|
-
|
|
249
|
-
|
|
250
|
+
static trimArray(data, length) {
|
|
251
|
+
if (data && length < data.length)
|
|
252
|
+
data.length = length;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Trim all index arrays to the stated length.
|
|
256
|
+
* This is called by PolyfaceBuilder to clean up after an aborted construction sequence.
|
|
250
257
|
*/
|
|
251
258
|
trimAllIndexArrays(length) {
|
|
252
259
|
PolyfaceData.trimArray(this.pointIndex, length);
|
|
@@ -1 +1 @@
|
|
|
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,a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AACR;;GAEG;AACoB,iCAAoB,GAAG,OAAO,CAAC;SAb3C,YAAY","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 /** Indices 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 deep 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 * Compress the instance by equating duplicate data.\r\n * * Search for duplicates within points, normals, params, and colors.\r\n * * Compress each data array.\r\n * * Revise all indexing for the relocated data.\r\n * @param tolerance optional tolerance for clustering mesh vertices. Default is [[Geometry.smallMetricDistance]].\r\n */\r\n public compress(tolerance: number = Geometry.smallMetricDistance): void {\r\n const packedPoints = ClusterableArray.clusterGrowablePoint3dArray(this.point, tolerance);\r\n this.point = packedPoints.growablePackedPoints!;\r\n packedPoints.updateIndices(this.pointIndex);\r\n\r\n // for now, normals, params, and colors use the default tolerance for clustering...\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 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 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"]}
|
|
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,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,C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AAE;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;;AA3eD,MAAM;AACN,iFAAiF;AACjF,8CAA8C;AAC9C,oFAAoF;AACpF,qDAAqD;AACrD,2CAA2C;AAC3C,sDAAsD;AACtD,0DAA0D;AAC1D,QAAQ;AACR;;GAEG;AACoB,iCAAoB,GAAG,OAAO,CAAC;SAb3C,YAAY","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 /** Indices 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 to be considered 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 /**\r\n * Flag indicating if the mesh closure is unknown (0), open sheet (1), closed solid (2).\r\n * * A boundary edge of a mesh is defined as an edge with only one connected facet.\r\n * * Closed solid is a mesh with no boundary edge. Open sheet is a mesh that has boundary edge(s).\r\n */\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 deep 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) {\r\n if (data && length < data.length)\r\n data.length = length;\r\n }\r\n /**\r\n * Trim all index arrays to the 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 * Compress the instance by equating duplicate data.\r\n * * Search for duplicates within points, normals, params, and colors.\r\n * * Compress each data array.\r\n * * Revise all indexing for the relocated data.\r\n * @param tolerance optional tolerance for clustering mesh vertices. Default is [[Geometry.smallMetricDistance]].\r\n */\r\n public compress(tolerance: number = Geometry.smallMetricDistance): void {\r\n const packedPoints = ClusterableArray.clusterGrowablePoint3dArray(this.point, tolerance);\r\n this.point = packedPoints.growablePackedPoints!;\r\n packedPoints.updateIndices(this.pointIndex);\r\n\r\n // for now, normals, params, and colors use the default tolerance for clustering...\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 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 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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-geometry",
|
|
3
|
-
"version": "4.5.0-dev.
|
|
3
|
+
"version": "4.5.0-dev.7",
|
|
4
4
|
"description": "iTwin.js Core Geometry library",
|
|
5
5
|
"main": "lib/cjs/core-geometry.js",
|
|
6
6
|
"module": "lib/esm/core-geometry.js",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"nyc": "^15.1.0",
|
|
35
35
|
"rimraf": "^3.0.2",
|
|
36
36
|
"typescript": "~5.0.2",
|
|
37
|
-
"@itwin/build-tools": "4.5.0-dev.
|
|
37
|
+
"@itwin/build-tools": "4.5.0-dev.7"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"flatbuffers": "~1.12.0",
|
|
41
|
-
"@itwin/core-bentley": "4.5.0-dev.
|
|
41
|
+
"@itwin/core-bentley": "4.5.0-dev.7"
|
|
42
42
|
},
|
|
43
43
|
"nyc": {
|
|
44
44
|
"extends": "./node_modules/@itwin/build-tools/.nycrc",
|