Sie sind auf Seite 1von 10

This article was originally published in a journal published by Elsevier, and the attached copy is provided by Elsevier for

the authors benet and for the benet of the authors institution, for non-commercial research and educational use including without limitation use in instruction at your institution, sending it to specic colleagues that you know, and providing a copy to your institutions administrator. All other uses, reproduction and distribution, including without limitation commercial reprints, selling or licensing copies or access, or posting on open internet sites, your personal or institutions website or repository, are prohibited. For exceptions, permission may be sought for such use through Elseviers permissions site at: http://www.elsevier.com/locate/permissionusematerial

ARTICLE IN PRESS

Computers & Graphics 30 (2006) 834842 www.elsevier.com/locate/cag

Chaos and Graphics

Cameron Brownea,, Paul van Wamelenb


a b

Abstract

Keywords: Archimedes spiral; Apollonian circle packing; Fractal; Art

r ay1=n ,

where r is the radial distance, y the polar angle, and n is a constant which determines how tightly the spiral is wrapped [1]. When this constant n 1, the resulting spiral is known as Archimedes spiral: r ay.

pe
(1) (2) (3) (4)

The Archimedean spiral is a spiral with the polar equation

th o

Archimedes spiral (Fig. 1, left) can be dened in cartesian coordinates by the properties (x, y, w, y, T, o) where (x, y) is the spirals center, w is the width of one rotation, y is the starting angle or phase, T is the total sweep or number of rotations, and o is the spirals orientation (o 1 for clockwise and o 1 for counterclockwise). Dening functions

r's

ys t y wt siny 2pot,

then the spiral is paramaterized by xs t; ys t for 0ptpT. We describe the area enclosed by the spirals outer 3601 sweep as its footprint (Fig. 1, right).
Corresponding author. Tel.: +61 7 3371 1576.

E-mail addresses: cameron.browne@swishzone.com (C. Browne), wamelen@math.lsu.edu (P. van Wamelen). 0097-8493/$ - see front matter r 2006 Elsevier Ltd. All rights reserved. doi:10.1016/j.cag.2006.07.010

Au

xs t x wt cosy 2pot,

rs

1. Archimedes spiral

on

2. Spiral packing We wish to pack a given area with connected sets of Archimedes spiral. This will be achieved by successively branching child spirals from parent spirals until the target area is lled to some desired level of coverage (Fig. 2). The following constraints must be met: 1. Each child may have at most one parent (though parents may have multiple children), 2. Each child must meet its parent tangentially, and be rotated such that its end point lies on the line between the spiral centers, 3. A childs width w must never exceed its parents width, and 4. Spirals may touch neighboring spirals tangentially but may not intersect them.

Other potential constraints are relaxed to allow exibility of design: a child may be of a greater total radius than its parent if T c 4T p , a child need not be the same orientation as its parent, and so on. Archimedes spiral was chosen as the most suitable form for both its aesthetic and well-behaved mathematical qualities. The packing starts with a seed pair of opposed matching spirals S1 and S2 (Fig. 2a) with identical w, T, o, opposed y, and tangential end points such that xs1 T xs2 T 1, ys1 T ys2 T 1, xs1 T 1 xs2 T, and ys1 T 1 xs2 T. Fig. 2b shows a child spiral branching from a single

al

We present a simple method for creating artistic space-lling designs based on spiral packings. Connected spiral sets are generated by successively branching child spirals from parent spirals, constrained to t nearby neighbors in their environment. The underlying geometry is discussed in detail and a number of color examples generated by the algorithm are given. r 2006 Elsevier Ltd. All rights reserved.

co

SWiSHzone.com Pty Ltd, The Basement, 33 Ewell Street, Balmain, NSW 2041, Australia Department of Mathematics, Louisiana State University, Baton Rouge, LA 70803-4918, USA

py

Spiral packing

ARTICLE IN PRESS
C. Browne, P. van Wamelen / Computers & Graphics 30 (2006) 834842 835

