DukeW123 pointed out a simpler algorithm than mine.

Another idea for your "interior point algorithm"...the sum of the areas of
the three triangles formed by any two points of the original triangle and the
test point is the area of the "big" triangle. This will not be true for points
outside the triangle...this would also be a lot easier to implement...you could
essentially do it in one long line of code, using Hero's [a.k.a. Heron's]
formula.

A problem with this algorithm is that it depends on testing equality of
floating point numbers, which in computers is not very reliable due to rounding
error. Another problem is this algorithm doesn't distinguish between a
point being *on* the triangle from being *in the interior of* the
triangle. Still, it's an interesting contribution. Thanks, DukeW123.

Return to the first page of this
"Point and Triangle" topic.

### Related pages in this website:

Heron's Formula
-- The area of triangle ABC (whose side lengths are a, b, and c, and whose
semiperimeter is s=(a+b+c)/2) is sqrt((s)(s-a)(s-b)(s-c))

The webmaster and author of this Math Help site is
Graeme McRae.