# Collision Detection

3 messages
Open this post in threaded view
|
Report Content as Inappropriate

## Collision Detection

 Dear Cafe,I am thinking about writing a small physics engine with collision detection and I wanted to go over my ideas with you to help me refine them.I want to express objects as a group of inequalities and their domain. For example, a sphere would be only one inequality: x^2+y^2+z^2 -1 <= 0 on the whole domain. That way, to check a collision between two objects, one needs to check if at least one pair of inequalities with overlapping domains has a solution. I am unsure about how to express the inequalities in a way that could still allow me to compare between two of them.To add forces in, I think I can express them by adding a time dimension to the inequalities. For example, a constant force in the x-dimension on the previous sphere could be represented as (C+dx/dt*t+0.5*a*t^2)^2+y^2+z^2 <= 0. But then I am not sure about how to treat non-integrable forces. Another approach is to calculate the displacement of the object after each time interval. I don't like this approach as I want to integrate it with FRP in the end, and FRP continues time is something I would like to preserve.After I'll have everything above sorted, the next things would be to run simulations. I think at the start I'll check every pair of objects and try to calculate whether or not the will collide in the future. I'll save all the results in ascending time order. and every iteration, update the movement after the closest collision and update the collision pair order.Thanks,Yotam _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafeOnly members subscribed via the mailman list are allowed to post.
Open this post in threaded view
|
Report Content as Inappropriate