Skip to main content

tessellate_primitive

Function tessellate_primitive 

Source
pub fn tessellate_primitive(
    primitive: &Primitive,
    tolerance: Tolerance,
) -> GeomResult<TriMesh>
Expand description

Tessellate one CSG primitive into a closed, outward-wound solid.

A sphere and a torus are doubly curved: every point of the exact surface lies within tolerance.linear() of the mesh (#231). Each is the revolution of an inscribed polygon (a meridian polygon, a tube circle polygon) about its axis, which lies in the polygon’s plane. A point of the exact surface is the rotation of a point within the polygon’s sagitta s_p of the polygon, and a point of the revolved polygon is on an arc of radius at most rho_max (the widest vertex) whose chord lies in a planar trapezoid of the mesh, so within rho_max (1 - cos(h/2)) of it for a step h round the axis. Each direction gets half the budget, so the two add to at most the whole. A cylinder and a cone are curved one way only, so their ring’s sagitta is the whole deviation and gets the whole budget (#232). Any of the four that needs more than 4096 segments is refused with BudgetExceeded, never clamped.

Outward winding is not decoration: axiolid-mesh-boolean-boolmesh and the clash containment test both read signed volume, and an inverted primitive silently produces negative volume and wrong verdicts.