You are here

Writing Mathlets III: A Call to Math Professionals - Center Points of Facets

Tom Leathrum
The center point computed for each facet is the centroid of the triangle: For each vertex, draw the line to the midpoint of the opposite side -- these lines are called medians of the triangle. Then the three lines cross at a single point, the centroid of the triangle. The applet here demonstrates this. You can drag the red vertex points of the triangle within the graphing region, and the applet updates the median lines (shown in blue, with the midpoints of sides in yellow ) and centroid ( green) as you drag.

This choice of center point for the triangular facets has several advantages, not least of which is that it is easy to compute. Even in three dimensions, computing the centroid of a triangle (given the coordinates of the vertices) amounts to just computing the coordinatewise average. In the graphing applet on page 2, this coordinatewise average is recomputed and stored each time a new vertex is added to the facet, but then it does not have to be recomputed during mouse rotations, which saves quite a few operations. Recall that the length of the projection onto the unit view vector is just a dot product, requiring three multiplications and two additions, for a total of 5 operations. (These five operations would be the same for any other choice of computed center point.) At 5 operations per facet for 3200 facets, that comes to a total of 16,000 operations.

There are other possible choices for computed center points, such as the orthocenter of the triangle: For each vertex, draw the line perpendicular to the opposite side (the altitudes of the triangle). These three lines cross at a single point called the orthocenter. However, the orthocenter may not even be in the interior of the triangle, for example, if the triangle has an obtuse angle. This could have the effect of putting a facet artificially out of place in the sorted list. Besides, the orthocenter is fiendishly difficult to compute in three dimensions, compared to the centroid.


Journal of Online Mathematics and its Applications