• No results found

On the injectivity of Wachspress and mean value mappings between convex polygons

N/A
N/A
Protected

Academic year: 2022

Share "On the injectivity of Wachspress and mean value mappings between convex polygons"

Copied!
15
0
0

Laster.... (Se fulltekst nå)

Fulltekst

(1)

Dept. of Math./CMA University of Oslo

Pure Mathematics No 15

ISSN 0806–2439 May 2008

On the injectivity of Wachspress and mean value mappings between convex polygons

Michael S. Floater and Jiˇr´ı Kosinka

Abstract

Wachspress and mean value coordinates are two generalizations of triangular barycentric coordinates to convex polygons and have recently been used to construct mappings between polygons, with ap- plication to curve deformation and image warping. We show that Wachspress mappings between convex polygons are always injective but that mean value mappings can fail to be so in extreme cases.

Keywords: Barycentric coordinates, Wachspress coordinates, mean value coordinates, injectivity.

Math Subject Classification: 65D17, 26B10

1 Introduction

There has recently been considerable interest in using generalized barycen- tric coordinates to deform shapes, when modelling and processing geometry:

shapes defined either by curves or surfaces [22, 14, 18]. Most of these meth- ods focus on two kinds of barycentric coordinates: Wachspress coordinates [20, 21, 13] and mean value coordinates [7, 9, 14, 10, 5]. Further work on generalized barycentric coordinates can be found in [2, 8, 11, 15, 16, 17, 19].

In the planar case, such barycentric coordinates can be used to map one polygon into another. So far, however, nothing seems to be known about when such mappings are injective, even though this is clearly an important property when these mappings are used in practice.

In this paper we investigate the injectivity of Wachspress and mean value mappings between planar convex polygons. We show that Wachspress map- pings are always injective. However, we have found examples of mean value mappings that are not injective when the polygons have five or more vertices.

(2)

p p p

p

q

q q

1 2

3

5

1

2 4

q5 q3

P Q

p4

Figure 1: Two convex polygons.

2 Barycentric mappings

Let P, Q ⊂ R2 be strictly convex polygons with vertices p1,p2, . . . ,pn and q1,q2, . . . ,qn respectively, ordered anticlockwise, with n ≥ 3. By strictly, we mean that no three vertices in the polygon are collinear. Figure 1 shows an example with n = 5. We view both polygons as open sets of R2 and denote their boundaries by ∂P and ∂Q and their closures by P and Q. We would like to define a smooth mapping f : P → Q. One way is to use barycentric coordinates. Let λ1, λ1, . . . , λn : P → R be a sequence of non- negative functions such that

n

X

i=1

λi(x) = 1, x∈P , (1)

n

X

i=1

λi(x)pi =x, x∈P . (2)

We call λ1, . . . , λn a set of barycentric coordinates for P. If n = 3, P is a triangle, and the equations (1-2) have, by Cramer’s rule, the unique solution

λ1(x) = A(x,p2,p3)

A(p1,p2,p3), λ2(x) = A(p1,x,p3)

A(p1,p2,p3), λ3(x) = A(p1,p2,x) A(p1,p2,p3). where A(p,q,r) denotes the signed area of the triangle [p,q,r],

A(p,q,r) = 1 2

1 1 1

p1 q1 r1 p2 q2 r2

. (3)

(3)

Forn ≥4, there are several possible choices of barycentric coordinates. One is the construction that goes back to Wachspress. For x∈P let

λi(x) =wi(x).Xn

j=1

wj(x), (4)

with

wi(x) =Ci

Y

j6=i−1,i

Aj(x). (5)

where Ci = A(pi−1,pi,pi+1), and Aj(x) = A(x,pj,pj+1); see [20, 21, 13].

Here and throughout the paper we view the index i in pi, qi, Ai, wi and so on cyclically with respect to n.

Ifx is not on the boundary ofP we can replace (5) by wi(x) = Ci

Ai−1(x)Ai(x), (6)

without altering λi. We will use this local expression later. A simple proof that the λi satisfy (2) is given in the appendix of [13]. Another choice is the mean value coordinates which, for x∈P, are given by (4) with

