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: booleanfalse): 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: booleanfalse): 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: booleanfalse): 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: booleanfalse, 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: number12): 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: booleanfalse): 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: booleantrue, tolerance: numberGeometry.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.  
findOrAddParamInGrowableXYArray(data: GrowableXYArray, index: number): undefined | number Add a uv parameter to the polyface. Deprecated  
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.  
findOrAddParamXY(x: number, y: number): number Add a uv parameter to the polyface. Deprecated  
findOrAddPoint(xyz: Point3d): number Add a point to the polyface. Deprecated  
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.  
findOrAddPointXYZ(x: number, y: number, z: number): number Add a point to the polyface. Deprecated  
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

Name Inherited from Description
handleAkimaCurve3d(_g: AkimaCurve3d): any Inherited NullGeometryHandler No-action implementation
handleArc3d(_g: Arc3d): any Inherited NullGeometryHandler No-action implementation
handleBagOfCurves(_g: BagOfCurves): any Inherited NullGeometryHandler No-action implementation
handleBezierCurve3d(_g: BezierCurve3d): any Inherited NullGeometryHandler No-action implementation
handleBezierCurve3dH(_g: BezierCurve3dH): any Inherited NullGeometryHandler No-action implementation
handleBSplineCurve3d(_g: BSplineCurve3d): any Inherited NullGeometryHandler No-action implementation
handleBSplineCurve3dH(_g: BSplineCurve3dH): any Inherited NullGeometryHandler No-action implementation
handleBSplineSurface3d(_g: BSplineSurface3d): any Inherited NullGeometryHandler No-action implementation
handleBSplineSurface3dH(_g: BSplineSurface3dH): any Inherited NullGeometryHandler No-action implementation
handleCoordinateXYZ(_g: CoordinateXYZ): any Inherited NullGeometryHandler No-action implementation
handleCurveChainWithDistanceIndex(_g: CurveChainWithDistanceIndex): any Inherited NullGeometryHandler No-action implementation
handleCurveCollection(_g: CurveCollection): any Inherited NullGeometryHandler No-action implementation
handleIndexedPolyface(_g: IndexedPolyface): any Inherited NullGeometryHandler No-action implementation
handleInterpolationCurve3d(_g: InterpolationCurve3d): any Inherited NullGeometryHandler No-action implementation
handleLineSegment3d(_g: LineSegment3d): any Inherited NullGeometryHandler No-action implementation
handleLineString3d(_g: LineString3d): any Inherited NullGeometryHandler No-action implementation
handlePath(_g: Path): any Inherited NullGeometryHandler No-action implementation
handlePointString3d(_g: PointString3d): any Inherited NullGeometryHandler No-action implementation
handleTransitionSpiral(_g: TransitionSpiral3d): any Inherited NullGeometryHandler No-action implementation

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

Last Updated: 21 November, 2024