Skip to content

Face

Under Construction

This documentation is auto-generated, and is a work in progress. Please see the source code at https://github.com/phetsims/kite/blob/main/js/ops/Face.ts for the most up-to-date information.

Overview

A face is usually contained by an ("inner") boundary of edges, and zero or more ("outer") boundary holes on the inside. The naming is somewhat counterintuitive here, because the "inner" boundaries are on the inside of the edges (towards our face), and the "outer" hole boundaries are on the outer half-edges of the holes.

There is normally one "unbounded" face without a normal boundary, whose "area" expands to infinity, and contains the everything on the exterior of all of the edges.

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

Class Face

import { Face } from 'scenerystack/kite';

Instance Methods

serialize() : SerializedFace

Returns an object form that can be turned back into a segment with the corresponding deserialize method.

dispose()

Removes references (so it can allow other objects to be GC'ed or pooled), and frees itself to the pool so it can be reused.

addBoundaryFaceReferences( boundary : Boundary )

Marks all half-edges on the boundary as belonging to this face.

recursivelyAddHoles( outerBoundary : Boundary )

Processes the boundary-graph for a given outer boundary, and turns it into holes for this face.

In the graph, every outer boundary in each connected component will be holes for the single inner boundary (which will be, in this case, our face's boundary). Since it's a tree, we can walk the tree recursively to add all necessary holes.

freeToPool()

Instance Properties

id : number

(readonly)

boundary : Boundary | null

"inner" types, null when disposed (in pool), OR null if the face is unbounded

holes : Boundary[]

"outer" types

windingMap : Record<number, number> | null

If non-null, it's a map from shapeId {number} => winding {number}

filled : boolean | null

Static Properties

pool : Pool

Type SerializedFace

import type { SerializedFace } from 'scenerystack/kite';
  • type: "Face"
  • id: number
  • boundary: number | null
  • holes: number[]
  • windingMap: Record<number, number> | null
  • filled: boolean | null

Source Code

See the source for Face.ts in the kite repository.