wi(x) = 1

kx−pik tan(αi−1(x)/2) + tan(αi(x)/2)

, (7)

where k · k is the Euclidean norm in R2 and αi(x) denotes the angle at x in the triangle [x,pi,pi+1]; see [7]. These mean value coordinates λi extend continuously to the boundary ∂P in the same way as Wachspress and all other barycentric coordinates. Using (1–2), it can be shown (see [8]) that if

x= (1−µ)p+µpℓ+1, (8) for some ℓ and some µ∈[0,1], with indexes treated cyclically, then

λ(x) = 1−µ, λℓ+1(x) =µ, and λi(x) = 0 fori6=ℓ, ℓ+ 1. (9) Consider next a barycentric mapping fromP toQ. We define the mapping f :P →R2 by

f(x) =

n

X

i=1

λi(x)qi, x∈P . (10)

(4)

Then (1) implies that f(x) is a convex combination of the points qi and so f(P)⊂Q. Further, by (9), ifx is the boundary point (8) then

f(x) = (1−µ)q+µq+1.

Thus f maps ∂P to ∂Q in a piecewise linear fashion, mapping vertices and edges of ∂P to corresponding vertices and edges of ∂Q.

Figure 2 shows examples of Wachspress and mean value mappings.

3 Conditions for injectivity

We start by deriving conditions on barycentric coordinates for injectivity:

both sufficient conditions and necessary conditions.

Using basic results of real analysis, see for example [12], it can be shown that a sufficient condition for the injectivity of f in (10) is that its Jaco- bian J(f) is strictly positive in P. This motivates looking for an expression for J(f) in terms of signed areas of triangles formed by vertices of Q. If f(x) = (f(x), g(x)), and ∂rh(x) := ∂h/∂xr,r = 1,2, the Jacobian of f is the determinant

J(f) =

1f ∂1g

2f ∂2g .

Lemma 1 For any set of differentiable functions λ1, . . . , λn satisfying (1), J(f)(x) = 2 X

1≤i<j<k≤n

det(λi, λj, λk)(x)A(qi,qj,qk), (11) where

det(a, b, c) =

a b c

1a ∂1b ∂1c

2a ∂2b ∂2c

. (12)

Proof. Differentiating (1) and (10) gives the matrix identity

1 f g

0 ∂1f ∂1g 0 ∂2f ∂2g

=

λ1 · · · λn

1λ1 · · · ∂1λn

2λ1 · · · ∂2λn

1 q11 q21

... ... ... 1 qn1 qn2

.

Applying the Cauchy-Binet theorem (see [1], formula (1.23)) to this equation and using the fact that the determinant of the matrix on the left equalsJ(f),

the result follows. 2

(5)

a)

b)

Figure 2: Barycentric mappings between pentagons: a) Wachspress mapping, b) mean value mapping.

(6)

Since Q is strictly convex we have that A(qi,qj,qk) > 0 whenever 1 ≤ i < j < k ≤ n because the triangle [qi,qj,qk] is positively oriented. Thus Lemma 1 leads to a sufficient condition for injectivity.

Theorem 1 Ifλ1, . . . , λn are differentiable barycentric coordinates such that for all x ∈ P, det(λi, λj, λk)(x) ≥ 0 for all i, j, k with 1 ≤ i < j < k ≤ n and det(λi, λj, λk)(x) > 0 for some i, j, k with 1≤ i < j < k ≤ n then f is injective.

Conversely, we derive necessary conditions for injectivity.

Theorem 2 If λ1, . . . , λn are differentiable barycentric coordinates and f is injective then for all r, s, t with 1≤r < s < t≤n,

X

r≤i<s≤j<t≤k<n+r

det(λi, λj, λk)≥0 in P . (13) Proof. Iff is injective thenJ(f)≥0 inP. LetQbe the polygon with vertices

q1 =· · ·=qr−1 = (0,0), qr =· · ·=qs−1 = (1,0), qs =· · ·=qt−1 = (0,1), qt=· · ·=qn= (0,0).

