n | n-simplex | |
0 | point | |
1 | line segment | |
2 | triangle | |
3 | tetrahedron |
Barycentric (bc) coordinates use n+1 reals to locate a point in n-space relative to some n-simplex except that <0, ... 0> does not denote any point. They are redundant for if a≠0 then <x0, ... xn> and <ax0, ... axn> denote the same point. In these pages we demand that ∑xi = 1. We adopt some point in our space as an origin to view it as a vector space. ∑xipi = <x0, ... xn> where {p0, ... pn} are the vertices of the simplex.
The vertices of the simplex have bc coordinates p0 = <1, 0, 0, ...>, p1 = <0, 1, 0, ...>, p2 = <0, 0, 1, ...>, ... pn = <0, 0, 0, ... 1>. If all of the coordinates are positive then the point is in the open simplex and conversely.
We will speak of barycentric coordinates (bcc) but suppress the detail of whether we carry n or n+1 numbers as a tactical detail that detracts from geometric presentation. That confusion will certainly plague us later in the code.
If we take p0 as the origin of our space and we omit x0 from our coordinate set, then the basis vectors for the resulting coordinate system are the edges of the simplex that
emanate from p0.
For 0<j≤n the n vectors pj − p0 form a set of basis vectors for a coordinate system with coordinates x1 ... xn.
In this system the open simplex is
{<x1, ... xn> | (0<j≤n → xj > 0) & ∑xi ≤ 1}.
We may use bcc to denote velocity. We denote velocity with derivatives of the coordinates of the moving point. It the coordinates of the moving point are pi then ∂pi/∂t denote the velocity. While ∑pi = 1, ∑(∂pi/∂t) = ∂(∑pi)/∂t = ∂1/∂t = 0. Interpreting a set of n+1 numbers to know a position or velocity must avoid the following confusion. Since they are redundant one of the numbers is normally discarded. If the ith component is ignored then the n basis vectors constituted by edges meeting vertex i, with origin there must be used. If a velocity is represented then each edge meting vertex i must be taken as a member of the basis set that spans the vector space of velocities. For redundant velocity coordinates, coordinate j be taken as a rate that the point is receding from facet j, normalized to altitude j of the zone.
These coordinates are in general oblique but there is a particularly simple way to compute the metric tensor for oblique barycentric coördinates from the edge lengths of the simplex. Tricks with the metric tensor, familiar from differential geometry, make doing numerical geometry easy in these coordinates. Here is some code using these ideas to compute dihedral and trihedral angles in arbitrary simplexes.
Contrast Barycentric Coordinates with Trilinear Coordinates.