Skip to content

shore.surface.projector ​

Ray-mesh projector with cached BVH and per-ray status tracking.

Phase 0: Projector class + ProjectionResult decoupling. Phase 2: Full status array (BACKFACE, TOO_NEAR, TOO_FAR, DEGENERATE) + on_failure.

ProjectionStatus class ​

python
class ProjectionStatus(Enum)

source

Per-ray outcome of a Projector.project call.

ProjectionResult dataclass ​

python
ProjectionResult(locations: np.ndarray, status: np.ndarray, distances: np.ndarray)

source

Outcome of a batch ray-cast from a single anchor point.

Parameters

  • locations (np.ndarray, shape (n, 3)) — Hit positions for HIT rays; NaN for non-HIT rays.
  • status (np.ndarray, shape (n,), dtype=object) — Per-ray ProjectionStatus value.
  • distances (np.ndarray, shape (n,)) — Anchor-to-hit distance; NaN for non-HIT rays.

ProjectionResult.hit_mask property ​

python
hit_mask: np.ndarray

source

Boolean mask where True means HIT.

ProjectionResult.all_hit property ​

python
all_hit: bool

source

True iff every ray has status HIT.

Projector class ​

python
Projector(mesh: trimesh.Trimesh, anchor: np.ndarray)

source

Ray-mesh intersector with a single cached BVH.

Holds a RayMeshIntersector built once at construction time so that multiple project calls share the same acceleration structure.

Parameters

  • mesh — Triangulated body surface.
  • anchor — Ray origin, shape (3,).

Projector.project method ​

python
project(dirs: np.ndarray, on_failure: str = 'raise') -> ProjectionResult

source

Cast rays from anchor in directions dirs.

Parameters

  • dirs — Unit direction vectors, shape (..., 3). Flattened internally.
  • on_failure — 'raise' — raise MeshInputError if any ray is not HIT. 'nearest' — fall back to trimesh closest-point for non-HIT rays and flag them in the status array. 'skip' — leave non-HIT locations as NaN.

Returns

  • ProjectionResult

Released under the MIT License.