example-based curve synthesis

8
Technical Section Example-based curve synthesis Paul Merrell , Dinesh Manocha University of North Carolina at Chapel Hill, USA article info Keywords: Procedural modeling Model synthesis Curve synthesis abstract We present a novel synthesis algorithm for procedurally generating complex curves. Our approach takes a simple example input curve specified by a user and automatically generates complex sets of curves that resemble the input. The algorithm preserves many of the local shape features of the input curves such as tangent directions, curvature, branch nodes, and closed loops. The overall approach is simple and can be used to generate varied curved 3D models in a few minutes. We demonstrate its application by generating complex, curved models of man-made objects including furniture pieces, chandeliers, glasses, and natural patterns such as river networks and lightning bolts. & 2010 Elsevier Ltd. All rights reserved. 1. Introduction One of the key problems in computer graphics is to generate geometric models of complex shapes and structures. The main goal is to generate 3D geometric content for many domains such as computer games, movies, architectural models, urban planning and virtual reality. In this paper, we address the problem of automatically or semi-automatically generating complex shapes with curved boundaries. Curved artistic decorations with re- peated patterns are an important part of the design of man-made objects. These include household items such as furniture, glasses, candlesticks, chandeliers, toys, etc. Curved structures are also used in buildings and interior design. Moreover, many natural patterns (e.g. terrain features or river network) and natural phenomena, such as lighting, also have curved boundaries with random variation. As a result, we need simple and effective tools that can assist artists, designers, and modelers in designing elaborate curved objects and structures. Most of the prior work in this area has been in procedural modeling, which generates 3D models with repeated patterns from a set of rules. These include L-systems, fractals and generative modeling techniques which can generate high-quality 3D models of plants, architectural models and city scenes. However, each of these methods is mainly limited to a special class of models. Instead, our goal is to use example-based techniques which are more general and can generate complex models from a simple example shape [1–4]. Some of these model synthesis methods have been inspired by texture synthesis, but the current methods are limited primarily to complex polyhedral models with planar boundaries or layouts of city streets. Main result: In this paper, we present a new method for rapidly generating many sets of curves based on an example. Our algorithm accepts a set of 2D curves as an input and rapidly generates many more complex curves in a similar style. Our method is primarily designed to capture the local structure of the example curve based on local shape characteristics such as tangent and curvature, and not the global structure. As a result, it is better suited for generating complex curves, which have a random layout. Our approach is general and makes no assumptions about the shape or smoothness of the input curves. We perform local shape analysis based on tangent vectors and curvature of the input curve, and generate output curves that tend to preserve these local features including cusps, branches, and closed loops. Furthermore, we explicitly check for self-intersections between the curve segments. We use a graph to maintain the topology of various curve segments and present automatic methods to incrementally refine the structure of the graph to generate the final curves. We also present an intuitive metric to evaluate the quality of the results. Given a set of generated curves, we perform an extrusion operation or use the final curves as generators for surfaces of revolution to generate 3D models of curved objects. The overall algorithm is relatively simple, efficient and quite robust in practice. Our system allows users to edit the generated curves interactively. We use our algorithm to generate complex 3D models of chandeliers, drinking glasses, candlesticks, river networks, lightning bolts, and cabinet handles with hundreds or thousands of curve segments or surface patches in a few minutes. The rest of the paper is organized as follows. In Section 2, we discuss related work on procedural modeling and curve genera- tion. In Section 3, we explain our curve generation algorithm. We show results and analyze our method in Section 4. We compare Contents lists available at ScienceDirect journal homepage: www.elsevier.com/locate/cag Computers & Graphics 0097-8493/$ - see front matter & 2010 Elsevier Ltd. All rights reserved. doi:10.1016/j.cag.2010.05.006 Corresponding author. E-mail address: [email protected] (P. Merrell). URL: http://gamma.cs.unc.edu/synthesis (P. Merrell). Computers & Graphics 34 (2010) 304–311

Upload: paul-merrell

Post on 04-Sep-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Computers & Graphics 34 (2010) 304–311

Contents lists available at ScienceDirect

Computers & Graphics

0097-84

doi:10.1

� Corr

E-m

URL

journal homepage: www.elsevier.com/locate/cag

Technical Section

Example-based curve synthesis

Paul Merrell �, Dinesh Manocha

University of North Carolina at Chapel Hill, USA

a r t i c l e i n f o

Keywords:

Procedural modeling

Model synthesis

Curve synthesis

93/$ - see front matter & 2010 Elsevier Ltd. A

016/j.cag.2010.05.006

esponding author.

ail address: [email protected] (P. Merrell).

: http://gamma.cs.unc.edu/synthesis (P. Merr

a b s t r a c t

We present a novel synthesis algorithm for procedurally generating complex curves. Our approach

takes a simple example input curve specified by a user and automatically generates complex sets of

curves that resemble the input. The algorithm preserves many of the local shape features of the input

curves such as tangent directions, curvature, branch nodes, and closed loops. The overall approach is

