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.  
addFacetFromVisitor(visitor: PolyfaceVisitor): void Add the current visitor facet to the evolving polyface.  
addGeometryQuery(g: GeometryQuery): void add facets for a GeometryQuery object.  
addGreedyTriangulationBetweenLineStrings(pointsA: Point3d[] | LineString3d | IndexedXYZCollection, pointsB: Point3d[] | LineString3d | IndexedXYZCollection): void Create (and add to the builder) triangles that bridge the gap between two linestrings.  
addIndexedPolyface(source: IndexedPolyface, reversed: boolean, 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: Point3d[] | CurvePrimitive | IndexedXYZCollection, sectionData: number | Arc3d | Readonly<WritableXAndY>, 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 unit 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): 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  
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  
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[]): 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
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
handleLoop(_g: Loop): any NullGeometryHandler no-action implementation
handleParityRegion(_g: ParityRegion): any NullGeometryHandler no-action implementation
handlePath(_g: Path): any NullGeometryHandler no-action implementation
handlePointString3d(_g: PointString3d): any NullGeometryHandler no-action implementation
handleUnionRegion(_g: UnionRegion): 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: 30 November, 2023