Is this a better point in triangle test (2D)? - posted in Math and Physics: So I was looking around for a way to do the old point in triangle test, and I was finding a lot of ways to do it using trig. Then I found one using areas, and this was simple enough, but the only way I knew to do areas was Herons formula, and thats a lot of sqrts (16 per triangle test, I believe). Then I found a way to do triangle areas using the determinant. No sqrt, no cos, or sin, etc. Im working fro...
I'm finding ways to test if a point is inside an octagon, which will be used for finding where a point sits. At the moment I'm finding this out by seeing if it's in the square which bounds the octagon, then if it's in the left area, right area, or centre area. If it's in the sides, i then check if it's in the top area, centre or bottom areas. If in the top or bottom sides, i check if it's in the triangles.
This seems like a fairly efficient method, especially if I use a similar algorithm to that discussed in the forum linked here. Checking if a point is in an octagon seems very confusing from other places that I've looked at and I understand this method a lot better. :)










