pub struct Collision;Expand description
Zero-sized type that hosts collision detection functions.
All methods are static (no self receiver) and are used by the
#[goud_api] proc-macro to auto-generate #[no_mangle] extern "C"
FFI wrappers. The free functions below delegate to these methods.
Implementations§
Source§impl Collision
impl Collision
Sourcepub fn aabb_aabb(
center_a: Vec2,
half_extents_a: Vec2,
center_b: Vec2,
half_extents_b: Vec2,
) -> Option<Contact>
pub fn aabb_aabb( center_a: Vec2, half_extents_a: Vec2, center_b: Vec2, half_extents_b: Vec2, ) -> Option<Contact>
Tests collision between two axis-aligned bounding boxes.
Sourcepub fn circle_circle(
center_a: Vec2,
radius_a: f32,
center_b: Vec2,
radius_b: f32,
) -> Option<Contact>
pub fn circle_circle( center_a: Vec2, radius_a: f32, center_b: Vec2, radius_b: f32, ) -> Option<Contact>
Tests collision between two circles.
Sourcepub fn circle_aabb(
circle_center: Vec2,
circle_radius: f32,
box_center: Vec2,
box_half_extents: Vec2,
) -> Option<Contact>
pub fn circle_aabb( circle_center: Vec2, circle_radius: f32, box_center: Vec2, box_half_extents: Vec2, ) -> Option<Contact>
Tests collision between a circle and an AABB.
Sourcepub fn point_in_rect(point: Vec2, rect_origin: Vec2, rect_size: Vec2) -> bool
pub fn point_in_rect(point: Vec2, rect_origin: Vec2, rect_size: Vec2) -> bool
Checks whether a point lies inside a rectangle.
Sourcepub fn point_in_circle(
point: Vec2,
circle_center: Vec2,
circle_radius: f32,
) -> bool
pub fn point_in_circle( point: Vec2, circle_center: Vec2, circle_radius: f32, ) -> bool
Checks whether a point lies inside a circle.
Sourcepub fn aabb_overlap(min_a: Vec2, max_a: Vec2, min_b: Vec2, max_b: Vec2) -> bool
pub fn aabb_overlap(min_a: Vec2, max_a: Vec2, min_b: Vec2, max_b: Vec2) -> bool
Fast boolean overlap test for two AABBs using min/max corners.
Sourcepub fn circle_overlap(
center_a: Vec2,
radius_a: f32,
center_b: Vec2,
radius_b: f32,
) -> bool
pub fn circle_overlap( center_a: Vec2, radius_a: f32, center_b: Vec2, radius_b: f32, ) -> bool
Fast boolean overlap test for two circles.
Sourcepub fn distance_squared(a: Vec2, b: Vec2) -> f32
pub fn distance_squared(a: Vec2, b: Vec2) -> f32
Returns the squared Euclidean distance between two points.
Auto Trait Implementations§
impl Freeze for Collision
impl RefUnwindSafe for Collision
impl Send for Collision
impl Sync for Collision
impl Unpin for Collision
impl UnsafeUnpin for Collision
impl UnwindSafe for Collision
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more