computeHorizon method
ConvexHull
computeHorizon(
- dynamic eyePoint,
- dynamic crossEdge,
- Face2 face,
- dynamic horizon,
)
Implementation
ConvexHull computeHorizon(eyePoint, crossEdge, Face2 face, horizon) {
// moves face's vertices to the 'unassigned' vertex list
deleteFace2Vertices(face, null);
face.mark = Deleted;
var edge;
if (crossEdge == null) {
edge = crossEdge = face.getEdge(0);
} else {
// start from the next edge since 'crossEdge' was already analyzed
// (actually 'crossEdge.twin' was the edge who called this method recursively)
edge = crossEdge.next;
}
do {
var twinEdge = edge.twin;
var oppositeFace2 = twinEdge.face;
if (oppositeFace2.mark == Visible) {
if (oppositeFace2.distanceToPoint(eyePoint) > tolerance) {
// the opposite face can see the vertex, so proceed with next edge
computeHorizon(eyePoint, twinEdge, oppositeFace2, horizon);
} else {
// the opposite face can't see the vertex, so this edge is part of the horizon
horizon.add(edge);
}
}
edge = edge.next;
} while (edge != crossEdge);
return this;
}