Barycentric Coordinates for Arbitrary Polygons in the Plane
Barycentric Coordinates for Arbitrary Polygons in the Plane
Barycentric Coordinates for Arbitrary Polygons in the Plane
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
BARYCENTRIC COORDINATES FOR ARBITRARY POLYGONS 9<br />
Figure 5: Colour <strong>in</strong>terpolation with generalized barycentric coord<strong>in</strong>ates <strong>for</strong> <strong>the</strong> polygons<br />
from Figure 4.<br />
function F (v)<br />
<strong>for</strong> i = 1 to n do<br />
s i := v i − v<br />
<strong>for</strong> i = 1 to n do<br />
r i := ‖s i ‖<br />
A i := det(s i , s i+1 )/2<br />
D i := 〈s i , s i+1 〉<br />
if r i = 0 <strong>the</strong>n<br />
// v = v i<br />
return f i<br />
if A i = 0 and D i < 0 <strong>the</strong>n // v ∈ e i<br />
r i+1 = ‖s i+1 ‖<br />
return (r i+1 f i + r i f i+1 )/(r i + r i+1 )<br />
f := 0<br />
W := 0<br />
<strong>for</strong> i = 1 to n do<br />
w := 0<br />
if A i−1 ≠ 0 <strong>the</strong>n<br />
w := w + (r i−1 − D i−1 /r i )/A i−1<br />
if A i ≠ 0 <strong>the</strong>n<br />
w := w + (r i+1 − D i /r i )/A i<br />
f := f + wf i<br />
W := W + w<br />
return f/W<br />
Figure 6: Pseudo-code <strong>for</strong> evaluat<strong>in</strong>g <strong>the</strong> <strong>in</strong>terpolation function.<br />
Technical Report IfI-05-05