Name: Anonymous 2007-11-03 1:00
I'm trying to make a collision-detection-function based on circles. The general idea is that, if circle A wants to move farther than is allowed by the distance between circle A and circle B, a collision will occur if the angle of circle A's desired movement is within a certain range around the angle of the difference between circle A and circle B.
The range is `atan ([radius A + radius B] / distance)' off from the angle of the difference between circle A and circle B. Two angles, min_radius and max_radius, measure both sides of the distance-angle. From both variables, the movement-angle is subtracted. After regulating both variables so that neither are negative, wether or not the movement-angle will cause a collision is determined by wether or not min_angle has become greater than max_angle. If the movement-angle is NOT within the scope, both variables would be angles where max_angle does not revolve past 2pi, and reset to zero, while min_angle would not drop below zero, and reset to 2pi, effectively making the scenario, `min_angle > max_angle'.
My problem is that working this idea out on paper works, but does work much at all in a program. What fundamental flaws am I overlooking?
The range is `atan ([radius A + radius B] / distance)' off from the angle of the difference between circle A and circle B. Two angles, min_radius and max_radius, measure both sides of the distance-angle. From both variables, the movement-angle is subtracted. After regulating both variables so that neither are negative, wether or not the movement-angle will cause a collision is determined by wether or not min_angle has become greater than max_angle. If the movement-angle is NOT within the scope, both variables would be angles where max_angle does not revolve past 2pi, and reset to zero, while min_angle would not drop below zero, and reset to 2pi, effectively making the scenario, `min_angle > max_angle'.
My problem is that working this idea out on paper works, but does work much at all in a program. What fundamental flaws am I overlooking?