You are on page 1of 5

The inverse of a rational bilinear mapping

Michael S. Floater∗
January 7, 2015

Abstract
We study the problem of inverting rational bilinear mappings, which leads to a one-
parameter family of generalized barycentric coordinates for quadrilaterals, including Wach-
spress coordinates as a special case.

Keywords: Bilinear mappings, inverse mappings, rational coordinates, barycentric coordinates.

1 Introduction
In a recent paper, Sederberg and Zheng [5] studied rational bilinear mappings from the unit
square to a convex quadrilateral, and their inverses. Such mappings have played an important
role in computer graphics and geometric design [7]. If P ⊂ R2 is the quadrilateral, with vertices
v1 , v2 , v3 , v4 in R2 , as in Figure 1, and weights w1 , w2 , w3 , w4 > 0 are chosen, the mapping
(1 − s)(1 − t)w1 v1 + s(1 − t)w2 v2 + stw3 v3 + (1 − s)tw4 v4
r(s, t) := ,
(1 − s)(1 − t)w1 + s(1 − t)w2 + stw3 + (1 − s)tw4
is a bijection r : [0, 1] × [0, 1] → P . This can be seen from the fact that for a fixed s in [0, 1], r is
a line segment connecting a point on the edge [v1 , v2 ] to a point on [v4 , v3 ], and as s increases
from 0 to 1, the convexity of P ensures that these line segments cover every point of P once
only. Thus r has an inverse and for any point x ∈ P , we can solve

r(s, t) = x, (1)

uniquely for s and t in [0, 1]. Sederberg and Zheng [5] derived a condition on the weights that
makes the inversion particularly simple. For i = 1, 2, 3, 4, let Ci denote the triangle area,

Ci = A(vi−1 , vi , vi+1 ),

where vertices are indexed cyclically, vi+4 = vi , i ∈ Z. They showed that if


w1 w3 C1 C3
= , (2)
w2 w4 C2 C4
Department of Mathematics, University of Oslo, PO Box 1053, Blindern, 0316 Oslo, Norway, email:

michaelf@math.uio.no

1
v4

v3
P

v1 v2

Figure 1: Convex quadrilateral

then s and t are rational functions of x.


In this short note we firstly point out that under condition (2), s and t can be obtained from
the area form of Wachspress’ rational coordinates for convex polygons. Secondly, we derive a
solution for s and t for arbitrary weights wi . From this general solution we obtain generalized
barycentric coordinates for P that do not seem to have been studied previously. They form a
one-parameter family of coordinates, including Wachspress coordinates as a special case.

2 Wachspress coordinates
Wachspress developed rational barycentric coordinates for convex polygons in [6]. The quadri-
lateral case has been studied in [3] and [1]. Meyer et al [4] found a formula for the coordinates
in terms of triangle areas, which for the quadrilateral P means that x ∈ P can be expressed as
C1 A2 A3 v1 + C2 A3 A4 v2 + C3 A4 A1 v3 + C4 A1 A2 v4
x= , (3)
C1 A2 A3 + C2 A3 A4 + C3 A4 A1 + C4 A1 A2
where, in addition to the triangle areas Ci , the Ai are also triangle areas,
Ai = Ai (x) = A(x, vi , vi+1 ).
An example of weights wi that satisfy condition (2) is wi = Ci . In this case, we see that by
dividing numerator and denominator of (3) by (A4 + A2 )(A1 + A3 ) the solution to (1) is
A4 A1
s= , t= .
A4 + A2 A1 + A3
For general weights satisfying (2), we can first multiply the numerator and denominator of (3)
by w1 /C1 to express it as
A2 A3 w1 v1 + ρ1 A3 A4 w2 v2 + ρ1 ρ2 A4 A1 w3 v3 + ρ2 A1 A2 w4 v4
x= ,
A2 A3 w1 + ρ1 A3 A4 w2 + ρ1 ρ2 A4 A1 w3 + ρ2 A1 A2 w4
where
w1 C2 w1 C4
ρ1 := , ρ2 := ,
C1 w2 C1 w4
and then we see that the solution to (1) under condition (2) is
ρ1 A4 ρ2 A1
s= , t= .
ρ1 A4 + A2 ρ2 A1 + A3

2
3 General solution
Consider now solving the inversion for arbitary weights wi . We can adapt the formula derived
recently in [2] for the inverse of the bilinear mapping

p(s, t) := (1 − s)(1 − t)v1 + s(1 − t)v2 + stv3 + (1 − s)tv4 . (4)

For any point x ∈ P the solution (s, t) to

p(s, t) = x (5)

can be expressed as follows. For i = 1, 2, 3, 4, define the vectors di = vi − x. Then (5) can be
expressed as
(1 − s)(1 − t)d1 + s(1 − t)d2 + std3 + (1 − s)td4 = 0.
Then, using the fact that
1
Ai = di × di+1 ,
2
and further defining
1
Bi = Bi (x) = A(x, vi−1 , vi+1 ) = di−1 × di+1 ,
2
(and noting that B3 = −B1 and B4 = −B2 ), it was shown in [2] that

