# 3D intersection point between circle and triangle

Given a 3D triangle with vertices $(v0, v1, v2)$ and a 3D circle of radius $r$, centered at $c$, and lying in the plane perpendicular to $axis$, how can I test for intersection points between them? Note that I'm only interested in the circle's boundary (i.e. it's not a filled-in disk.)

I could approximate it by subdividing the circle into $n$ line segments and doing line/triangle intersection tests for each, but I figure a direct solution should be faster.

Perhaps a circle/plane test can help (followed by a test to see if the intersections are inside the triangle), but I'm not sure how to do that in 3D (and if the the circle lies on the plane too, giving infinitely many intersections, how to test if any of those lie inside the triangle?)

-
Sorry, but what do you mean by 'perpendicular to axis'? –  M.B. Jun 1 '12 at 0:12
The circle is in 3D, so giving its center and radius isn't enough to fully describe it (that would be a sphere.) By saying 'perpendicular to $axis$', I mean that the circle's points lie on the plane with $axis$ as its normal (and passing through point $c$.) –  Nicholas Bishop Jun 1 '12 at 0:14
but WHICH axis do you mean? –  tomasz Jun 1 '12 at 0:15
An arbitrary one — $axis$ is meant to be a new variable here. –  Nicholas Bishop Jun 1 '12 at 0:18

The simplest solution I can think of is:

1. Find the line of intersection of the plane of the circle and the plane of the triangle
2. Find intersections of the circle and the line (if any).
3. Check if any of those points (if they exist) lies within the triangle.

I don't think the details should be very hard to work out.

Now I noticed that there's the case where the circle and the triangle are coplanar, which is really a different task altogether. In this case the separate solution would be: find intersections between the border of the triangle (if any, it's a matter of some quadratic equations and linear inequalities), then all intersections with the full triangle are some of the arcs between the intersections with the border. To see which, just test one point within each arc.

-
Thanks, that looks like a good solution. –  Nicholas Bishop Jun 1 '12 at 0:33