collidex v0.1.0 Collidex.Detection.Rects

This module tests for collisions between pairs of grid-aligned rectangles.

Summary

Functions

Test for collision between two grid-aligned rectangles. Expects two Collidect.Detection.Rect structs and returns { :collision, "todoprovidevector" } if the two rectangles share any points in common, and false otherwise

Functions

collision?(r1, r2)

Test for collision between two grid-aligned rectangles. Expects two Collidect.Detection.Rect structs and returns { :collision, "todoprovidevector" } if the two rectangles share any points in common, and false otherwise.

Examples

iex> Collidex.Detection.Rects.collision?( ...> Collidex.Geometry.Rect.make(-2, -0.75, 2, -2), ...> Collidex.Geometry.Rect.make(2, 0.5, 3, -0.5) ...> ) false

iex> Collidex.Detection.Rects.collision?( ...> Collidex.Geometry.Rect.make(2, 0.5, 3, -0.5), ...> Collidex.Geometry.Rect.make(3,-3,-3,3) ...> ) {:collision, "todoprovidevector"}