#### Archived

This topic is now archived and is closed to further replies.

# Ray-Arc Intersection ?

This topic is 5488 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi guys, I need to find out if a ray intersects an arc and if so where. Is that possible ? My arc is a perfect quarter-circle and the ray comes in from the outside (opposite the rays from the center of the circle to the edge.) Also, the two straight sides of the arc are aligned with the X and Y axes, I''m doing this in 2D as well. For the last three hours I''ve been using graph paper and one of those things the architects use to trace circles with and it looks like this will solve all my problems. Thanks for all the help in the past.

##### Share on other sites
if the center of the circle from which the arc was cut is (a,b) and the radius of the arc is r then the arc's equation is (x-a)^2+(y-b)^2=r^2 where a<=x<=r+a ,b<=y<=b+r (asuuming that the arc is alignied in the positive x and y directions) .so find the point of intersection of the ray with the arc using the equation of the ray and the equation of the arc,if the point of intersection is (c,d)then you can use the following code to test if the ray intersects the arc or not
if (c>=a&c<=(r+a))
{
if (c>=b&c<=(r+b))
{
the point of intersection is (c,d)
}
else
{
there's no intersection
}
}
else
{
there's no intersection
}

the ray's equation can be found as follows
if the ray is passing through points (x1,y1) and (x2,y2) then the ray's equation is y-y1/x-x1=y2-y1/x2-x1

[edited by - mohamed adel on July 7, 2003 4:12:10 AM]

1. 1
Rutin
19
2. 2
3. 3
JoeJ
16
4. 4
5. 5

• 26
• 20
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631700
• Total Posts
3001781
×