simple and can be used to generate varied curved 3D models in a few minutes. We demonstrate its

application by generating complex, curved models of man-made objects including furniture pieces,

chandeliers, glasses, and natural patterns such as river networks and lightning bolts.

& 2010 Elsevier Ltd. All rights reserved.

1. Introduction

One of the key problems in computer graphics is to generategeometric models of complex shapes and structures. The maingoal is to generate 3D geometric content for many domains suchas computer games, movies, architectural models, urban planningand virtual reality. In this paper, we address the problem ofautomatically or semi-automatically generating complex shapeswith curved boundaries. Curved artistic decorations with re-peated patterns are an important part of the design of man-madeobjects. These include household items such as furniture, glasses,candlesticks, chandeliers, toys, etc. Curved structures are alsoused in buildings and interior design. Moreover, many naturalpatterns (e.g. terrain features or river network) and naturalphenomena, such as lighting, also have curved boundaries withrandom variation. As a result, we need simple and effective toolsthat can assist artists, designers, and modelers in designingelaborate curved objects and structures.

Most of the prior work in this area has been in proceduralmodeling, which generates 3D models with repeated patternsfrom a set of rules. These include L-systems, fractals andgenerative modeling techniques which can generate high-quality3D models of plants, architectural models and city scenes.However, each of these methods is mainly limited to a specialclass of models. Instead, our goal is to use example-basedtechniques which are more general and can generate complexmodels from a simple example shape [1–4]. Some of these modelsynthesis methods have been inspired by texture synthesis, but

ll rights reserved.

ell).

the current methods are limited primarily to complex polyhedralmodels with planar boundaries or layouts of city streets.

Main result: In this paper, we present a new method for rapidlygenerating many sets of curves based on an example. Ouralgorithm accepts a set of 2D curves as an input and rapidlygenerates many more complex curves in a similar style. Ourmethod is primarily designed to capture the local structure of theexample curve based on local shape characteristics such astangent and curvature, and not the global structure. As a result,it is better suited for generating complex curves, which have arandom layout.

Our approach is general and makes no assumptions about theshape or smoothness of the input curves. We perform local shapeanalysis based on tangent vectors and curvature of the inputcurve, and generate output curves that tend to preserve theselocal features including cusps, branches, and closed loops.Furthermore, we explicitly check for self-intersections betweenthe curve segments. We use a graph to maintain the topologyof various curve segments and present automatic methods toincrementally refine the structure of the graph to generate thefinal curves. We also present an intuitive metric to evaluate thequality of the results. Given a set of generated curves, we performan extrusion operation or use the final curves as generators forsurfaces of revolution to generate 3D models of curved objects.

The overall algorithm is relatively simple, efficient and quiterobust in practice. Our system allows users to edit the generatedcurves interactively. We use our algorithm to generate complex3D models of chandeliers, drinking glasses, candlesticks, rivernetworks, lightning bolts, and cabinet handles with hundreds orthousands of curve segments or surface patches in a few minutes.

The rest of the paper is organized as follows. In Section 2, wediscuss related work on procedural modeling and curve genera-tion. In Section 3, we explain our curve generation algorithm. Weshow results and analyze our method in Section 4. We compare

P. Merrell, D. Manocha / Computers & Graphics 34 (2010) 304–311 305

our approach to other methods in Section 5 and discuss ideas forfuture research in Section 6.

2. Related work

A few techniques have been developed to transform curvessketched in one particular artistic style into a different artisticstyle [5,6]. The artistic styles are determined automatically fromthe example curves sketched by the user. Similar techniques havealso been applied to meshes to transform the models [7,8] andalso to transform space–time curves for animation [9]. Simhonand Dudok [10] use a hidden Markov model to add artistic detailsto sketches. These techniques rely on the user to specify the large-scale structure of the curve or shape to be generated, but do notaddress the problem of generating many curves of a particularstyle with a varied large-scale structure.

Layouts of city streets have been created using an interactivetool which uses tensor fields [11]. Kalnins et al. [12] use a non-photorealistic rendering technique to draws 3D models indifferent artistic styles. It generates curves representing thestrokes an artist might draw or paint in a particular style.

Example-based techniques are widely used to synthesizetexture [13,14]. Similar techniques have been applied to vectordata to generate strokes in a particular style [15,16]. Two-dimensional arrangements of elements can be created from anexample [17]. Three-dimensional closed polyhedral models canalso be synthesized from example models [2–4]. However,example-based techniques have only been applied to curvedmodels in specific cases such as the layout of city streets [1].

Procedural modeling techniques are widely used to generatedifferent types of objects including urban environments [18,19]and plants using L-systems [20–22]. Pottmann et al. [23] havepresented elegant algorithms to generate freeform shapes forarchitectural models. Wong et al. [24] have developed aprocedural technique for designing floral ornamentation. Thesetechniques produce compelling models, but requires significanteffort from the user to control and cannot be modifiedinteractively.