The bottom row of Fig. 3 shows the underlying geometry of these relationships. In each case, S is rotated to lie tangent to S1 such that its end point T lies on the line between the spiral centers. The child is clipped at the intersection point U and the parent is clipped along the interval between the tangent point V and intersection point U. Following clipping, there should be no intersection between any pair of spirals within the packing. In all cases, the parent spiral is deemed to remain complete even though intervals along its sweep may be clipped by children.

rs

on

1. Case I: Child spiral S branching from existing parent spiral S1 (Fig. 3a). The child spiral is of a specied width w, number of turns T, orientation o, and direction relative to the parent. 2. Case II: Child spiral S of a specied width w, number of turns T and orientation o branching from parent S1 to touch one other spiral S2 (Fig. 3b). 3. Case III: Child spiral S of a specied number of turns T and orientation o branching from parent S1 to touch two other spirals S2 and S3 (Fig. 3c).

Each pair of touching spirals give three equations. The xcoordinates must agree and the y-coordinates must agree: xs ti xsi t0i , (5) (6)

and the slopes of touching pairs must be equal: qxs ti qysi t0i qxsi t0i qys ti . qti qt0i qti qt0i (7)

Another equation species that the child spiral to be tted should be rotated such that its end point lies on the line between the centers of S and S1: sinyx1 x cosyy1 y. (8)

(x,y)

th o

r's

Note that although the childs end point lies on the line between the centers, the tangent point does not necessarily do so; it does not necessarily occur at precisely Ts1. We therefore have ten equations with ten unknowns. Trying to solve this set of equations algebraically is probably a hopeless endeavor, but there are well-known techniques for solving such systems numerically. We will describe one of the simplest, Newtons Method for Systems. We dene v x; y; w; y; t1 ; t01 ; t2 ; t02 ; t3 ; t03 , a vector containing all of our variables, and denote its components by v1, v2 etc. Rewriting the ten equations gives f 1 v xs t1 xs1 t01 , f 2 v ys t1 ys1 t01 , f 3 v qxs t1 qys1 t01 qxs1 t01 qys t1 , qt1 qt01 qt1 qt01 (9) (10) (11)

Fig. 1. Archimedes spiral and its footprint.

Au

(a)

(b)

pe

(c)

al

ys ti xsi t0i ,

Fig. 2. Spiral packing: (a) a seed pair, (b) simple branch, (c) tting to one other, and (d) tting to two others.

co
(d)

parent. For the sake of clarity, the parent spiral is deemed to remain a complete spiral in subsequent operations even though part of it is clipped by the child spiral. Next is shown a further child spiral that touches one other spiral (Fig. 2c), and a smaller child that touches two other spirals (Fig. 2d). This process continues within the (decreasing) target area until a packing of the desired density is achieved. There will be as many distinct connected spiral sets within a packing as there are seed pairs. There are therefore three general geometric cases to consider, as shown in Fig. 3:

3. Numerical solution We now consider the solution of case III, the most difcult. We will write down the equations resulting from the cartesian coordinates of the relevant intersections and tangential points, and discuss the solution of the resulting system of equations. We have the following ten variables: 1. x, y, w and y describe the spiral we are looking for, and 2. ti and t0 i are real numbers such that S at ti touches Si at t0 i, for i 1, 2, 3.

py

ARTICLE IN PRESS
836 C. Browne, P. van Wamelen / Computers & Graphics 30 (2006) 834842

S2

S2

S S

S1

S1

S1

W C V T P U P T U V C T V C

al on
(c) P

(a)

(b)

Fig. 3. Branch geometry: (a) simple branch, (b) tting to one other, and (c) tting to two others.

f 5 v ys t2 ys2 t02 , f 6 v qxs t2 qys2 t02 qxs2 t02 qys t2 , qt02 qt2 qt02 qt2

pe

f 4 v xs t2 xs2 t02 ,

(12)

(13)

(14)

rs

column vector y and then setting v1 v0+y. It is known that this iteration converges quadratically to a solution for our system, provided that our initial guess is good enough. Note that the system can also be written in the form vi1 vi Jvi 1 F vi , (20)

f 8 v ys t3 ys3 t03 , f 9 v

r's

f 7 v xs t3 xs3 t03 ,

(15) (16) (17) (18)

