Computer Aided Geometric Design 32 (2015) 1–4
Contents lists available at ScienceDirect
Computer Aided Geometric Design www.elsevier.com/locate/cagd
Birational quadrilateral maps ✩ Thomas W. Sederberg a,∗ , Jianmin Zheng b a b
Department of Computer Science, Brigham Young University, Provo, UT 84602, USA School of Computer Engineering, Nanyang Technological University, Singapore 639798, Singapore
a r t i c l e
i n f o
a b s t r a c t
Article history: Received 9 August 2014 Received in revised form 3 November 2014 Accepted 4 November 2014 Available online 20 November 2014
A generic planar quadrilateral defines a 2:1 bilinear map. We show that by assigning an appropriate weight to one vertex of any planar quadrilateral, we can create a map whose inverse is rational linear. © 2014 Elsevier B.V. All rights reserved.
Keywords: Quadrilateral meshes Birational map
1. Introduction A planar quadrilateral with vertices Pi j = (xi j , y i j ) defines a bilinear map
P(s, t ) = P00 s¯t¯ + P10 st¯ + P01 s¯t + P11 st
(1)
where s¯ = (1 − s) and t¯ = (1 − t ). If the quad is a trapezoid, the map is 1:1. Otherwise, the map is generally 2:1 and the inverse involves a square root (Wolberg, 1990). For point E in Fig. 1.a,
s=
x − 4 y + 36 ± 24
f (x, y )
,
t=
−x + 4 y + 36 ±
f (x, y )
32
,
where f (x, y ) = x2 − 8xy + 16 y 2 − 72x − 96 y + 1296. So E has pre-images (s, t ) = ( 13 , 34 ) and (s, t ) = (2, 2). Fig. 1.b shows
that E lies on two different t-isoparameter lines: t = 34 and t = 2. This paper proves that assigning a weight w i j to one control point, the map defined by any non-degenerate quadrilateral can be forced to be generally 1:1 with a rational linear inverse. For example, in Fig. 2.a we assign w 01 = 53 to the quad in Fig. 1. In this case, point E lies on a single s- and t-isoparameter 3x−4 y
2y
line. The inversion equations are s = 26−4 y and t = 20−x and the pre-image of E is (s, t ) = ( 25 , 23 ). This is an example of a birational map, meaning that both the map and its inverse can be expressed as a polynomial divided by a polynomial.
✩
*
This paper has been recommended for acceptance by Kai Hormann. Corresponding author. E-mail addresses:
[email protected] (T.W. Sederberg),
[email protected] (J. Zheng).
http://dx.doi.org/10.1016/j.cagd.2014.11.001 0167-8396/© 2014 Elsevier B.V. All rights reserved.
2
T.W. Sederberg, J. Zheng / Computer Aided Geometric Design 32 (2015) 1–4
Fig. 1. Quadrilateral with t-isoparameter lines.
Fig. 2. With w 01 =
5 . 3
Both families of isoparameter lines form pencils.
2. Birational quadrilaterals As illustrated in Fig. 2.a, birational quadrilateral maps are characterized by the fact that each family of isoparameter lines form a pencil, that is, they pivot about axis points As and At , respectively. We now show how those pencils can be created by assigning a single control point weight. Given a triple Q = (a, b, c ) of homogeneous projective coordinates, Point(Q) denotes the point whose Cartesian coordinates are (a/c , b/c ) and Line(Q) denotes the line ax + by + c = 0. Given triples Q1 and Q2 , Line(Q1 ) and Line(Q2 ) intersect at Point(Q1 × Q2 ) and Point(Q1 ) and Point(Q2 ) lie on Line(Q1 × Q2 ). The projective coordinates robustly express the intersection of two parallel lines as a point at infinity, i.e., a point for which c = 0. If Q1 · Q2 = 0, Point(Q1 ) lies on Line(Q2 ). If Q(t ) = (a(t ), b(t ), c (t )) is a triple of polynomials, Point(Q(t )) is a rational curve and Line(Q(t )) is called a moving line (Sederberg et al., 1994), i.e., a line that moves as a function of t. Denoting ˜ i j = w i j Qi j , Qi j = (xi j , y i j , 1) and Q
˜ 00 s¯t¯ + Q˜ 10 st¯ + Q˜ 01 s¯t + Q˜ 11 st ) Q(s, t ) = Point(Q
(2)
defines a rational bilinear map. In Fig. 2.b,
˜ 00 × Q˜ 01 ) × (Q˜ 10 × Q˜ 11 ), As = (Q
˜ 00 × Q˜ 10 ) × (Q˜ 01 × Q˜ 11 ), At = (Q
˜ 01 + sQ˜ 11 , Bs (s) = s¯ Q
˜ 00 + sQ˜ 10 , Cs (s) = s¯ Q
˜ 10 + sQ˜ 11 , Bt (t ) = s¯ Q
˜ 00 + sQ˜ 01 . Ct (t ) = s¯ Q
(3)
For a generic quadrilateral, the families of s- and t-isoparameter lines are Line( I s (s)) and Line( I t (t )), where
I s (s) = Bs (s) × Cs (s),
I t (t ) = Bt (t ) × Ct (t ).
Line( I s (s)) is a pencil with axis Point(As ) if As · I s (s) ≡ 0. This implies
w 01 w 10 As · Q01 × Q10 + w 11 w 00 As · Q11 × Q00 = 0 or w 00 w 11 As · Q01 × Q10 w 01 w 10
=
As · Q00 × Q11
.
(4)
Likewise, Line( I t (t )) is a pencil with axis Point(At ) if
w 00 w 11 w 01 w 10
=
At · Q10 × Q01 At · Q00 × Q11
.
Letting |ABC | denote A × B · C , and applying to (3) the identity
( A × B ) × (C × D ) = A · ( B × D ) C − A · ( B × C ) D ,
(4) and (5) become equivalent to
(5)
T.W. Sederberg, J. Zheng / Computer Aided Geometric Design 32 (2015) 1–4
3
Fig. 3. Special cases involving collinearity.
Fig. 4. Other special cases.
w 00 w 11 w 01 w 10 where
=
|Q01 Q00 Q10 ||Q10 Q11 Q01 | =ρ |Q11 Q01 Q00 ||Q00 Q10 Q11 |
(6)
ρ is a constant. For trapezoids, ρ = 1 so all weights can be one.
3. Inversion equations The main contribution of this paper is the observation that if (6) holds, Line( I s (s)) and Line( I t (t )) each form a pencil. Hence the map (2) is birational and we can find rational linear inversion equations as follows. If (6) holds and no three vertices are collinear,
Line I s (s) = Line As × Bs (s) = Line As × Cs (s) .
(7)
Point P = (x, y , 1) lies on Line( I s (s)) at the value of s for which |As Bs (s)P| = 0:
s=
|As Q˜ 01 P| . ˜ |As Q01 P| − |As Q˜ 11 P|
(8)
P also lies on Line( I s (s)) at the value of s for which |As Cs (s)P| = 0:
s=
|As Q˜ 00 P| |As Q˜ 00 P| − |As Q˜ 10 P|
.
(9)
In similar manner, we obtain two inversion equations for t as
t= t=
|At Q˜ 10 P| |At Q˜ 10 P| − |At Q˜ 11 P| |At Q˜ 00 P| |At Q˜ 00 P| − |At Q˜ 01 P|
(10)
.
(11)
If no three vertices are collinear, (8) and (9) produce the same value of s and (10) and (11) produce the same value of t, so all four are valid inversion equations. If Q10 , Q11 , and Q01 are collinear, as shown in Fig. 3.a, (6) requires w 11 = 0 and the geometry produces As = Q01 and At = Q10 . Consequently, (9) and (11) are valid inversion equations but (8) and (10) are not. The same discussion applies to the “hanging” vertex example in Fig. 3.b. In the case of a non-convex quadrilateral, the weight of the concave vertex is negative, as illustrated in Fig. 4.a. While the inversion equations work in this case, only points within the region bounded by quadrilateral Q00 At Q11 As have pre-images in the [0, 1] × [0, 1] domain. The inversion equations work properly in the self-intersection case shown in Fig. 4.b, and the pre-image of each point in the twisted quadrilateral lie in the [0, 1] × [0, 1] domain. In this example, all weights are positive,
4
T.W. Sederberg, J. Zheng / Computer Aided Geometric Design 32 (2015) 1–4
even though two of the triple-products in (6) are negative. We can also satisfy (6) by assigning w 10 = w 01 = −2, however the inversion equation for s applied to points in the twisted quadrilateral lie outside [0, 1]. 4. Singularities The birational maps we have presented are generally 1:1, but not everywhere. Pencils Line( I s (s)) and Line( I t (t )) have one line in common: Line(As × At ). From (8)–(11), all points on that line have an s parameter
sˆ = s =
|As Q˜ 01 At | |As Q˜ 00 At | = , ˜ ˜ ˜ |As Q01 At | − |As Q11 At | |As Q00 At | − |As Q˜ 10 At |
and a t parameter
tˆ =
|At Q˜ 10 As | |At Q˜ 00 As | = . ˜ ˜ ˜ |At Q10 As | − |At Q11 As | |At Q00 As | − |At Q˜ 01 As |
Thus, point (s, t ) = (ˆs, tˆ) “blows up” to Line(As × At ). Since all s-isoparameter lines pass through As and all t-isoparameter lines pass through At , the pre-image of As is the line t = tˆ and the pre-image of At is the line s = sˆ . In other words,
Point(As ) = Point Q(s, tˆ) ,
Point(At ) = Point Q(ˆs, t ) .
5. Affine map
˜ 00 − Q˜ 10 − Q˜ 01 + Q˜ 11 , which vanishes The map (2) is bilinear in s, t. If we convert (2) to power basis, the st coefficient is Q if
w 00 Q00 − w 10 Q10 − w 01 Q01 + w 11 Q11 = 0.
(12)
The general-case solution to (12) is
w 00 : w 10 : w 01 : w 11 = |Q10 Q01 Q11 | : |Q00 Q01 Q11 | : |Q00 Q11 Q10 | : |Q00 Q01 Q10 |
(13)
The fact that a quad map (2) is affine if it satisfies (13) is algebraically equivalent to a well-known result for mapping the vertices of a quad to the vertices of a square by solving a 4 × 4 linear system (Wolberg, 1990). Affine maps are birational, and weights that satisfy (13) also satisfy (6). 6. Discussion The main contribution of this paper is (6). This result says that we can assign weights to any three vertices of a planar quad and solve for the fourth weight using (6) such that the quad will be birational. Thus, birationality can be obtained by imposing a single scalar constraint. Using this insight, a planar mesh of quads whose map is C 0 can be constructed by growing the mesh one quad at a time and solving for the free weight(s) using (6). By contrast, the condition (13) for affine map has no degrees of freedom, so if quads in a mesh were each made birational using the method in Section 5, the map derived from such a mesh would be C −1 . Fig. 1.b can be interpreted as the projection of a doubly-ruled quadric surface, a topic studied in classical projective geometry (Semple and Kneebone, 1979) where it is well-known, for example, that the envelope curve shown in Fig. 1.b is a conic. However, to our knowledge, the result in (6) has not appeared in the literature, either classical or recent. While the results in this paper apply only to planar quadrilaterals, non-planar bilinear patches are always birational, for any choice of weights (Sederberg et al., 1984). Quadrilaterals and quad meshes have played an important role in computer graphics, geometric design, and analysis for several decades, and it is somewhat surprising that the insight in Section 2 has been overlooked. While the result is relatively simple, its importance is amplified because quad meshes are ubiquitous. The concept can be of value in algorithms where inverse maps need to be calculated, such as image warping, morphing, and texture mapping in ray tracing. References Sederberg, T.W., Anderson, D.C., Goldman, R.N., 1984. Implicit representation of parametric curves and surfaces. Comput. Vis. Graph. Image Process. 28 (1), 72–84. Sederberg, T.W., Saito, T., Qi, D., Klimaszewski, K.S., 1994. Curve implicitization using moving lines. Comput. Aided Geom. Des. 11 (6), 687–706. Semple, J., Kneebone, G., 1979. Algebraic Projective Geometry. Oxford Science Publications, Clarendon Press. Wolberg, G., 1990. Digital Image Warping, vol. 10662. IEEE Computer Society Press, Los Alamitos, CA.