Expand description
Barycentric and mean-value coordinates, for interpolating values given at the corners of a triangle, a tetrahedron, a polygon or a closed triangle mesh (#143).
Every function returns one weight per corner. The weights sum to one and
reproduce the point: sum(w_i * corner_i) == point, up to rounding. A
point on a corner gets weight exactly one there and zero elsewhere, so
corner values are reproduced exactly.
Shapes thinner than the linear tolerance are refused rather than given
weights that are mostly rounding noise; a triangle’s or tetrahedron’s
thinness is its least altitude. Weights outside [0, 1] are not an
error: they place the point outside the triangle or tetrahedron, which is
how callers extrapolate or test containment.
Four polygon schemes are offered, trading generality for positivity:
mean_value_coordinates2 answers for any simple polygon, convex or
not; wachspress_coordinates2 and discrete_harmonic_coordinates2
require a strictly convex polygon (refused by name otherwise), and the
latter can still produce an infinite or cancelled weight at a pole, which
is refused the same way mean-value cancellation is.
mean_value_coordinates3 extends the 2D mean-value scheme to a closed
triangle mesh in space.
Enums§
- Barycentric
Error - Why coordinates could not be computed.
Functions§
- discrete_
harmonic_ coordinates2 - Discrete harmonic coordinates of
pointin a strictly convex polygon, one weight per vertex (Pinkall and Polthier’s cotangent weights, applied to the triangle fan(point, v_i, v_{i+1}); Floater’s survey calls this scheme “discrete harmonic”). - mean_
value_ coordinates2 - Mean-value coordinates of
pointin a simple polygon, one weight per vertex (Floater 2003, in the form for arbitrary polygons of Hormann and Floater 2006). - mean_
value_ coordinates3 - Mean-value coordinates of
pointin a closed triangle mesh, one weight per vertex (Floater, Kos and Reimers 2005). - tetrahedron_
barycentric - Barycentric coordinates of
pointin a tetrahedron, as weights of its four corners in order. - triangle_
barycentric2 - Barycentric coordinates of
pointin a 2D triangle, as weights ofa,bandc. - triangle_
barycentric3 - Barycentric coordinates of
pointin a 3D triangle, as weights ofa,bandc. - wachspress_
coordinates2 - Wachspress coordinates of
pointin a strictly convex polygon, one weight per vertex (Wachspress 1975, in the determinant form of Meyer, Lee, Barr and Desbrun 2002).