REAL-TIME TOOL FOR AFFINE TRANSFORMATIONS OF TWO DIMENSIONAL IFS FRACTALS ELENA HADZIEVA AND MARIJA SHUMINOSKA arxiv:1504.02744v1 s.gr 10 Apr 2015 Abstrat. This work introdues a novel tool for interative, real-time transformations of two dimensional IFS fratals. We assign baryentri oordinates (relative to an arbitrary affine basis of R 2 to the points that onstitute the image of a fratal. The tool uses some of the nie properties of the baryentri oordinates, enabling any affine transformation of the basis, done by lik-and-drag, to be immediately followed by the same affine transformation of the IFS fratal attrator. In order to have a better ontrol over the fratal, as affine basis we use a kind of minimal simplex that ontains the attrator. We give theoretial grounds of the tool and then the software appliation. 1. Introdution One of the simplest ways of reating fratals is by means of iterated funtion systems (IFSs. Generally, the IFS an be defined on any omplete metri spae, but for the purposes of this paper we will restrit our disussion to the two-dimensional real spae R 2. In this setion we will go through the basi definitions, given in 3, 10. The transformation defined on R 2 of the form w(x = A x + b, where A is 2 2 real matrix and b is a two-dimensional real vetor, is alled a (two-dimensional affine transformation. The finite set of affine ontrative transformations, {w 1, w 2,..., w n } with respetive ontrativity fators s i, i = 1, 2,..., n, together with the Eulidean spae (R 2, d E is alled (hyperboly iterated funtion system (IFS. Its notation is {R 2 ; w 1, w 2,..., w n } and its ontrativity fator is s = max{s i, i = 1, 2,..., n}. Sine (R 2, d E is a omplete metri spae, suh is (H(R 2, h(d E, where (H(R 2, h(d E is the spae of nonempty ompat subsets of R 2, with the Hausdorff metri h(d E derived from the Eulidean metri d E (3. It an be shown that if the hyperboli IFS {R 2 ; w 1, w 2,..., w n } with the ontrativity fator s is given, then the transformation W defined on H(R 2, by W (B = n i=1w i (B, B H(R 2 2010 Mathematis Subjet Classifiation. 28A80, 65D17. Key words and phrases. IFS, fratal, affine transformation, baryentri oordinates, real-time tool. 1
2 ELENA HADZIEVA AND MARIJA SHUMINOSKA is a ontration mapping with the ontrativity fator s. Aording to the fixed-point theorem, there exist a unique fixed point of W, A H(R 2, alled the attrator of the IFS, that obeys W (A = A = lim n W (B, for any B H(R 2. (Note that there are weaker onditions under whih the attrator of an IFS an be obtained - the IFS need not to be ontrative, see 4. Two algorithms are used for the visualization of an IFS attrator, deterministi and random (the last is also alled haos game algorithm. In this paper we onstrut the images of the attrators with the seond, more effiient algorithm. Our primary target in this paper will be fratal attrators, sine there is no interative, real-time tool for their modeling, to the best of our knowledge.. The rest of the paper is organized in four setions: Related Artiles, Theoretial Grounds of the Tool, The Tool and its Appliation, Conlusions and Future Work. 2. Related Artiles Barnsley et al., in 5, 6 define the fratal transformation as mapping from one attrator to another, using the top addresses of the points of both attrators and illustrate the appliation in digital imaging. Although not user friendly, not real-time and not ontinuous (they are ontinuous under ertain onditions, these transformations, have a lot of potential for diverse appliations. In 7 the oordinates of the points that ompose the fratal image are determined from the IFS ode and then the IFS ode is modified to obtain translated, rotated, saled or sheared fratal attrator, or attrator transformed by any affine transformation as the omposition of aforementioned transformations. To make a new transformation, another IFS ode has to be onstruted. In 8, Darmanto et al. show a method for making weaving effets on tree-like fratals. They make a loal ontrol of the branhes of the tree, by hanging a part of the IFS ode. The ontrol over the hange of the attrator depends on the experiene of the user for prediting how the modifiation of the oeffiients in the IFS ode will hange the tree-like fratal. Compared to the methods for transforming fratals in the ited papers, our tool is user-friendly, real time, relatively fast and relatively low memory onsuming. It enables a ontinuous affine transformation of an arbitrary IFS attrator. The idea for modeling fratals, i.e. their preditive, ontinuous transformation, where baryentri oordinates are involved, is exposed in 12,13, 1, by means of, so-alled Affine Invariant Iterated Funtion Systems - AIFS. The IFS ode is transformed into AIFS ode whih involves baryentri oordinates. The method that we propose is also based on baryentri oordinates, but no transformation of the IFS ode is needed. Also, Koi et al. in 14 propose the use of, so alled minimal anonial simplex, for better ontrol of the attrator (for 2D ase, minimal anonial
REAL-TIME TOOL FOR AFFINE TRANSFORMATIONS OF TWO DIMENSIONAL IFS FRACTALS3 simplex is the isoseles right-angled triangle with the minimal area that ontains the attrator and whose atheti are parallel to the x and y axes. In 2 the authors prove a theorem for existene and uniqueness of suh minimal anonial simplex. It is the limit of the Cauhy sequene of the minimal simplexes of the n-th preattrator when n approahes to infinity, in the omplete metri spae (H(R m, h(d E. (The n-th preattrator in this paper is defined as the set obtained after n iterations of the haos game algorithm. 3. Theoretial Grounds of the Tool Baryentri oordinates of points (and vetors promote global geometrial form and position rather than exat oordinates in relation to the origin/axes. Thus, the geometri design done by the use of baryentri oordinates an be alled oordinate-free geometri design. The set of the three points {A, B, C} is said to be affine basis of the affine spae of points R 2 if the set { AB, AC} is a vetor base of R 2, observed as a vetor spae (11. We say that the point M has baryentri oordinates (a, b, relative to the basis {A, B, C}, where a + b + = 1, and we write M = aa + bb + C (1 if and only if one of the following three equivalent onditions holds: AM = b AB + AC BM = a BA + BC CM = a CA + b CB We will give the relations between the baryentri oordinates relative to the given basis {A, B, C} and the retangular oordinates of an arbitrary point from R 2. Suppose that the arbitrary point M and the three basis points A, B and C have retangular oordinates (x, y, (a 1, a 2, (b 1, b 2 and ( 1, 2, respetively. Then the relation (1 an be rewritten in the following form x a1 b1 1 = a + b +, (2 y a 2 b 2 2 or, in matrix form x y a1 b = 1 1 a b. a 2 b 2 2 By rearranging the last matrix equation, we obtain more suitable form for further manipulations: x y = a 1 b 1 1 a 2 b 2 2 a b. (3 1 1 1 1
4 ELENA HADZIEVA AND MARIJA SHUMINOSKA The relation (3 defines the onversion of the baryentri oordinates relative to the affine basis {A, B, C} into the retangular oordinates. Let us denote the 3 3 matrix by T to indiate triangle. The inverse onversion an be easily get, by simple multipliation of (3 by the inverse of T (whih exists, sine {A, B, C} is an affine basis. That is, the onversion of the retangular oordinates into the baryentri oordinates relative to the basis {A, B, C} is defined by the relation a b = T 1 x y 1, (4 whih after alulating the inverse of T, an be expressed in its expliit form, a b = 1 b 2 2 1 b 1 b 1 2 b 2 1 2 a 2 a 1 1 a 2 1 a 1 2 x y, (5 det T a 2 b 2 b 1 a 1 a 1 b 2 a 2 b 1 1 where det T = a 1 b 2 b 1 a 2 + b 1 2 1 b 2 + 1 a 2 a 1 2 0. Baryentri oordinates have two other names: affine and relative oordinates. Affine, sine they are related to an affine basis, and relative, sine they define relative positions in the plane/spae. Namely, if we onsider a set of points with given baryentri oordinates relative to the basis {A, B, C} and we affinly transform the basis into the basis {A, B, C }, then the set of points having the same baryentri oordinates, but now relative to the basis {A, B, C }, will keep the relative geometry, i.e. will be transformed by the same affine transformation. Note that any hange of one affine basis to another, defines a unique affine transformation. Sine the image of the attrator, generated by the random algorithm is a finite set of points, we will use the aforementioned property of the baryentri oordinates to affinly transform the IFS fratal. 4. The Tool and Its Appliation Our real time, user-friendly tool is written in C# programming language using the Visual Studio 2013. It allows both on-lik definition of the triangle and definition by speifying the triangle s verties diretly in the ode, with their retangular oordinates. When the affine base is defined, the image of the fratal is reated (relative to the triangle and ready for transformation. Triangle s verties are moved by drag and drop option of the ursor. When the ursor is plaed over the verties, it has a hand shape, otherwise its shape is ross. The affine transformations of the triangle, immediately followed by the same affine transformation of the fratal image, are visible in real time, in the oordinate system of the window. We will show the superiority of our tool on two examples of fratal attrators, the so alled flower and maple. In order to get learer image of the attrator, we neglet the first 14 points and start to plot from the 15-th point.
REAL-TIME TOOL FOR AFFINE TRANSFORMATIONS OF TWO DIMENSIONAL IFS FRACTALS5 Note that, by default, the origin of the oordinate system of the window is loated at the top-left orner of the window, with positive diretions: to the right for the x-axis and down for the y-axis. Example 1. The IFS {R 2 ; w 1, w 2 }, whose attrator is the flower fratal, is defined by the following ontrative mappings w i : x A i x + b i, i = 1, 2: 0.47 0.30 A 1 = 0.30 0.47 0.48 0.29 A 2 = 0.29 0.48, b 1 =, b 2 = 0.37 1.74 0.34 1.75 Figure 1 (a, b, depits that the arbitrary ontrol triangle is defined on-lik. When moving its vertexes by lik-and-drag, the fratal attrator appropriately responds to the transformations done over the triangle. Example 2. The attrator of the IFS {R 2 ; w 1, w 2, w 3, w 4 }, where the mappings w i : x A i x + b i, i = 1, 2, 3, 4, are defined by ;. 0.04 0 0.08 A 1 =, b 0.23 0.65 1 = 0.26 0.61 0 0.07 A 2 =, b 0 0.31 2 = ; 3.5 0.65 0.29 0.74 A 3 =, b 0.3 0.48 3 = ; 0.39 0.64 0.3 0.56 A 4 =, b 0.16 0.56 4 = ; 0.60 is the fratal alled maple. We omputed the oordinates of the verties of the minimal anonial simplex for this fratal and used the verties as an affine basis. Suh affine basis ensures better ontrol over the attrator (14, 2, see Figure 2. We examined reation of the shadow or wind effet for the maple tree, throughout d to f on this figure. 5. Conlusions and future work We sueeded in reating a real-time and user-friendly tool for interative modeling of IFS attrators, with fous on fratal attrators. To the best of our knowledge, this is the first real-time interative tool for modeling fratals. The tool is very effiient beause it is relatively low memory and time onsuming. We foresee a great appliation of our tool, sine all images oded by an IFS ode an be affinly transformed aording the user needs, only by lik-and-drag. These are the first steps in fratal modeling with our tool. There is muh more to be done to enhane the tool s performanes. For instane, inluding a ontrol polygon of more than three points. Moreover, it would be very effiient to use the onvex hull of the attrator as a ontrol polygon. In the last ase the ontrol over the global hanges of the attrator will be maximal. ;
6 ELENA HADZIEVA AND MARIJA SHUMINOSKA Inluding loal ontrol would be also useful for satisfying the sophistiated needs of the users. Finally, expanding the tool over 3D IFS attrators will bring higher pratial importane to the tool. Referenes 1 E. Babae: Iterated Funtion System with Affine Invariane Property (in Maedonian, PhD Thesis, Faulty of Natural Sienes and Mathematis, University Ss. Cyril and Methodius, Skopje, R. Maedonia, 2009 2 E. Babae, Lj. M. Koić : Minimal Simplex for IFS Fratal Sets, NAA 2008, Leture Notes in Computer Siene 5434, pp.168-175, Eds.: S. Margenov, L. G. Vulkov, J. Wasniewski, Springer-Verlag Berlin Heidelberg, 2009 3 M. F. Barnsley: Fratals everywhere, Aademi Press, 1988 4 M. F. Barnsley, A Vine: The Chaos Game on a General Iterated Funtion System, Ergodi Theory Dynam. Systems 31, no. 4, 1073-1079, 2011 5 M. F. Barnsley, B. Harding: Fratal Transformations in 2 and 3 Dimensions, arxiv:1308.6648v1, 30 Aug 2013 6 M. F. Barnsley, T. Harding, K. Igudesman, How to transform and Filter Images Using Iterated Funtions Systems, SIAM Journal of Imaging Sienes,vol. 4, no. 4, pp 1001-1028, 2011 7 H. T. Chang: Arbitrary affine transformation and their omposition effets for twodimensional fratal sets, Image Vision Comput. 22 (13, 1117-1127, 2004 8 T. Darmanto, I. S. Suwardi, R. Munir: Weaving Effets in Metamorphi Animation of Tree- like Fratal based on a Family of Multi-transitional Iterated Funtion System Code, Computer, DOI: 10.1109/IC3INA.2013.6819150 Conferene: The International Conferene on Computer, Control, Informatis and its Appliations 2013 (IC3INA 2013, At Jakarta, Indonesia, Volume: I 9 T. D. DeRose: Three-Dimensional Computer Graphis, A oordinate-free Approah (manusript, University of Washington, 1992 10 K. J. Faloner: Fratal Geometry. Mathematial foundations and Appliations, John Wiley and Sons, 1990 11 J. Gallier: Geometri Methods and Appliations For Computer Siene and Engineering, Springer - Verlag, TAM Vol.38, 2000 12 Lj. M. Koić: AIFS - a Tool for Biomorphi Fratal Modeling, Nonlinear Dynam., Psyhology Life Si. 5, no. 1, 45-63, 2000 13 Lj. M. Koić, A. C. Simonelli: Towards free-form fratal modelling, In: Mathematial Methods for Curves and Surfaes II, M. Daehlen, T. Lyhe and L. L. Shumaker (eds., pp. 287-294, Vanderbilt University Press, Nashville (TN., 1998 14 Lj. M. Koić, L. Stefanovska, E. Babae: AIFS and the Minimal Simplex Problem, Proeedings of The International Conferene of Differential Geometry and Dynamial Systems, 5-7.10.2007, Buharest, Romania, pp.119-128, 2008 University St. Paul the Apostle, Partizanska bb, Ohrid, Maedonia E-mail address: elena.hadzieva@uist.edu.mk University St. Paul the Apostle, Partizanska bb, Ohrid, Maedonia E-mail address: marija.shuminoska@se.uist.edu.mk
REAL-TIME TOOL FOR AFFINE TRANSFORMATIONS OF TWO DIMENSIONAL IFS FRACTALS 7 a e b d f Figure 1. a Drawing point A; b Drawing point B; Drawing point C and the fratal; d Moving point B, after point C is moved; e Moving point A; f Moving point C.
8 ELENA HADZIEVA AND MARIJA SHUMINOSKA a e b d f Figure 2. a Creating simultaneously the minimal anonial simplex and the fratal relative to the simplex; b Moving point B; Moving point C; d Moving point A; e Moving point C; f Moving point C further.