Logo by Trifox - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. November 29, 2025, 07:30:26 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: How do you create an affline transformation?  (Read 5944 times)
Description: Sounds silly, but read on, I'll explain what I mean
0 Members and 1 Guest are viewing this topic.
Nomad
Guest
« on: April 25, 2012, 06:20:09 PM »

I am following the classic Fractal Flame white paper by Draves and Reckase (http://flam3.com/flame.pdf) with the goal of understanding what I'm doing.  I've been writing a program to make the flame renders but have already been stumped by something that must be so trivial.

In the paper it's mentioned that an affline transformation is applied to x and y, and the affline function takes the form of f(x,y) = (ax + by+ c, dx + ey + f).  This transformation to the input and the coefficent values (a thru f) seem critical but I can't figure out how I'm supposed to generate values for a thru f, are they random, random on the bi-unit cube, is there somewhere I could read more about this? 

I am familiar with affline transformations in regards to more modern rendering APIs (i.e. glTranslate*, etc).  Is it the case that I apply a random number of random transformation matrices?  That would build my 2x3 matrix of my coefficient values and allow me to transform x and y, but it seems so arbitrary and completely unspoken in the paper.  I feel like that guess is a little too far out there.

Thanks
Logged
lkmitch
Fractal Lover
**
Posts: 238



« Reply #1 on: April 25, 2012, 07:21:03 PM »

Generally, the matrix [[a, b] [c, d]] should be contractive, which means that its determinant has a magnitude less than 1.  These coefficients determine scaling, rotation, shearing, and flipping.  The other 2 coefficients, e & f, are translations.  So, the set of coefficients can be determined with an eye to what you want that particular transformation to accomplish.  In this regard, its similar to an IFS system.
Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #2 on: April 25, 2012, 09:48:33 PM »

I am familiar with affline transformations in regards to more modern rendering APIs (i.e. glTranslate*, etc).  Is it the case that I apply a random number of random transformation matrices?  That would build my 2x3 matrix of my coefficient values and allow me to transform x and y, but it seems so arbitrary and completely unspoken in the paper.  I feel like that guess is a little too far out there.

Thanks

It can take a while to get your head around plain IFS never mind flames.

The best option is to look at the IFS versions of classic 2D fractals - Sierpinski triangle. Manger Carpet etc. and try to follow how the application of the transforms works.
The thing to remember is that the easiest visualisation of the results is not by considering the chaos-game render method but rather the deterministic method - here you start with a point on the fractal and perform the whole tree of transforms to a given depth plotting each point - the chaos game method was suggested by Michael Barnsley when he realised that any sequence of the particular transforms will produce points on the attractor and if controlled correctly simple random selection would build the "complete" result over time.
The difference between the deterministic method and the chaos game is that the deterministic method provides very rigid control over the resolution of the image produced whereas the chaos game is generally a little more "lax" and unless the random generator used is near perfect, often reveals bias in the results e.g. one corner of a Sierpinski being less dense than another.

So for a 3-transform fractal such as the Sierpinski Triangle, the tree of transforms for a deterministic render would be a little like this:

                                                                                     start p
                                   p0                                                 p1                  p2
         p00                    p01                     p02            p10   p11    p12       p2x
p000  p001 p002  p010 p011 p012  p020 p021 p022  p10x  p11x  p12x     p2xy
etc.

Note that I've abbreviated the branching/nodes of the tree to the right simply as it doesn't fit otherwise wink
Of course with a standard IFS of n transforms there are n^d nodes at each depth d.

Also understanding affine transforms that don't involve rotations or skews is fairly easy, what happens when rotations are added is somewhat more complicated wink
See: http://www.meden.demon.co.uk/Fractals/

Also for IFS involving transforms of differing scale then the depth to go down each branch of the IFS tree in deterministic rendering to produce an image to a constant resolution/density depends on the scales involved - analogous to the random weightings used to produce consistent/correct results when using the chaos game method.

Also I now personally prefer rendering even IFS using the escape-time method (i.e. reversing the usual IFS transforms) as this is far simpler to convert to OpenGL/OpenCL/CUDA etc. - the drawback being that the stadard "flame" colouring method is far from easy to do this way, though something similar is not impossible wink


Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #3 on: April 25, 2012, 10:04:46 PM »

@dave is there a tutorial on the det. Method? I still dont get it and i would be interested in how results look?
Is it like just points belonging to the set are returned like the black area of the brot?
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Nomad
Guest
« Reply #4 on: April 25, 2012, 11:02:41 PM »

Generally, the matrix [[a, b] [c, d]] should be contractive, which means that its determinant has a magnitude less than 1.  These coefficients determine scaling, rotation, shearing, and flipping.  The other 2 coefficients, e & f, are translations.  So, the set of coefficients can be determined with an eye to what you want that particular transformation to accomplish.  In this regard, its similar to an IFS system.

From my understanding of the white paper I need know a, b, c, d, e, and f to be able to generate a flame (as described in the paper), the paper does mention the convenience of contractive transformations.  How would I find the values of a, b, c, and d without a guess-and-check strategy (find random values within a logical range; check if det(matrix) >=1; repeat)?

If I'm reading what you wrote correctly, the idea is to find 1 set of coefficients (for all a thru f) and just use that.  From my reading of the paper I thought the affline transform was generated and then applied each iteration, as in the pseudo-code it falls within the loop.  But maybe it means you apply the same affline transform each iteration and then pick a variation.  That might be where I went askew (affline xform pun!)

Thanks!
Logged
Nomad
Guest
« Reply #5 on: April 25, 2012, 11:26:38 PM »

It can take a while to get your head around plain IFS never mind flames.

The best option is to look at the IFS versions of classic 2D fractals - Sierpinski triangle. Manger Carpet etc. and try to follow how the application of the transforms works.
The thing to remember is that the easiest visualisation of the results is not by considering the chaos-game render method but rather the deterministic method - here you start with a point on the fractal and perform the whole tree of transforms to a given depth plotting each point - the chaos game method was suggested by Michael Barnsley when he realised that any sequence of the particular transforms will produce points on the attractor and if controlled correctly simple random selection would build the "complete" result over time.
The difference between the deterministic method and the chaos game is that the deterministic method provides very rigid control over the resolution of the image produced whereas the chaos game is generally a little more "lax" and unless the random generator used is near perfect, often reveals bias in the results e.g. one corner of a Sierpinski being less dense than another.

So for a 3-transform fractal such as the Sierpinski Triangle, the tree of transforms for a deterministic render would be a little like this:

                                                                                     start p
                                   p0                                                 p1                  p2
         p00                    p01                     p02            p10   p11    p12       p2x
p000  p001 p002  p010 p011 p012  p020 p021 p022  p10x  p11x  p12x     p2xy
etc.

Note that I've abbreviated the branching/nodes of the tree to the right simply as it doesn't fit otherwise wink
Of course with a standard IFS of n transforms there are n^d nodes at each depth d.

Also understanding affine transforms that don't involve rotations or skews is fairly easy, what happens when rotations are added is somewhat more complicated wink
See: http://www.meden.demon.co.uk/Fractals/

Also for IFS involving transforms of differing scale then the depth to go down each branch of the IFS tree in deterministic rendering to produce an image to a constant resolution/density depends on the scales involved - analogous to the random weightings used to produce consistent/correct results when using the chaos game method.

Also I now personally prefer rendering even IFS using the escape-time method (i.e. reversing the usual IFS transforms) as this is far simpler to convert to OpenGL/OpenCL/CUDA etc. - the drawback being that the stadard "flame" colouring method is far from easy to do this way, though something similar is not impossible wink


David, thanks for the reply.  I did get the Sierpinski triangle rendering using the chaos method as it's given as an example in the white paper.  In that experiment I had three transforms to pick from, being a chaos method I only applied one then moved on.  So if I were doing the deterministic method you described then I would attempt to apply each until a max depth (max depth 3: xform1->xform1->xform1:plot; xform1->xform1->xform2:plot; etc), does that seem  right?  (Conceptually I see this as a depth first tree search, once the tree is exhausted you are done.)

The escape time method does seem useful, if you use it under the chaos game would it work in the same manner?  Seems like it could, but I can't quite visualize the results without trying it.

I appreciate your time replying, thank you.
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #6 on: April 26, 2012, 12:46:59 AM »

@nomad the 6 parameters ( a,b,c,d,e,f) stand for the standard IFS fractal, with which the for example the fern fractal can be modelled (got that? please ask!)
the whole thing about the flame algorithm is: "do not just use affine transformations, allow all transformation..." <- this is it ... but: "...and as a hint take care that
those functions do show a contractive behaviour ( for mathematicians: determinant of matrix>0 ) with that is meant that scale functions lead
to smaller copies, e.g. scale 0.999 ... and btw, it is the linear component that makes it chaotic wink )

