IndexedPolyface Class

An IndexedPolyface is a set of facets which can have normal, param, and color arrays with independent point, normal, param, and color indices.

Extends

Methods

Name Description
constructor(data: PolyfaceData, facetStart?: number[], facetToFaceData?: number[]): IndexedPolyface Protected Constructor for a new polyface.  
addColor(color: number): number Add a color  
addColorIndex(index: number): void Add a color index  
addIndexedPolyface(source: IndexedPolyface, reversed: boolean, transform: Transform | undefined): void * Add facets from source to this polyface.  
addNormal(normal: Vector3d, priorIndexA?: number, priorIndexB?: number): number Add a normal vector  
addNormalIndex(index: number): void Add a normal index  
addNormalXYZ(x: number, y: number, z: number): number Add a normal vector given by direct coordinates  
addParam(param: Point2d): number Add a uv param.  
addParamIndex(index: number): void Add a param index  
addParamUV(u: number, v: number, priorIndexA?: number, priorIndexB?: number): number Add a uv parameter to the parameter array.  
addPoint(point: Point3d, priorIndex?: number): number add (a clone of ) a point.  
addPointIndex(index: number, visible: boolean = true): void Add a point index with edge visibility flag.  
addPointXYZ(x: number, y: number, z: number): number add a point.  
cleanupOpenFacet(): void clean up the open facet.  
clone(): IndexedPolyface Return a deep clone.  
cloneTransformed(transform: Transform): IndexedPolyface Return a deep clone with transformed points and normals  
createVisitor(numWrap: number = 0): PolyfaceVisitor create a visitor for this polyface  
dispatchToGeometryHandler(handler: GeometryHandler): any Second step of double dispatch: call handler.handleIndexedPolyface(this)  
extendRange(range: Range3d, transform?: Transform): void Extend range with coordinates from this mesh  
facetIndex0(index: number): number ASSUME valid facet index .  
facetIndex1(index: number): number ASSUME valid facet index .  
getFaceDataByFacetIndex(facetIndex: number): FacetFaceData Given the index of a facet, return the data pertaining to the face it is a part of.  
isAlmostEqual(other: any): boolean Tests for equivalence between two IndexedPolyfaces.  
isSameGeometryClass(other: any): boolean Test if other is an instance of IndexedPolyface  
isValidFacetIndex(index: number): boolean test if index is a valid facet index.  
numEdgeInFacet(facetIndex: number): number Return the number of edges in a particular facet.  
range(transform?: Transform, result?: Range3d): Range3d Return the range of (optionally transformed) points in this mesh.  
reverseIndices(): void Reverse the order of indices around all facets.  
reverseNormals(): void Reverse the direction of all normal vectors.  
reverseSingleFacet(facetId: number): void Reverse indices for a single facet.  
setNewFaceData(endFacetIndex: number = 0): boolean All terminated facets since the last face declaration will be mapped to a single new FacetFaceData object
using facetToFaceData[].
 
terminateFacet(validateAllIndices: boolean = true): any announce the end of construction of a facet.  
tryGetFaceData(i: number): FacetFaceData | undefined return face data using a facet index.  
tryTransformInPlace(transform: Transform): boolean apply the transform to points
apply the (inverse transpose of) the matrix part to normals
If determinant is negative, also
negate normals
* reverse index order around each facet.
 
create(needNormals: boolean = false, needParams: boolean = false, needColors: boolean = false, twoSided: boolean = false): IndexedPolyface Static Create an empty facet set, with coordinate and index data to be supplied later.  

Inherited methods

Name Inherited from Description
tryTranslateInPlace(dx: number, dy: number = 0, dz: number = 0): boolean GeometryQuery try to move the geometry by dx,dy,dz
areIndicesValid(indices: number[] | undefined, indexPositionA: number, indexPositionB: number, data: any | undefined, dataLength: number): boolean Static Polyface Check validity of indices into a data array.

Properties

Name Type Description
_facetStart Protected number[] * index to the index array entries for a specific facet.  
_facetToFaceData Protected number[] * For facet i, _facetToFaceData[i] is the index of the faceData entry for the facet.  
colorCount Accessor ReadOnly number (read-only property) number of colors  
faceCount Accessor ReadOnly number (read-only property) number of faces  
facetCount Accessor ReadOnly number (read-only property) number of facets  
isEmpty Accessor ReadOnly boolean Returns true if either the point array or the point index array is empty.  
normalCount Accessor ReadOnly number (read-only property) number of normals  
paramCount Accessor ReadOnly number (read-only property) number of parameters  
pointCount Accessor ReadOnly number (read-only property) number of points  
zeroTerminatedIndexCount Accessor ReadOnly number Return the total number of param indices in zero-terminated style, which includes
all the indices in the packed zero-based table
one additional index for the zero-terminator of each facet.
 

Inherited properties

Name Type Inherited from Description
children Accessor ReadOnly GeometryQuery[] | undefined GeometryQuery return GeometryQuery children for recursive queries.

* leaf classes do not need to implement.
data PolyfaceData Polyface Underlying polyface data.
geometryCategory "polyface" = "polyface" Polyface String name for schema properties
twoSided Accessor boolean Polyface Return the flag indicating if the mesh display must assume both sides are visible.

Defined in

Last Updated: 08 January, 2020