2d Circle different ARC's Collision detection

Started by
3 comments, last by Khatharr 8 years, 2 months ago

The way to detect collision between 2 circles or circle and line . using trigonometry
But now i like be able to detect which part of the circle arcs im hitting , for example i divided my circle to 4 different sized arcs. i will like to know which ARC of the Circle is bean hit . 1 ,2 ,3, or 4 See image
what is the best collision detection algorithm for this ? or how does it called ?F4fP5px.png

Advertisement

If you know the point on the circle that is colliding with the other circle or the line, you can determine the angle between whatever direction the circle is "facing" (if the circle, and thus the individual arcs, can rotate around the center) and the collision point. The arcs can then just be thought of as angle-ranges (0 through PI/2, Pi/2 through 3Pi/2, etc.).

Inspiration from my tea:

"Never wish life were easier. Wish that you were better" -Jim Rohn

soundcloud.com/herwrathmustbedragons

If you got the local closest point on the circle, just use arctan2 to get the angle for that point.

Secondly bring that angle into range 0 - 2*PI (google: normalize angle radians)

Detect region/arc from that normalized angle. Done.

@Finalspace
mind to give some example ? i didn't understand much from your saying

Do you have the point of intersection worked out?

atan2 can give you the angle if you feed it the y,x position relative to the center of the circle. The angle it gives will consider zero degrees/radians to be pointing toward the right.

Each one of your arcs has a start angle and an end angle, so just look to see which range your angle is in.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

This topic is closed to new replies.

Advertisement