addNewFace2s method
ConvexHull
addNewFace2s(
- dynamic eyeVertex,
- dynamic horizon
)
Implementation
ConvexHull addNewFace2s(eyeVertex, horizon) {
newFace2s = [];
var firstSideEdge;
var previousSideEdge;
for (var i = 0; i < horizon.length; i++) {
var horizonEdge = horizon[i];
// returns the right side edge
var sideEdge = addAdjoiningFace2(eyeVertex, horizonEdge);
if (firstSideEdge == null) {
firstSideEdge = sideEdge;
} else {
// joins face.getEdge( 1 ) with previousFace2.getEdge( 0 )
sideEdge.next.setTwin(previousSideEdge);
}
newFace2s.add(sideEdge.face);
previousSideEdge = sideEdge;
}
// perform final join of new faces
firstSideEdge.next.setTwin(previousSideEdge);
return this;
}