Then A(qi,qj,qk) = 1/2 if 1 ≤ i < r ≤j < s ≤ k < t or r ≤ i < s ≤ j <

t ≤k≤n and zero otherwise. Substituting these values into (11) gives X

1≤i<r≤j<s≤k<t

det(λi, λj, λk) + X

r≤i<s≤j<t≤k≤n

det(λi, λj, λk)≥0. (14) Replacing i, j, k by k, i, j in the first sum and using the fact that

det(λk, λi, λj) = det(λi, λj, λk), the first sum can be written as

X

1≤k<r≤i<s≤j<t

det(λi, λj, λk) = X

r≤i<s≤j<t n+1≤k<n+r

det(λi, λj, λk−n).

Replacingλk−nbyλk, combining this second expression with the second sum

in (14) gives (13). 2

(7)

We have thus derived sets of sufficient conditions and necessary condi- tions for injectivity, based on the signs of the determinants det(λi, λj, λk).

Finding conditions that are both sufficient and necessary could be difficult.

Interestingly, a similar difficulty arose in [3, 4, 6] when trying to characterize bases of functions that guarantee convexity preservation of curves: when the control polygon is convex, the curve should be too. So far, a characterization is not known. However, as we will see in the next section, the sufficient con- ditions of Theorem 1 are good enough to show that Wachspress mappings are injective and we use the necessary ones to help to derive a counterexample for mean value mappings.

For barycentric coordinates expressed in the form (4), the following iden- tity helps to simplify the task of checking the signs of these determinants.

Lemma 2 For differentiable functions a, b, c, and µ,

det(µa, µb, µc) =µ3det(a, b, c). (15) Proof. Recalling (12), expand the second and third rows of the determinant det(µa, µb, µc) using the product rule. Then, subtracting ∂1µ times the first row from the second row and subtracting ∂2µ times the first row from the

third row, gives the result. 2

4 Wachspress mappings

We now use the sufficient conditions of Theorem 1 to show that Wachspress mappings are injective.

Theorem 3 If λ1, . . . , λn are the Wachspress coordinates (4–5) then f is injective.

Proof. The proof uses Theorem 1 and consists of two steps dealing with x∈P and x∈∂P, respectively.

Step 1: First let x∈P and choose i, j, k such that 1≤i < j < k ≤n. We will show that det(λi, λj, λk)(x) > 0. Since x is not on the boundary of P we can define λi in (4) using the rational weight function wi of (6), i.e., as λi =µwi, where µ= 1/P

jwj >0, and then by Lemma 2, it is sufficient to show that det(wi, wj, wk)(x)>0. To this end, observe that

det(wi, wj, wk) =wi∇wj × ∇wk+wj∇wk× ∇wi+wk∇wi× ∇wj, (16)

(8)

where ∇w:= (∂1w, ∂2w) andp×q:=p1q2−p2q1. Using (3), differentiation of Ai(x) with respect to x1 and x2 gives

∇Ai = 1

2rot(pi+1−pi), (17)

where rot(p1, p2) := (−p2, p1), a rotation through a positive angle of π/2.

Therefore, from (6), we have

∇wi =−wi

rot(pi−pi−1)

2Ai−1(x) + rot(pi+1−pi) 2Ai(x)

, and it follows that

∇wi× ∇wj =wiwjSij, (18) where

Sij =Ri−1,j−1+Ri−1,j+Ri,j−1+Rij, and

Rij = rot(pi+1−pi)×rot(pj+1−pj)

4Ai(x)Aj(x) = (pi+1−pi)×(pj+1−pj)

4Ai(x)Aj(x) . (19) Substituting (18) into (16) gives

det(wi, wj, wk) =wiwjwk(Sij +Sjk+Ski),

where we have used the fact that Rij =−Rji and consequently Sij = −Sji. Now, each of the three S terms expands into four R terms, giving twelve R terms altogether. We can group these twelve terms into four groups of three such that each group has the form

Tpqr :=Rpq +Rqr+Rrp. There are two ways of doing this. One is