f 10 v sinyx1 x cosyy1 y.
T

Let F v f 1 v; f 2 v; . . . ; f 10 v be the column vector containing our functions. We are looking for a v such that F v 0. Dene the 10 10 Jacobian matrix: 0 qf 1 v qf 1 v v 1 qf 110 qx1 qx2 qx C B qf v qf v v 2 B 2 qf 210 C C B qx1 qx2 qx C (19) Jv B . B . . C. .. . . C . B . . A . . @ qf 10 v qf 10 v v qf 1010 qx1 qx2 qx

Au

th o

qxs t3 qys3 t03 qxs3 t03 qys t3 , qt3 qt03 qt3 qt03

which makes its similarity to the usual one-dimensional Newtons Method more apparent. The functions occurring in the Jacobian matrix are simple enough that their derivatives can be determined symbolically, hence the Jacobian matrix can be precomputed explicitly. The implementation of a method to solve this set of equations numerically should be relatively straightforward. The solutions of the simpler cases I and II involve similar, but simplied, applications of this process. 4. Apollonian packing We turn now to the related study of circle packing. The Greek geometer Apollonius of Perga (3rd century BC) studied the problem of drawing a circle tangent to three other objects, each of which may be a point, line or circle. There are a total of ten cases, the tenth being tting a circle tangent to three other circles, hence this problem is known as Apollonius Tenth Problem. There are eight total solutions to this problem [1], but we are only interested in one: the circle of minimum radius

Now suppose that we have as initial guess v0 for the values of the variables. Then we can obtain a better guess, v1, by solving the linear set of equations Jv0 y F v0 for the

co
Q W X U R

py
S3

ARTICLE IN PRESS
C. Browne, P. van Wamelen / Computers & Graphics 30 (2006) 834842 837

Fig. 4. Apollonian circle packing and the Apollonian gasket.

5. Iterative spiral tting

Given a parent spiral S1 and a preferred location for a child spiral S0, specied by the user with known number of turns T and orientation o, we wish to nd the child spiral S branching from S1 as close to S0 as possible, and tted to any potentially intersecting spirals S2, S3, etc. The algorithm must be robust enough to handle ambiguous child placements by the user. Our algorithm consists of the following steps: 1. If S0 does not intersect other spirals let S S0. 2. If S0 intersects two or more spirals, try to t S to the closest two without being too far from S0.

Au

th o

(Fig. 4, left). Note that for each touching pair of circles the tangent point lies on the line between the circles centers. If the three bounding circles are mutually tangent, then the minimal tted circle is called the interior Soddy circle [1]. The three interstitial gaps formed by such a placement can themselves be tted with interior Soddy circles; continuing this process to a specied depth results in a fractal structure called the Apollonian gasket [1], Apollonian fractal [2] or Apollonian packing [3,4], as shown in Fig. 4 (right). Kasner and Supnick [3] prove that the porosity of a full Apollonian packing (the ratio of vacant area to the area covered by circles) is zero; the packing is an area-lling set. The fractal dimension of the simplest Apollonian packing has been calculated to be 1.30568470.00001 [4]. Despite the obvious similarities between Apollonian packing and the packing of spirals that we aim to achieve, there are also signicant differences that make the case of spiral packing more difcult. However, this comparison provided the impetus for an intuitive solution to the spiral packing problem due to the second author. This solution was tried mostly out of curiosity but proved more than adequate for our purposes, and is discussed in the next section.

pe

r's

rs

on

3. If 2. fails or there is only one intersecting spiral, then try to t a spiral with the same width as S0 to the spiral with the greatest intersection with S0. If the resulting spiral is not too far from S0 then use it. 4. If all else fails t the biggest spiral in the direction of S0 to the parent.

