Face¶
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¶
Instance Methods¶
initialize( boundary )¶
Similar to a usual constructor, but is set up so it can be called multiple times (with dispose() in-between) to support pooling. @private
@param {Boundary} boundary @returns {Face} - This reference for chaining
serialize()¶
Returns an object form that can be turned back into a segment with the corresponding deserialize method. @public
@returns {Object}
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. @public
addBoundaryFaceReferences( boundary )¶
Marks all half-edges on the boundary as belonging to this face. @public
@param {Boundary} boundary
recursivelyAddHoles( outerBoundary )¶
Processes the boundary-graph for a given outer boundary, and turns it into holes for this face. @public
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.
@param {Boundary} outerBoundary