rhusics_core/
collide2d.rs

1//! Type wrappers and convenience functions for 2D collision detection
2
3pub use collision::algorithm::minkowski::GJK2;
4pub use collision::primitive::{Circle, ConvexPolygon, Particle2, Rectangle, Square};
5
6use cgmath::{Basis2, Point2};
7use collision::algorithm::broad_phase::BruteForce;
8use collision::primitive::Primitive2;
9use collision::Aabb2;
10
11use collide::*;
12use BodyPose;
13
14/// Collision shape for 2D, see [`CollisionShape`](../collide/struct.CollisionShape.html) for more
15/// information
16///
17/// ### Type parameters:
18///
19/// - `S`: Scalar type (f32 or f64)
20/// - `T`: Transform
21/// - `Y`: Collider type, see `Collider` for more information
22pub type CollisionShape2<S, T, Y = ()> = CollisionShape<Primitive2<S>, T, Aabb2<S>, Y>;
23
24/// Broad phase brute force algorithm for 2D, see
25/// [`BruteForce`](../collide/broad/struct.BruteForce.html) for more information.
26pub type BroadBruteForce2 = BruteForce;
27
28/// Broad phase sweep and prune algorithm
29///
30/// ### Type parameters:
31///
32/// - `S`: Scalar type (f32 or f64)
33pub type SweepAndPrune2<S> = ::collision::algorithm::broad_phase::SweepAndPrune2<S, Aabb2<S>>;
34
35/// Body pose transform for 2D, see [`BodyPos`e](../struct.BodyPose.html) for more information.
36///
37/// ### Type parameters:
38///
39/// - `S`: Scalar type (f32 or f64)
40pub type BodyPose2<S> = BodyPose<Point2<S>, Basis2<S>>;