det(wi, wj, wk) =wiwjwk(Ti,j,k +Ti,j−1,k−1+Ti−1,j,k−1+Ti−1,j−1,k), and the other is

det(wi, wj, wk) =wiwjwk(Ti−1,j−1,k−1+Ti,j,k−1+Ti,j−1,k+Ti−1,j,k).

(9)

p

p

j p

p

p i

j+1

k+1

pj

pj+1

pk k

pk+1 pi+1

pi pi+1

(a) (b)

Figure 3: At least two cross products are positive

Now, since Rii= 0, we see that Tpqr = 0 whenever p=qorq=r. Therefore, using either expression, we see that det(wi, wj, wk)>0 if

Tijk>0, 1≤i < j < k≤n.

To show this, observe from the cross product in (19) and from the convexity of P that at least two of the terms Rij, Rjk, Rki must be strictly positive.

We may assume without loss of generality that these are Rij and Rjk. If the third term Rki is non-negative, as illustrated in Figure 3(a), then Tijk > 0 as claimed. Thus it remains to treat the case that Rki <0, as illustrated in Figure 3(b). To this end, with Lα denoting the infinite line that extends the line segment [pα,pα+1], consider the three lines Li, Lj, Lk. They intersect in three points: r1 the intersection of Li and Lj; r2 the intersection of Li and Lk; and r3 the intersection of Lj and Lk; see Figure 4. Then, recalling the

‘half the base times the height’ rule for the area of a triangle, it is easy to see that

pi+1−pi

Ai(x) = r2−r1

A(x,r1,r2), pj+1−pj

Aj(x) = r3−r1

A(x,r1,r3), pk+1−pk

Ak(x) = r3−r2

A(x,r2,r3), and it follows from (19) that

Rij = A(r1,r2,r3) 2A(x,r1,r2)A(x,r1,r3),

(10)

pi pi+1

pk+1

pk

pj+1 r

r 3 x

p j r1

2

Figure 4: Intersections of three lines Rjk = A(r1,r2,r3)

2A(x,r1,r3)A(x,r2,r3), Rki = −A(r1,r2,r3)

2A(x,r2,r3)A(x,r1,r2). So

Tijk = (A(r1,r2,r3))2

2A(x,r1,r2)A(x,r1,r3)A(x,r2,r3) >0.

This shows that det(wi, wj, wk)(x)>0 forx∈P.

Step 2: It remains to deal withx∈∂P, which we may assume to be as in (8) for some ℓand µ∈[0,1). Since the λi are continuous on the whole ofP and det(λi, λj, λk)(x) > 0 on P, we know that det(λi, λj, λk)(x) ≥ 0 by Step 1.

However, for general n, it is possible that there are some triples i, j, k with 1 ≤ i < j < k ≤ n such that det(λi, λj, λk)(x) = 0. In fact, recalling (12), this is the case when none of i, j, k equal either ℓ or ℓ+ 1, for then λi(x) = λj(x) = λk(x) = 0. We will, however, show that det(λℓ−1, λ, λ+1)(x) > 0 which is sufficient for injectivity by Theorem 1. To simplify this task we again appeal to Lemma 2 but this time must use the polynomial wi. We will show that det(wℓ−1, w, w+1)(x) > 0 with wi as in (5). From (16), we can write the determinant as

det(wℓ−1, w, w+1) =wℓ−1∇w× ∇w+1+w2

w+1

w

× ∇wℓ−1, (20)

(11)

valid as long as w 6= 0. This expression is convenient because wℓ+1

w

= Cℓ+1

C

Aℓ−1

A+1

,

and, using (17),

Aℓ−1

A+1

= rot(p−pℓ−1) 2A+1

− Aℓ−1rot(pℓ+1−p) 2A2+1

.

Using these observations, we now evaluate (20) at x = (1−µ)p +µp+1. Since wℓ−1(x) = 0 and

∇wℓ−1(x) =Krot(p+1−p), where

K =Cℓ−1

Y

j6=ℓ−1,ℓ,ℓ+1

Aj(x)>0, we find

det(wℓ−1, w, w+1)(x) = K1A(pℓ−1,p,p+1) +K2A(p,p+1,p+2), where

