<<

Computers & Graphics 27 (2003) 407–414 Technical section On bounding boxes of system Hsueh-Ting Chu, Chaur-Chin Chen*

Department of , National Tsing Hua University, Hsinchu 300, Taiwan, ROC

Abstract

Before rendering 2D or 3D with iterated function systems, it is necessary to calculate the bounding extent of fractals. We develop a new to compute the bounding boxwhich closely contains the entire of an . 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 to generate 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 (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. 0 more tractable if we could find an initial box B such Though many researchers have developed bounding 0 that WðB ÞCB : Assuming this hypothesis is true, B ball algorithms as shown above, the minimum bounding 0 0 0 will be a loose bounding boxof the attractor of W: We boxes of the fern in Figs. 2 and 3 are much smaller than can find a tight bounding boxof the attractor of W by the computed bounds. Thus, we try to develop a refining B0 iteratively according to the following theorem.

2.1. Basic theory

C* 2 Theorem 3. Let W ¼fR ; w1; w2; y; wng be an iterated 2 function system of affine mappings in R : Let B0 ¼ 2 Boxðxmin; xmax; ymin; ymaxÞfðx; yÞAR j xminpxpxmax and yminpypymaxg be an arbitrary box satisfying the following condition

WðB0ÞCB0: ð11Þ Then i iÀ1 Fig. 3. Hart’s bounding ball for fern. W ðB0ÞCW ðB0Þ; for iX1: ð12Þ 410 H.-T. Chu, C.-C. Chen / Computers & Graphics 27 (2003) 407–414

(0.64,0.64) (0,1) (1,1)

(0,0) (0,1.28)

affine mappping w (0,0) (1,0) (0.64,-0.64)

Fig. 4. An example of transforming a box with an affine mapping w:

Proof. We prove this by induction. When k ¼ 1; boxof the attractor of the IFS W: This allows us to k kÀ1 k W ðB0ÞCW ðB0Þ by Eq. (10). Assume W ðB0Þ generate tighter bounding boxes when we iteratively kÀ1 CW ðB0Þ holds for some k > 1: We attempt to prove apply W on B0: This hypothesis however is based on the kþ1 k k kÀ1 W ðB0ÞCW ðB0Þ: Because W ðB0ÞCW ðB0Þ; thus existence of the initial box B0: Does a box B0 such that k kÀ1 for any point pAW ðB0Þ; it implies pAW ðB0Þ: the condition WðB0ÞCB0 holds for any IFS W exist? k kþ1 k Therefore, WðpÞAW ðB0Þ: Hence W ðB0ÞCW ðB0Þ: The answer is negative. For instance, we cannot find In consequence, the theorem is proved. & such a boxfor the IFS code of the fractal ‘‘dragon’’ in Table 1. However, we can ensure the hypothesis holds Definition 3 (Minimum bounding box). Let SCR2 be a for some IFSs under a certain restriction described subset of R2; the minimum bounding box MðSÞ of S below. 2 is a box Boxðxmin; xmax; ymin; ymaxÞfðx; yÞAR j xminp Theorem 4. Let W ¼fR2; w ; w ; y; w g be an iterated x xmax and ymin y ymaxg that contains the supreme 1 2 n p p p 2 values of coordinates of points in S: That is, for any function system of affine mappings in R : The affine mappings are point ðxp; ypÞAS; xminpxppxmax and yminpyppymax; "#!"#"# "# and there exist four supreme points p1; p2; p3 and x ai bi x ei w ¼ þ : p4AS such that xp ¼ xmin; xp ¼ xmax; yp ¼ ymin and i 1 2 3 y ci di y fi yp4 ¼ ymax: If we assume that iÀ1 Let the minimum bounding boxof W ðB0Þ be ja jþjb j 1; jc jþjd j 1 for i ¼ 1; y; n; ð13Þ iÀ1 iÀ1 i i o i i o MðW ðB0ÞÞ¼Boxðxmin; xmax; ymin; ymaxÞ; then W ðB0Þ iÀ1 i iÀ1 then there exists a box B such that WðB ÞCB : CMðW ðB0ÞÞ: On the other hand, W ðB0ÞCW ðB0Þ 0 0 0 i iÀ1 implies W ðB0ÞCMðW ðB0ÞÞ by Theorem 3. Therefore iÀ1 Proof. We prove this by finding a boxthat obeys the the supreme values of MðW ðB0ÞÞ are bounded by the condition WðB0ÞCB0: We check the absolute values of rectangle of ðxmin; xmax; ymin; ymaxÞ: This means that i iÀ1 the coefficients of the mappings fwig: Let MðW ðB0ÞÞCMðW ðB0ÞÞ which implies that we will get smaller boxes as we continuously apply the IFS S ¼ max fmaxfjaijþjbij; jcijþjdijgg; ð14aÞ 1pipn operator W on an initial box B0; if the condition C WðB0Þ B0 holds. Let A be the attractor of the IFS W; E ¼ max jeij; ð14bÞ N 1pipn we know W ðB0Þ¼A by Theorem 1. Therefore, the i N sequence fMðW ðB0ÞÞg converges to the minimum i¼0 F ¼ max jfijð14cÞ bounding box MðAÞ of the attractor A: 1pipn and E þ F 2.2. Existence of an initial box K ¼ : ð15Þ 1 À S

Assume a box B0 is found, and the condition Then, the box B  Boxðxmin; xmax; ymin; ymaxÞ¼ðÀK; K; WðB0ÞCB0 holds. Then the box B0 is a loose bounding ÀK; KÞ will be such a boxthat the condition WðB0ÞCB0

Table 1 IFS code for dragon wi ai bi ci di ei fi 1 0.824074 0.281482 À0.212346 0.864198 À1.882290 À0.110607 2 0.088272 0.520988 À0.463889 À0.377778 0.785360 8.095795 H.-T. Chu, C.-C. Chen / Computers & Graphics 27 (2003) 407–414 411 holds. The verification of this success is given in the (a) For any point pAA; there exists an integer c c appendix. & such that pAW ðzÞ: Let p ¼ t1t2ytcðzÞ where tiAfw1; w2; y; wng: We scan the sequence t1t2ytc; and Eq. (13) holds for the affine maps of the IFS codes for transfer the pattern tjtjþ1 into fs if tj ¼ w1 and tjþ1 ¼ ws: the fractals ‘‘coral’’ and ‘‘fern’’ in Tables 2 and 3. Hence, If tc ¼ w1 and tcÀ1aw1; then we can transfer tc into f1; as 2 we can find an initial box B0 with Eq. (15), then refine w1ðzÞ¼w1ðzÞ¼z: Consequently, we can rewrite m the boxinto a very tight bounding boxas MðW ðB0ÞÞ; t1t2ytcðzÞ as u1u2yud ðzÞ where uiAff1; f2; y; fn; 0d 0 where m is a large number. However, Eq. (13) does not w2; y; wng: Hence pAW ðzÞ and pAA : hold for the fractal ‘‘dragon’’. We overcome this (b) For any point pAA0; there exists an integer d 0d problem by Theorem 5 listed below. such that pAW ðzÞ: Let p ¼ u1u2yud ðzÞ where uiAff1; f2; y; fn; w2; y; wng: It is apparent by definition Definition 4. Let W1; W2 be two iterated function that there exists an integer c such that p ¼ t1t2ytcðzÞ; 2 systems of affine mappings in R ; and let A1; A2 be where tiAfw1; w2; y; wng: Thus pAA: 0 the attractors associated with W1; W2; respectively. We By (a) and (b), the attractors A and A are say that W1; W2 are equivalent if A1; A2 are identical. identical. &

2 2 Theorem 5. Let W ¼fR ; w1; w2; y; wng be an iterated Given an IFS W ¼fR ; w1; w2; y; wng; we can 2 function system of affine mappings in R : Let fi ¼ w1wi; decompose the affine mapping wi into ðwiw1; wiw2; y; 0 2 for i ¼ 1; 2; y; n: Then the IFS W ¼fR ; f1; f2; y; fn; wiwnÞ; if Eq. (13) does not hold for wi: Thus forming a 0 w2; y; wng is equivalent to W: new IFS, W ; that is equivalent to the original IFS. Moreover, we can iteratively apply this decomposition Proof. Let A and A0 be the attractors of IFSs W; procedure until Eq. (13) holds for all of affine mappings. 0 and W ; respectively. Let z be the fixed point of w1: Because all the affine mappings in W are contractive, the Then zAA by Lemma 1. Also by Theorem 1, there decomposition procedure always succeeds. For example, 2k k exists an integer k; such that z ¼ w1 ðzÞ¼f1 ðzÞ: Thus we can decompose the affine mapping w1 of the IFS for 0 zAA ; too. Thus by Theorem 2, the attractors the ‘‘dragon’’in Table 1 into ðw1w1w1; w1w1w2; w1w2Þ; 2 N 0 2 are A ¼fzg,fWðzÞg,fW ðzÞg,?,fW ðzÞg and and the new IFS W ¼fR ; w1w1w1; w1w1w2; w1w2; w2g 0 0 02 0N 2 A ¼fzg,fW ðzÞg,fW ðzÞg,?,fW ðzÞg: is equivalent to the original IFS W ¼fR ; w1; w2g: Table 4

Table 2 IFS code for coral wi ai bi ci di ei fi 1 0.307692 À0.531469 À0.461538 À0.293706 5.401953 8.655175 2 0.307692 À0.076923 0.153846 À0.447552 À1.295248 4.152990 3 0 0.545455 0.692308 À0.195804 À4.893637 7.269794

Table 3 IFS code for fern wi ai bi ci di ei fi 1 0 0 0 0.16 0 0 2 0.85 0.04 À0.04 0.85 0 1.6 3 0.2 À0.26 0.23 0.22 0 1.6 4 À0.15 0.28 0.26 0.24 0 0.44

Table 4 Equivalent IFS code for dragon wi ai bi ci di ei fi 1-a 0.409460 0.585012 À0.441325 0.492851 À4.682884 0.792306 1-b À0.165779 0.143135 À0.350368 À0.446332 0.869093 5.474304 1-c À0.057834 0.322995 À0.419636 À0.437105 1.043725 6.718995 2 0.088272 0.520988 À0.463889 À0.377778 0.785360 8.095795 412 H.-T. Chu, C.-C. Chen / Computers & Graphics 27 (2003) 407–414 lists the new IFS code W 0 for the fractal ‘‘dragon’’. Since BboxIFS(W, Epsilon, MaxLayer) Eq. (13) holds for all of affine mappings in W 0; we can f compute a tight bounding boxof the fractal ‘‘dragon’’ /nEach mapping w[i] in the IFS W is composed of sixcoefs: using Theorem 3. a½iŠ; b½iŠ; c½iŠ; d½iŠ; e½iŠ; f ½iŠ as equation-2*/ n / Calculate the initial BBox*/ S ¼ MaxðMaxðja½iŠj þ jb½iŠjÞ; Maxðjc½iŠj þ jd½iŠjÞ 3. The new algorithm E ¼ Maxðje½iŠjÞ F ¼ Maxðjf ½iŠjÞ As we have seen in the previous section, we are able to K ¼ðE þ FÞ=ð1-SÞ find a tight bounding boxof the attractor A of an affine Box ¼ðK; -K; K; -KÞ IFS W: Given a box B0 such that WðB0ÞAB0; we know IdentMap ¼½1; 0; 0; 1; 0; 0Š i n n n that the sequence fMðW ðB0ÞÞgi¼0 converges to the / Refine the BBox / minimum bounding box MðAÞ of the attractor A: while(1) i Thus W ðB0Þ with large i values will be close to MðAÞ: f Let the corners of B0 be b1; b2; b3; b4: Then the XMax ¼ XMaxAtLayerNðIdentMap; 1Þ supreme values of the x- and y-coordinates of points XMin ¼ XMinAtLayerNðIdentMap; 1Þ i i in W ðB0Þ will fall in W ðfb1; b2; b3; b4gÞ: Thus, we XMax ¼ YMaxAtLayerNðIdentMap; 1Þ i compute W ðfb1; b2; b3; b4gÞ to find the bounding XMax ¼ YMinAtLayerNðIdentMap; 1Þ i box MðW ðB0ÞÞ: However, the computation of NewBox ¼ðXmax; XMin; YMax; YMinÞ i W ðfb1; b2; b3; b4gÞ is expensive. It requires exponential if ðBox-NewBoxoEpsilonÞ time. For example, the computation for a tight break bounding box MðW 100ðfb1; b2; b3; b4gÞÞ of the fractal else ‘‘fern’’ in Table 3 needs to compute 4  4100 points Box ¼ NewBox (corners) which is not feasible by exhaustive computa- g tions. Fortunately, the computations for most of the return NewBox points are redundant, and can be reduced using the g following lemma. XMaxAtLayerN(CurMap, Layer) f 2 n Lemma 2. Let W ¼fR ; w1; w2; y; wng be an iterated / We need another set of mappings t[i] for the 2 n n n n function system of affine mappings in R : Let B0 be an combination of w w y w = arbitrary box and WðB0ÞDB0: Then if (CurMap has not been visited) i iÀ1 f wjðW ðB0ÞÞDwjðW ðB0ÞÞ; for iX1; j ¼ 1; y; n: for i ¼ 1ton ð16Þ f t½iŠ¼CurMapnw½iŠ Proof. This lemma is a natural extension of Theorem 3, apply the mapping t[i] to the four corners of Box, i iÀ1 i because W ðB0ÞDW ðB0Þ implies that wjðW ðB0ÞÞD denoted as t[i](Box) iÀ1 wjðW ðB0ÞÞ: & compute the max x-coordinates of t[i](Box), denoted as SubXMax[Layer][i] Fig. 5 shows a tree representation of computing g 2 W ðB0Þ: Let xmax1 be the maximum x-coordinate of g WðB0Þ that comes from one of the x-coordinates of else w2ðB0Þ: Then the x-coordinates of the points w1ðB0Þ f are all less than xmax1: Moreover, by Lemma 2, the ðXMax; iÞ¼MaxðSubXMax½LayerŠ½1Š; y; x-coordinates of points in w1WðB0Þ¼fw1w1ðB0Þ; SubXMax½LayerŠ½nŠÞ n w1w2ðB0Þ; y; w1wnðB0Þg are always less than xmax1; t½iŠ¼CurMap w½iŠ too. As a result, the computation of w1WðB0Þ may be Update t[i](Box) and SubXMax[Layer][i] 2 unnecessary for the supreme x-value of W ðB0Þ: There- g fore, we compute w2WðB0Þ first. Let xmax2 be the ðXMax; iÞ¼MaxðSubXMax½LayerŠ½1Š; y; maximum x-coordinate of w2WðB0Þ: If all of the x- SubXMax½LayerŠ½nŠÞ coordinates of the points w1ðB0Þ are still less than if ðLayer ¼¼ MaxLayerÞ return XMax xmax2; then it confirms the uselessness of computing SubXMax½LayerŠ½iŠ¼XMaxAtLayerNðt½iŠ; Layer þ 1Þ w1ðWðB0ÞÞ: On the contrary, we perform w1ðWðB0ÞÞ to ðXMax; jÞ¼MaxðSubXMax½LayerŠ½1Š; y; check whether xmax2 is still the supreme x-value of SubXMax½LayerŠ½nŠÞ 2 W ðB0Þ: In this way, we can build a dynamic program- return XMax ming algorithm as the following pseudocode. g H.-T. Chu, C.-C. Chen / Computers & Graphics 27 (2003) 407–414 413

B0 Layer-0

… w1(B0) w2(B0) wn(B0) Layer-1 ... … …

w1w1 (B0) w1w2 (B0) w1wn (B0) wnw1 (B0) wnw2 (B0) wnwn (B0) Layer-2 Fig. 5. Transformed sub-boxes of an initial bounding box for two layers.

Table 5 Computed areas of the proposed algorithm and Hart’s algorithm

Fractal Proposed bounding boxalgorithm Hart’s bounding ball algorithm

ðXmin; Xmax; Ymin; YmaxÞ Area value Origin ðX; YÞ; Radius Area value Dragon ðÀ6:20; 6:15; À0:21; 10:11Þ 127.45 (2.17, 4.31), 19.41 1183.59 Coral ðÀ4:95; 5:00; À0:10; 10:03Þ 100.79 (0.46, 5.01), 11.43 410.43 Fern ðÀ2:18; 2:66; 0; 10:00Þ 48.40 (0.03, 1.44), 9.28 270.55

Before we preform the function BboxIFS( ), we have systems. Firstly we compute a loose initial bounding box to verify if Eq. (13) holds for each mapping in the IFS by a simple equation. If the initial boxis not available, W: If there exists some mapping for which Eq. (13) does we have to decompose the iterated function system. not hold, we have to compute an equivalent IFS instead. Then we refine the bounding boxuntil a predefined For convenience, we compute the supreme values of x condition is reached. The computed bounding boxes are and y values separately in BboxIFS( ), and we only so tight that we can minimize the required space of represent the routine XMaxAtLayerN( ) here. The three drawing fractals. Using the bounding boxalgorithm, we other routines XMinAtLayerN( ), YMaxAtLayerN( ), have two choices. We only need to compute once the and YMinAtLayerN( ) are similar. The routine XMax- very tight bounding boxes with strict conditions (small AtLayerN( ) represents the structure of dynamic pro- epsilon and deep layers), the computed bounding box gramming for recursively computing the supreme values. can then be permanently associated with its IFS code. It’s noticeable that the computed values Sub- Or we can compute a bounding boxwith loose XMax[Layer][i] have to be saved for the use in the next conditions (larger epsilon and fewer layers) in real-time iteration. Only the mappings that provide current applications. supreme values are updated recursively.

4. Experimental results Acknowledgements

We have computed bounding boxes for the fractals The authors would like to express the deepest ‘‘dragon’’, ‘‘coral’’, and ‘‘fern’’ with the parameters gratitude to the anonymous reviewers for their valuable Epsilon ¼ 0:0001; and Maxlayer ¼ 100: For comparison, comments, which were very useful in improving the we have also computed the bounding balls for these presentation of this article. fractals using Hart and DeFanti’s algorithm. Table 5 lists the corners of the computed bounding boxes, the origins and the radii of the computed bounding balls. Also the Appendix. The proof of the success of the initial box B area values of these two kinds of bounding extent are 0 listed. The results show that the areas of the computed In Theorem 4, we give an upper bounding box B ¼ bounding boxes are much smaller than those of the ðÀK; K; ÀK; KÞ; and we claim WðB ÞCB holds. We bounding balls by using Hart and DeFanti’s algorithm. 0 0 have to show that for any point p ¼ðx; yÞAR2; À Kpx; ypK; then the x- and y-coordinates of WðpÞ lie in 5. Conclusion the interval ½ÀK; KŠ: That is, for any point ðx0; y0Þ¼q ¼ 0 0 wiðpÞ; i ¼ 1yn; À Kpx ; y pK: We have proposed an algorithm to compute the tight (a) We illustrate x0pK by using the notations as bounding boxes of the attractors of iterated function defined in Theorem 4. 414 H.-T. Chu, C.-C. Chen / Computers & Graphics 27 (2003) 407–414

0 _ x ¼ a x þ b y þ e and jxj K; E þðjaijþjbijÞF ðjaijþjbijÀSÞE i i i p ¼À À 1 À S 1 À S ‘ x0 ja jjxjþjb jjyjþje j; E þðja jþjb jÞF p i i i X À i i 1 À S 0 ‘ x p jaijK þjbijK þ E since jaijþjbijpSo1 81pipn; so ¼ðjaijþjbijÞK þ E ðja jþjb jÀSÞE i i X E þ F À 0 ¼ðja jþjb jÞ þ E 1 À S i i 1 À S E þ F ) x0X À ¼ÀK: ðja jþjb jÞðE þ FÞþEð1 À SÞ 1 À S ¼ i i 1 À S From (a) and (b), ÀKpx0pK is proved. Similarly, we 0 ðjaijþjbijÀSÞE þ E þðjaijþjbijÞF can show that ÀK y K: Thus we have proved the ¼ p p 1 À S transformed point q ¼ wiðpÞ is in the box B ¼ E þðjaijþjbijÞF ðjaijþjbijÀSÞE BoxðÀK; K; ÀK; KÞ; hence the condition WðB ÞCB ¼ þ 0 0 1 À S 1 À S holds. E þðjaijþjbijÞF p 1 À S References since jaijþjbijpSo1 81pipn; so

