rhusics_core/
lib.rs

1//! # Rhusics physics library
2//!
3//! A physics library.
4//! Uses [`cgmath`](https://github.com/brendanzab/cgmath/) for all computation.
5//!
6//! Features:
7//!
8//! * Two different broad phase collision detection implementations:
9//!   * Brute force
10//!   * Sweep and Prune
11//! * Narrow phase collision detection using GJK, and optionally EPA for full contact information
12//! * Functions for collision detection working on user supplied transform, and
13//!    [`CollisionShape`](collide/struct.CollisionShape.html) components.
14//!    Can optionally use broad and/or narrow phase detection.
15//!    Library supplies a transform implementation [`BodyPose`](struct.BodyPose.html) for
16//!    convenience.
17//! * Uses single precision as default, can be changed to double precision with the `double`
18//!   feature.
19//! * Has support for doing spatial sort/collision detection using the collision-rs DBVT.
20//! * Support for doing broad phase using the collision-rs DBVT.
21//! * Has support for all primitives in collision-rs
22//!
23
24#![deny(
25    missing_docs,
26    trivial_casts,
27    unsafe_code,
28    unstable_features,
29    unused_import_braces,
30    unused_qualifications
31)]
32#![allow(unknown_lints, type_complexity, borrowed_box)]
33
34extern crate cgmath;
35extern crate collision;
36extern crate rhusics_transform;
37
38#[cfg(feature = "specs")]
39extern crate specs;
40
41#[cfg(test)]
42#[macro_use]
43extern crate approx;
44
45#[cfg(feature = "serde")]
46#[macro_use]
47extern crate serde;
48
49pub use body_pose::BodyPose;
50pub use collide::broad::{BroadPhase, BruteForce, SweepAndPrune2, SweepAndPrune3};
51pub use collide::narrow::NarrowPhase;
52pub use collide::{
53    basic_collide, tree_collide, Collider, CollisionData, CollisionMode, CollisionShape,
54    CollisionStrategy, Contact, ContactEvent, GetId, Primitive,
55};
56pub use physics::simple::{next_frame_integration, next_frame_pose};
57pub use physics::{
58    resolve_contact, ApplyAngular, ForceAccumulator, Inertia, Mass, Material, PartialCrossProduct,
59    PhysicalEntity, ResolveData, SingleChangeSet, Velocity, Volume, WorldParameters,
60};
61pub use rhusics_transform::{PhysicsTime, Pose};
62
63pub mod collide2d;
64pub mod collide3d;
65pub mod physics2d;
66pub mod physics3d;
67
68mod body_pose;
69mod collide;
70#[cfg(feature = "specs")]
71mod ecs;
72mod physics;
73
74/// Wrapper for data computed for the next frame
75#[derive(Clone, Debug, PartialEq)]
76#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
77pub struct NextFrame<T> {
78    /// Wrapped value
79    pub value: T,
80}