Here is a quick AN exercise:
"How to make Epicycloid?".
I decided to write this real quick after receiving email from Eli S earlier this morning. Thanks for your email asking about this, I guess nothing wrong to try to review old thing. Maybe I was missing a step in my explanation in my old writing.
Not long ago I must have done this using Sverchok. Either way, they both can do cool stuffs that overlap with each other. Just slightly different way of thinking.
Animation Nodes (AN) add-in in Blender is really fantastic to build a quick prototype to study motion. Like Steve Jobs would say: "It's INSANELY GREAT." I would say AN is INSANELY AWESOME!
AN Script Node for Epicycloid
You can create this Epicycloid shape using a few Math and Number nodes or perhaps Expression node in AN, however, I decided to use AN Script Node. Why? Because I want to show clearly INPUT and OUTPUT things the simple way.This is really simple to build, actually.
1) Research the Formulae for Epicycloid
You must love Math, like I do :) Not the complexity per se, I mean, the complex stuff will be dealed by smarter geniuses people. We, computer artist, very often can skip that part and simply use the formula. For epicycloid shape, I found this on Wiki, super useful:
https://en.wikipedia.org/wiki/Epicycloid
2) Write it down
I quickly jump into Blender and rewrite the formula inside Blender Text Editor. I do not write this in single typing. Basically I started just by typing this:
x = r * ( k + 1 ) * cos(a) - r * cos ( (k + 1) * a)
y = r * ( k + 1 ) * sin(a) - r * sin ( (k + 1) * a)
THEN, it become something like below:
Few things changes, depending on what variable names I give, what are going to be the INPUTS and how it fit the requirement of AN script node. You add input and output variables as needed.
3) Noding it
AN Script node does all the magic. You could actually make your own custom (real) node for AN that simply creates Epicycloid shape.
For our purpose, we use Script node, which is like a quick prototype node. It's really fast to make and super handy for a lot of things.
Keep in mind that this Script node is linked to your script earlier.
4) Build the Node Tree
The rest is piece of cake. You simply use the actual Script Node and test it in 3D View.
I am applying the Epicycloid formulate to create this epicycloid motion to the default Cube.
The shape will be created as we play with the ANGLE variable. I use the Time Info node, and plugging in the output to the angle. Watch out here that I convert the Degrees to Radian in order to make this working properly.
5) Viewing the Motion
Now, in order to view the motion, you need to see it in Playback. As this is really just a motion in shape of Epicycloid.
What nice is that Blender has a way to display a keyframed motion, and this is build in on object transform, under "Motion Paths" subpanel.
What I did below, is I am using AN Set Keyframes to bake the motion, then I simply draw view the curve motion.
Drawing Epicycloid Curve using AN
I was going to stop writing here. But then I am thinking... You must be curious on how you can draw this using AN?If you read my previous blog writing, you should be able to build the setup.
The aim is to generate Vector List using Loop. It's easy. This way we can pipe the Vectors => Points for Curve aka Spline.
We can smooth the spline, bevel it etc, and then voila, a 3D cycloid mesh.
And... moreover, why did we do all this steps? Because in node based system, you can always go back, change variables, improve it and you get different result.
That's all folks, Merry Christmas 2015, since it's already pass, hope you all have an insanely awesome new year 2016!
Post a Comment