Sketch-based interfaces have been developed as an intuitiveway to model and deform meshes [25,26]. These methodscomplement our approach and can be used to transform 2Dcurves into full 3D models.

3. Curve generation

In this section, we present our curve synthesis algorithm. Wefirst give an overview of our method, then we describe each stageof the algorithm in more detail. We describe how to decomposethe input into a set of small segments which are connected andstretched into larger curves. These curves are modified stochas-tically and evaluated based on how closely they resemble theoriginal curves and if they avoid self-intersections.

3.1. Overview

The user inputs an example curve as a set of parametric curves.The curves may or may not contain closed loops, branches, andcusps. Our algorithm generates a set of output curves thatresemble the input curves.

We first subdivide the input curve into smaller parts calledcurve segments as described in Section 3.2. The output curves areformed as an ordered sequence of segments. Two curve segmentscan connect together if their tangents and curvatures are close toeach other. We allow the user to control the shape of the curves

interactively by selecting points on the curves and repositioningthem. In order for those points to reach their specified positions,the curves are stretched as described in Section 3.3. But the curvesshould not be stretched very far, since this causes them toresemble the original curve less. To prevent the curves fromstretching too far, it is necessary to modify the sequence ofsegments. We replace segments in the sequence with newsegments to decrease the amount of stretching.

Minimizing the amount of stretching is one of several goals wehave for the set of curves. It is also important that the curves donot intersect themselves and do not separate into disjoint parts.We evaluate the set of curves by determining how far the curvesare stretched and how many branches, self-intersections, anddisjoint parts they contain. The curves are modified stochasticallyas described in Section 3.4 and are evaluated as described inSection 3.5. Each curve modification is only kept if it decreases theamount of stretching. Changes to the curves can occur rapidly andthey are displayed to the user in real-time as part of ourinteractive interface.

Since our goal is to generate sets of curves which may containmultiple branches and loops, we use a graph data structure torepresent the set of curves (see Section 3.4). The vertices of thegraph are the curves’ endpoints and branching points.

3.2. Creating and connecting segments

This section discusses how we subdivide the input curves intocurve segments and then combine them together. The curvesegments are the basic building blocks of the output curves. Theinput is a set of parametric curves fc1ðtÞ; c2ðtÞ, . . .g, where eachcurve ci(t) starts at t¼0 and ends at t¼1. We use 2D Bezier curvesin practice, but our algorithm can handle any curve representa-tion as long as we can subdivide the curves and evaluate boundson their tangents and curvatures.

Our method ensures that the new curves resemble theexample curves in a similar way to many texture synthesisalgorithms, which is to force every local neighborhood of the newcurve to resemble a neighborhood of the example curve. A curve’slocal neighborhood is characterized by its tangent angley¼ atan2ðyu,xuÞ and signed curvature k¼ ðxuyu

u

�yuxuu

Þ=ðxu2þyu

2Þ3=2.

The tangent angles and curvatures are discretized into uniformbins y ¼ by=ybc and k ¼ bk=kbc where yb and kb are the size of thebins. In our algorithm, two curve segments can be connected ifthey have tangent angles and curvatures inside the same bin.

Each segment si has a starting and ending tangent angle, ys

i ,ye

i ,

and a starting and ending curvature ks

i ,ke

i . Smooth segments are

subdivided until they start and end only one bin apart. Thetangents and curvature are not defined at cusps. All this means isthat we never divide the curve at a cusp. The cusp is alwayscontained inside one of the segments. It is always combined withthe part of the curve immediately before and the part immedi-ately after it into a single segment. The cusp is integrated into asegment si with well-defined beginning and ending tangents

ys

i ,ye

i . Algorithm 1 gives a pseudo-code description of how the

curves are subdivided.

Algorithm 1. Method for subdividing a piecewise smooth curveinto segments.

subdividePiecewise({c1(t),c2(t),y,cn(t)})c is a piecewise smooth curve composed of the curvesc1(t),c2(t),ywhich may intersect at cusps.

1:

for i ¼ 1 to n do 2: subdivide(ci,0,1) 3: end for

Fo

u

B

o

P. Merrell, D. Manocha / Computers & Graphics 34 (2010) 304–311306

4:

ig. 1.ver 25

sed to

ezier p

f this

if there is a cusp at ci�1(1)¼ci(0) then

5:

Usin

0 br

cre

atc

artic

Combine the last segment of ci�1 with the first of ci.

6: end if

subdivide(c,ts,te)

1: Calculate discretized start and end tangents y

s,y

e

2:

Calculate discretized start and end curvatures ks,k

e

3:

if jk

s

i�ke

i jr1 and jys

i�ye

i jr1 or jys

i�ye

i j ¼

�pybc�1 then

4:

return a curve segment ci(t) from ts to te

5:

else 6: return both subdivide(c,ts, tsþ te

2 ) and subdivide ðc, tsþ te2 ,teÞ

7:

end if

