1/*!
2ncollide
3========
45**ncollide** is a 2 and 3-dimensional collision detection library written with
6the rust programming language.
78As its name suggests, it is generic wrt the dimension: it works with both
92-dimensional and 3-dimensional shapes.
1011The official user guide is available [here](http://ncollide.org).
12The rustdoc documentation is available [here](http://ncollide.org/rustdoc/ncollide).
1314## Compilation
15You will need the last stable build of the [rust compiler](http://www.rust-lang.org)
16and the official package manager: [cargo](https://github.com/rust-lang/cargo).
1718Simply add the following to your `Cargo.toml` file:
1920```.ignore
21[dependencies]
22ncollide2d = "0.33" # For 2D collision detection.
23ncollide3d = "0.33" # For 3D collision detection.
24```
252627## Features
28- dynamic bounding volume tree based broad phase
29- ball vs. ball collision detection,
30- plane vs. any convex object collision detection.
31- collision detection between arbitrary convex objects
32- compound shapes
33- ray-casting
34- time of impact computation for objects without rotational movement (compound vs. compound is not
35 yet implemented)
3637And various traits for collision detectors and broad phase collision detection.
38*/
3940#![deny(non_camel_case_types)]
41#![deny(unused_parens)]
42#![deny(non_upper_case_globals)]
43#![deny(unused_qualifications)]
44#![deny(missing_docs)]
45#![deny(unused_results)]
46#![warn(unused_imports)]
47#![allow(missing_copy_implementations)]
48#![doc(html_root_url = "http://ncollide.org/rustdoc")]
4950#[cfg(feature = "serde")]
51#[macro_use]
52extern crate serde;
53#[macro_use]
54extern crate approx;
55#[macro_use]
56extern crate downcast_rs;
57#[macro_use]
58extern crate bitflags;
59extern crate num_traits as num;
6061pub extern crate nalgebra as na;
62pub extern crate simba;
6364macro_rules! try_ret {
65 ($val: expr) => {
66try_ret!($val, ())
67 };
68 ($val: expr, $ret: expr) => {
69if let Some(val) = $val {
70 val
71 } else {
72return $ret;
73 }
74 };
75}
7677const NOT_REGISTERED_ERROR: &'static str =
78"This collision object has not been registered into a world (proxy indexes are None).";
7980#[deprecated = "use the `pipeline` module instead."]
81pub use crate::pipeline::{broad_phase, narrow_phase, world};
8283pub mod bounding_volume;
84pub mod interpolation;
85pub mod partitioning;
86pub mod pipeline;
87pub mod procedural;
88pub mod query;
89pub mod shape;
90pub mod transformation;
91pub mod utils;
9293/// Compilation flags dependent aliases for mathematical types.
94#[cfg(feature = "dim3")]
95pub mod math {
96use na::{Isometry3, Matrix3, Point3, Translation3, UnitQuaternion, Vector3, Vector6, U3, U6};
9798/// The dimension of the space.
99pub const DIM: usize = 3;
100101/// The dimension of the ambient space.
102pub type Dim = U3;
103104/// The dimension of a spatial vector.
105pub type SpatialDim = U6;
106107/// The dimension of the rotations.
108pub type AngularDim = U3;
109110/// The point type.
111pub type Point<N> = Point3<N>;
112113/// The angular vector type.
114pub type AngularVector<N> = Vector3<N>;
115116/// The vector type.
117pub type Vector<N> = Vector3<N>;
118119/// The matrix type.
120pub type Matrix<N> = Matrix3<N>;
121122/// The vector type with dimension `SpatialDim × 1`.
123pub type SpatialVector<N> = Vector6<N>;
124125/// The orientation type.
126pub type Orientation<N> = Vector3<N>;
127128/// The transformation matrix type.
129pub type Isometry<N> = Isometry3<N>;
130131/// The rotation matrix type.
132pub type Rotation<N> = UnitQuaternion<N>;
133134/// The translation type.
135pub type Translation<N> = Translation3<N>;
136}
137138/// Compilation flags dependent aliases for mathematical types.
139#[cfg(feature = "dim2")]
140pub mod math {
141use na::{Isometry2, Matrix2, Point2, Translation2, UnitComplex, Vector1, Vector2, U2};
142143/// The dimension of the space.
144pub const DIM: usize = 2;
145146/// The dimension of the ambiant space.
147pub type Dim = U2;
148149/// The point type.
150pub type Point<N> = Point2<N>;
151152/// The vector type.
153pub type Vector<N> = Vector2<N>;
154155/// The matrix type.
156pub type Matrix<N> = Matrix2<N>;
157158/// The orientation type.
159pub type Orientation<N> = Vector1<N>;
160161/// The transformation matrix type.
162pub type Isometry<N> = Isometry2<N>;
163164/// The rotation matrix type.
165pub type Rotation<N> = UnitComplex<N>;
166167/// The translation type.
168pub type Translation<N> = Translation2<N>;
169}