K1 =KC+1

C

w2(x) A+1(x) >0, and

K2 =KC+1

C

w2(x)Aℓ−1(x) A2ℓ+1(x) >0.

2

5 Mean value mappings

Mean value mappings are defined by (10), (4) and (7). Following numerous numerical tests, we conjecture that they are always injective when n = 4.

However, we have discovered counterexamples whenn = 5. These were found by exploiting Theorem 2.

(12)

1,05 0,8 y 0,55

0,3 0,05

-0,2

0,2 0,6 1,0 1,4 1,8 2,2 3,0

-0,2 2,6 3,4

x

3,40 3,42 3,44 3,46 3,48 3,50

0,4990 0,4995 0,5000 0,5005 0,5010

Figure 5: Counterexample 1: Mean value mapping between two convex poly- gons. Top: The gray region G corresponds to negative Jacobian in P. Bot- tom: The image of G, the foldover area, is bounded by the black dots in Q.

Only a scaled part of Q near its vertex q3 is shown.

1,05 0,8 y0,55

0,3 0,05

-0,2

5,0

2,5 7,5

0,0 10,0

x

14,80 14,85 14,90 14,95 15,00

4,994 4,996 4,998 5,000 5,002 5,004 5,006

Figure 6: Counterexample 2: A foldover of a mean value mapping over two strictly convex polygons. P is non-uniformly scaled and only a part ofQ is shown in order to emphasize the foldover.

(13)

5.1 Counterexample 1

Let us suppose that P is given by p1 = (0,0), p2 = (0.7,0.1),p3 = (2,0.5), p4 = (0.7,0.9) and p5 = (0,1). Moreover, let x = (1.2,0.5) ∈ P. By evaluating det(λi, λj, λk)(x) for the mean value coordinates of P one obtains that det(λ1, λ2, λ5)(x) =−0.00011838,

det(λ1, λ3, λ5)(x) =−0.00040841, det(λ1, λ4, λ5)(x) =−0.00011838.

(21) Therefore,

det(λ1, λ2, λ5)(x) + det(λ1, λ3, λ5)(x) + det(λ1, λ4, λ5)(x) =−0.00064517.

As this value is negative, it violates the necessary conditions of Theorem 2 for n = 5, r = 1, s = 2 and t = 5. Consequently, by choosing Q to be, for example, given by q1 = (2.5,0), q2 = q3 = q4 = (3.5,0.5) and q5 = (2.5,1), we arrive at an example of a mean value mapping over convex polygons where the Jacobian is negative at some interior points. Indeed, J(f)(x) =−0.00064517.

Figure 5 depicts the situation and shows the region of P where the cor- responding Jacobian is negative. Moreover, it shows a star of line segments in P. One can see the intersections of their images in Figure 5 – a fact that contradicts the injectivity of mean value mappings over convex polygons.

5.2 Counterexample 2

In this second example we assume that P has vertices p1 = (0,0), p2 = (0.7,0), p3 = (10,0.5), p4 = (0.7,0.1), p5 = (0,1) and Q is given by q1 = (13,0), q2 = (14.999,4.99), q3 = (15,5), q4 = (14.999,5.01) and q5 = (13,10).

Note that in this example both P and Q are strictly convex polygons.

Still, Figure 6 shows that the corresponding mean value mapping is not injective.

References

[1] T. Ando, Totally positive matrices, Linear Algebra Appl. 90 (1987), 165–219.

(14)

[2] A. Belyaev, On transfinite barycentric coordinates, inEurographics sym- posium on geometry processing, K. Polthier and A. Sheffer (eds.), 2006, pp 89–99.

[3] J. M. Carnicer, M. Garcia-Esnaola, and J. M. Pe˜na, Convexity of ra- tional curves and total positivity, J. Comp. Appl. Math. 71 (1996), 365–382.

[4] J. M. Carnicer and M. Garcia-Esnaola, Global convexity of curves and polygons, Comp. Aided Geom. Design 15 (1998), 893–907.

