# Union area of circle and triangle

Having circle placed in $xi;yi$ coords with radius $r$ and also having three verticles of the triangle how can we calculate union area of this circle and triangle?

Seems like it required basic calculations, but i still can't come up with solution.

Is there any nice solution to this problem?

Chris

-

the easiest thing to do would be to look at the cases:

• one point is in the circle: then the area can be divided in a triangle and a circle segment (see wikipedia for some formulae)
• two points are in the circle then you have a trapezoid shape and a circle segment
• and last case - all three points are in the circle then the area is coinciding with the triangle itself

• no point is within the circle is hardest:

• no intersection of triangle and circle - $\sqrt{}$ nothing to do
• the other ones i leave to you (don't forget about edge case when one or more triangle sides are tangential to the circle

then the union area is: $A_{circle} + A_{triangle} - A_{intersection}$

-
Oh, you are right. If i have some segment made from two points i have to check if this segment intersect circle in two places, calculate those places and i'll have a chord. Wikipedia gives some formulas for this. Thanks for ideas i got it. –  Chris Dec 1 '11 at 22:52