On Bounding Boxes of Iterated Function System Attractors Hsueh-Ting Chu, Chaur-Chin Chen*
Total Page:16
File Type:pdf, Size:1020Kb
Computers & Graphics 27 (2003) 407–414 Technical section On bounding boxes of iterated function system attractors Hsueh-Ting Chu, Chaur-Chin Chen* Department of Computer Science, National Tsing Hua University, Hsinchu 300, Taiwan, ROC Abstract Before rendering 2D or 3D fractals with iterated function systems, it is necessary to calculate the bounding extent of fractals. We develop a new algorithm to compute the bounding boxwhich closely contains the entire attractor of an iterated function system. r 2003 Elsevier Science Ltd. All rights reserved. Keywords: Fractals; Iterated function system; IFS; Bounding box 1. Introduction 1.1. Iterated function systems Barnsley [1] uses iterated function systems (IFS) to Definition 1. A transform f : X-X on a metric space provide a framework for the generation of fractals. ðX; dÞ is called a contractive mapping if there is a Fractals are seen as the attractors of iterated function constant 0pso1 such that systems. Based on the framework, there are many A algorithms to generate fractal pictures [1–4]. However, dðf ðxÞ; f ðyÞÞps Á dðx; yÞ8x; y X; ð1Þ in order to generate fractals, all of these algorithms have where s is called a contractivity factor for f : to estimate the bounding boxes of fractals in advance. For instance, in the program Fractint (http://spanky. Definition 2. In a complete metric space ðX; dÞ; an triumf.ca/www/fractint/fractint.html), we have to guess iterated function system (IFS) [1] consists of a finite set the parameters of ‘‘image corners’’ before the beginning of contractive mappings w ; for i ¼ 1; 2; y; n; which is of drawing, which may not be practical. i denoted as W ¼fX; w ; w ; y; w g: For this reason, this paper is devoted to develop a 1 2 n practical bounding boxalgorithm. A good bounding In this paper, we assume contractive affine transforms algorithm is also a priori for rendering 3D fractals. Hart in an iterated function system. A contractive affine and DeFanti [5] use bounding spheres in their system of transform w in R2 is 3D fractal rendering. Sometimes the bounding spheres "#!"#"# "# "# "# are very loose such that the rendering of common x ab x e x e fractals may be inefficient. Most of 3D computer w ¼ þ ¼ A þ ð2Þ y cd y f y f graphic systems employ bounding boxes for rendering objects. Thus, it is important to develop a tight and a contractive affine transform w in R3 is bounding boxalgorithm for rendering fractal objects 02 31 2 32 3 2 3 in a 3D system. x abc x t B6 7C 6 76 7 6 7 w@4 y 5A ¼ 4 def54 y 5 þ 4 u 5 z ijk z v 2 3 2 3 x t 6 7 6 7 *Corresponding author. Tel.:+11-886-3-573-1078; fax:+11- ¼ A4 y 5 þ 4 u 5; ð3Þ 886-3-572-3694. E-mail address: [email protected] (C.-C. Chen). z v 0097-8493/03/$ - see front matter r 2003 Elsevier Science Ltd. All rights reserved. doi:10.1016/S0097-8493(03)00035-9 408 H.-T. Chu, C.-C. Chen / Computers & Graphics 27 (2003) 407–414 where the eigenvalues of the matrix A have magnitude Theorem 2 indicates that the entire attractor can be less than 1. generated by applying the IFS on some point zAA iteratively. Thus, it provides a formula to represent all the Theorem 1 (Barnsley [1]). Let f : : X-X be a contrac- points in the attractor as A ¼fpjp ¼ t1t2ytcðzÞ; tiAfw1; tive mapping in a complete metric space ðX; dÞ: Then f w2; y; wng and z is the fixed-point of some mapping wjg: possesses a unique fixed-point xf AX; and for any xAX; n the Cauchy sequence ff ðxÞg converges to xf ; where 1.2. Previous work f nðxÞ¼f nÀ1ðf ðxÞÞ; and f 0ðxÞ¼x: Let W ¼fX; w1; w2; y; wng be an iterated function In a Hausdorff metric space ðHðXÞ; hðdÞÞ; an IFS, W; system on X; and let A be the attractor associated with is also a contractive mapping, thus it possesses a W: We try to find the bounding volume of the attractor unique fixed-point, called the attractor of the IFS. A: In the literature, only bounding ball algorithms were Tables 1–3 list the 2D IFS codes of fractals given by developed [5–8] for IFSs. A bounding ball is also called a the program Fractint, which generate the ‘‘dragon’’, bounding circle in a 2D space or a bounding sphere in a ‘‘coral’’, and ‘‘fern’’ fractal objects [1], respectively. 3D space. Fig. 1 shows a picture of these fractal objects. We Canright [6] uses multiple bounding balls to envelop will compute the bounding boxes of these IFS codes the entire attractor of an IFS. Let z1; z2; y; zn be later. the fixed points of w1; w2; y; wn on ðX; dÞ; and let s1; s2; y; sn be the contractivity factors of w1; w2; y; wn; Lemma 1. Let W ¼fX; w ; w ; y; w g be an iterated 1 2 n respectively. They seek n balls SCi centered on zi; 1pipn function system. Let A be the attractor associated with W C C n such that wðAÞ Ci; then A i¼1 Ci: The radii frig are on ðHðXÞ; hðdÞÞ; and let z1; z2; y; zn be the fixed points of chosen to satisfy [6] w1; w2; y; wn; respectively, on ðX; dÞ: Then ziAA for ri ¼ si maxðrj þ dðzi; zjÞÞ; 1pipn: ð6Þ i ¼ 1; 2; y; n: jai N Fig. 2 illustrates Canright’s bounding balls for the fern. Proof. zi ¼ wi ðziÞ since zi is the fixed point of wi; hence N N In order to enclose Canright’s balls, a large bounding ziAW ðfzigÞ: By Theorem 1, W ðfzigÞ ¼ A: Hence N box B Boxðx ; x ; y ; y Þ¼ðÀ14:24; 19:16; ziAW ðfzigÞ ¼ A: & min max min max À9:36; 26:70Þ is necessary. We mark the minimum bounding boxof the fern with dotted lines in the figure, Theorem 2. Let W ¼fX; w1; w2; y; wng be an iterated function system. Let A be the attractor associated with then the computed bounding boxby Canright’s algo- W; and zAA: Then the attractor A is equal to rithm is too loose in practice. However, Canright fzg,fWðzÞg,fW 2ðzÞg,?,fW NðzÞg: provided a very simple and fast solution to compute a bound for drawing fractals. Proof. (a) By Theorem 1, fW NðzÞg ¼ A: Hence, Hart and DeFanti [5] introduced another bounding ball algorithm. Only one bounding ball is computed to ADfzg fWðzÞg fW 2ðzÞg ? fW NðzÞg: ð Þ , , , , 4 enclose the attractor of an IFS in their algorithm. Initially (b) We know zAA; then all the sets the ball C is the unit ball at the origin, then the ball is fzg; fWðzÞg; fW 2ðzÞg; y; fW NðzÞgDA: Thus, moved and enlarged to envelop the entire attractor n N iteratively. The next ball C in the sequence is found as fzg,fWðzÞg,fW 2ðzÞg,?,fW ðzÞgDA: ð5Þ Xn 2 n 1 From (a) and (b), A=fzg,fWðzÞg,fW ðzÞg o ¼ wiðoÞð7Þ N n ,?,fW ðzÞg: & i¼1 Fig. 1. The attractors of the 2D IFS codes in Tables 1–3. H.-T. Chu, C.-C. Chen / Computers & Graphics 27 (2003) 407–414 409 bounding boxalgorithm instead. We desire to acquire a very tight bounding volume instead of a loose one. C However, there are many of problems we have to 2 overcome. In the next section, we consider these problems and their solutions. For convenience, we consider the bounding problem in 2D cases. In Section 3, the new algorithm is presented. We show experimental results in Section 4. Finally, conclusions are drawn in Section 5. 2. Bounding boxes for IFS attractors C4 The advantage of a bounding ball algorithm is that it can handle rotations. It is a complexproblem we have to C3 C1 resolve when developing a bounding boxalgorithm instead. An affine transformation is composed of translation, scaling, and rotation. Thus a 2D contractive affine transform of Eq. (2) can be rewritten as "#!"#"# "# Fig. 2. Canright’s bounding balls for fern. x sx cos y sy sin y x e w ¼ þ ; ð9Þ y Àsx sin y sy cos y y f and where jsxjo1 and jsyjo1: n n For example, let y ¼ p=4; sx ¼ sy ¼ 0:9; ox ¼ oy ¼ 0; r ¼ max ðsir þ dðwiðoÞ; o ÞÞ; ð8Þ i¼1yn then "#!"#"# "# x 0:64 0:64 x e where o and r are the origin and radius of ball C and w ¼ þ : ð10Þ likewise for ball Cn: y À0:64 0:64 y f We show the bounding ball for the fern computed by In this case, we will always obtain a smaller ball after Hart’s algorithm in Fig. 3. The origin and radius of the applying w: Here the new radius is 0.9 of the original, ball Cn are (0.03, 1.44) and 9.28, respectively. Compared but we may need a larger boxto enclose the transformed with Canright’s algorithm, Hart’s algorithm obtains a box. Fig. 4 shows the transformation of a boxwith w: A better result in this case. Rice [8] tries to improve Hart’s square with the length of sides 1.28 is necessary to algorithm by optimizing the radius r: The effort made by enclose the transformed unit square. As a result, given Rice has little improvement in this case because the an arbitrary initial box B ; WðB Þ may exceed the computed radius for the fern, by Hart’s algorithm, is 0 0 extent of B ; for an IFS W: On the contrary, it would be close to the optimal radius.