Skip to content

RationalFace

Overview

Represents a face with a main (positive-oriented) boundary and zero or more (negative-oriented) holes.

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class RationalFace

import { RationalFace } from 'scenerystack/alpenglow';

Constructor

new RationalFace( boundary : RationalBoundary )

Instance Methods

toAccumulator( accumulator : ClippableFaceAccumulator, matrix : Matrix3 )

getEdges() : RationalHalfEdge[]

getBounds( matrix : Matrix3 ) : Bounds2

getIncludedRenderPaths() : Set<RenderPath>

Returns a set of render paths that are included in this face (based on winding numbers).

REQUIRED: Should have computed the winding map first.

Instance Properties

holes : RationalBoundary[]

(readonly)

windingMapMap : Map

windingMap : WindingMap | null

renderProgram : RenderProgram | null

processed

Static Methods

traceBoundaries( filteredRationalHalfEdges : RationalHalfEdge[], innerBoundaries : RationalBoundary[], outerBoundaries : RationalBoundary[], faces : RationalFace[] ) : RationalHalfEdge[]

NOTE: Returns better-filtered rational half edges, with zero-area boundaries removed

computeFaceHolesWithOrderedWindingNumbers( outerBoundaries : RationalBoundary[], faces : RationalFace[] ) : RationalBoundary[]

Returns the fully exterior boundaries (should be singular in the rendering case, since we added the exterior, rectangle, HOWEVER can be multiples otherwise) NOTE: mutates faces order

computeFaceHoles( integerBounds : Bounds2, outerBoundaries : RationalBoundary[], faces : RationalFace[], faceHoleLog : FaceHoleLog | null ) : RationalBoundary

Returns the fully exterior boundary (should be singular, since we added the exterior rectangle) TODO: DOUBTS on the correctness of this, the filtering of boundaries seems sketchy. Probably not as high-performance TODO: BUT perhaps it is more parallelizable?

createUnboundedFace( ...exteriorBoundaries : RationalBoundary[] ) : RationalFace

computeWindingMaps( filteredRationalHalfEdges : RationalHalfEdge[], unboundedFace : RationalFace )

Computes winding maps for all of the faces

traceCombineFaces( faces : RationalFace[], fromIntegerMatrix : Matrix3, getFaceData : ( face: RationalFace ) => FaceData, createOutputFace : ( face: ClippableFaceType, faceData: FaceData, bounds: Bounds2 ) => OutputFace, isFaceDataCompatible : ( faceData1: FaceData, faceData2: FaceData | null ) => boolean, accumulator : ClippableFaceAccumulator<ClippableFaceType> ) : OutputFace[]

Combines faces that have equivalent face data IFF they border each other (leaving separate programs with equivalent face data separate if they don't border). It will also remove edges that border between faces that we combine, and will connect edges to keep things polygonal!

Source Code

See the source for RationalFace.ts in the alpenglow repository.