This algorithm, explained in more detail in Listing 1, assumes that we can solve the spiral tting Cases I, II and III outlined in Section 2. We use the following iterative approximation algorithm for all three cases: 1. Approximate the spirals by circles, 2. Solve the circle tting problem, and 3. Use the solution to make better circle approximations to the spirals. Pseudocode for this procedure is given in Listing 2. Listing 1. Description of the general tting algorithm. Input: A spiral, S, indicated by the user, branching from S_P, the parent spiral. Output: A spiral, as close to S as possible, but not intersecting any non-parent spirals. Step 1: Return an error if S has its center inside S_P. Step 2: If S has width more than its parent, reduce the width to that of the parent and adjust the center so that the spiral still branches in the same direction as indicated by the user. Step 3: If S does not intersect any non-parent spirals, return S. Step 4: If the indicated spiral intersects 2 or more spirals do the following: (at many points things might fail below, if so go to Step 5)

al

co

py

ARTICLE IN PRESS
838 C. Browne, P. van Wamelen / Computers & Graphics 30 (2006) 834842

Step 4a: Approximate all existing spirals by discs. For each existing non-parent spiral (approximated as a disc) determine the radius of the disc that touches this disc and the parent disc and has its center on the line connecting the centers of S_P and S. Let S_1 and S_2 be the two spirals with the smallest such associated radius (the "bounding spirals"). Step 4b: Fit a spiral S_3 to S_1 and S_2 (branching from S_P). Step 4c: While S_3 intersects existing (non-parent) spirals: Let S_4 be the spiral with the biggest intersection with S_3. Let S_5 be the spiral tted to S_1 and S_4. Let S_6 be the spiral tted to S_2 and S_4. Select S_5 or S_6 with the smallest width and let this be the new S_3. If this increases the width of S_3, go to Step 5. Let the new S_1, S_2 be S_1, S_4 or S_2, S_4 depending on whether S_5 or S_6 was selected. Fit a spiral S_3 to S_1 and S_2. End while Step 4d: If the angle from S_Ps center to S_3s center is within 12.5 degrees of the angle to Ss center, return S_3. Step 5: (Step 4 fails or just one spiral intersects S). If just one spiral intersects S, let it be denoted S_1. Otherwise let S_1 be the bounding spiral with smallest bounding radius, as in Step 4a. Try to nd a spiral S_2 with the same width as S branching from S_P and touching S_1. Step 6: If S_2 does not intersects non-parent spirals, and its angle isnt off (as in 4d) by more than 12.5 degrees, return S_2. Step 7: Set S_2 S. Repeat until S_2 does not intersect any non-parent spirals: Let S_1 be the spiral with the biggest intersection with S_2. Let (the new) S_2 be the spiral branching from S_P, touching S_1 and with its center on the line connecting the centers of S_P and S. End repeat Step 8: Return S_2.

pe

rs

