PolyfaceBuilder Class
Simple construction for strongly typed GeometryQuery objects:
Create a builder with
builder = PolyfaceBuilder.create()Add GeometryQuery objects:
builder.addGeometryQuery(g: GeometryQuery)builder.addCone(cone: Cone)builder.addTorusPipe(surface: TorusPipe)builder.addLinearSweepLineStringsXYZOnly(surface: LinearSweep)builder.addRotationalSweep(surface: RotationalSweep)builder.addLinearSweep(surface: LinearSweep)builder.addRuledSweep(surface: RuledSweep)builder.addSphere(sphere: Sphere)builder.addBox(box: Box)builder.addIndexedPolyface(polyface)
Extract with
builder.claimPolyface(true)Simple construction for ephemeral constructive data:
Create a builder with
builder = PolyfaceBuilder.create()Add from fragmentary data:
builder.addBetweenLineStringsWithStoredIndices(linestringA linestringB)builder.addBetweenLineStringsWithRuleEdgeNormals(linestringA, vA, linestringB, vB, addClosure)builder.addBetweenTransformedLineStrings(curves, transformA, transformB, addClosure)builder.addLinearSweepLineStringsXYZOnly(contour, vector)builder.addPolygon(points, numPointsToUse)builder.addTransformedUnitBox(transform)builder.addTriangleFan(conePoint, linestring, toggleOrientation)builder.addTrianglesInUncheckedConvexPolygon(linestring, toggle)builder.addUVGridBody(surface,numU, numV, createFanInCaps)builder.addGraph(Graph, acceptFaceFunction)
Extract with
builder.claimPolyface(true)Low-level detail construction -- direct use of indices:
Create a builder with
builder = PolyfaceBuilder.create()Add GeometryQuery objects
builder.addPoint(point)builder.findOrAddPointInLineString(linestring, index)builder.addPointXYZ(x,y,z)builder.addTriangleFacet(points)builder.addQuadFacet(points)
Extends
Methods
| Name | Description | |
|---|---|---|
| addBetweenLineStringsWithRuleEdgeNormals(lineStringA: LineString3d, vA: number, lineStringB: LineString3d, vB: number, addClosure: boolean = false): void | Add facets between lineStrings with matched point counts. | |
| addBetweenLineStringsWithStoredIndices(lineStringA: LineString3d, lineStringB: LineString3d): void | Add facets between lineStrings with matched point counts. | |
| addBetweenTransformedLineStrings(curves: AnyCurve, transformA: Transform, transformB: Transform, addClosure: boolean = false): void | Add facets between lineStrings with matched point counts. | |
| addBox(box: Box): void | Add facets from a box. | |
| addCone(cone: Cone): void | Add facets from a Cone. | |
| addCoordinateFacets(pointArray: Point3d[][], paramArray?: Point2d[][], normalArray?: Vector3d[][], endFace: boolean = false): void | Add facets to the builder given arrays of coordinates for multiple facets. | |
| addFacetFromGrowableArrays(points: GrowableXYZArray, normals: GrowableXYZArray, params: GrowableXYArray, colors: number[], edgeVisible?: boolean[]): void | Add a polygon to the evolving facets. | |
| addFacetFromIndexedVisitor(visitor: PolyfaceVisitor, indices: number[]): boolean | Add the subset of visitor data indexed by the indices. | |
| addFacetFromVisitor(visitor: PolyfaceVisitor): void | Add the current visitor facet to the evolving polyface. | |
| addFacetsFromVisitor(visitor: PolyfaceVisitor): void | Add all visitor facets to the evolving polyface (in reverse order if indicated by the builder state). | |
| addGeometryQuery(g: GeometryQuery): void | Add facets for a GeometryQuery object. | |
| addGreedyTriangulationBetweenLineStrings(pointsA: IndexedXYZCollection | Point3d[] | LineString3d, pointsB: IndexedXYZCollection | Point3d[] | LineString3d): void | Add triangular facets between two linestrings. | |
| addIndexedPolyface(source: IndexedPolyface, reversed: boolean = false, transform?: Transform): void | Add a polyface with optional reverse and transform. | |
| addLinearSweep(surface: LinearSweep): void | Add facets from the linear sweep. | |
| addLinearSweepLineStringsXYZOnly(contour: AnyCurve, vector: Vector3d): void | Add point data (no params, normals) for linestrings. | |
| addMiteredPipes(centerline: IndexedXYZCollection | Point3d[] | CurvePrimitive, sectionData: number | Readonly<WritableXAndY> | Arc3d, numFacetAround: number = 12, capped: boolean = false): void | Add quad facets along a mitered pipe that follows a centerline curve. | |
| addParamInGrowableXYArray(data: GrowableXYArray, index: number): undefined | number | Add a uv parameter to the polyface. | |
| addParamXY(x: number, y: number): number | Add a uv parameter to the polyface. | |
| addPoint(xyz: Point3d): number | Add a point to the polyface. | |
| addPointXYZ(x: number, y: number, z: number): number | Add a point to the polyface. | |
| addPolygon(points: Point3d[], numPointsToUse?: number): void | Add a polygon to the evolving facets. | |
| addPolygonGrowableXYZArray(points: GrowableXYZArray): void | Add a polygon to the evolving facets. | |
| addQuadFacet(points: Point3d[] | GrowableXYZArray, params?: Point2d[], normals?: Vector3d[], colors?: number[]): void | Add a quad to the polyface given its points in order around the edges. | |
| addRotationalSweep(surface: RotationalSweep): void | Construct facets for a rotational sweep. | |
| addRuledSweep(surface: RuledSweep): boolean | Add facets from a ruled sweep. | |
| addSphere(sphere: Sphere, strokeCount?: number): void | Add facets from a sphere. | |
| addSweptIndexedPolyface(source: IndexedPolyface, sweepVector: Vector3d, triangulateSides: boolean = false): boolean | Add facets from the source polyface, from its translation along the vector, and from its swept boundary edges, | |
| addTorusPipe(surface: TorusPipe, phiStrokeCount?: number, thetaStrokeCount?: number): void | Add facets for a TorusPipe. | |
| addTransformedRangeMesh(transform: Transform, range: Range3d, faceSelector?: boolean[]): void | Add facets for a transformed range box. | |
| addTransformedUnitBox(transform: Transform): void | Add facets for a transformed unit box. | |
| addTriangleFacet(points: Point3d[] | GrowableXYZArray, params?: Point2d[], normals?: Vector3d[], colors?: number[]): void | Add a triangle to the polyface given its points in order around the edges. | |
| addTriangleFan(conePoint: Point3d, ls: LineString3d, toggle: boolean): void | Add triangles from conePoint to each far edge. |
|
| addTrianglesInUncheckedConvexPolygon(ls: LineString3d, toggle: boolean): void | Add triangles from the first point of the linestring to the subsequent edges of the linestring. | |
| addTriangulatedRegion(region: AnyRegion): void | Construct facets for any planar region. | |
| addUVGridBody(surface: UVSurface, numU: number, numV: number, uMap?: Segment1d, vMap?: Segment1d): void | Add facets from the parametric surface. | |
| applyStrokeCountsToCurvePrimitives(data: GeometryQuery | AnyCurve): void | Apply stroke counts to curve primitives. | Deprecated |
| claimPolyface(compress: boolean = true, tolerance: number = Geometry.smallMetricDistance): IndexedPolyface | Extract the polyface. | |
| endFace(): boolean | Produce a new FacetFaceData for all terminated facets since construction of the previous face. | |
| findOrAddNormalInGrowableXYZArray(xyz: GrowableXYZArray, index: number, transform?: Transform, priorIndex?: number): undefined | number | Add a normal to the polyface. | |
| findOrAddNormalInLineString(ls: LineString3d, index: number, transform?: Transform, priorIndexA?: number, priorIndexB?: number): undefined | number | Add a normal to the polyface. | |
| findOrAddParamInLineString(ls: LineString3d, index: number, v: number, priorIndexA?: number, priorIndexB?: number): undefined | number | Add a uv parameter to the polyface, taking u from ls.fractions and v from input. |
|
| findOrAddPointInGrowableXYZArray(xyz: GrowableXYZArray, index: number, transform?: Transform, priorIndex?: number): undefined | number | Add a point to the polyface. | |
| findOrAddPointInLineString(ls: LineString3d, index: number, transform?: Transform, priorIndex?: number): undefined | number | Add a point to the polyface. | |
| handleBox(g: Box): any | Double dispatch handler for Box. | |
| handleCone(g: Cone): any | Double dispatch handler for Cone. | |
| handleLinearSweep(g: LinearSweep): any | Double dispatch handler for LinearSweep. | |
| handleLoop(g: Loop): any | Double dispatch handler for Loop. | |
| handleParityRegion(g: ParityRegion): any | Double dispatch handler for ParityRegion. | |
| handleRotationalSweep(g: RotationalSweep): any | Double dispatch handler for RotationalSweep. | |
| handleRuledSweep(g: RuledSweep): any | Double dispatch handler for RuledSweep. | |
| handleSphere(g: Sphere): any | Double dispatch handler for Sphere. | |
| handleTorusPipe(g: TorusPipe): any | Double dispatch handler for TorusPipe. | |
| handleUnionRegion(g: UnionRegion): any | Double dispatch handler for UnionRegion. | |
| toggleReversedFacetFlag(): void | Toggle (reverse) the flag controlling orientation flips for newly added facets. | |
| create(options?: StrokeOptions): PolyfaceBuilder Static | Create a builder with given StrokeOptions. | |
| pointsToTriangulatedPolyface(points: Point3d[], options?: StrokeOptions): undefined | IndexedPolyface Static | Create a polyface from a triangulation of the points. | |
| polygonToTriangulatedPolyface(points: Point3d[], localToWorld?: Transform): undefined | IndexedPolyface Static | Create a polyface containing triangles in a (space) polygon. |
Inherited methods
Properties
| Name | Type | Description | |
|---|---|---|---|
| options Accessor ReadOnly | StrokeOptions | Return (pointer to) the StrokeOptions in use by the builder. |
|
| reversedFlag Accessor ReadOnly | boolean | Ask if this builder is reversing vertex order as loops are received. |
Defined in
- polyface/PolyfaceBuilder.ts Line 209
Last Updated: 28 October, 2025
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.