Skip to main content

Crate rustsim_geometry

Crate rustsim_geometry 

Source
Expand description

Geometric primitives and queries for rustsim.

This crate is intentionally tiny and dependency-free. It provides:

  • Vec2 and Vec3 type aliases over [f64; 2] and [f64; 3] with free-function arithmetic in the vec2 and vec3 modules.
  • Axis-aligned bounding boxes Aabb2, Aabb3.
  • Segments Segment2, Segment3 with closest-point queries.
  • Rays Ray3 and planes Plane3 with ray-plane intersection.
  • Triangles Triangle3 with closest-point and ray-triangle intersection (Möller–Trumbore).
  • Spheres Sphere3 with sphere-vs-AABB / sphere-vs-triangle tests.

All functions are f64. No unsafe. No external crates. No allocation in hot paths.

Re-exports§

pub use aabb::Aabb2;
pub use aabb::Aabb3;
pub use ray::Plane3;
pub use ray::Ray3;
pub use segment::Segment2;
pub use segment::Segment3;
pub use sphere::Sphere3;
pub use triangle::Triangle3;
pub use vec2::Vec2;
pub use vec3::Vec3;

Modules§

aabb
Axis-aligned bounding boxes in 2-D and 3-D.
prelude
Convenience re-exports.
ray
Rays and planes in 3-D.
segment
Line segments in 2-D and 3-D with closest-point queries.
sphere
3-D spheres with overlap tests.
triangle
3-D triangles with closest-point and Möller–Trumbore ray intersection.
vec2
2-D vector helpers.
vec3
3-D vector helpers.