_geometry3d module¶
- class pyrockfall._geometry3d.Geometry3D(nodes: NDArray[floating], *, elements: NDArray[integer] | None = None, nodes_std: NDArray[floating] | None = None, attributes: Sequence[int] | NDArray[integer] | None = None, neighbours: NDArray[integer] | None = None)[source]¶
Bases:
Geometry3D triangular geometry with 3D intersection helpers (exit time & parabola hit).
This subclass keeps
Geometry’s nodes/sampling logic and only overrides:exitTime()(ray–directed-edge on the current triangle plane)intersectParabola()(parabola–triangle via neighbour walk)
- Parameters:
nodes – Node coordinates of shape
(N, 3).elements – Triangle connectivity of shape
(E, 3)(0-based).materialIDs – Optional per-element IDs into materials (when materials is a table).
nodes_std – Optional node std-devs, shape
(N, 3).neighbours – Optional directed-edge neighbours array of shape
(E, 3). If omitted, it will be computed lazily on first access.
- Raises:
ValueError – If nodes are not 3D, elements are not triangles, or provided neighbours has an invalid shape/index range.
- property neighbours: ndarray¶
Directed-edge neighbours per triangle.
Convention: for triangle
[v0, v1, v2],neighbours[e, 0]is across the directed edgev0→v1,neighbours[e, 1]acrossv1→v2, andneighbours[e, 2]acrossv2→v0. Boundary →-1.- Type:
np.ndarray of shape (E, 3)
- exitTime(p: ndarray, v: ndarray, elem_id: ndarray, *, samples: ndarray | None = None, tol: float = 1e-12) Tuple[ndarray, ndarray][source]¶
Earliest t>0 where x(t)=p+v t hits a directed edge of the current triangle.
- Parameters:
p – Positions (3, S).
v – Velocities (3, S).
elem_id – Current triangle per sample (S,).
samples – Optional sampled nodes (3, M, 1) or (3, M, S).
tol – Numerical tolerance.
- Returns:
next_elem (S,), t_exit (S,) with
-1/nanfor no exit.- Return type:
Tuple[np.ndarray, np.ndarray]
- intersectParabola(p: ndarray, v: ndarray, a: ndarray, current: ndarray, *, samples: ndarray | None = None, t_min: float = 0.0, t_max: float = inf, tol: float = 1e-12, max_steps: int = 32) Tuple[ndarray, ndarray][source]¶
First impact for x(t)=p + v t + 0.5 a t² using directed-edge neighbour walking.
- Parameters:
p – Initial positions (3, S).
v – Initial velocities (3, S).
a – Constant accelerations (3, S).
current – Starting triangle per sample (S,) (use -1 for “unknown”).
samples – Optional sampled nodes (3, M, 1) or (3, M, S).
t_min – Minimum accepted time (inclusive).
t_max – Maximum accepted time (inclusive).
tol – Numerical tolerance.
max_steps – Maximum neighbour-walk iterations.
- Returns:
- (hit_elem (S,), t_hit (S,))
with
-1/nanon no impact.
- Return type:
Tuple[np.ndarray, np.ndarray]