Wacław Franciszek Sierpiński was a polish Math-magician - aka Grand Master of set theory, Senior Warlock of number theory, dude who liked fractals - and school teacher.
He is best know for "Sierpinski's triangle" (in 3D its called Sierpiński tetrahedron)
his carpet -also related to Sierpiński Sponge or Menger's Sponge when in 3D.
his arrowheadcurve
and hispentagon O_O
*He also got to be on a coin, which is pretty cool.*
These beauties are known as iterated function systems or IFS, and we will be looking at how we can build some self-similar fractals using Softimage ICE in this post. **All these IFS have fixed Attractors.**
Some fractal Terminology...
Iterated Function System:
A finite set of contraction maps for , 2, ..., , each with a contractivity factor , which map a compact metric space onto itself. It is the basis for fractal image
compression techniques.
Self-similarity:
An object is said to be self-similar if it looks "roughly" the same on any scale.
Attractor:
Each consists of affine transformations
involving
rotations, translation and scaling by a constant ratio, where
applicable. It can also be divined as the smallest unit which itself
cannot be decomposed into two or more attractors.
L-Systems:
A Lindenmayer system, also known as an L-system, is a string writing system that can be used to generate fractals
with dimensions between 1 and 2.
Sierpinski's triangle
To create this fractal you need the following things:
1. repeat on counter node
2. clone point node
3. basic kind of loop *Just a note, this is a really render and ram intensive way of doing any fractal, but it is cool if you just want to get your head around the math of L-Systems*
In Image A you will see that I have two parts to my setup. Part one is adding a single point to a pointcloud, and part two which I call the I.F.S is where that point gets cloned and repeated for the fractal. This is the basic setup for all four of Sierpinski's fractals shown above.
Image A
*click on image to make bigger* To start add a single point to an empty pointcloud at the origin. As shown in Image B. Make that point into a cone or create your own triangle and use that as an instance shape. The scale of the triangle/cone 10, 10, 10. *Its easier to see the small iterations when the first triangle is nice and big*
Image B - Attractor NODE
*click on image to make bigger*
After that you will need to setup the tree shown in Image C. Here is where it gets interesting, to build the ICE tree shown in Image C you will have to build all the trees in images C1, D and E. In the cast of Sierpinski's triangle, the first Iteration on the Repeat with counter node will produce 3 clones of the original triangle - you want to turn on the delete source if cloned option - and then 9 triangles by the second iteration and so on.
Image C - IFS_Triangle NODE
*click on image to make bigger*
What the Log node - Image D - does is translate the new triangles so that they fit inside the original triangle. We do this with the help of the point ID's and a select case node, run by a loop.
Image D - log 3 NODE
*click on image to make bigger*
The translate local point - Image C1 - node makes sure that the previous point position gets calculated as well as the new point position. *I got this useful little node from doing Chris Marshall'stutorial on a tree.*
Image C1 - Translate local points NODE
*click on image to make bigger*
In Image E we subtract the Point ID by one so that it starts with zero as a value just like the select case node. Then we feed it through the modulo node to be modulated by the number 3 - number of clones in IFS.
In Image F you can see the ram usage and render time if your on an Iteration step of 12 with 531 441 triangles in your scene. I'm totally looking into ways of speeding this up. My poor laptop can't really handle this much ram going to a render.
Image F
*click on image to make bigger*
Sierpinski's Triangle
Sierpinski's Tetrahedron
Sierpinski's Carpet
Once you've mastered the Triangle feel free to try and make his carpet as well. Image AA and AB shows the log and scale for that. Start with a Box with a scale of 10 and then fit 8 new boxes to the side facing the X translation.
Image AA
*click on image to make bigger*
Note the difference in the scale being 0.667 instead of 0.5 like with the triangle
Image AB
*click on image to make bigger*
This one is even worse on the ram side but really nice looking.
Image AC
*click on image to make bigger*
Sierpinski's Carpet
Sierpinski's Sponge
Sierpinski's Arrowhead
The arrowhead is really interesting because you don't just work with the center point position like you did with the triangle and the carpet, you now work with the starting point 0, 0 - the root of the cylinder - and the end position 0, 1 - the tip of the cylinder, like with the triangle you will have a Log of 3 here, but now you also have to deal with the orientation of the cylinders.
Start with a single cylinder that is rotated to lay horizontally with a scale of 5, 10, 1. Now just build Image BA and BB into the IFS node.
Image BA
*click on image to make bigger*
The scale for this one is also 0.5 just like the triangle.
Image BB
*click on image to make bigger*
This one becomes really heavy after 12 iterations couldn't even render it... Image BC
*click on image to make bigger*
Sierpinski's Arrowhead
Sierpinski's Pentagon
To make the beautiful pentagon you will need to make a pentagon and the use the instance shape node to add it to your point in your pointcloud. This one is a weird one... It has a log with 5 clones and a scale of 0.618 but it also has an offset of sorts.
Image CA
*click on image to make bigger*
The offset comes in with the 5 sides of the pentagon being in strange places : / See Image CB for the strangeness.
Image CB
*click on image to make bigger*
All of them seem to come in at around 2 to 4 min a frame with anything from 600mb to 1700mb of ram usage.
I know, I know fractals have been done to death and all that - but I like them so - I'll be playing with fractals a bit too :D
I started with a simple - or at lest what I thought would be simple - 90 degree angle fractal that just scales from big to small....
It was interesting getting the right-angles because of the iteration step, here's that ICE Tree on the rotation stuff.
*click to make bigger*
But all and all I was quite happy with this exercise. It showed me just how little I understand about fractals so obviously after that....
... I went and made a tree...
*click to make bigger*
*click to make bigger*
Yeah, that was fun but still....
what are fractals really anyway? Are there rules? What makes a fractal a fractal and not just some pretty pattern?
Wikipedia says : Fractals are typically self-similar patterns, where self-similar means they are "the same from near as from far". Fractals may be exactly the same at every scale, or, they may be nearly the same at different scales. The definition of fractal goes beyond self-similarity per se to exclude trivial self-similarity and include the idea of a detailed pattern repeating itself.
I for one will be posting loads more on fractals as I play with them :D
For some cool stuff on fractals and doodling click on the triangle below...
Continuing on with the calculating of area... lets look at triangles.
There are tons of ways to get the area of a triangle so.....
Here is a link to wikipedia's section on Triangles .
I went with Heron's Formula, simply because I had all the edge/side lengths worked out already. Here is what my scene looks like...
*click to make bigger*
I drew a linear curve with three points for my triangle.
The black value(area=√( s(s-a)(s-b)(s-c) )) is the area of the triangle, the orange value(cos C = (a^2 + b^2 - c^2)/2ab) is the corner angle of Point_02_Null. The light green value(s = (a+b+c)/2) is half the length of the perimeter of the triangle.
Lets go look at all this in ICE.
To start I made a little cluster to null constraint so I could move the triangle points around freely. I named them Point_01_Null, Point_02_Null and Point_03_Null. *something to keep in mind is that one of your points will be numbered 0, and be on 0,0,0. I just moved mine off the origin. In the wikipedia they go into a whole section on this.*
Here's what that constraint looked like in ICE.
Then I worked out the length and center of the three sides.
Side A, B and C letters where stuck too the curve by a standard Softimage constrain between two points.
Using a linear blend between the two nulls was the fastest why to get the center point on the curves
Using the distance between node, I got all three sides lengths and then added them together to get the perimeter of the whole triangle.
Here's what the inside of the compound "length of C" looks like....
Next I tested the side lengths with the curve length to see if the perimeters matched up.
Now I could work out the angles of the triangle using the law of cosin:
cos C = (a^2 + b^2 - c^2)/2ab
Here's what the ICE tree looks like... *note I had the to use ArcCos to get the right answer*
Last I worked out the Area of my triangle using Herons Formula.
This formula has two parts to it, the first being: (s = (a+b+c)/2 which gets half of the perimeter, and then area=√( s(s-a)(s-b)(s-c) ) which uses the value s to work out the area.
Here's what those two sums look like....
Taking the ready made side lengths(A, B and C) and subtract the value s from them. Multiply those answers with the value s. Thenall thats left is to get the square root of that and you have the area of the triangle.