Fig. 2. The curve is decomposed into segments which have only small changes to

their tangents and curvatures. The segments are placed into bins with bounds on

their tangent angles and curvatures.

We place each curve segment into a 2D array of bins as shownin Fig. 2. Each segment starts and ends in two adjacent bins exceptfor the segments that contain cusps which might extend acrossthe array. The start of a segment sj can be attached to the end of

segment si if their endpoints are in the same bin ðys

j ,ks

j Þ ¼ ðye

i ,ke

i Þ.

Let Ai be the set of segments that can follow after si,

Ai ¼ fsjjðys

j ,ks

j Þ ¼ ðye

i ,ke

i Þg and let Bi be the set of segments that

can come before si. The segment sj is always attached to the end ofsi if Ai ¼ fsjg and Bj ¼ fsig. We combine these small segments into a

larger unified segment because this reduces the total number ofsegments and improves the efficiency of the algorithm.

A parametric curve ci(t) could form a closed loop cið0Þ ¼ cið1Þ orit could stop at a particular point or it could branch off of anothercurve. In these cases, the segments at the end do not have anysegments after them, so we include special symbols in the sets Ai

and Bi to indicate that before or after si the curve ends or branchesoff another segment.

3.3. Bending and stretching the curves

We allow the user to interactively move any point on agenerated curve to a new location to allow user control of theshape of the curves. This section explains how the curves can bebent and stretched to reach any specified location.

Our algorithm uses a graph to represent the topology of the setof generated curves. The graph’s vertices correspond to pointswhere a curve starts, ends, or branches as well as any point that

g the example curve sketched in red, several curves (blue) are generated au

anches and all of them were created in less than 3 min. Five of the generate

ate models of chandeliers by using them as generators for surfaces of revolu

hes which are generated using extrusion operations. (For interpretation of th

le.)

the user decides to reposition. An edge exists in the graphbetween two vertices if there is a parametric curve betweenthose two points. Each parametric curve is a composite ofseveral segments that are stretched to fit between two vertices.Let r(t) be a parametric curve that starts at the origin r(0) ¼ 0 andthat combines several segments in sequence as described inSection 3.2. We estimate the arc length of r(t) using a piecewiselinear approximation and compute an arc-length parameteriza-tion of r(t) such that the curve starts at the origin r(0) and ends atthe point r(1).

The curve r(t) is stretched so that a stretched version of thecurve interpolates between two vertices v0 and v1. Let s(t) be thenew curve (Fig. 3) that is generated by stretching r(t). The newcurve is formulated as

sðtÞ ¼ rðtÞþv0þtðv1�v0�rðtÞÞ ð1Þ

The vertices v0 and v1 are the endpoints of s(t) since sð0Þ ¼ v0

and sð1Þ ¼ v1. The curve s(t) is stretched evenly over its entirelength. Long curves are distorted less than short curves whenstretched the same distance. Our goal is to keep the amount that acurve stretches small especially for short curves.

We now have a simple method to stretch a curve to fitbetween two endpoints. Each endpoint is a vertex of the graph.The user could specify the location of every vertex, but the usermight decide not to specify the position of some of the vertices. Inthis case, the unspecified vertices are treated as unknown freevariables in the plane. The positions of the free vertices areoptimized to minimize the amount of stretching. The amounteach curve stretches is equal to the length of the differencebetween the endpoints of s(t) and the endpoints of r(t). It is

tomatically in the style of the example using our algorithm. The new curves have

d curves are shown on the left. The curves contain many branches. The curves are

tion or lofting. The final models of the chandeliers are composed of about 200,000

e references to color in this figure legend, the reader is referred to the web version

Fig. 3. The points along a parametric curve s(t) are bent and stretched so that the

curve goes from the vertex v0 to v1.

Fig. 4. The graph is modified by removing segments from part of the graph and

then reconnecting them.

Fig. 5. The curve starting at point p could end up at several possible locations. It

could connect to the clipped segment at point a or as a branch to point b or as an

unattached leaf at point c.

P. Merrell, D. Manocha / Computers & Graphics 34 (2010) 304–311 307

equal to

sð1Þ�sð0Þ�ðrð1Þ�rð0ÞÞ ¼ v1�v0�rð1Þ ð2Þ

This value measures the amount of stretching for each edge ofthe graph. We minimize the amount of stretching in the leastsquares sense. The values of r(1) are known as well as any user-specified vertex locations vi. We solve for the remaining vertexlocations vi. We use a weighted least squares optimization thatweights each equation by the reciprocal of the length of eachcurve to ensure that short curve segments are stretched less thanthe long segments.

3.4. Choosing the sequence of curve segments

Our method is designed to refine and improve the currentsolution interactively while the user makes adjustments to it. Forthe initial solution we generate a short open curve. Our algorithmrandomly computes many possible modifications to the set ofcurves. This includes topological changes. We evaluate eachmodification based on several factors including how muchstretching it requires. Because the modifications are generatedat random, only a fraction of them improve the result, but ouralgorithm can generate and evaluate hundreds of modificationsper second.

Algorithm 2 describes our method to modify the set of curves.First, we pick a region to modify and remove any curves from thatregion. The curves that are removed are replaced by attachingnew curves and we evaluate the modified set of curves in terms ofseveral criteria explained in Section 3.5 such as how much thecurves are stretched and distorted. We keep the modified graph ifit improves the result based on the proposed evaluation function.

Algorithm 2. Method for incrementally modifying the set ofcurves.

1:

Pick a region to modify. 2: Cut out the segments in the region using Algorithm 1. 3: for each cut segment do 4: Create a curve by adding segments using Ai. 5: di ¼ the shortest distance found from the extended

curve to any of the targets

6: if diodmax then 7: Stretch the curve to the closest target. 8: else 9: Add the curve as a leaf node. 10: end if 11: end for 12: Evaluate the modified graph. 13: if the modified graph is worse than the original then 14: Revert back to the original. 15: end if

First, we select a region to modify. We modify inside a circularregion chosen at random. Its center and radius are selected at

random. The center is always a point on one of the curves. Withinthe circular region, we remove every curve segment as shown inFig. 4(b). This leaves behind several truncated or clipped segmentswhich are repaired by attaching new segments to them. Theseclipped segments can be repaired in three ways as shown inFig. 5(a–c). They can be repaired by connecting two clippedsegments together (a) or by connecting a clipped segment as abranch of another curve (b) or by leaving the clipped segmentdetached (c). Since the new curves must locally match the input,branches can only be attached to curves if they are attached withthe same tangent angles and curvatures found in the input.

Our goal is to assemble a sequence of segments that extendsfrom one clipped segment to one of several target locations. Eachtarget location is either a clipped segment (Fig. 5(a)) or abranching point (Fig. 5(b)). When the curve reaches the target,it must have a certain tangent angle and curvature to branchproperly or to attach properly to a clipped segment.

Suppose that ðys,k

sÞ is our current tangent angle and curvature

and that ðye,k

eÞ is the tangent angle and curvature that the curve

should end with. Let Pðys,k

s,y

e,k

eÞ be the shortest valid sequence

of segments, in terms of arc-length, that transform the curve from

ðys,k

sÞ to ðy

e,k

eÞ. The function Pðy

s,k

s,y

e,k

eÞ describes the shortest

path between all pairs and can be computed using the Floyd–Warshall algorithm as a preprocessing step. So we can use thefunction P to extend any curve so it ends with the proper tangentangle and curvature to properly connect with each target.

At one of the clipped segments, we start attaching individualsegments to it by selecting them out of the set of possiblesegments Ai described in Section 3.2. The segments are selected atrandom. This produces a random walk. During each step of therandom walk, we add a new curve segment and at each step wecompute how far we are from each of the target locations after we

extend the current curve using the segments from Pðys,k

s,y

e,k

eÞ.

We record which target location the curve passes the closest toand stretch the curve to the exact location of the closest target.The curve is stretched according to the method described inSection 3.3. The end of the new curve also might not pass close toany of the target locations. In this case, one end of the curve is leftunattached which creates a leaf in the graph, i.e. a vertex with asingle edge incident to it (Fig. 5(c)).

P. Merrell, D. Manocha / Computers & Graphics 34 (2010) 304–311308

3.5. Evaluating the set of curves

The circular region shown in Fig. 4(b) may cut into manydifferent segments. Every cut segment is attached to a new curveusing the method described in Section 3.4 multiple times ifnecessary. Next, we evaluate the new set of curves based on theamount of stretching and the number of leaves, branches, andself-intersections. If the modified set of curves evaluates betterthan the original set of curves, the modification is preserved andthe new set is used. Otherwise, it is discarded. The set of curves isevaluated using a cost function p where

p¼Xn

i ¼ 1

widiþwLL�wRRþwDDþwSS ð3Þ

The terms in the cost function are defined as:

di: the distance of the i-th curve from its target;L: the number of leaves in the graph;R: the number of branches in the graph;D: the number of disjoint unconnected parts of the graph;S: the number of self-intersections;wi, wL, wR, wD, wS: different weights applied to each cost.

The widi term is used as a stretching penalty based on how farthe i-th curve is stretched to reach its target. The curve segmentsoriginally come from the example. Before the segments arestretched, they are identical to the example curve; as they arestretched more, they resemble the example less. It is especiallyimportant that small curves are not stretched long distances, sothe weight wi is inversely proportional to the length of the curve.The stretching penalty does not apply to a new leaf node since theposition of the leaf node is not specified by the user and it can beplaced in a position with no stretching penalty. Consequently, thestretching penalty could cause leaf nodes to be overproduced andso a penalty is added for each leaf node in the graph. To encouragebranching, we also subtract a value wR from the cost function foreach branch.

It is possible that parts of the graph may become disconnectedas shown in Fig. 5(c). In order to avoid this, we count the numberof disjoint parts of the graph and add a heavy penalty wD for each.We also avoid creating self-intersections, by counting the numberof self-intersections S and adding a heavy penalty wS for each. Byadding up all of these different costs, we evaluate the set of curvesas a whole and use the modified set of curves only if the new sethas a lower cost.

Fig. 6. The user interface. The user begins by sketching the example curves on the

left. Then new curves are automatically generated on the right and can be edited

interactively.

Most of the cost function in Eq. (3) can be computed veryquickly. The most expensive computation is to calculate thenumber of self-intersections in the set of curves. As a result, weonly compute the number of self-intersections after we haveestablished that the new graph is a good candidate based on theother terms in the cost function.

Algorithm 2 describes how to improve the graph over time andto respond to changes the user makes. The user can pick points onthe curves and reposition them (Fig. 6) to control the shape of thecurves and then Algorithm 2 will improve the curves so they arestretched less. The initial graph is either a closed loop or a singleopen curve. Branches are added if they improve the result.

4. Results and analysis

Our method was tested on example curves corresponding toboth man-made and natural objects. It was used to design thechandeliers with branches shown in Fig. 1. Generated curves wereused to design candlesticks (Fig. 10) and drinking glasses (Fig. 12)by revolving the curves around an axis. It was also used to modelfancy cabinet handles in Fig. 9, bolts of lightning (Fig. 7), and riversystems (Fig. 8). The output curve generated by our system is apiecewise Bezier curve.

The following weights were used to produce each result:wL¼10, wR¼80, wd¼2000, and ws¼1000. The values of wi, di, andkB are computed using distances measured in pixels. The binswere set to yB ¼ 123 and kB ¼ 0.02. The same values were used forall the results. They were not tweaked for any particular result,but they could be adjusted for example to increase or decrease thenumber of branches by changing wR.

The results in each figure were produced with some brief userinteraction. The user first sketches a set of example curves. Then anew set of curves is generated. The user moves points within thisset and in response the set grows or contracts in real-time. Table 1shows the number of curve segments and branches in the inputand final output. The output curves are much larger and morecomplex than the originally curves. The entire process is verybrief. The individual curves in the figures were generated inseconds. All of the curves in each figure were created in only a fewminutes on a 2.8 GHz Pentium 4 computer.

Fig. 7. From a sketch of a few bolts of lightning, several more complex lightning

patterns are generated in under 2 min. The output curves contain about 150

branches and over 12,000 segments.

Fig. 8. From a sketch of a river system, several larger and more complex river

systems are automatically generated in under 2 min. The output curves each have

an average of about 80 branches and 10,000 segments.

P. Merrell, D. Manocha / Computers & Graphics 34 (2010) 304–311 309

Analysis: The final shapes produced by our algorithm dependon the set of example curves and the position of any points theuser repositions. Our underlying algorithm ensures that the local

Fig. 10. The profile of a candlestick is sketched and used to design many similar

candlesticks in under 1 min. The curves are revolved around an axis to produce

these candlesticks. The example candlestick is tinted red. (For interpretation of the

references to color in this figure legend, the reader is referred to the web version of

this article.)

Fig. 11. Many curves are generated to add decoration beneath every step of a staircase.

2 min.

Fig. 9. From a simple sketch of the handle of a cabinet, several complex cabinet

handles are designed automatically in the same style. The example handle is the

top center red-tinted handle. We ran our algorithm on one half of curve and

computed its mirror image. Before mirroring the curve, we moved the endpoints

onto the same central vertical line, so that the curves would close properly. (For

interpretation of the references to color in this figure legend, the reader is referred

to the web version of this article.)

features of the output curves, in terms of tangent vectors andcurvature, are similar to the features of the example curves.However, the stretching deformation can alter these features. Therunning time of the algorithm varies as a function of numberinput segments, curve degree and the number of branch points inthe final curve. In practice, our algorithm is very fast and cangenerate new curves at interactive rates on a desktop PC forcurves with many segments.

If the input curves contain branches the output will also containbranches, as shown in Figs. 1, 7 and 8. Likewise, if the input containscusps, the output will too as shown in Figs. 7, 9, 11 and 12.

5. Comparison and limitations

Much of the prior work in procedural modeling has focused onmodeling plants using L-systems. Our method has rules similar to L-systems. For example, the acceptable sequences of segmentsdescribed in Section 3.2 could be generated using a complex L-system. Overall, we expect that prior algorithms based on L-systemswould generate higher quality models of plants and trees. In contrast,our curve synthesis algorithm is faster and more amenable to user-driven changes and modifications. The main benefit of our approachis in generating models of curved man-made objects (e.g. decorativeobjects) such as furniture and household items. We are not aware ofany prior procedural methods for generating such curved objects. Asa result, tools that are general and that can model a wide variety ofobjects are highly valuable. Our method can model a wide variety ofobjects because it is example-based. The user can easily switchbetween creating two very dissimilar types of objects by sketching anew example curve.

