Skip to main content

make_polyhedron

Function make_polyhedron 

Source
pub fn make_polyhedron(
    model: &mut Model,
    points: &[Point],
    rings: &[Vec<usize>],
    tol: Tolerances,
) -> OgeomResult<Built>
Expand description

A convex solid from planar rings over shared points.

rings name the faces, each a loop of indices into points in either winding: the builder winds every ring outward itself, judged against the centroid of all the points, which is what makes the solid’s convexity a requirement rather than a courtesy. Every ring must be planar, and every edge (a pair of consecutive points on a ring) must be shared by exactly two rings, or the shell would not close. The corner tool’s block at an N-edged vertex is one: the N host planes and, through the ball’s centre, the N planes square to the edges.

§Errors

OgeomError::Construction if a point is not finite, a ring names fewer than three points or a point out of range, a ring is not planar, an edge is not shared by exactly two rings, or the rings span no volume.