The functions
M_TriangleFromLines2() and
M_TriangleFromLines3() return an
M_Triangle2 or
M_Triangle3 describing a triangle in terms of three lines
L1, L2 and
L3. The three lines must be non-colinear and their endpoints must coincide.

M_TriangleFromPts2() and
M_TriangleFromPts3() return a triangle in terms of three (non-colinear) points
a, b, c.

The
M_TriangleRead[23]() and
M_TriangleWrite[23]() functions read or write a triangle structure from/to an
AG_DataSource(3).

The macros
M_TRIANGLE2_INITIALIZER() and
M_TRIANGLE3_INITIALIZER() expand to static initializers for
M_Triangle2 and
M_Triangle3, respectively.

COMPUTATIONS

intM_PointInTriangle2 (M_Triangle2 T, M_Vector2 p)

The
M_PointInTriangle2() routine tests (using barycentric coordinates) whether point
p lies within the triangle
T and returns 1 if it does, otherwise 0.