11
Vis Comput DOI 10.1007/s00371-009-0396-3 ORIGINAL ARTICLE An intuitive polygon morphing Martina Málková · Jindˇ rich Parus · Ivana Kolingerová · Bedˇ rich Beneš © Springer-Verlag 2009 Abstract We present a new algorithm for morphing simple polygons that is inspired by growing forms in nature. While previous algorithms require user-assisted definition of com- plicated correspondences between the morphing objects, our algorithm defines the correspondence by overlapping the in- put polygons. Once the morphing of one object into another is defined, very little or no user interaction is necessary to achieve intuitive results. Our algorithm is suitable namely for growth-like morphing. We present the basic algorithm and its three variations. One of them is suitable mainly for convex polygons, the other two are for more complex poly- gons, such as curved or spiral polygonal forms. Keywords Morphing · Vector data · Polygon intersection · Computer Graphics This work was supported by Grant Agency of the Czech Republic—project No. 201/09/0097. Electronic supplementary material The online version of this article (http://dx.doi.org/10.1007/s00371-009-0396-3) contains supplementary material, which is available to authorized users. M. Málková ( ) · J. Parus · I. Kolingerová University of West Bohemia, Plzeˇ n, Czech Republic e-mail: [email protected] J. Parus e-mail: [email protected] I. Kolingerová e-mail: [email protected] B. Beneš Purdue University, West Lafayette, USA e-mail: [email protected] 1 Introduction Morphing is a (non-linear) transformation of a shape into another shape and has practical uses in computer graphics, animation, modeling and design. This area has been thor- oughly researched and the existing methods can be classified into two main groups—traditional volume and image mor- phing and boundary-based morphing. In this article we focus on boundary-based morphing methods. The algorithms de- signed in this area concentrate on morphing similar shapes, where some common features can be identified. However, in some cases it is not possible to align all the main features of the input shapes (e.g. a head with and without horns). A nat- ural morph usually means growth of the non-aligned part from its aligned neighbor. In this paper, we propose a novel approach for morphing with this “growth-like” nature. The computation of a morph requires three inputs: two shapes (source and destination), the definition of vertex cor- respondences between the source and the destination, and the definition of vertex paths together with the dynamics of the transformation. The last input defines the way in which the shapes are morphed in time. The morph can be linear, it can accelerate or decelerate, or its time dependence can be described by a user-defined mapping function. Establish- ing the correspondence of the vertices and the vertex paths are two independent steps, which can be solved by different algorithms, but both usually require some user interaction. Although there is much to achieve by a suitable vertex path computation, the definition of the correspondence between two shapes remains crucial. Most algorithms offer the user the ability to influence the correspondence by adding some constraints or manually defining corresponding vertices, but such a definition can be complex and sometimes the user cannot predict how the changes will influence the result, so a trial and error technique is usually applied iteratively.

An intuitive polygon morphing - Purdue Universityhpcg.purdue.edu/bbenes/papers/Malkova10VisComp.pdf · polygons that is inspired by growing forms in nature. While previous algorithms

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: An intuitive polygon morphing - Purdue Universityhpcg.purdue.edu/bbenes/papers/Malkova10VisComp.pdf · polygons that is inspired by growing forms in nature. While previous algorithms

Vis ComputDOI 10.1007/s00371-009-0396-3

O R I G I NA L A RT I C L E

An intuitive polygon morphing

Martina Málková · Jindrich Parus · Ivana Kolingerová ·Bedrich Beneš

© Springer-Verlag 2009

Abstract We present a new algorithm for morphing simplepolygons that is inspired by growing forms in nature. Whileprevious algorithms require user-assisted definition of com-plicated correspondences between the morphing objects, ouralgorithm defines the correspondence by overlapping the in-put polygons. Once the morphing of one object into anotheris defined, very little or no user interaction is necessary toachieve intuitive results. Our algorithm is suitable namelyfor growth-like morphing. We present the basic algorithmand its three variations. One of them is suitable mainly forconvex polygons, the other two are for more complex poly-gons, such as curved or spiral polygonal forms.

Keywords Morphing · Vector data · Polygon intersection ·Computer Graphics

This work was supported by Grant Agency of the CzechRepublic—project No. 201/09/0097.

Electronic supplementary material The online version of this article(http://dx.doi.org/10.1007/s00371-009-0396-3) containssupplementary material, which is available to authorized users.

M. Málková (�) · J. Parus · I. KolingerováUniversity of West Bohemia, Plzen, Czech Republice-mail: [email protected]

J. Paruse-mail: [email protected]

I. Kolingerováe-mail: [email protected]

B. BenešPurdue University, West Lafayette, USAe-mail: [email protected]

1 Introduction

Morphing is a (non-linear) transformation of a shape intoanother shape and has practical uses in computer graphics,animation, modeling and design. This area has been thor-oughly researched and the existing methods can be classifiedinto two main groups—traditional volume and image mor-phing and boundary-based morphing. In this article we focuson boundary-based morphing methods. The algorithms de-signed in this area concentrate on morphing similar shapes,where some common features can be identified. However, insome cases it is not possible to align all the main features ofthe input shapes (e.g. a head with and without horns). A nat-ural morph usually means growth of the non-aligned partfrom its aligned neighbor. In this paper, we propose a novelapproach for morphing with this “growth-like” nature.

The computation of a morph requires three inputs: twoshapes (source and destination), the definition of vertex cor-respondences between the source and the destination, andthe definition of vertex paths together with the dynamics ofthe transformation. The last input defines the way in whichthe shapes are morphed in time. The morph can be linear,it can accelerate or decelerate, or its time dependence canbe described by a user-defined mapping function. Establish-ing the correspondence of the vertices and the vertex pathsare two independent steps, which can be solved by differentalgorithms, but both usually require some user interaction.Although there is much to achieve by a suitable vertex pathcomputation, the definition of the correspondence betweentwo shapes remains crucial. Most algorithms offer the userthe ability to influence the correspondence by adding someconstraints or manually defining corresponding vertices, butsuch a definition can be complex and sometimes the usercannot predict how the changes will influence the result, soa trial and error technique is usually applied iteratively.

Page 2: An intuitive polygon morphing - Purdue Universityhpcg.purdue.edu/bbenes/papers/Malkova10VisComp.pdf · polygons that is inspired by growing forms in nature. While previous algorithms

M. Málková et al.

We present an algorithm for easy-to-use and easy-to-define morphing of polygonal objects. Our technique takestwo polygonal objects that partially overlap. Then an over-lapping area of these two polygonal objects is formed, defin-ing the core of the morphing. We suppose that the core con-sists of a single simple polygon, which is a typical situa-tion for such inputs where one would expect a growth-likemorph. The morphing simultaneously changes both poly-gons. The input polygon is absorbed by the core, whereasthe output polygon grows out of it. The principal advan-tage of the shape absorption and the growth is that they canbe viewed as the same process with different direction intime. Algorithmically this means that we need to implementonly one process. Another advantage of the algorithm is thatit offers growth-like morphing. This process could not beeasily achieved using traditional algorithms as it would re-quire manually defining many correspondences. Thanks toits growth-like shape change, our algorithm also producessatisfactory results for polygons that are not star-shaped.

The algorithm solves the correspondence of the two inputpolygons as well as the vertex paths. The final animation iscomputed by the linear interpolation between the intermedi-ate positions in the vertex paths.

The paper is organized as follows. Section 2 describesrelated work in the area of polygon morphing. Section 3describes the method itself and discusses three morphingstrategies used. Section 4 shows the results of the algorithmand demonstrates typical uses of the techniques described inSect. 3. Finally, Sect. 5 describes our conclusions and sug-gestions for future work.

2 Related work

Digital warping and morphing has a long tradition in Com-puter Graphics and its full exposition is outside the scope ofthis paper. We refer readers to [5] for a detailed description.Here we describe the work related to 2D polygon morphing.

Polygon morphing computation can be divided into twoparts: (1) defining the vertex-to-vertex correspondence inthe source and the destination polygons, and (2) definingthe transitions. Point out that the source and the destinationpolygons are not required to have the same number of ver-tices.

The problem of vertex-to-vertex correspondence was ad-dressed by Sederberg and Greenwood in [10] by using aphysical model. The polygon edges are modeled as elasticconnections and the shape transformation involves the cal-culation of a physical response by minimizing the energy ofthe system. This algorithm is efficient for similar input poly-gons and it can also handle cases when the initial shapes arerotated or translated. The algorithm does not address highlydissimilar shapes and self-intersections.

A computation of trajectories was described by Seder-berg et al. in [9], where edge lengths or internal angles areinterpolated instead of the vertex positions. The polygonsare converted to the so-called edge–angle representation [5]that is invariant to rigid transformations. This interpolationscheme avoids edge collapsing and non-monotonic anglechanges. This technique was used to generate in-betweensfor animation based on keyframes. The concept of interpo-lation of intrinsic parameters was also further used for mor-phing of planar triangulations in [12, 13]. The intrinsic in-terpolation avoids local self-intersections. However, it doesnot solve the problem of global self-intersections which mayoccur for highly dissimilar and complicated shapes.

Shapira and Rappoport [11] introduced a method that firstdecomposes the source and the destination polygons intostar-shaped polygons. The skeleton is a planar graph whichjoins star-points of neighboring star-shaped polygons. Theskeletons are interpolated and the intermediate shapes are re-constructed from the interpolated skeletons. The differencebetween this approach and methods described in [9, 10] isthat this approach also considers the interior of the poly-gon and not only the boundary. The problem with this ap-proach is that it relies on isomorphic star-shaped decompo-sition which might be difficult to compute, especially in thecase of dissimilar shapes.

Alexa et al. introduced as-rigid-as-possible shape inter-polation in [2]. They compute a compatible triangulation ofthe input polygons. The compatible triangulation is a dissec-tion of the source and the destination polygons so that thetriangulations are isomorphic, i.e., there is one-to-one cor-respondence between triangles in the source and in the des-tination. Then, an affine transformation which transforms asource triangle to the destination triangle is computed. Inter-polation of the affine transformation defines the morphing.Adjacent triangles are also considered in the interpolation.Similar approaches were also described by Surazhsky andGotsman in [12, 13]. The principal problem of these meth-ods is the computation of the isomorphic triangulation ofthe input shapes, as its quality influences the quality of themorphing.

Gomez et al. introduced 2D merging [5], which is a 2Dapplication of the algorithm that was originally developedfor 3D meshes (see for example [1, 7]). First, the input poly-gons are mapped to a unit disc, then both mappings aremerged. The vertices of the first polygon are mapped onthe second polygon and vice versa using inverse mapping.This results in polygons with the same number of vertices.A linear interpolation is used to obtain the resulting mor-phing transition. This technique is suitable for convex, star-shaped or slightly non-convex polygons. This algorithm isnot suitable for highly non-convex polygons, as it producesself-intersections during the morphing transition.

Carmel and Cohen-Or [3] showed an algorithm whichcombines a 2D merging and a polygon evolution. A user

Page 3: An intuitive polygon morphing - Purdue Universityhpcg.purdue.edu/bbenes/papers/Malkova10VisComp.pdf · polygons that is inspired by growing forms in nature. While previous algorithms

An intuitive polygon morphing

first specifies anchor points that define the correspondencebetween polygons. Using the anchor points, a warp functionis computed that warps the source polygon to the destina-tion polygon. Once the source polygon is warped, a polygonevolution technique is used to evolve the source and the des-tination polygon to a convex shape.

Johnstone and Wu [6] described an alternative approachto merging polygons by morphing. The 2-to-1 morphing isa fundamental case in the morphing between different num-bers of polygons. The basic idea is to merge the two poly-gons into one and then use the one-to-one polygon morph-ing technique to morph between the merged polygon and adestination polygon. During the merging the two polygonsare morphed towards each other until they meet at a point.Then a curve evolution technique is used to morph the twopolygons connected at some point into a more natural shapewhich is later morphed towards the destination shape.

3 The polygon morphing algorithm

Let us have an ordered set of vertices vi , i = 0, . . . ,N − 1.An edge ei is a line segment with endpoints vi and vi+1.A polygonal chain Q is a sequence of edges e0, e2, . . . , eN−2

with vertices v0, v1, . . . , vN−1. A polygon P is a region ofthe plane bounded by a closed polygonal chain δP , i.e. apolygonal chain where v0 = vN−1. A polygon is simple ifthere is no pair of nonconsecutive edges sharing a point.

3.1 Algorithm overview

The algorithm takes as input two simple polygons (seeFig. 1), the source polygon A and the destination polygonB which must spatially overlap, A ∩ B �= ∅. No further con-dition on the polygons is imposed. However, it is beneficialif the polygon vertices are distributed equidistantly. There-fore, an optional preprocessing step is to resample the inputpolygons A,B so that their vertices are equidistantly distrib-uted.

The overlapping area of A and B is called the core ofthe morph and it is denoted by C = A ∩ B . Without loss ofgenerality, we suppose that the core C consists of a singlesimple polygon.

Fig. 1 The description of thepolygons. A and B are the inputpolygons. C is the intersection(the core) and P and Q arepolygons that will be absorbedand grow out of the corerespectively

The area of polygon A that is clipped out is denoted byP = A − B and analogously the area of the polygon B thatis clipped out is denoted by Q = B − A. Note that P andQ are not necessarily single polygons. They can be a setof simple polygons so that P = ⋃

i Pi and Q = ⋃j Qj . We

suppose that P �= ∅ or Q �= ∅. During the morphing process,the parts Qj grow out from the core, while the parts Pi areabsorbed into the core. All parts of the polygons grow andare absorbed simultaneously, which results in the effect ofmorphing two simple polygons. Algorithmically, the processof absorption is an inverse process of growing, so for now wewill concentrate only on the description of the absorption ofone part Pi .

The boundary δPi consists of two polygonal chains Cin,Cout, where Cin is a shared polygonal chain of δC and δPi ,Cout is the rest of δPi which remains after removing Cin

from δPi . The polygonal chains Cin, Cout are separated byintersection vertices vI0, vI1 (Fig. 2). An intersection vertexlies in the intersection of the closed polygonal chains δA andδB . If Pi �= A and Pi �= B then two vertices of δPi becomeintersection vertices. By morphing the polygon chain Cout

to the polygon chain Cin we achieve the effect of the partPi being absorbed into the core C. Hereby, we can expressthe polygon morphing problem as several polygonal chainmorphing problems.

The morphing between a polygonal chain Cout and Cin

can be described in terms of a vertex path. The vertex pathof a vertex vi is a list of coordinates describing points inE2 that the vertex passes through during the morphing se-quence. The vertex path is computed for each vertex of thepolygonal chain Cout excluding the intersection vertices vI0

and vI1. It has at least two elements, i.e., the initial positionof the vertex at the time t = 0 and the final position of thevertex at the time t = 1. A set of vertex transformations isobtained by computing intermediate positions of a vertex.The intermediate positions are computed by interpolatingthe position values pk along the vertex path. Any interpo-lation technique such as a piecewise linear interpolation, acubic spline interpolation or some other interpolation formcan be used.

The vertex path is computed using a concept of a topo-logical distance. If we define a distance d(vi, vj ) betweenvertices vi and vj as the minimal number of edges on thepolygon between vi and vj , the topological distance of avertex vi is its minimal distance to the intersection ver-tices dmin(vi) = min(d(vi, vI0), d(vi, vI1)). Figure 2 showsan example of topological distances—the vertices are la-beled according to the topological distance from the inter-section vertices vI0, vI1. The topological distance estab-lishes the order in which the vertices will grow. The verticeswith a smaller topological distance will reach their destina-tion sooner than the vertices with a larger topological dis-tance. This prevents self-intersections during the morphing

Page 4: An intuitive polygon morphing - Purdue Universityhpcg.purdue.edu/bbenes/papers/Malkova10VisComp.pdf · polygons that is inspired by growing forms in nature. While previous algorithms

M. Málková et al.

Fig. 2 A highly non-convexpolygon Pi is absorbed in thecore C (the hatched part). Thepolygon Pi will be absorbed inthe core C by morphing thepolygonal chain Cout to Cin

Input: Two partially overlapping polygons A, B (Optional:Resample the input polygons so that their vertices are equidis-tantly distributed).Output: A polygon R = A∪B , where each vertex of δR eithercontains a vertex path determining its behavior over time, orbelongs to A ∩ B .The algorithm:1. Compute the core C = A ∩ B .2. Compute the polygon sets P = A − B = ⋃

i Pi , Q =B − A = ⋃

i Qi .3. ∀vi ∈ δP and ∀vi ∈ δQ: compute its topological distance di .4. Using a user-selected method (Perimeter, Midpoint, or Pro-

jection growing), compute the vertex path of each vertex vi .5. Merge the polygon C and the polygon sets P,Q to get the

resulting polygon R

Fig. 3 Pseudocode of the algorithm

process. Moreover, we extend the concept of the topologicaldistance to distinguish between topological distances of ver-tices lying on the polygonal chains Cin and Cout. The topo-logical distance should be positive only, but we use posi-tive distance for vertices vi ∈ δPiCin and add the negativesign to the vertices lying on the polygonal chain Cin. Thendmin, dmax are minimal and maximal topological distancesof the vertices from δPi .

The pseudocode of the algorithm can be seen in Fig. 3. Instep 4 of the algorithm, we use three different methods forcomputing the vertex paths to morph polygonal chains Cin

and Cout and to simulate a process of absorption for poly-gon Pi ; the Perimeter growing, the Midpoint growing andthe Projection growing. These methods will be described be-low.

3.2 The perimeter growing method

As was described in Sect. 2, many previously introduced al-gorithms struggle with morphing of curved objects such asthose shown in Fig. 4a, b.

We address this problem with a method that we callPerimeter growing. The basic idea is that the vertices

Fig. 4 Cases that are suitable (a, b) and that are not suitable (c, d) forthe perimeter growing (dark gray color indicates the place where thepart meets the core, light gray represents the part that grows out, theinput polygon is indicated by a thick line)

vi ∈ Cout travel along the perimeter of the polygon Pi , mean-ing that its vertex path contains only positions of the verticesof δPi . When deciding about the correspondence of the ver-tices of Cin and Cout, we need to determine at which vertexvj with the topological distance dj is the specific vertexpath supposed to end. The vertex path of a vertex vi withthe topological distance di contains vertices with topologi-cal distances (di−1, di−2, . . . , d0, d−1, . . . , dj ) (see Fig. 5).We define two conditions concerning the last vertex of thevertex path, vertex vj . First, it must belong to the polygonalchain Cin. Second, there should be at least one vertex pathto end at each vertex that belongs to the polygonal chainCin (to form the shape of the other polygon). Based on theseobservations, we let the vertex path of the vertex with dmax

Page 5: An intuitive polygon morphing - Purdue Universityhpcg.purdue.edu/bbenes/papers/Malkova10VisComp.pdf · polygons that is inspired by growing forms in nature. While previous algorithms

An intuitive polygon morphing

Fig. 5 Vertex paths (dmax = 3,dmin = −2): (a) the vertex pathfor the vertex with d = dmaxends at the vertex with d = dmin(b) for the vertex withd = dmax−1 it ends at the vertexwith d = dmin+1 (c), and so on

Fig. 6 Three possible inputconfigurations for computingvertex paths: (a) nin = nout,(b) nin > nout, (c) nin < nout.(The dark gray color representsthe core C, the grey representsthe selected part, the light greyindicates the place where thepart meets the core; the firstpolygon is indicated by a fullline and the second by a dashedline, the vertex paths areoutlined by grey arrows)

always end at the vertex with dmin. If there is only one vertexwith dmax, we duplicate it to solve the case when there aretwo vertices with dmin. The vertex path of the vertex withdmax−1 should end at the vertex with dmin+1. Generally, avertex path of the vertex with dmax−i should end at the ver-tex with dmin+i , as shown in Fig. 5.

However, this situation is a special case that happens onlywhen Cout and Cin have the same number of vertices. For theother cases, let us denote nin and nout the number of verticesof Cin and Cout respectively. We can then distinguish thefollowing three cases:

– nin = nout (Fig. 6a).The vertex path of each vertex of Cout ends at one vertexof Cin.

– nin > nout (Fig. 6b).Some vertices of Cin do not belong to any vertex path.However, they should have a correspondence. One solu-tion is to duplicate some vertices of Cout. We use suchvertices of Cout that have a topological distance equal toone and duplicate them as many times as is necessary tocover all the vertices of Cin that remain.

– nin < nout (Fig. 6c) .

Some vertices of Cout do not have any corresponding ver-tices in Cin. In such a case their paths will end at the in-tersection vertices.

Because the vertex path follows the perimeter of the poly-gon, the resulting polygon will look like it is growing fromthe core. The Perimeter growing method works for most ofthe morphs; however, there are two problematic cases. First,the top of the growing polygon is always a straight line con-necting the vertices with the same topological distance. Thismakes the method unsuitable for polygons, where some ver-tices with the same topological distance are wide apart, suchas those in Fig. 4c. The second problem is that following theshape of the polygon is not always desirable—for example,if we have a polygon as in Fig. 4d, it will first grow from thecore and then be absorbed a bit before continuing its growth.

3.3 The midpoint growing method

The Midpoint growing attempts to make the top of the grow-ing part less flat than does the Perimeter growing. Thismethod uses the midpoints of the line segments defined bythe vertices of the same polygonal chain Cout or Cin with the

Page 6: An intuitive polygon morphing - Purdue Universityhpcg.purdue.edu/bbenes/papers/Malkova10VisComp.pdf · polygons that is inspired by growing forms in nature. While previous algorithms

M. Málková et al.

same topological distance (Fig. 7) as the vertices in the ver-tex paths. Figure 8 shows that the method produces similarresults to the Perimeter growing method, the only differenceis that the top of the growing part, which is flat in the case ofthe Perimeter growing method, but sharp for the Midpointgrowing method.

Let us denote mi the midpoint of the line segment vivj

where di = dj . The vertex path of a vertex vi with thetopological distance di contains vertices (mi−1,mi−2, . . . ,

m0, . . . ,mj−1, vj ). The vertex vj is computed according tothe rules described for the Perimeter growing method inSect. 3.2. The results for all three cases with a differentrelationship between nin, nout are shown in Fig. 9. Whennin = nout (Fig. 9a), each vertex of Cout ends its path at onevertex of Cin. If nin > nout (Fig. 9b), some of the vertices ofCout need to be duplicated (those with the topological dis-tance equal to one). If nin < nout (Fig. 9c), some vertices ofCout cannot end their paths at the expected vertex (so theyend at the intersection vertices).

Fig. 7 Midpoints m0,m1,m2 connecting the vertices with the sametopological distance (and of the same polygonal chain)

3.4 The projection growing method

Both the Perimeter and the Midpoint growing methods cangenerate undesired deformations at the top of the growingpart—the former “cuts” the top (there are always two ver-tices connected by a straight line), the latter bends the top alittle, but none of the methods indicates the final shape of thetop of the part. Therefore, both methods produce better re-sults for narrow and curved parts. To morph parts that are notcurved, we created a new method based on a projection andwe call it Projection growing method. This method equidis-tantly maps the vertices onto the line segment connectingthe two intersection vertices.

The main difference of the Projection growing methodfrom the previously presented methods is that all verticesof Cout have the same number of elements in their vertexpaths. Let us describe in detail how this method calculatesthe vertex paths. First, the vertices of Cout are mapped (pro-jected) onto the line segment li defined by the intersectionvertices (i.e., the vertices with a zero topological distance),using an equidistant mapping. The line segment li is dividedinto nout + 1 parts, where nout is the number of the verticesof Cout. We assign the vertices of Cout sequentially to thenew vertices on the line segment (Fig. 10a). The next step isto map the vertices of Cin in a similar way (Fig. 10b).

The last step (Fig. 10c) is to sort the projected vertices ofCin and Cout onto an ordered list in the order in which theyappear on li . We denote the list vI0 = a0, a1, a2, . . . , an−1 =vI1, where ai is a mapped vertex that originally belongs ei-ther to Cin or to Cout. Then we traverse this list as follows:

1. Start at vI0. Go through the list until a vertex of Cin isreached. Add it into the vertex paths of all the vertices ofCout that are located before this vertex.

Fig. 8 A suitable input shape for the Midpoint morphing (dark gray color indicates the place where the part meets the core, light gray representsthe part that grows out, the input polygon is marked by a thick line)

Fig. 9 Three possible inputs forcomputing vertex paths:(a) nin = nout, (b) nin > nout,(c) nin < nout (light grey colordesignates the place where thepart meets the core, and thevertex paths are outlined by greyarrows. . .)

Page 7: An intuitive polygon morphing - Purdue Universityhpcg.purdue.edu/bbenes/papers/Malkova10VisComp.pdf · polygons that is inspired by growing forms in nature. While previous algorithms

An intuitive polygon morphing

Fig. 10 Computing the vertex paths in the Projection growing method:(a) mapping the vertices of Cout onto the line segment between the in-tersection vertices, (b) the vertices of Cin onto the same line segment,

(c) choosing the vertices of Cin for the vertex paths of the vertices ofCout (the mapping is marked by a dashed line, the vertex paths areoutlined by thin lines)

Fig. 11 Vertex paths (grey) for (a) projection using the auxiliary coor-dinates in the vertex paths, (b) direct projection

2. Continue traversing the list. Each time the vertex Cout isreached, add the recent vertex of Cin to its vertex path.

3. The traversal is completed when vI1 is reached.

The above-mentioned method produces vertex paths con-taining only two vertices as it defines only the vertex-to-vertex correspondence between Cout and Cin. There is a pos-sibility of using the position on li , where vi was mapped,in the morphing sequence—so as to include it in its pathbetween the two vertices. This modification brings differ-ent results—instead of heading straight towards their cor-responding vertices, the vertices of Cout first travel towardstheir positions on li . The difference between the two strate-gies is shown in Fig. 11. The modified Projection morph-ing using an intermediate point is more suitable when bothCin and Cout lie on the same side of li , whereas the directvertex-to-vertex morphing provides better results when Cout

and Cin lie on different sides of li .The Projection growing method generates output that ap-

pears to be somewhere between the Perimeter (or Midpoint)growing methods and the typical algorithms based on thecorrespondence between the whole polygons. There is stilldependence of the output on the core; however, the vertexpaths are not influenced by the shape of the polygon, theyonly define the correspondence of the vertices. Therefore,the projection is not usable for curled or spiral parts, whereit has the same problems as the traditional correspondence-

Fig. 12 The Projection growing method provides intuitive results in(a, b) but fails in the case (c) (dark gray color indicates the place wherethe part meets the core, light gray represents the part that grows out,and the input polygon is marked by a thick line)

based algorithms. This morphing method is suitable for thecases where the shape of the part is convex or when it isnon-convex, but not curled (Fig. 12).

3.5 Merging

The last step of our algorithm (recall Fig. 3) is merging. Thepolygons Pi and Qi that were clipped out by the core C

are merged into one polygon R. Moreover, each vertex inR has its vertex path that is defined by one of the abovedescribed morphing methods. The direction of each vertexpath depends on the direction of morphing. Vertex paths ofvertices from δQ point into the core as the polygon Q isabsorbed, whereas the vertex paths of vertices from δP pointout.

The merging process is motivated by Weiler–Atherton al-gorithm for polygon intersection [4]. It processes each poly-gon and makes copies of vertices with positive topologicaldistance to the new list of vertices, while preserving the ver-tex order. The details of the merging process are in Fig. 13.

Page 8: An intuitive polygon morphing - Purdue Universityhpcg.purdue.edu/bbenes/papers/Malkova10VisComp.pdf · polygons that is inspired by growing forms in nature. While previous algorithms

M. Málková et al.

Input: List of polygons S = ⋃i Pi ∪ ⋃

i Qj , lists of verticesof each polygon li = (v0, . . . , vN−1). The lists li are circular sothe next vertex to vN−1 is v0 and the previous vertex to v0 isvN−1. Each polygon has a different number of vertices in itslist, but each part shares exactly two vertices with two otherpolygons (the intersection vertices).Output: One list of vertices containing such vertices vj fromthe lists li that have dj ≥ 0.The merging algorithm:1. Choose a polygon Si from the list of input polygons. Start

from the first vertex in Si . Go through li until the first inter-section vertex vj is found. Add vj to the resulting list (whichnow contains only vj ).

2. Check the vertex vj+1 if its topological distance is positive.If so, continue forward, otherwise backward in li . Add eachvisited vertex to the resulting list until the next intersectionvertex vk is added. Delete the part Si from the list of poly-gons.

3. Because vk was the intersection vertex, either one of theparts in the list contains it (in such a case use this part andcontinue from step 2), or the list of parts is empty (vk is theintersection vertex from step 1). In such a case, the algorithmterminates.

Fig. 13 The merging algorithm

4 Implementation and results

In the following examples we demonstrate the different be-haviors of the presented methods. In the examples, only onemethod is used to morph all the parts, to show the behav-ior of each method, one at a time. Our algorithm is com-pared to the Carmel and Cohen-Or’s algorithm and Seder-berg and Greenwod’s algorithm, which are well establishedcorrespondence-based algorithms.

In the first example we show the morphing of a spiralusing the Perimeter growing (Fig. 14). This method providesmore intuitive results than the Midpoint and the Projectiongrowing. As can be seen in Fig. 14, the Perimeter growingmethod produces more intuitive results than both the Carmeland Cohen-Or algorithm and the Sedeberg and Greenwoodalgorithm, where many unwanted self-intersections occur.

Although the Projection growing method produces unex-pected results when we desire a spiral form to grow out ofthe core, it can sometimes give interesting esthetic results,

especially when we fill the polygons with color (because theoverlapping parts are filled with the background color). Fig-ure 15 shows an example of an in-between result obtainedusing the Projection growing method in the case of a snail’sshell morphing.

The second example shows the case where the Projectiongrowing method is more suitable for objects that are convexor nearly convex (Fig. 16). Here, a butterfly is morphed intoan alien. The body of the butterfly is similar to that of thealien, which makes the objects good candidates for growingand absorption. One would expect the wings of the butterflyto be absorbed in the body of the alien, and the eyes (at theend of the antennae) to grow out from the antennae of thebutterfly.

The example in Fig. 17 depicts long straight parts grow-ing and absorption from a complex polygon. When the shapeof a morphed part is long and more or less straight, theProjection, the Perimeter, and the Midpoint growing meth-ods can provide comparable results, whereas the projectiongrowing method is not suitable. The Carmel and Cohen-Oralgorithm produces comparable results as well as the Sede-berg and Greenwood algorithm, both displaying a few self-intersections (Fig. 17).

The case shown in this particular example is not a casewhere one would naturally expect a growing behavior, be-cause the octopus and the shark do not have any similar part.However, the growth of the octopus’ tentacles is an aesthet-ically pleasing way to morph from the shark’s belly into theoctopus’ tentacles without any intersections.

We have presented three examples showing the behav-ior of the three designed methods—the Perimeter growing,the Half-line growing and the Projection growing method.According to the results achieved, the user should use theProjection growing method for convex or nearly convexparts and the Perimeter growing or the Half-line growingfor curved parts.

The examples show that our algorithm produces the ex-pected results for the cases where some parts of one polygonare supposed to grow out of the other polygon or be absorbedinto it. However, as we can see in the last example, the al-gorithm can also be used in some cases where growing is

Fig. 14 The Perimeter growingmethod comparison: (a) the newPerimeter growing method,(b) the object being morphedusing the Carmel and Cohen-Oralgorithm, and (c) using theSedeberg and Greenwoodalgorithm

Page 9: An intuitive polygon morphing - Purdue Universityhpcg.purdue.edu/bbenes/papers/Malkova10VisComp.pdf · polygons that is inspired by growing forms in nature. While previous algorithms

An intuitive polygon morphing

not expected and it still produces acceptable results. An an-imation showing the described behavior of our algorithm isavailable at http://home.zcu.cz/~mmalkov/morphing.avi.

Our algorithm has also some limitations. It is not suit-able for morphing of objects that are only rotated or trans-lated, because these transformations cannot be representedas growth. Figure 18 shows how all the three algorithms be-have for the case of a rotated fish. None of the algorithmsproduces a clear rotation, but the Carmel and Cohen-Or al-gorithm produces acceptable results with some user interac-tion.

Fig. 15 Example of morphing for esthetic purposes

In the Carmel and Cohen-Or algorithm, the correspon-dence can be influenced by manually defining some corre-sponding vertices. Our algorithm offers the user an easierway to influence the correspondence—changing the mutualposition of the polygons, while the results are easily pre-dictable. Mostly, the best mutual position is a position wherethe area of the intersection is the maximally possible. Appar-ently two different choices of the core will lead to differentresults. This is demonstrated in Fig. 19 which shows twomorphing sequences of the wings and the circle, each pro-duced by a different mutual positions of the objects. Theautomatic decision of the mutual position remains a prob-lem, as the maximal possible intersection is not always thebest solution. But for this type of morphing problem, theuser usually has a clear idea about which part of the objecthe/she wants to grow.

Figure 20 shows four morphing sequences of a circle anda curved shape to demonstrate the behavior of our algorithmwhen the overlapping area consists of more polygons. Oneof the polygons is chosen as a core (filled by blue color) and

Fig. 16 Comparison of (a) theProjection growing method,(b) the Midpoint growingmethod, (c) the Carmel andCohen-Or algorithm, and (d) theSedeberg and Greenwoodalgorithm

Fig. 17 Comparison of (a) theProjection growing method,(b) the Midpoint growingmethod, (c) the Carmel andCohen-Or algorithm, and (d) theSedeberg and Greenwoodalgorithm

Page 10: An intuitive polygon morphing - Purdue Universityhpcg.purdue.edu/bbenes/papers/Malkova10VisComp.pdf · polygons that is inspired by growing forms in nature. While previous algorithms

M. Málková et al.

Fig. 18 Comparison of themethods for a case of a rotatedobject. (a) The Projectiongrowing method, (b) the Carmeland Cohen-Or algorithm, (c) theSedeberg and Greenwoodalgorithm, and (d) the Carmeland Cohen-Or algorithm withpredefined four correspondingvertices

Fig. 19 The Projection growingmethod (different mutualpositions of the polygons):(a, c) position of the polygons,(b, d) the resulting morphingsequence

Fig. 20 The Perimeter(a, b) and the Projection(c, d) growing methods: theoverlapping area consists of(a, c) one polygon, (b, d) morepolygons—one is chosen.

the algorithm continues as if the overlapping area consistedof only one polygon. The core is chosen randomly or by theuser. Such situation is not typical for growth-like morphing,because we would not expect growing behavior of a part thatis connected with the core at several places.

5 Conclusions and future work

We have described a new algorithm for morphing of sim-ple polygons which defines their correspondence by par-tially overlapping them. Our algorithm allows us to define

Page 11: An intuitive polygon morphing - Purdue Universityhpcg.purdue.edu/bbenes/papers/Malkova10VisComp.pdf · polygons that is inspired by growing forms in nature. While previous algorithms

An intuitive polygon morphing

the correspondence in a more intuitive way than previouslypublished methods.

We have shown three different techniques for the morphcalculation, each of which is suitable for a different case ofmorphing, and we have demonstrated their use in variouscases. We have also compared the results of our algorithmwith two commonly used correspondence-based morphingmethods. The experiments confirmed that our algorithm issuitable for instances of morphing, where the user expectssome parts of the resulting polygon to grow out of or intothe intersection. Our algorithm is not suitable for similaror nearly similar polygons with dissimilarities of the non-growth type (such as faces with different expressions, bend-ing or straightening of fingers and polygons which are ro-tated, translated or scaled versions of each other), in whichcase the traditional algorithms should be used.

An obvious future work would be an extension of our ap-proach to 3D (see [8] for preliminary results). Another futurework lies in finding new strategies for the elementary growthproblem together with some guidelines (or some automaticdecision mechanism) as to which strategy to use in each dis-tinct case of morphing. Last but not least, we would like todescribe a framework that would integrate our growth-likemorphing with the traditional approaches.

Acknowledgement We would like to thank Pavel Celba for provid-ing implementation of the Sederberg algorithm.

References

1. Alexa, M.: Merging polyhedral shapes with scattered features. Vis.Comput. 16(1), 26–37 (2000)

2. Alexa, M., Cohen-Or, D., Levin, D.: As-rigid-as-possible shapeinterpolation. In: Proceedings of SIGGRAPH 2000, pp. 157–164(2000)

3. Carmel, E., Cohen-Or, D.: Warp-guided object-space morphing.Vis. Comput. 13, 465–478 (1997)

4. Comninos, P.: Mathematical and Computer Programming Tech-niques for Computer Graphics. Springer, Berlin (2006)

5. Gomes, J., Darsa, L., Costa, B., Velho, L.: Warping and Morphingof Graphical Objects. Morgan Kaufmann, San Mateo (1999)

6. Johnstone, J.K., Wu, X.: Morphing two polygons into one. In: The40th Annual Southeast ACM Conference (2002)

7. Kent, J.R., Carlson, R.E., Parent, W.E.: Shape transformation forpolyhedral objects. Comput. Graph. 26, 47–54 (1992)

8. Málková, M.: Core-based morphing algorithm for triangle meshes.In: SIGRAD 2008, vol. 34, pp. 39–46 (2008)

9. Sederberg, T.W., Gao, P., Mu, G., Wang, H.: 2-d shape blending:An intrinsic solution to the vertex path problem. Comput. Graph.27, 15–18 (1993)

10. Sederberg, T.W., Greenwood, E.: A physically based approach to2-d shape blending. ACM SIGGRAPH 26, 25–34 (1992)

11. Shapira, M., Rappoport, A.: Shape blending using the star-skeleton representation. IEEE Comput. Graph. Appl. 15, 44–50(1995)

12. Surazhsky, V., Gotsman, C.: Controllable morphing of compatibleplanar triangulations. ACM Trans. Graph. 20, 203–231 (2001)

13. Surazhsky, V., Gotsman, C.: Intrinsic morphing of compatible tri-angulations. Int. J. Shape Model. 9, 191–201 (2003)

Martina Málková received herBachelor and Master’s degree inComputer Science at the Universityof West Bohemia in Pilsen. Since2008, she has been doing her post-graduate studies at the same univer-sity. So far, her research interestscontain mainly morphing.

Jindrich Parus finished 5 years’M.Sc. studies at the University ofWest Bohemia in Pilsen in the fieldof Computer Graphics in 2003. Heis a member of the Center of Com-puter Graphics and Data Visualiza-tion at the University of West Bo-hemia. He is interested in computergraphics, especially in the field ofmorphing. Nowadays he is a post-graduate student at the University ofWest Bohemia.

Ivana Kolingerová graduated inComputer Science in 1987, receivedher Ph.D. in Informatics and Com-puter Science in 1994 and habili-tated in 2000. She works as Asso-ciate Professor in the Departmentof Computer Science and Engi-neering at the University of WestBohemia in Pilsen, Czech Repub-lic. Her research interests includecomputer graphics and computa-tional geometry, especially algo-rithms for triangulated models. Herinternational experience includesDenmark, USA, Slovenia and Aus-tria.

Bedrich Beneš is Assistant Pro-fessor of Department of ComputerGraphics Technology at Purdue Uni-versity. His research interests in-clude procedural modeling, artifi-cial life, real-time rendering, andglobal illumination. Dr. Beneš re-ceived his Ph.D. from the CzechTechnical University. He is a mem-ber of ACM SIGGRAPH, Euro-graphics, and IEEE.