An Intuitive Polygon Morphing
Total Page:16
File Type:pdf, Size:1020Kb
Vis Comput DOI 10.1007/s00371-009-0396-3 ORIGINAL ARTICLE An intuitive polygon morphing Martina Málková · Jindrichˇ Parus · Ivana Kolingerová · Bedrichˇ Beneš © Springer-Verlag 2009 Abstract We present a new algorithm for morphing simple 1 Introduction polygons that is inspired by growing forms in nature. While previous algorithms require user-assisted definition of com- Morphing is a (non-linear) transformation of a shape into plicated correspondences between the morphing objects, our another shape and has practical uses in computer graphics, algorithm defines the correspondence by overlapping the in- animation, modeling and design. This area has been thor- oughly researched and the existing methods can be classified put polygons. Once the morphing of one object into another into two main groups—traditional volume and image mor- is defined, very little or no user interaction is necessary to phing and boundary-based morphing. In this article we focus achieve intuitive results. Our algorithm is suitable namely on boundary-based morphing methods. The algorithms de- for growth-like morphing. We present the basic algorithm signed in this area concentrate on morphing similar shapes, and its three variations. One of them is suitable mainly for where some common features can be identified. However, in convex polygons, the other two are for more complex poly- some cases it is not possible to align all the main features of gons, such as curved or spiral polygonal forms. 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 · · · Keywords Morphing Vector data Polygon intersection approach for morphing with this “growth-like” nature. Computer Graphics 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 This work was supported by Grant Agency of the Czech the transformation. The last input defines the way in which Republic—project No. 201/09/0097. the shapes are morphed in time. The morph can be linear, Electronic supplementary material The online version of this article it can accelerate or decelerate, or its time dependence can (http://dx.doi.org/10.1007/s00371-009-0396-3) contains be described by a user-defined mapping function. Establish- supplementary material, which is available to authorized users. ing the correspondence of the vertices and the vertex paths M. Málková () · J. Parus · I. Kolingerová are two independent steps, which can be solved by different University of West Bohemia, Plzen,ˇ Czech Republic algorithms, but both usually require some user interaction. e-mail: [email protected] Although there is much to achieve by a suitable vertex path J. Parus computation, the definition of the correspondence between e-mail: [email protected] two shapes remains crucial. Most algorithms offer the user I. Kolingerová the ability to influence the correspondence by adding some e-mail: [email protected] constraints or manually defining corresponding vertices, but B. Beneš such a definition can be complex and sometimes the user Purdue University, West Lafayette, USA cannot predict how the changes will influence the result, so e-mail: [email protected] a trial and error technique is usually applied iteratively. M. Málková et al. We present an algorithm for easy-to-use and easy-to- A computation of trajectories was described by Seder- define morphing of polygonal objects. Our technique takes berg et al. in [9], where edge lengths or internal angles are two polygonal objects that partially overlap. Then an over- interpolated instead of the vertex positions. The polygons lapping area of these two polygonal objects is formed, defin- are converted to the so-called edge–angle representation [5] ing the core of the morphing. We suppose that the core con- that is invariant to rigid transformations. This interpolation sists of a single simple polygon, which is a typical situa- scheme avoids edge collapsing and non-monotonic angle tion for such inputs where one would expect a growth-like changes. This technique was used to generate in-betweens morph. The morphing simultaneously changes both poly- for animation based on keyframes. The concept of interpo- gons. The input polygon is absorbed by the core, whereas lation of intrinsic parameters was also further used for mor- the output polygon grows out of it. The principal advan- phing of planar triangulations in [12, 13]. The intrinsic in- tage of the shape absorption and the growth is that they can terpolation avoids local self-intersections. However, it does be viewed as the same process with different direction in not solve the problem of global self-intersections which may time. Algorithmically this means that we need to implement occur for highly dissimilar and complicated shapes. only one process. Another advantage of the algorithm is that Shapira and Rappoport [11] introduced a method that first it offers growth-like morphing. This process could not be decomposes the source and the destination polygons into easily achieved using traditional algorithms as it would re- star-shaped polygons. The skeleton is a planar graph which quire manually defining many correspondences. Thanks to joins star-points of neighboring star-shaped polygons. The its growth-like shape change, our algorithm also produces skeletons are interpolated and the intermediate shapes are re- satisfactory results for polygons that are not star-shaped. constructed from the interpolated skeletons. The difference The algorithm solves the correspondence of the two input between this approach and methods described in [9, 10]is polygons as well as the vertex paths. The final animation is that this approach also considers the interior of the poly- computed by the linear interpolation between the intermedi- gon and not only the boundary. The problem with this ap- ate positions in the vertex paths. proach is that it relies on isomorphic star-shaped decompo- sition which might be difficult to compute, especially in the The paper is organized as follows. Section 2 describes case of dissimilar shapes. related work in the area of polygon morphing. Section 3 Alexa et al. introduced as-rigid-as-possible shape inter- describes the method itself and discusses three morphing polation in [2]. They compute a compatible triangulation of strategies used. Section 4 shows the results of the algorithm the input polygons. The compatible triangulation is a dissec- and demonstrates typical uses of the techniques described in tion of the source and the destination polygons so that the Sect. 3. Finally, Sect. 5 describes our conclusions and sug- triangulations are isomorphic, i.e., there is one-to-one cor- gestions for future work. respondence between triangles in the source and in the des- tination. Then, an affine transformation which transforms a source triangle to the destination triangle is computed. Inter- 2 Related work polation of the affine transformation defines the morphing. Adjacent triangles are also considered in the interpolation. Digital warping and morphing has a long tradition in Com- Similar approaches were also described by Surazhsky and puter Graphics and its full exposition is outside the scope of Gotsman in [12, 13]. The principal problem of these meth- this paper. We refer readers to [5] for a detailed description. ods is the computation of the isomorphic triangulation of Here we describe the work related to 2D polygon morphing. the input shapes, as its quality influences the quality of the Polygon morphing computation can be divided into two morphing. parts: (1) defining the vertex-to-vertex correspondence in Gomez et al. introduced 2D merging [5], which is a 2D the source and the destination polygons, and (2) defining application of the algorithm that was originally developed the transitions. Point out that the source and the destination for 3D meshes (see for example [1, 7]). First, the input poly- polygons are not required to have the same number of ver- gons are mapped to a unit disc, then both mappings are tices. merged. The vertices of the first polygon are mapped on The problem of vertex-to-vertex correspondence was ad- the second polygon and vice versa using inverse mapping. dressed by Sederberg and Greenwood in [10]byusinga This results in polygons with the same number of vertices. physical model. The polygon edges are modeled as elastic A linear interpolation is used to obtain the resulting mor- connections and the shape transformation involves the cal- phing transition. This technique is suitable for convex, star- culation of a physical response by minimizing the energy of shaped or slightly non-convex polygons. This algorithm is the system. This algorithm is efficient for similar input poly- not suitable for highly non-convex polygons, as it produces gons and it can also handle cases when the initial shapes are self-intersections during the morphing transition. rotated or translated. The algorithm does not address highly Carmel and Cohen-Or [3] showed an algorithm which dissimilar shapes and self-intersections. combines a 2D merging and a polygon evolution. A user An intuitive polygon morphing first specifies anchor points that define the correspondence The area of polygon A that is clipped out is denoted by between polygons. Using the anchor points, a warp function P = A − B and analogously the area of the polygon B that is computed that warps the source polygon to the destina- is clipped out is denoted by Q = B − A. Note that P and tion polygon. Once the source polygon is warped, a polygon Q are not necessarily single polygons. They can be a set = = evolution technique is used to evolve the source and the des- of simple polygons so that P i Pi and Q j Qj .We tination polygon to a convex shape.