Does anyone know of an elegant method for checking for a collision between a triangle and a circle?
Thanks in advance.
circle - triangle collision
circle - triangle collision
I love Purebasic.
- Kaeru Gaman
- Addict

- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
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...
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...
oh... and have a nice day.
- Psychophanta
- Always Here

- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
@Heathen, perhaps this is useful to you:
http://www.purebasic.fr/english/viewtop ... 023#250023
http://www.purebasic.fr/english/viewtop ... 023#250023
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.
I love Purebasic.