Our method has some similarities with the curve analogiesalgorithm [5] since both methods are based on using examplecurves. However, our method is designed with a differentapplication in mind. The curve analogies method is designed totake curves drawn in one style and draw them in a different style.Curves have both a local and a large-scale structure. Our methodand curve analogies both attempt to reproduce the local structureof a set of example curves. The difference is that in curveanalogies the large-scale structure of the new curves is based on auser’s sketch while in our method it is automatically generated.Our method is designed for cases where the user has notdetermined the large-scale structure or would like to rapidlygenerate many different sets of curves which vary widely on alarge scale. Also, our method is designed to generate a set ofcurves that form exact closed loops and branches with a minimalamount of stretching.

The generated curves are shown on the right. The curves were generated in under

Table 1Table of the number of output curves generated, input segments, output segments, input branches, and output branches.

Number of output Input segments Output segments Input branch Output branch

Chandelier 8 105 5686 4 56

Cabinet 9 38 9787 0 0

Streams 5 203 9900 5 82

Lightning 4 633 12,509 3 149

Glasses 13 42 2749 0 0

Candlestick 8 53 1080 0 0

Fig. 12. The profile of a drinking glass is sketched (red curve) and used to design many glasses in a similar style (blue curves). The glasses are modeled by revolving the

curves around an axis. The surface of revolution obtained from the example input curve is shown as red tinted glass. (For interpretation of the references to color in this

figure legend, the reader is referred to the web version of this article.)

P. Merrell, D. Manocha / Computers & Graphics 34 (2010) 304–311310

Another method that is based on using examples is modelsynthesis, but it is not well-suited for generating curved shapessince curved object must either be created on a grid [2] or wouldconsume a lot of time and memory [3].

Limitations: As explained in Section 3.4, the curves aregenerated by making small incremental changes and testing ifthe changes improve a cost function. In some ways, our algorithmis performing an optimization in the design space and there is arisk that the current solution may fall within a local minimum ofthe cost function, meaning that small incremental changes wouldnot improve the solution and large changes would be needed. Thisis a particularly different problem with self-intersections since itmay be difficult to modify the curves in certain ways withoutintroducing an additional self-intersection. The shape of the finalobject depends on the input curve and where the user chooses toreposition any points. In some cases, our approach can result inunnatural shapes. Our algorithm can produce self-intersections,and we need to explicitly check for them.

Also, while the generated curves have the same local structureas the example they may not match the example on a larger scale.It would be difficult to generate curves that are part of a highlystructured and intricate design.

6. Conclusion and future work

We have presented a method for taking a set of curves sketchedby a user and automatically generating a new set of curves thatresemble the input. Parts of each new curve closely resemble parts ofthe example curve because they have the same geometric character-ization including tangent vectors, curvature and branches. Theexample curve is divided into segments. These segments are bentand stretched and rearranged to fit a cost function. The cost functiongives good scores to curves that are not stretched far, that do not self-intersect, and that have many branches. We have applied thealgorithm to different input curves and have used it to generatecurved models of man-made objects and natural patterns.

There are many avenues for future work. We can improve theuser interface and use more sophisticated physically based deforma-tion algorithms for stretching the curves. We would like to use ouralgorithm to generate other types of models including architecturalstructures and outdoor scenes. The set of input curves can alsoinclude subdivision curves, and our approach can be extended togenerate non-planar 3D curves as well as 4D space–time curves foranimation. Each segment in the output curve is a translated copy of asegment in the input curve. We would like to extend our method toalso allow rotated copies. This is useful for objects that are notorientation-sensitive such as the river systems in Fig. 8. Some objectsare orientation-sensitive like the chandeliers in Fig. 1 since thebranches must have a certain orientation to hold up the candles.Finally, we would like to extend our approach to procedurallygenerate 3D surface models composed of freeform surfaces.

Acknowledgements

We would like to thank the reviewers for their comments. Thiswork was supported in part by W911NF-04-1-0088, NSF award0636208, DARPA/RDECOM Contracts N61339-04-C-0043 andWR91CRB-08-C-0137, Intel, and Microsoft.

Appendix A. Supplementary data

Supplementary data associated with this article can be foundin the online version at doi:10.1016/j.cag.2010.05.006.

References

[1] Aliaga DG, Vanegas CA, Benes B. Interactive example-based urban layoutsynthesis. In: SIGGRAPH Asia: ACM SIGGRAPH Asia 2008 papers. New York,NY, USA: ACM; 2008. p. 1–10.

[2] Merrell P. Example-based model synthesis. In: I3D ’07: symposium oninteractive 3D graphics and games. ACM Press; 2007. p. 105–12.

P. Merrell, D. Manocha / Computers & Graphics 34 (2010) 304–311 311

[3] Merrell P, Manocha D. Continuous model synthesis. ACM Trans Graph2008;27(5):1–7.

