Created
September 14, 2016 21:12
-
-
Save IdahoEv/7e1aa4c93357449dfc01885369ee0d65 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Collidex.ListDetector do | |
@moduledoc """ | |
Functions responsible for testing lists of geometric primitives for | |
collisions. | |
""" | |
@doc """ | |
Given two lists `list1` and `list2`, will return a list of collisions | |
found between any shapes in list1 and any shapes in list2. | |
""" | |
def find_collisions(list_1, list_2, method \\ :accurate ) | |
def find_collisions(list_1, list_2, method) do | |
for shape_1 <- list_1, | |
shape_2 <- list_2, | |
{ :collision, vector } = Collidex.Detector.collision?(shape_1, shape_2, method) do | |
{ shape_1, shape_2, vector } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment