Module primitives

Module primitives 

Source
Expand description

Geometric primitives for 3D graphics and collision detection.

This module provides common geometric shapes and primitives used in 3D graphics, physics simulations, and collision detection systems.

§Examples

use rs_math3d::primitives::{Ray, Plane, Tri3};
use rs_math3d::vector::Vector3;
 
// Create a ray from origin pointing along +X axis
let ray = Ray::new(
    Vector3::new(0.0, 0.0, 0.0),
    Vector3::new(1.0, 0.0, 0.0)
);
 
// Create a plane at z=5 facing down
let plane = Plane::new(
    Vector3::new(0.0, 0.0, 1.0),
    -5.0
);

Structs§

Box3
A 3D axis-aligned bounding box (AABB).
Dimension
A 2D dimension with width and height.
Line
An infinite line in 2D or 3D space.
ParametricPlane
Parametric Plane
Plane
Plane
Ray
A ray with an origin and direction.
Rect
A 2D axis-aligned rectangle.
Segment
A line segment with defined start and end points.
Sphere3
Sphere3
Tri3
Triangle

Functions§

quad_normal
Computes the normal vector of a quadrilateral.
shortest_segment3d_between_lines3d
Finds the shortest segment connecting two 3D lines.
tri_normal
Tri