Expand description
§Physics Geometry Library
A comprehensive geometry processing library for 3D physics simulations.
This library provides a set of geometric shapes and basic operations commonly used in physics engines, including volume computation and bounding box calculations.
§Features
- Primitive Shapes: Sphere, Capsule, Cuboid, Cylinder, Cone, Triangle, Tetrahedron, InfinitePlane
- Bounding Volumes: Axis-Aligned Bounding Boxes (AABB) and Oriented Bounding Boxes (OBB)
- Volume Computation: Calculate volumes of various geometric shapes
- Precision Control: Switch between f32 and f64 using feature flags
- Serialization: Optional serde support for data persistence
§Usage
use phys_geom::{shape::Sphere, shape::Cuboid, volume::ComputeVolume, aabb3::ComputeAabb3};
// Create a sphere with radius 1.0
let sphere = Sphere::new(1.0);
// Compute its volume
let volume = sphere.compute_volume();
// Create a cuboid (box) with given dimensions
let cuboid = Cuboid::new([2.0, 3.0, 1.0]);
// Compute its axis-aligned bounding box
let aabb = cuboid.compute_aabb();
use phys_geom::math::*;
// These types change based on the `f64` feature flag
let vector: Vec3 = Vec3::new(1.0, 2.0, 3.0);
let point: Point3 = Point3::new(1.0, 2.0, 3.0);
let rotation: UnitQuat = UnitQuat::identity();
Re-exports§
pub use aabb2::Aabb2;
pub use aabb3::Aabb3;
pub use aabb3::ComputeAabb3;
Modules§
- aabb2
- aabb3
- Axis-Aligned Bounding Box (AABB) operations in 3D space.
- math
- obb3
- shape
- Geometric shape implementations for 3D physics simulations.
- volume
- Volume computation and mesh processing utilities.
Structs§
- Interval
- A one-dimensional interval on the real number line.
- Ray
- A ray composed of an origin point and a unit direction vector.