2A4 2A1
s= √ , t= √ , (6)
2A4 − B1 + B2 + D 2A1 − B1 − B2 + D
where
D = B12 + B22 + 2A1 A3 + 2A2 A4 .
Consider now the rational case. If we define the scaled vectors d̃i = wi (vi − x) we can
express (1) in the similar form

(1 − s)(1 − t)d̃1 + s(1 − t)d̃2 + std̃3 + (1 − s)td̃4 = 0.

Thus we can find s and t from the formulas (6) if we replace the Ai and Bi by the scaled
versions,
1 1
Ãi = d̃i × d̃i+1 , B̃i = d̃i−1 × d̃i+1 .
2 2
This shows

Theorem 1 The solution to (1) is

2Ã4 2Ã1
s= p , t= p , (7)
2Ã4 − B̃1 + B̃2 + D̃ 2Ã1 − B̃1 − B̃2 + D̃
with
D̃ = B̃12 + B̃22 + 2Ã1 Ã3 + 2Ã2 Ã4 .

3
4 Dependence on the weights
To find out how s and t depend on the weights wi , we can use the fact that
d̃i = wi di , Ãi = wi wi+1 Ai , B̃i = wi−1 wi+1 Bi ,
and with these substitutions we find that

D̃ = w2 w4 D′ ,
where
D′ = B12 + ρ2 B22 + 2ρ(A1 A3 + A2 A4 ),
and
w1 w3
ρ= .
w2 w4
Putting these expressions into (7) gives
2(w1 /w2 )A4 2(w1 /w4 )A1
s= , t= . (8)
2(w1 /w2 )A4 + F2 2(w1 /w4 )A1 + F3
with √ √
F2 := −B1 + ρB2 + D′ , F3 := −B1 − ρB2 + D′ .
This shows that s depends only on ρ and the ratio w1 /w2 (or equivalently on ρ and w3 /w4 ),
and that t depends only on ρ and w1 /w4 (or equivalently on ρ and w3 /w2 ).
Consider now the generalized barycentric coordinates generated by s and t. Defining
(1 − s)(1 − t)w1 s(1 − t)w2 stw3 (1 − s)tw4
φ1 = , φ2 = , φ3 = , φ4 = , (9)
W W W W
where
W = (1 − s)(1 − t)w1 + s(1 − t)w2 + stw3 + (1 − s)tw4 ,
we have
4
X 4
X
x= φi v i , 1= φi .
i=1 i=1
To consider how the coordinates φi depend on the wi , we can substitute the formulas
(8) into P
(9), and after cancelling common factors and using the definition of ρ we find that
φi = λi / 4j=1 λj , where
λ1 = F 2 F 3 , λ2 = 2F3 A4 , λ3 = 4ρA4 A1 , λ4 = 2A1 F2 .
This shows that the coordinates φi depend only on ρ and thus form a one-parameter family
that includes Wachspress coordinates in the case ρ = ρ∗ := C1 C3 /(C2 C4 ).
Figure 2 shows contour plots of φ1 , φ2 , φ3 , φ4 from left to right, for the four values ρ =
0.1, ρ∗ , 1, 10, where ρ∗ ≈ 0.8842. Thus the coordinates in the second row are Wachspress
coordinates, and those in the third row come from inverting p in (4). It is interesting to observe
that for the small and large values of ρ the coordinates appear to approach the piecewise linear
coordinates obtained by triangulating P using one or other of the diagonals. This could be
a topic for future research. Another interesting question is whether any of the results of this
paper extend to three dimensions, for example, to rational trilinear mappings from the unit
cube to a convex hexahedron.

4
Figure 2: From top to bottom, ρ = 0.1, ρ∗ , 1, 10.

References
[1] W. Dahmen, H. P. Dikshit, and A. Ojha, On Wachspress quadrilateral patches, Comp. Aided
Geom. Design 17 (2000), 879–890.

[2] M. S. Floater, Generalized barycentric coordinates and applications, Acta Numerica (2015),
To appear.

[3] J. L. Gout, Construction of a Hermite rational ‘Wachspress type’ finite element, Comp.
Math. with Appls. 5 (1979), 337–347.

[4] M. Meyer, A. Barr, H. Lee, and M. Desbrun, Generalized barycentric coordinates for irreg-
ular polygons, J. Graph. Tools 7 (2002), 13–22.

[5] T. W. Sederberg and J. Zheng, Birational quadrilateral maps, Comput. Aided Geom. Design
32 (2015), 1–4.

[6] E. L. Wachspress, A rational finite element basis, Academic Press, New York, 1975.

[7] G. Wolberg, Digital image warping, IEEE Computer Society Press, 1990.

You might also like