Logged

---

divide and conquer - iterate and rule - chaos is No random!
Nomad
Guest
« Reply #7 on: April 26, 2012, 03:32:48 AM »

I think I'm starting to get my head wrapped around this.  Forgetting the 'flame' part of this, generating an IFS fractal seems to be the process of finding 1 or more affline transformations and applying a coordinate (or n-tuple, I guess they aren't 2d limited) to the transform(s) a number of time, as in an assigned 'depth'.  And as mentioned if it's not a contractive transform then the result will likely run away (as it's being iterated many many many times).  And really depending on the transform(s) you get different visually identifiable shapes (like ferns, Sierpinski manifolds, Menger sponges, etc, etc)

With all that said (and please correct anything that is incorrect), the "problem" I had with the flame paper was that it's referencing these infinite number of possible affline transformation sets in a general form.  So for me to continue working through the flame white paper I need to identify a method for discovering the parameters (a,b,c,d,e,f).  I think the easiest way for me to do that is to use some basic matrix manipulation and simple basic affline transformations.

Rotation would be a=cos(t), b=sin(t), c=0, d=-sin(t), e=cos(t), f=0. t = radians of rotation
Scale would be a=s, b=1, c=0, d=1, e=s, f=0. s is scale value (<0.999...)

It should then be possible to apply both transforms in one iteration (if desired) and continue as any normal IFS.  To be clear I'm thinking 't' and 's' would need to be constant... or the results would be... funky.

