PolyfaceData Class

PolyfaceData carries data arrays for point, normal, uv-parameters, and color, and index arrays for each.

  • Normal, uv-parameter, and color data are optional.
  • A given data array is defined if and only if its corresponding index array is defined.
  • All defined index arrays have parallel face loop order and structure, and thus the same length.
  • IndexedPolyface carries a PolyfaceData as a member (NOT as a base class; it already has GeometryQuery as base).
  • IndexedPolyfaceVisitor uses PolyfaceData as a base class. In this use, there is only a single facet in PolyfaceData.
  • PolyfaceData does not know what index range constitutes a given facet. This is managed by a derived/carrier class.

Extended by

Methods

Name Description
constructor(needNormals: boolean = false, needParams: boolean = false, needColors: boolean = false, twoSided: boolean = false): PolyfaceData Constructor for facets.  
clone(): PolyfaceData Return a deep clone.  
compress(tolerance: number = Geometry.smallMetricDistance): void Compress the instance by equating duplicate data.  
copyNormalTo(i: number, dest: Vector3d): void Copy the contents (not pointer) of normal[i] into dest.  
copyParamTo(i: number, dest: Point2d): void Copy the contents (not pointer) of param[i] into dest.  
copyPointTo(i: number, dest: Point3d): void Copy the contents (not pointer) of point[i] into dest.  
gatherIndexedData(other: PolyfaceData, index0: number, index1: number, numWrap: number): void Copy data from other to this.  
getColor(i: number): number Return indexed color at index i.  
getEdgeVisible(i: number): boolean Return indexed visibility.  
getNormal(i: number, result?: Vector3d): undefined | Vector3d Return indexed normal at index i.  
getParam(i: number, result?: Point2d): undefined | Point2d Return indexed param at index i.  
getPoint(i: number, result?: Point3d): undefined | Point3d Return indexed point at index i.  
isAlmostEqual(other: PolyfaceData): boolean Test for equal indices and nearly equal coordinates.  
isAlmostEqualParamIndexUV(i: number, u: number, v: number): boolean Test if param at a index i matches the given uv  
range(result?: Range3d, transform?: Transform): Range3d Return the range of the point array (optionally transformed).  
resizeAllArrays(length: number): void Resize all data and index arrays to the specified length.  
resizeAllDataArrays(length: number): void Resize all data arrays to the specified length. Deprecated  
reverseIndices(facetStartIndex?: number[]): void Reverse the indices for the specified facets in the index arrays (pointIndex, normalIndex, paramIndex, colorIndex,  
reverseIndicesSingleFacet(facetIndex: number, facetStartIndex: number[]): void Reverse the indices for the specified facet in the index arrays (pointIndex, normalIndex, paramIndex, colorIndex,  
reverseNormals(): void Scale all the normals by -1.  
setTaggedNumericData(data: undefined | TaggedNumericData): void Set the tagged geometry data.  
trimAllIndexArrays(length: number): void Trim all index arrays to the stated length.  
tryTransformInPlace(transform: Transform): boolean Apply transform to point and normal arrays and to auxData.  
isValidFacetStartIndexArray(facetStartIndex: number[]): boolean Static Test if facetStartIndex is (minimally) valid.  
reverseIndices<T>(facetStartIndex: number[], indices: undefined | T[], preserveStart: boolean): boolean Static Reverse the indices for the specified facets in the given index array.  
reverseIndicesSingleFacet<T>(facetIndex: number, facetStartIndex: number[], indices: undefined | T[], preserveStart: boolean): boolean Static Reverse the indices for the specified facet in the specified index array.  

Properties

Name Type Description
auxData undefined | PolyfaceAuxData Auxiliary data.  
color undefined | number[] Color values.  
colorCount Accessor ReadOnly number Get the color count  
colorIndex undefined | number[] Indices of colors at facet vertices.  
edgeVisible boolean[] Booleans indicating visibility of corresponding edges.  
expectedClosure Accessor number Get flag indicating if the mesh closure is unknown (0), open sheet (1), closed solid (2).  
face FacetFaceData[] Map from facet index to face data.  
faceCount Accessor ReadOnly number Get the number of faces.  
indexCount Accessor ReadOnly number Get the index count.  
normal undefined | GrowableXYZArray Coordinates of normal vectors (packed as numbers in a contiguous array).  
normalCount Accessor ReadOnly number Get the normal count  
normalIndex undefined | number[] Indices of normals at facet vertices.  
param undefined | GrowableXYArray Coordinates of uv parameters (packed as numbers in a contiguous array).  
paramCount Accessor ReadOnly number Get the param count  
paramIndex undefined | number[] Indices of params at facet vertices.  
point GrowableXYZArray Coordinate data for points in the facets (packed as numbers in a contiguous array).  
pointCount Accessor ReadOnly number Get the point count  
pointIndex number[] Indices of points at facet vertices.  
requireColors Accessor ReadOnly boolean Ask if colors are required in this mesh.  
requireNormals Accessor ReadOnly boolean Ask if normals are required in this mesh.  
requireParams Accessor ReadOnly boolean Ask if params are required in this mesh.  
taggedNumericData undefined | TaggedNumericData Tagged geometry data.  
twoSided Accessor boolean Get boolean tag indicating if the facets are to be considered viewable from the back.  

Defined in

Last Updated: 25 April, 2024