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.addLinearSweepLineStrings(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.addBetweenLineStrings (linestringA, linestringB, addClosure)
      • builder.addBetweenTransformedLineStrings (curves, transformA, transformB, addClosure)
      • builder.addBetweenStroked (curveA, curveB)
      • builder.addLinearSweepLineStrings (contour, vector)
      • builder.addPolygon (points, numPointsToUse)
      • builder.addTransformedUnitBox (transform)
      • builder.addTriangleFan (conePoint, linestring, toggleOrientation)
      • builder.addTrianglesInUncheckedPolygon (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.findOrAddPoint(point)
      • builder.findOrAddPointInLineString (linestring, index)
      • builder.findOrAddTransformedPointInLineString(linestring, index, transform)
      • builder.findOrAddPointXYZ(x,y,z)
      • builder.addTriangle (point0, point1, point2)
      • builder.addQuad (point0, point1, point2, point3)
      • builder.addOneBasedPointIndex (index)

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: GrowableXYZArray | undefined, params: GrowableXYArray | undefined, colors: number[] | undefined): 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
The swept contour
each cap.
 
addLinearSweepLineStringsXYZOnly(contour: AnyCurve, vector: Vector3d): void Add point data (no params, normals) for linestrings.  
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[]): 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  
addTorusPipe(surface: TorusPipe, phiStrokeCount?: number, thetaStrokeCount?: number): void Add facets for a TorusPipe.  
addTransformedUnitBox(transform: Transform): void add facets for a transformed unit box.  
addTriangleFacet(points: Point3d[] | GrowableXYZArray, params?: Point2d[], normals?: Vector3d[]): 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
* Assume the polygon is convex.
 
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: AnyCurve | GeometryQuery): 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): number | undefined Announce point coordinates.  
findOrAddNormalInLineString(ls: LineString3d, index: number, transform?: Transform, priorIndexA?: number, priorIndexB?: number): number | undefined Announce normal coordinates found at index in the surfaceNormal array stored on the linestring  
findOrAddNormalnLineString(ls: LineString3d, index: number, transform?: Transform, priorIndexA?: number, priorIndexB?: number): number | undefined This is a misspelling of findOrAddNormalInLineString Deprecated
findOrAddParamInGrowableXYArray(data: GrowableXYArray, index: number): number | undefined Announce param coordinates.  
findOrAddParamInLineString(ls: LineString3d, index: number, v: number, priorIndexA?: number, priorIndexB?: number): number | undefined Announce param coordinates, taking u from ls.fractions and v from parameter.  
findOrAddParamXY(x: number, y: number): number Announce point coordinates.  
findOrAddPoint(xyz: Point3d): number Announce point coordinates.  
findOrAddPointInGrowableXYZArray(xyz: GrowableXYZArray, index: number, transform?: Transform, priorIndex?: number): number | undefined Announce point coordinates.  
findOrAddPointInLineString(ls: LineString3d, index: number, transform?: Transform, priorIndex?: number): number | undefined Announce point coordinates.  
findOrAddPointXYZ(x: number, y: number, z: number): number Announce point coordinates.  
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[]): IndexedPolyface | undefined Static Triangulate the points as viewed in xy.  
polygonToTriangulatedPolyface(points: Point3d[], localToWorld?: Transform): IndexedPolyface | undefined Static Create a polyface containing triangles in a (space) polygon.  

Inherited methods

Name Inherited from Description
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
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: 08 January, 2020