[4] Merrell P, Manocha D. Constraint-based model synthesis. In: SPM: 2009SIAM/ACM joint conference on geometric and physical modeling. New York,NY, USA: ACM; 2009. p. 101–11.

[5] Hertzmann A, Oliver N, Curless B, Seitz SM. Curve analogies. In: EGRW ’02:proceedings of the 13th eurographics workshop on rendering. Aire-la-Ville,Switzerland: Eurographics Association; 2002. p. 233–46.

[6] Freeman WT, Tenenbaum JB, Pasztor EC. Learning style translation for thelines of a drawing. ACM Trans Graph 2003;22(1):33–46.

[7] Bhat P, Ingram S, Turk G. Geometric texture synthesis by example. In: SGP:proceedings of the 2004 eurographics/ACM SIGGRAPH symposium ongeometry processing. New York, NY, USA: ACM Press; 2004. p. 41–4.

[8] Zelinka S, Garland M. Mesh modelling with curve analogies. In: PG:Proceedings of the computer graphics and applications, 12th pacificconference. 2004. p. 94–8.

[9] Wu Y, Zhang H, Song C, Bao H. Space–time curve analogies for motion editing.In: GMP, 2008. p. 437–49.

[10] Simhon S, Dudek G. Sketch interpretation and refinement using statisticalmodels. In: Keller A, Jensen HW, editors. Proceedings of eurographicssymposium on rendering 2004, Norrkoping, Sweden, June 21–23. EURO-GRAPHICS Association; 2004. p. 23–32, 406.

[11] Chen G, Esch G, Wonka P, Muller P, Zhang E. Interactive procedural streetmodeling. In: Proceedings of ACM SIGGRAPH. New York, NY, USA: ACM;2008. p. 1–10.

[12] Kalnins RD, Markosian L, Meier BJ, Kowalski MA, Lee JC, Davidson PL, et al.WYSIWYG NPR: drawing strokes directly on 3D models. In: Proceedings ofACM SIGGRAPH, vol. 21 (3), 2002. p. 755–62.

[13] Efros AA, Leung TK. Texture synthesis by non-parametric sampling. In: IEEEinternational conference on computer vision, Corfu, Greece; 1999. p. 1033–8.

[14] Kwatra V, Schdl A, Essa I, Turk G, Bobick A. Graphcut textures: image andvideo synthesis using graph cuts. In: Proceedings of ACM SIGGRAPH ’03,2003. p. 277–86.

[15] Barla P, Breslav S, Thollot J, Sillion FX, Markosian L. Stroke Pattern Anal Syn2006;25(3):663–71.

[16] Jodoin P-M, Epstein E, Granger-Piche M, Ostromoukhov V. Hatching byexample: a statistical approach. In: NPAR: proceedings of the 2nd interna-tional symposium on non-photorealistic animation and rendering. New York,NY, USA: ACM; 2002. p. 29–36.

[17] Ijiri T, Mech R, Igarashi T, Miller G. An example-based procedural system forelement arrangement. Comput Graph Forum 2008;27:429–36.

[18] Muller P, Wonka P, Haegler S, Ulmer A, Gool LV. Procedural modeling ofbuildings. ACM Trans Graph 2006;25(3):614–23.

[19] Wonka P, Wimmer M, Sillion F, Ribarsky W. Instant architecture. In:Proceedings of ACM SIGGRAPH, 2003. p. 669–77.

[20] Mech R, Prusinkiewicz P. Visual models of plants interacting with theirenvironment. In: Proceedings of ACM SIGGRAPH ’96, 1996. p. 397–410.

[21] Ijiri T, Owada S, Okabe M, Igarashi T. Floral diagrams and inflorescences:interactive flower modeling using botanical structural constraints. In:Proceedings of ACM SIGGRAPH. New York, NY, USA: ACM Press; 2005.p. 720–6.

[22] Power JL, Brush AJB, Prusinkiewicz P, Salesin DH. Interactive arrangement ofbotanical l-system models. In: I3D: proceedings of the 1999 symposium oninteractive 3D graphics. New York, NY, USA: ACM; 1999. p. 175–82.

[23] Pottmann H, Liu Y, Wallner J, Bobenko A, Wang W. Geometry of multi-layerfreeform structures for architecture. In: Proceedings of ACM SIGGRAPH ’07,2007.

[24] Wong MT, Zongker DE, Salesin DH. Computer-generated floral ornament.In: Proceedings of ACM SIGGRAPH ’98. New York, NY, USA: ACM; 1998.p. 423–34.

[25] Igarashi T, Matsuoka S, Tanaka H. Teddy: a sketching interface for 3d freeformdesign. In: Proceedings of ACM SIGGRAPH. New York, NY, USA: ACM Press,Addison-Wesley Publishing Co.; 1999. p. 409–16.

[26] Singh K, Fiume E. Wires: a geometric deformation technique. In: Proceedingsof ACM SIGGRAPH. New York, NY, USA: ACM; 1998. p. 405–14.