ðjaijþjbijÀSÞE p0 [1] Barnsley MF. Fractals everywhere, 2nd ed. New York: 1 À S Academic Press, 1993. E þ F [2] Bell S. Fractals: a fast, accurate and illuminating algorithm. ) x0p ¼ K: 1 À S Image and Vision Computing 1995;13(4):253–7. [3] Chu HT, Chen CC. A fast algorithm for generating fractals. (b) Similarly, we illustrate ÀK x0 as follows. p Proceedings ICPR’2000. Barcelona, Spain, 2000. p. 306–9. 0 _ x ¼ aix þ biy þ ei and jxjpK; [4] Monro DM, Dudbridge F. Rendering algorithms for deterministic fractals. IEEE and 0 ‘ x X ÀjaijjxjÀjbijjyjÀjeij; Applications 1995;15(1):32–41. [5] Hart JC, DeFanti TA. Efficient anti-aliased rendering of 3D 0 linear fractals. Computer Graphics 1991;25(4):91–100. ‘ x X ÀjaijK ÀjbijK À E [6] Canright D. Estimating the spatial extent of attractors of ¼Àðja jþjb jÞK À E i i iterated function systems. Computers and Graphics E þ F 1994;18(2):231–8. ¼Àðja jþjb jÞ À E i i 1 À S [7] Edalat A, Sharp DWN, While RL. An upper bound on the area occupied by a fractal. Proceedings ICASSP’95. 1995. ðja jþjb jÞðE þ FÞþEð1 À SÞ ¼À i i p. 2443–6. 1 À S [8] Rice J. Spatial bounding of self-affine iterated function ðja jþjb jÀSÞE þ E þðja jþjb jÞF ¼À i i i i system attractor sets. Proceedings of the Conference of 1 À S Graphics Interface GI’96. 1996. p. 107–15.