Queries
The columns of the table in Overview: what can be asked of a piece of geometry, and what comes back. Every query in this section runs on the host and, for geometry held in a memory pool or needing none, on a device (see Running queries on a GPU).
Distance and inside
The first question is the value at a point: signedDistance(p), negative inside, positive outside and zero
on the surface (see Geometry as a function). Its sign says whether the point is inside; its size
says how far the surface is, as exactly as the shape’s distance quality allows. Every shape answers it, and
it is the one query a shape of your own must answer.
A composition of several regions adds two: which region a point is in, and the distance to the surface of one region (see Regions, materials and domains). A point cloud has no inside, so its distance is unsigned: how far the nearest point is.
The value also gives the direction to the surface. Its gradient, the outward normal where the point is on the surface, is taken from the value by finite differences for any function (Octree subdivision), and a mesh’s normals at its edges and corners are its pseudonormals (Surface meshes).
Closest
The second question is which part of the geometry is closest: the face of a mesh, the sphere of a sphere cloud, the k nearest points of a point cloud, or the leaf of a composition that decides its value at the point. For a composition, the deciding leaf is not always the one whose surface is nearest, since the nearest surface may be a part the composition removed. Leaves, surfaces and labels explains which part decides, and how a query drills into collections (a union of meshes, a sphere cloud inside a tape) down to the member, its face and its label.
Rays
The third question is about a line instead of a point: where a ray, or a particle’s step from one position to the next, first crosses the surface, and whether it does at all. Every shape answers it, exactly for the shapes that can be intersected with a line and by marching for the rest (Rays and segments). A composition of several regions also finds the first point where the region changes. A picture is many rays, one per pixel (Rendering).
Neighbors
The last question is about a discrete set: which members are near a given one. A point cloud finds each point’s k nearest other points, and a sphere cloud finds the spheres touching a sphere, or closer to its surface than a gap (Clouds of points and spheres). These are the neighbor lists and contact pairs of a particle code.
One result, three names
Each family of queries returns its own plain result type, and several of them name the same idea:
Idea |
Point queries |
Ray queries |
|---|---|---|
Where, and how far |
|
|
Which part |
|
|
Which surface, with its label |
|
|
Every one is an index into something the caller holds: the positions a cloud was built from, the faces of the mesh file, the leaves in the order the expression lists them. The library stores no user data with the geometry; per-point, per-face or per-leaf data lives in the caller’s own arrays, indexed by these numbers.