Compile a closed oriented surface, or an open oriented sheet, into a
nearest-point and signed-distance query.
Unlike a depth envelope, which cannot tell the inside from empty space
between solids or behind a concavity, this reads the nearest feature: its
face projection or closed edge segment gives the distance, and the side of
its pseudonormal, the face normal, the sum of an edge's face normals or the
angle-weighted vertex normal (Baerentzen and Aanaes, 2005), gives the sign,
positive on the oriented exterior. Coordinates are metres, and a point near
the surface gets the computed value, not one forced through a tolerance.
The mesh is snapshotted, so changing it later needs a new query. Vertices
that share exact coordinates are welded, joining UV-split copies without
moving them. Admission throws on a malformed or empty index buffer, a
non-finite position, a triangle without positive finite area, an edge used
by more than two triangles or by two with the same direction, and a vertex
whose incident triangles form more than one fan. A closed surface also
requires every edge to be paired. The caller still owns an embedded,
non-self-intersecting, outward-oriented surface, cavity walls included,
which this neither infers nor repairs; reversing every face reverses the
sign.
With boundary: "open" an oriented sheet is admitted: an edge used by one
triangle takes that face's normal as its pseudonormal. A sheet's sign is
meaningful only within its reach, the distance below which the nearest
feature's orientation still separates the two sides, which the caller states
from its own geometry; a result whose nearest feature is a rim edge or rim
vertex reports boundary: true, meaning its side is not a side of the
sheet's interior. A closed surface never reports it.
Callers query in very large numbers, such as a hair strand stepping a few
millimetres at a time against a head, so the leaf loop allocates nothing and
each query first measures the triangle the previous one won, which for a
walking caller supplies the bound that prunes most of the tree. Neither
changes an answer: only boxes farther than the running best are skipped, and
among equally near features the lowest triangle ordinal wins. A query throws
on a point that is not three finite coordinates or whose distance to the
surface's box overflows.
Compile a closed oriented surface, or an open oriented sheet, into a nearest-point and signed-distance query.
Unlike a depth envelope, which cannot tell the inside from empty space between solids or behind a concavity, this reads the nearest feature: its face projection or closed edge segment gives the distance, and the side of its pseudonormal, the face normal, the sum of an edge's face normals or the angle-weighted vertex normal (Baerentzen and Aanaes, 2005), gives the sign, positive on the oriented exterior. Coordinates are metres, and a point near the surface gets the computed value, not one forced through a tolerance.
The mesh is snapshotted, so changing it later needs a new query. Vertices that share exact coordinates are welded, joining UV-split copies without moving them. Admission throws on a malformed or empty index buffer, a non-finite position, a triangle without positive finite area, an edge used by more than two triangles or by two with the same direction, and a vertex whose incident triangles form more than one fan. A closed surface also requires every edge to be paired. The caller still owns an embedded, non-self-intersecting, outward-oriented surface, cavity walls included, which this neither infers nor repairs; reversing every face reverses the sign.
With
boundary: "open"an oriented sheet is admitted: an edge used by one triangle takes that face's normal as its pseudonormal. A sheet's sign is meaningful only within its reach, the distance below which the nearest feature's orientation still separates the two sides, which the caller states from its own geometry; a result whose nearest feature is a rim edge or rim vertex reportsboundary: true, meaning its side is not a side of the sheet's interior. A closed surface never reports it.Callers query in very large numbers, such as a hair strand stepping a few millimetres at a time against a head, so the leaf loop allocates nothing and each query first measures the triangle the previous one won, which for a walking caller supplies the bound that prunes most of the tree. Neither changes an answer: only boxes farther than the running best are skipped, and among equally near features the lowest triangle ordinal wins. A query throws on a point that is not three finite coordinates or whose distance to the surface's box overflows.