#![deny(missing_docs)]
pub extern crate nalgebra as na;
#[cfg(feature = "dim2")]
pub extern crate ncollide2d as ncollide;
#[cfg(feature = "dim3")]
pub extern crate ncollide3d as ncollide;
#[cfg(feature = "serde")]
#[macro_use]
extern crate serde;
extern crate num_traits as num;
#[cfg(feature = "parallel")]
pub use rayon;
#[cfg(all(
feature = "simd-is-enabled",
not(feature = "simd-stable"),
not(feature = "simd-nightly")
))]
std::compile_error!("The `simd-is-enabled` feature should not be enabled explicitly. Please enable the `simd-stable` or the `simd-nightly` feature instead.");
#[cfg(all(feature = "simd-is-enabled", feature = "enhanced-determinism"))]
std::compile_error!(
"SIMD cannot be enabled when the `enhanced-determinism` feature is also enabled."
);
macro_rules! enable_flush_to_zero(
() => {
let _flush_to_zero = crate::utils::FlushToZeroDenormalsAreZeroFlags::flush_denormal_to_zero();
}
);
#[cfg(feature = "simd-is-enabled")]
macro_rules! array(
($callback: expr; SIMD_WIDTH) => {
{
#[inline(always)]
#[allow(dead_code)]
fn create_arr<T>(mut callback: impl FnMut(usize) -> T) -> [T; SIMD_WIDTH] {
[callback(0usize), callback(1usize), callback(2usize), callback(3usize)]
}
create_arr($callback)
}
}
);
#[allow(unused_macros)]
macro_rules! par_iter {
($t: expr) => {{
#[cfg(not(feature = "parallel"))]
let it = $t.iter();
#[cfg(feature = "parallel")]
let it = $t.par_iter();
it
}};
}
macro_rules! par_iter_mut {
($t: expr) => {{
#[cfg(not(feature = "parallel"))]
let it = $t.iter_mut();
#[cfg(feature = "parallel")]
let it = $t.par_iter_mut();
it
}};
}
#[allow(unused_macros)]
macro_rules! try_ret {
($val: expr) => {
try_ret!($val, ())
};
($val: expr, $ret: expr) => {
if let Some(val) = $val {
val
} else {
return $ret;
}
};
}
pub(crate) const INVALID_U32: u32 = u32::MAX;
pub(crate) const INVALID_U64: u64 = u64::MAX;
pub(crate) const INVALID_USIZE: usize = INVALID_U32 as usize;
pub mod counters;
pub mod data;
pub mod dynamics;
pub mod geometry;
pub mod pipeline;
pub mod utils;
#[cfg(feature = "dim2")]
pub mod math {
#[cfg(feature = "simd-is-enabled")]
pub use super::simd::*;
use na::{Isometry2, Matrix2, Point2, Translation2, UnitComplex, Vector2, Vector3, U1, U2};
pub const DIM: usize = 2;
pub const MAX_MANIFOLD_POINTS: usize = 2;
pub type Dim = U2;
pub type AngDim = U1;
pub type Isometry<N> = Isometry2<N>;
pub type Vector<N> = Vector2<N>;
pub type AngVector<N> = N;
pub type Point<N> = Point2<N>;
pub type Rotation<N> = UnitComplex<N>;
pub type Translation<N> = Translation2<N>;
pub type AngularInertia<N> = N;
pub type PrincipalAngularInertia<N> = N;
pub type CrossMatrix<N> = Vector2<N>;
pub type Matrix<N> = Matrix2<N>;
pub type SpacialVector<N> = Vector3<N>;
pub type SdpMatrix<N> = crate::utils::SdpMatrix2<N>;
}
#[cfg(feature = "dim3")]
pub mod math {
#[cfg(feature = "simd-is-enabled")]
pub use super::simd::*;
use na::{Isometry3, Matrix3, Point3, Translation3, UnitQuaternion, Vector3, Vector6, U3};
pub const DIM: usize = 3;
pub const MAX_MANIFOLD_POINTS: usize = 4;
pub type Dim = U3;
pub type AngDim = U3;
pub type Isometry<N> = Isometry3<N>;
pub type Vector<N> = Vector3<N>;
pub type AngVector<N> = Vector3<N>;
pub type Point<N> = Point3<N>;
pub type Rotation<N> = UnitQuaternion<N>;
pub type Translation<N> = Translation3<N>;
pub type AngularInertia<N> = crate::utils::SdpMatrix3<N>;
pub type PrincipalAngularInertia<N> = Vector3<N>;
pub type CrossMatrix<N> = Matrix3<N>;
pub type Matrix<N> = Matrix3<N>;
pub type SpacialVector<N> = Vector6<N>;
pub type SdpMatrix<N> = crate::utils::SdpMatrix3<N>;
}
#[cfg(feature = "simd-is-enabled")]
mod simd {
#[allow(unused_imports)]
#[cfg(feature = "simd-nightly")]
use simba::simd::{f32x16, f32x4, f32x8, m32x16, m32x4, m32x8, u8x16, u8x4, u8x8};
#[cfg(feature = "simd-stable")]
use simba::simd::{WideBoolF32x4, WideF32x4};
pub const SIMD_WIDTH: usize = 4;
pub const SIMD_LAST_INDEX: usize = 3;
#[cfg(not(feature = "simd-nightly"))]
pub type SimdFloat = WideF32x4;
#[cfg(not(feature = "simd-nightly"))]
pub type SimdBool = WideBoolF32x4;
#[cfg(feature = "simd-nightly")]
pub type SimdFloat = f32x4;
#[cfg(feature = "simd-nightly")]
pub type SimdBool = m32x4;
}