# Intersection between a line and a piece of pie

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

## Recommended Posts

Sorry for the corny subject, but I can't think of the technical name for a segment of a circle, like a slice of pie. But my problem is that I need an intersect function between a line and a segment of a circle starting at the origin. Eg, A segment of 120 degrees and given radius, and a definite line. if anyone has any ideas, pls let me know. Thanks

##### Share on other sites
The first step will of course be to find the intersection points, if any, between the line and the full circle (the algorithm for this is easy to find online).

How you proceed from there may depend partly on whether the 'wedge' can ever have an angle > 180 degrees (that is, it includes more than half of the circle). In any case, at this point you need to determine if the point(s) of intersection lie on the arc of the wedge, which can be done by testing it against the hyperplanes making up the edges of the wedge (if the wedge angle is < 180), or by computing and comparing angles. Note that I'm assuming here that you're only concerned with intersecting the line with the arc, not with the line segments that make up the edges of the wedge.

If you need more detailed info, perhaps you could clarify this latter point, as well as whether the arc angle will ever be > 180 degrees.

##### Share on other sites
Thanks for the reply. I've got it working.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 28
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634103
• Total Posts
3015539
×