Expand description
Wall thickness at many points of a mesh or a shape, by rays or by inscribed spheres.
thickness measures against a triangle mesh through its Bvh, and
thickness_of_shape against a B-rep’s own surfaces, never a
tessellation of them. Each point carries its outward normal, and the
wall is measured into the material from the point, against the normal.
Both answer every point independently, in parallel, in the points’
order, and the same points give the same answers bit for bit on any
thread count.
§Rays
Method::Ray casts from the point along its inward normal and reads
the distance to the first surface the ray crosses, on either side of it:
a triangle’s winding, or a face’s orientation, does not matter. With a
cone, rays rays are cast, the first along the normal and the others
spread over the cone by a golden-angle spiral that covers its solid
angle evenly, and the shortest reading wins.
§Spheres
Method::Sphere reads the diameter of the largest ball that touches
the point, has its centre on the inward normal, and holds no surface: the
medial ball through the point, whose diameter is the wall measured
square across it. Every such ball is tangent to the point’s tangent
plane, so the smaller ones nest in the larger, and the search starts
from the ball centred halfway along the inward ray to its first
crossing, which the ray’s far end bounds: the ball is never longer than
the ray. A ball tangent at p along the inward unit normal u passes
through x at radius |x − p|² / (2 (x − p)·u), the circumradius of
the shrinking-ball iteration.
On a mesh the medial ball is found in one pass, exactly: a triangle
outside the starting ball is outside every ball nested in it, so the
medial radius is the least, over the triangles the starting ball holds,
of the radius at which a ball growing from p first touches each one
(inside its face where the ball is tangent to its plane, on an edge
where it is tangent to the edge’s line, or at a corner, whichever is
least). The ball is the medial ball of the mesh as faceted: where it
would touch a convex curved wall along a whole circle, as a rod’s
across its diameter, the facets turned in round the point it touches
cut it, and it reads less than the smooth wall would.
On a shape the iteration is the shrinking ball’s: the surface nearest
the centre is found by projection, and while it lies inside the ball by
more than the confusion distance the ball shrinks to the one through
it. A step from a point δ inside a ball of radius r shrinks it by
δ (2r − δ) / (2 (x − p)·u), at least δ / 4, so the steps end, with a
ball that holds no surface deeper inside it than the confusion distance.
A wedge between two planes at an angle α therefore reads 2 s tan(α/2)
at a distance s from its edge along one face, where a ray along the
normal reads s tan α.
§What is measured to
A surface within Thickness::facing_limit of edge-on to the ray (for
a sphere, to the point’s normal) is passed over: the side walls of a
plate do not cut off the plate’s thickness near its rim. On a mesh, the
triangles within the confusion distance of the point are its own and
are passed over too: a ball that touches a corner of a faceted surface
would otherwise be cut by the facets meeting there. On a shape the faces
the point lies on are passed over at the ray’s start only, so the far
side of a curved face that folds back is still met. Those are the faces
that hold the point within their tolerance, and where it lies in the
band of a face’s trim, as a point read off an edge in single precision
does, the faces that hold its nearest point on the shape: it is on the
edge to within the band, and on the faces meeting there. A ball passes
over those faces, and the edges and vertices they alone hold, where they
are nearest its centre on its radius from the point: at the point
itself, or edge-on through the centre, as the ray passed over them.
Structs§
- Thickness
- How
thicknessandthickness_of_shapemeasure.
Enums§
- Method
- How
thicknessandthickness_of_shaperead a wall.
Functions§
- thickness
- The wall thickness at each point of the mesh
targetwas built over, measured into the material against the point’s outward normal; in the points’ order,Nonewhere it is thicker thanThickness::maxor the inward ray leaves the mesh without crossing it. - thickness_
of_ shape - The wall thickness at each point of
shape, a solid or a shell, measured into the material against the point’s outward normal on the faces’ own surfaces; in the points’ order,Nonewhere it is thicker thanThickness::maxor the inward ray leaves the shape without meeting a face.