Does that sound about right?  If so, I think I understand enough now to continue on my efforts to work through that flame paper.


 
Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #8 on: April 26, 2012, 05:05:47 AM »

@dave is there a tutorial on the det. Method? I still dont get it and i would be interested in how results look?
Is it like just points belonging to the set are returned like the black area of the brot?


Well it's really straightforward - you start with a point on the attractor - this can usually be gotten by solving p=p.T for x and y where p is (x,y) and T is any one of the transforms in the IFS/flame.
Then you apply all n transforms to this giving n new points p.T1, p.T2....p.Tn and plot them (obviously using the #hits method for flames).
Now repeat for *all* the new points giving p.Ta.T1 through p.Ta.Tn where Ta is each of the 1st depth transforms.
The only other important piece of information is to consider the scale change at each depth for each separate branch - the greater the reduction in scale the sooner you can prune the branches of the tree and to a finite resolution there's a given depth for all transforms provided they're contractive.
e.g. if you have 3 transforms in an IFS one of scale 0.8, one of scale 0.5 and one of scale 0.3 and you need an overall scale factor of 0.1 for the resolution you want for the final image then on the branch where you only perform the first transform would need to go down to depth 11 (for an overall scale of 0.8^11) on the branch using only the second transform with scale 0.5 you'd need to go down to depth 4 (for an overall scale of 0.5^4) and for the branch using only the third transform with scale 0.3 you'd only need to go to depth 2 i.e. overall scale 0.3^2.
All the rest of the tree would require various depths between these values depending on the applied transforms on each branch at each depth.

The required depth for a given detail level on a given fractal depends on the dimensionality of the math (i.e. 2D for x,y, 3D for x,y,z etc.) and the actual fractal dimension of the fractal itself - the lower the fractal (Hausdorf) dimension of the IFS then the less far down the tree we need to go - it's possible to compute the fractal dimension of an IFS correctly as follows:

D = log(s0)/log(p0) = log(s1)/log(p1) =.....log(sn)/log(pn)

where p0+p1+...+pn=1

Where s0 to sn are the scales and p0 to pn are the probabilites that would be used in the chaos game - solving the above gives the probablities and the dimension D which can then be used to control the depth in the deterministic method by giving the required overall scale factor based on the dimension, the pixel resolution and the zoom/magnification.

I hope that helps, don't have time to give more detail atmo....

Edit: Apologies but this is just "off the top of my head", I've just corrected the above by adding the log()s - also it's possible I may have the scale/probability equation the wrong way up i.e. it maybe should be probability/scale but I guess if it gives a dimension >1 for the cantor set then you'll know it's upside-down wink
« Last Edit: April 26, 2012, 05:13:54 AM by David Makin » Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #9 on: April 26, 2012, 05:09:00 AM »

@Nomad Just to add that most implementations of IFS and flame fractals allow either user input via the raw a,b,c,d,e,f values or by defining rotations, scales, skews and translations for the transforms such that the program converts these to a single affine matrix.
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Nomad
Guest
« Reply #10 on: April 26, 2012, 06:37:03 AM »

@Nomad Just to add that most implementations of IFS and flame fractals allow either user input via the raw a,b,c,d,e,f values or by defining rotations, scales, skews and translations for the transforms such that the program converts these to a single affine matrix.

Thanks for the info.  That makes sense, I should probably go download and play with some flame generating programs.
Logged
Nomad
Guest
« Reply #11 on: April 26, 2012, 06:39:30 AM »

Thanks to everyone for the help and insight.  I feel much better about how this works.
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
create 3D fractal using images? 3D Fractal Generation teamfresh 10 7443 Last post March 26, 2010, 01:13:43 AM
by Fractal_Artist
How to create 'unique' fractal art with M3D (or how not to) Mandelbulb 3d « 1 2 » kameelian 16 15395 Last post April 28, 2012, 02:04:19 AM
by PhotoComix
call for help, to create international subtitles for chaosTV production cKleinhuis 7 2940 Last post August 10, 2012, 07:24:09 PM
by GFWorld
Software to create Julia Set Columns in 3d Mandelbrot & Julia Set slinker 1 12679 Last post October 08, 2017, 11:45:11 PM
by Spain2points
Do z-->z/c² or z-->z*c² create a fractal General Discussion « 1 2 » Chillheimer 21 15972 Last post May 28, 2017, 09:49:27 AM
by Adam Majewski

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.283 seconds with 27 queries. (Pretty URLs adds 0.01s, 2q)