Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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}$

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.