[5] C. Dyken and M. S. Floater, Transfinite mean value interpolation, to appear in Comp. Aided Geom. Design.

[6] M. S. Floater, Total positivity and convexity preservation, J. Approx.

Theory 96 (1999), 46–66.

[7] M. S. Floater, Mean value coordinates, Comp. Aided Geom. Design 20 (2003), 19–27.

[8] M. S. Floater, K. Hormann, and G. K´os, A general construction of barycentric coordinates over convex polygons, Adv. in Comp. Math. 24 (2006), 311–331.

[9] M. S. Floater, G. Kos, and M. Reimers, Mean value coordinates in 3D, Comp. Aided Geom. Design 22 (2005), 623-631.

[10] K. Hormann and M. S. Floater, Mean value coordinates for arbitrary planar polygons, ACM Trans. on Graphics 25(2006), 1424–1441.

[11] W. J. Gordon and J. A. Wixom, Pseudo-harmonic interpolation on con- vex domains, SIAM J. Numer. Anal. 11 (1974), 909–933.

[12] H. Kestelman, Mappings with non-vanishing Jacobian, Amer. Math.

Monthly 78 (1971), 662–663.

[13] M. Meyer, A. Barr, H. Lee, and M. Desbrun, Generalized barycentric coordinates on irregular polygons, Journal of graphics tools 7 (2002), 13–22.

[14] T. Ju, S. Schaefer, and J. Warren, Mean value coordinates for closed triangular meshes, ACM Trans. on Graphics 24 (2005), 561–566.

(15)

[15] T. Ju, S. Schaefer, J. Warren, and M. Desbrun, A geometric construc- tion of coordinates for convex polyhedra using polar duals, inGeometry Processing 2005, M. Desbrun and H. Pottman (eds.), Eurographics As- sociation 2005, 181–186.

[16] T. Langer, A. Belyaev, and H.-P. Seidel, Spherical barycentric coordi- nates, in Eurographics symposium on geometry processing, K. Polthier and A. Sheffer (eds.), 2006, pp 81–88.

[17] S. L. Lee, Mean value representations and curvatures of compact convex hypersurfaces, preprint, 2007.

[18] Y. Lipman, J. Kopf, D. Cohen-Or, and D. Levin, GPU-assisted pos- itive mean value coordinates for mesh deformation, in Symposium on Geometry Processing, 2007.

[19] S. Schaefer, T. Ju, and J. Warren, A unified integral construction for coordinates over closed curves, Comp. Aided Geom. Design 24 (2007), 481–493.

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

[21] J. Warren, Barycentric coordinates for convex polytopes, Adv. in Comp.

Math. 6 (1996), 97–108.

[22] J. Warren, S. Schaefer, A. Hirani, and M. Desbrun, Barycentric coordi- nates for convex sets, Adv. in Comp. Math. 27 (2007), 319–338.

Referanser

RELATERTE DOKUMENTER

The figure illustrates two scenarios where the source country infant mortality rate (SIMR) is set to a ‘high’ value of 104 and a ‘low’ value of 18, which are the mean

FORSVARETS FORSKNINGSINSTITUTT Norwegian Defence Research Establishment P O Box 25, NO-2027 Kjeller, Norway.. However, these conditions also provide opportunities that can

In the subsequent section, we express a vector lying in a con- vex polyhedral cone as a linear combination of the rays of the cone and utilize this construction to deduce a

In particular, we introduce spherical mean value coordinates that inherit many good properties of their planar counter- parts and are defined for arbitrary spherical polygons (Sec-

The Gordon-Wixom interpolation scheme [GW74] and transfinite counterparts of discrete harmonic and Wachspress-Warren coordinates are studied as particular cases of that

When the interactions between fluid particles and cloth polygons are calculated, the polygon that is the closest to a particle have to be searched for as well.. Because the

The introduction of mean value coordinates (MVC) as a space deformation method led to much more control over the em- bedded mesh since the control points are geometry-aware..

We prove that spherical mean value coordinates are defined for arbitrary polygons on the sphere, and we show that the vector coordinates in [JSWD05] are a special case of