collidex v0.2.0 Collidex.ListDetector

Functions responsible for testing lists of geometric primitives for collisions.

Summary

Functions

Given two lists list1 and list2, find any collisions found between shapes in list1 and any shapes in list2

Searches for collisions between elements of list. Returns a list of collisions in the same format as find_collisions/3

Functions

find_collisions(list_1, list_2, method \\ :accurate)

Given two lists list1 and list2, find any collisions found between shapes in list1 and any shapes in list2.

Return value is a list of 3-tuples { shape_1, shape_2, _ } where 'shape1' is the geometry from 'list1' that overlaps with 'shape2' from 'list2', and the third member of the tuple is undefined for now but will eventually be the vector from 'shape1' to 'shape2'.

Examples

iex> c1 = Collidex.Geometry.Circle.make(0.0, 0.0, 1.0) iex> r1 = Collidex.Geometry.Rect.make({0.5, -1.0}, {1.5, 1.0}) iex> r2 = Collidex.Geometry.Rect.make({1.5, -1.0}, {2.5, 1.0}) iex> Collidex.ListDetector.findcollisions([c1], [r1, r2]) == [ ...> { c1, r1, "todoprovide_vector" } ] true

find_collisions_within(list, method \\ :accurate)

Searches for collisions between elements of list. Returns a list of collisions in the same format as find_collisions/3.