scirs2_spatial/collision/
mod.rs

1//! Collision detection algorithms for various geometric primitives
2//!
3//! This module provides implementations of collision detection algorithms
4//! for common geometric primitives in 2D and 3D space. It supports both
5//! discrete collision detection (testing if two objects intersect at a given
6//! moment) and continuous collision detection (testing if two moving objects
7//! will collide during a time interval).
8//!
9//! ## Features
10//!
11//! * Point collision tests with various shapes
12//! * Line segment intersection tests
13//! * Ray casting and intersection
14//! * Collision detection between various geometric primitives
15//! * Bounding volumes (spheres, axis-aligned bounding boxes)
16//! * Continuous collision detection for moving objects
17//!
18//! ## Examples
19//!
20//! ### Testing if a point is inside a sphere
21//!
22//! ```
23//! use scirs2_spatial::collision::{Sphere, point_sphere_collision};
24//!
25//! let sphere = Sphere {
26//!     center: [0.0, 0.0, 0.0],
27//!     radius: 2.0,
28//! };
29//!
30//! let point = [1.0, 1.0, 1.0];
31//! let inside = point_sphere_collision(&point, &sphere);
32//!
33//! println!("Is the point inside the sphere? {}", inside);
34//! ```
35//!
36//! ### Testing if two circles collide
37//!
38//! ```
39//! use scirs2_spatial::collision::{Circle, circle_circle_collision};
40//!
41//! let circle1 = Circle {
42//!     center: [0.0, 0.0],
43//!     radius: 2.0,
44//! };
45//!
46//! let circle2 = Circle {
47//!     center: [3.0, 0.0],
48//!     radius: 1.5,
49//! };
50//!
51//! let collide = circle_circle_collision(&circle1, &circle2);
52//! println!("Do the circles collide? {}", collide);
53//! ```
54
55// Re-export all public items from submodules
56pub use self::broadphase::*;
57pub use self::continuous::*;
58pub use self::narrowphase::*;
59pub use self::response::*;
60pub use self::shapes::*;
61
62// Public modules
63pub mod broadphase;
64pub mod continuous;
65pub mod narrowphase;
66pub mod response;
67pub mod shapes;
68
69// Tests
70mod tests;