Triangles and area coordinates
December 15, 2022 at 2:31 PM by Dr. Drang
Earlier this month, John D. Cook posted a nice little article about using a determinant to get the area of a triangle. The method was both familiar and unfamiliar. I knew I’d once learned about getting a triangle’s area from a determinant, but I was sure it wasn’t the same way Cook did it. So I pulled my favorite finite element textbook1 off the shelf to refresh my memory. Now I’m going to inflict that memory on you.
In Cook’s post, he starts with a triangle whose vertices are defined by the three complex variables , , and , where the real part of each variable is the x-coordinate and the imaginary part is the y-coordinate. The area of the triangle can be computed through this non-obvious formula:
where the straight lines on either side of the matrix represent the determinant, and a bar over a variable represents the complex conjugate.
Although this is a compact and easy-to-remember formula, I knew it wasn’t the one I learned back in my finite element analysis class, primarily because we didn’t use complex variables in that class. But we did use area coordinates, and that’s where I learned how to get the area of a triangle from a (different) determinant.
Area coordinates—also called natural coordinates—for triangles are a set of three variables, , , and , that conveniently define a point within a triangle. Given the point P shown below, its coordinates are
where is the area of the entire triangle, and
The advantage of using area coordinates is shown in the drawing on the right.2 For each vertex, one of the coordinates is one and the other two are zero. Along each side, one of the coordinates is zero and the other two add to one. Another nicety of area coordinates is that the centroid of the triangle is at .
Of course, using three coordinates to define a point in a plane involves one degree of redundancy. If you know two of the coordinates, the third can always be calculated through
which is a direct consequence of the area summation formula above.
If you’re dealing with just one triangle, there’s not much value in using area coordinates. But if you’re doing a finite element analysis with triangular elements, you can easily have thousands of elements, so the consistency of area coordinates can be a big help—if you can easily transform between the and area coordinate systems. And you can. Here’s the relationship:
Note that the top row of the transformation matrix represents the constraint equation among the area coordinates.
The inverse transformation isn’t as nice, but it’s not too bad:
If you remember how matrix inversion works, you may suspect that is the determinant of the original transformation matrix. And you’d be right. Therefore, the area can be calculated through this simple determinant:
It’s as easy to remember as the formula Cook wrote about and easier to compute—no need to carry around two terms for each variable.
It’s not too hard to show that this determinant and Cook’s are equivalent, especially if you have a computer algebra system. Both areas can be reduced to
which takes up less space vertically but isn’t really any simpler than the area coordinates-based determinant form.
-
Amazon has the fourth and current edition (2001) of the Concepts and Applications of Finite Element Analysis, written by Robert Cook (no relation to John, as far as I know) and various coauthors. It’s still in print after 20 years without a revision, a testament to its value. I have the third edition (1989) and learned from the second edition (1981). ↩
-
I wish the triangle in the figure, which I scanned from Chapter 5 of Robert Cook’s book, didn’t look so much like an equilateral triangle. Area coordinates can be used on any triangle. ↩