locate the two spirals S2 and S3 closest to S0 (not including S1) c0 circle with center equal to S0 and unknown radius r0 do { for (each spiral Si {1,2,3} to be tted to) { ri radius of Si in the direction of the S rsi radius of S in the direction of the Si // for S1 this is the radius of S at T1 ci circle with center equal to Si and radius ri(rsirso) } solve the appropriate circle tting problem: Case I: Fit c0 to c1 (if no intersection) Case II: Fit c0 to c1 and c2 (if intersect S2) Case III: Fit c0 to c1, c2 and c3 (if intersect S2 and S3) D discrepancy between c0s new and previous centers S center c0 center S width r0/(T1)// radius at T1 equals the radius of c0 } while (D4threshold) return S.

on

Replacing spirals by circles makes the tting problem easy to solve for each case. Simply take the equations for the various circles: x cx 2 y cy 2 r2 , (21)

r's

and solve the system of simultaneous equations. This reduces to at most a quadratic equation which can be solved with the quadratic formula, and the best of the two resulting solutions picked (if necessary). The best solution will generally be the closest to the preferred placement. We cannot prove that our spiral tting algorithm will always converge (and in fact for very bad initial guesses it will not) but in practice it works well. Note that if the algorithm does converge, then it will not give the exact geometric solution outlined in Section 3 due to the assumption that spirals touch tangentially on the line connecting their centers, and in general this is not the case. However, the error introduced by this assumption is on the order of one part in one thousand and is negligible for our purposes. Fig. 5 shows a portion of a spiral packing generated from a single seed pair using this iterative algorithm. The overall effect of this design is similar in nature to the Apollonian packing, however there is one major difference: every interior point within a spiral set is connected to every other. There will be as many self-connected spiral sets in a design as there are seed pairs.

Listing 2. Pseudocode for the iterative solution of Cases I, II and III. Input: parent spiral S1 and preferred child position S0 Output: tted child spiral S

Au

th o

al

co

py

ARTICLE IN PRESS
C. Browne, P. van Wamelen / Computers & Graphics 30 (2006) 834842 839

Fig. 5. Zoomed views of a sparsely packed area.

6. Implementation The algorithms described above form the basis of a spiral design editor implemented in Visual C++. There are two basic operations: 1. Nominate a seed pair, and 2. Nominate a child. The user interactively species the preferred location of each seed pair or child using the mouse, and the program adds the correctly tted result if possible. The preferred spirals degrees of freedom (width, turns, orientation and so on) are described by a master spiral template that may be edited by the user. Similarly, any placed spiral may be deleted or its color scheme edited. Boundary shapes were implemented in the program as sets of small, closely spaced spirals laid at regular intervals along the boundary path. Boundary spirals have small width but a large number of turns (100) to give them reasonably constant exterior curvature and make them circle-like in nature; this is another attractive feature of Archimedes spiral. Boundary spirals participate in the tting process but are excluded from the nal output. Boundary shapes with smooth owing curves such as spirals, teardops and Paisleys were found to give the best results. Seamless tiles that replicate to ll the plane may be achieved by repeating each spiral periodically based on tile width, and taking wrapped spirals into account when tting children. Each tile will contain at least one seed pair. When using the spiral editor, it was found that ipping orientation with each level of nesting gave best results, as children then generally followed their parents direction of outward ow. This can be seen in Fig. 5. When branching children, it is best to branch from the spiral with width closest to the expected child width. Packing to the same depth in all areas was found to give uneven coverage; a more uniform coverage is achieved by packing each successive spiral in the largest remaining gap.

th o

r's

1. Image based: Draw the area as an image. Place a seed pair then successively grow children, removing from the image the footprint of each new spiral. A distance map of the image will indicate the most suitable placement for the next spiral (the highest point within range of a potential parent), and the records of existing spirals can be accessed to determine its exact t. Continue until the largest remaining image area falls below a given threshold. 2. Triangulation: Coarsely polygonize the boundary area and determine its Constrained Delaunay Triangulation. Place a seed pair then successively grow children, retriangulating with each new spirals center added as a vertex. The largest current triangle adjacent to a potential parent will contain the preferred location for the next spiral. Continue until the largest triangle falls below a given threshold.

pe

Au

rs

on
7. Results

Drawing the outlines of the nal design is a simple matter of clipping each parent along the intervals at which children attach, and clipping each child at the point of intersection with its parent. Coloring the interior of spirals is less straightforward. The most attractive color schemes were found to involve color blends around the spiral sweep such that there is some contrast between concentric layers. A number of dominant colors are specied for each spiral, and the ll brush blends from one color to the next along its sweep. However, care must be taken to avoid the pronounced optical illusion of three-dimensional ridges that may occur if alternating light and dark color shifts fall into phase along concentric layers. Fig. 6 (left) shows a 7201 sweep blending from white at 01 to black at 3601 to white at 7201.

al

This last point leads to some approaches for automating the spiral packing process. Given an area to be packed, two obvious approaches are:

co

py

ARTICLE IN PRESS
840 C. Browne, P. van Wamelen / Computers & Graphics 30 (2006) 834842

Fig. 6. The spiral ridge illusion caused by concentric color gradients in phase.

th o

r's

pe
Fig. 8. Under the spreading curly tree (Ficus archimedea). Fig. 7. A single connected set of spirals.

The right side of the resulting spiral shows no effect, however the left side shows a pronounced ridged effect due to the fortuitous combination of color gradients. Fig. 6 (right) shows how distracting this effect can become for larger designs. This problem may be avoided by ensuring that color cycles occur out of phase at say 2701 rather than 3601 intervals, so that any residual effect is distributed across the design at various angles and diminished.

Au

rs
Another subtlety of coloring is that children must exactly match their parents color along the branch interval. If a child branches midway between two dominant parent colors, then its color scheme may benet from some tweaking (such as a cycling of its colors) to avoid the propagation of a diluted color mix. For instance, if the parent is red and blue, then some of its descendants will be predominantly purple unless adjusted. Fig. 7 shows a connected set of spirals generated from a single seed pair constrained to a Paisley shape, with exterior ourishes added after the removal of the boundary. Each spirals color palette covers the spectrum. This image was exported in PostScript format, then treated in Photoshop with a glass lter that suggests a

on

al

co

py

ARTICLE IN PRESS
C. Browne, P. van Wamelen / Computers & Graphics 30 (2006) 834842 841

Fig. 9. Intertwined arms in red, green and blue palettes. Each arm is a single connected spiral set.

Au

three-dimensional meniscus through judicious shading and highlights. Fig. 8 shows a tree-like design generated from a single seed pair, one of which was excised from the nal design and replaced manually with the trunk silhouette. This gure shows the footprint of the spiral set (black) minus its outline (white) attenuated for width according to spiral size. The three distinct spiral sets in Fig. 9 themselves follow spiral paths. The spirals within each set have color palettes based on brightness variations of that sets primary color: red, green or blue. This gure shows unmodied PostScript output from the spiral design editor. Fig. 10 shows four distinct spiral sets, each constrained to a disjoint area of the Yin Yang shape. The spiral sets were mapped onto a hemisphere, then POV-Ray sphere primitives generated at regular intervals along each spiral path with radii based on spiral width. The end result was four polyspheres, which were renderd using the POV-Ray ray tracer. Each of these designs were generated interactively using the spiral design editor and took from half an hour to two hours to complete.

th o

r's

pe
Fig. 10. Four connected spiral sets exported as polyspheres mapped onto a hemisphere.

8. History The idea of spiral packing for space-lling artistic designs occurred to the rst author during a plane ight to Istanbul. However, seeing the very same principles in action the next day on the walls of the 6th century Aya Soa mosque (Fig. 11, left) indicated the prevalence of this motif in the history of art. There are many precedents, an early example being the tri-spiral stone carvings from the Newgrange tomb in Ireland (Fig. 11, right). These carvings were made circa 3100 BC, predating the Celtic style of artworkwhich is replete with interlocking rather than branching spiralsby over 1500 years.

rs

on

al

co

py

ARTICLE IN PRESS
842 C. Browne, P. van Wamelen / Computers & Graphics 30 (2006) 834842

Fig. 11. A mural in the Aya Soa mosque (Istanbul) and the Newgrange tri-spiral (Ireland). Photos by Helen Gilbert and Jorge Tutor r /www.jorgetutor.comS.

9. Conclusion

Au

th o

r's

This paper describes a method for creating connected spiral sets which may be used to ll given boundary shapes to a given density, for artistic purposes. A numerical solution for exact tting is given, as well as an iterative method based on the approximation of spirals by circles. Future work might include the implementation of the exact geometric solution for the spiral tting problem to

pe

rs

It is interesting to note that after placing a seed pair to start a spiral packing, the tri-spiral is the most natural step to take next. Four-sided placements are generally less elegant and more difcult to work into a design, as can be seen in Fig. 2. Hargittai and Pickover [5] give an excellent overview of spirals in art, nature and science.

on
References

allow accurate packing to as yet untried levels, and the automation of the packing process using the techniques suggested.

[1] Weisstein E. Concise encyclopedia of mathematics. Boca Raton: CRC Press; 1999. [2] Bourke P. An introduction to the Apollonian fractal. /http:// astronomy.swin.edu.au/$pbourke/papers/apollony/apollony.pdfS [3] Kasner E, Supnick F. The Apollonian packing of circles. Proceedings of the National Academy of Sciences of the United States of America 1943;29:37884. [4] Manna S, Herrmann H. Precise determination of the fractal dimensions of Apollonian packing and various space-lling bearings. Journal of Physics A: Mathematical and General 1991;24:L48190. [5] Hargittai I, Pickover C, editors. Spiral symmetry. Singapore: World Scientic; 1992.

al

co

py

Das könnte Ihnen auch gefallen