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 Given arrays of coordinates for multiple facets.  
addFacetFromGrowableArrays(points: GrowableXYZArray, normals: undefined | GrowableXYZArray, params: undefined | GrowableXYArray, colors: undefined | 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 Create (and add to the builder) triangles that bridge the gap 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  
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): void * Create (and add to the builder) quad facets for a mitered pipe that follows a centerline curve.  
addParamInGrowableXYArray(data: GrowableXYArray, index: number): undefined | number Announce uv parameter coordinates.  
addParamXY(x: number, y: number): number Announce uv parameter coordinates.  
addPoint(xyz: Point3d): number Announce point coordinates.  
addPointXYZ(x: number, y: number, z: number): number Announce point coordinates.  
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, to form a polyface that encloses a volume.  
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 points[0] to each far edge.  
addTrianglesInUncheckedConvexPolygon(ls: LineString3d, toggle: boolean): void Add triangles from points[0] to each far edge  
addTriangulatedRegion(region: AnyRegion): void Construct facets for any planar region  
addUVGridBody(surface: UVSurface, numU: number, numV: number, uMap?: Segment1d, vMap?: Segment1d): void * Evaluate (numU + 1) * (numV + 1) grid points (in 0..1 in both u and v) on a surface.  
applyStrokeCountsToCurvePrimitives(data: GeometryQuery | AnyCurve): void * Recursively visit all children of data.  
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 Announce point coordinates.  
findOrAddNormalInLineString(ls: LineString3d, index: number, transform?: Transform, priorIndexA?: number, priorIndexB?: number): undefined | number Announce normal coordinates found at index in the surfaceNormal array stored on the linestring  
findOrAddParamInGrowableXYArray(data: GrowableXYArray, index: number): undefined | number Announce uv parameter coordinates. Deprecated  
findOrAddParamInLineString(ls: LineString3d, index: number, v: number, priorIndexA?: number, priorIndexB?: number): undefined | number Announce param coordinates, taking u from ls.fractions and v from parameter.  
findOrAddParamXY(x: number, y: number): number Announce uv parameter coordinates. Deprecated  
findOrAddPoint(xyz: Point3d): number Announce point coordinates. Deprecated  
findOrAddPointInGrowableXYZArray(xyz: GrowableXYZArray, index: number, transform?: Transform, priorIndex?: number): undefined | number Announce point coordinates.  
findOrAddPointInLineString(ls: LineString3d, index: number, transform?: Transform, priorIndex?: number): undefined | number Announce point coordinates.  
findOrAddPointXYZ(x: number, y: number, z: number): number Announce point coordinates. 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 Triangulate the points as viewed in xy.  
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 NullGeometryHandler No-action implementation
handleArc3d(_g: Arc3d): any NullGeometryHandler No-action implementation
handleBSplineCurve3d(_g: BSplineCurve3d): any NullGeometryHandler No-action implementation
handleBSplineCurve3dH(_g: BSplineCurve3dH): any NullGeometryHandler No-action implementation
handleBSplineSurface3d(_g: BSplineSurface3d): any NullGeometryHandler No-action implementation
handleBSplineSurface3dH(_g: BSplineSurface3dH): any NullGeometryHandler No-action implementation
handleBagOfCurves(_g: BagOfCurves): any NullGeometryHandler No-action implementation
handleBezierCurve3d(_g: BezierCurve3d): any NullGeometryHandler No-action implementation
handleBezierCurve3dH(_g: BezierCurve3dH): any NullGeometryHandler No-action implementation
handleCoordinateXYZ(_g: CoordinateXYZ): any NullGeometryHandler No-action implementation
handleCurveChainWithDistanceIndex(_g: CurveChainWithDistanceIndex): any NullGeometryHandler No-action implementation
handleCurveCollection(_g: CurveCollection): any NullGeometryHandler No-action implementation
handleIndexedPolyface(_g: IndexedPolyface): any NullGeometryHandler No-action implementation
handleInterpolationCurve3d(_g: InterpolationCurve3d): any NullGeometryHandler No-action implementation
handleLineSegment3d(_g: LineSegment3d): any NullGeometryHandler No-action implementation
handleLineString3d(_g: LineString3d): any NullGeometryHandler No-action implementation
handlePath(_g: Path): any NullGeometryHandler No-action implementation
handlePointString3d(_g: PointString3d): any NullGeometryHandler No-action implementation
handleTransitionSpiral(_g: TransitionSpiral3d): any 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: 16 April, 2024