Page 1 of 1
circle - triangle collision
Posted: Tue Jun 24, 2008 10:59 pm
by Heathen
Does anyone know of an elegant method for checking for a collision between a triangle and a circle?
Thanks in advance.
Posted: Wed Jun 25, 2008 12:03 am
by Kaeru Gaman
in the Coding Questions forum was a thread about line-point collision,
there were some solutions working with distance to the line.
http://www.purebasic.fr/english/viewtopic.php?t=32780
... performing this check for the center of the circle and all three line of your triangle
and comparing the distance with the radius may be an approach for you...
just an idea.. perhaps there are better ways...
Posted: Sun Jun 29, 2008 12:57 pm
by Psychophanta
Posted: Sun Jun 29, 2008 6:29 pm
by Heathen
Hey guys, thanks for the responses. I figured out a good method myself already. I was going to use triangle collision as a sort of 2d FOV. The idea is, as the objects rotate, the triangle also rotates and anyone within the triangle is considered 'seen'. instead I'm just comparing the angle difference and doing a distance check. Seems to work pretty well.