pub fn axis_of_revolution(
mesh: &Triangulation,
options: &Directions,
tol: Tolerances,
) -> OgeomResult<Option<Revolution>>Expand description
The axis a mesh’s walls turn about, and the share of its area on them.
A wall is a triangle whose normal is within the resolution of
perpendicular to a direction; the axis direction is the one the walls’
normals are most nearly perpendicular to, the least eigenvector of their
area-weighted second moments, and the axis line the one their normal
lines meet, by least squares: a normal line (c, n) meets the axis
(p, a) where (c − p)·(a × n) = 0, which is linear in p. The walls
are then the triangles whose normal is within the resolution of pointing
straight at that line, and the two are found again from them until they
stop changing. Walls at any radius serve, so a stepped shaft gives the
axis its steps share.
The search starts from each of the face directions and from the principal directions of the normals, and keeps the axis that gathers the most wall area. A shoulder or an end is not a wall and does not count towards the share, nor does a cone’s taper.
None where no direction has walls whose normal lines locate a line:
an empty mesh, one plane, a sphere’s single point.
§Errors
As face_directions.