Triangle is made up of three points v1, v2 and v3.
The triangle have three edges e1, e2, e3.
The length of each edge is l1, l2 and l3.
The triangle lies in a plane.
The perimeter of the triangle the sum of the length of it's sides. p = l1 + l2+ l3.
The semi perimeter s is half of the of the perimeter. s = (l1 + l2+ l3) / 2.
The area of a triangle can be calculated with the length of the sides with herons formula. A = sqrt( s(s-l1) * (s-l2) * (s-l3) ),
In 3D we can use the cross product. A = (||e1 x e2 ||) / 2.
Center of gravity or centroid or geometric center
g = v1+ v2 + v3 / 3.
Barycentric coo = 0.33,0.33,0.33
The circumcenter is the center of a circle passing through the three vertices of the triangle.
s = l1+l2+l3
i = l1v1 + l2v2 + l3v3 / s
Barycentric coo: l1/ s, l2/s, l3/s
Radius of inscribed circle: r = A/s
This is a coordinate space that moves around on the plane of the triangle.
Any point in the plane of the triangle can be given as a weighted average of the vertices in the triangle.
p = b1v1 + b2v2 + b3v3.
(b1,b2,b3) are the barycentric coordinates. There sum should always add up to one.
v1 = (1,0,0), v2 = (0,1,0) and v3 = (0,0,1)
All points inside the triangle will have the coordinates in range of 0...1. A point outside will have at least one coordinated negative.
Barycentric space splits the plane into triangles of the same size as the orginal triangle.
Random Point In a Triangle – Barycentric Coordinates - 2009
Barycentric Coordinates and Point in Triangle Tests - 2011
Why Triangles - 2014
Understanding Sutherland-Hodgman Clipping for Physics Engines - 2013