Another Rotate Vector example. This time, I rotate the points of a mesh around the global X axis. In short, the point positions are treated as vectors, and then rotated about the specified axis. Of course, this requires some conversion between coord systems, which is always fun 🙂
The bottom part of the tree is just for visualization.
Not sure how Rotate Vector works? Is that 26 words (including five “the”s) of documentations not doing it for you?
Fortunately, it’s not hard to rig up an ICE tree to help visualize what Rotate Vector does.
Compound is here if you want it.
Dividing an integer N by itself doesn’t always give you 1.
I think it’s a problem in the Divide by Scalar node (the division is probably returning a scalar like 0.99999999, and then that is truncated to zero when it is converted to an integer).
A workaround is to do all your division with scalars, and then use modulo to determine whether you Round or Floor the result. Here’s an example compound by Guillaume Laforge:
You don’t necessarily have to understand everything about transformation matrices to use them. Just understand then when you multiply a point by a transformation matrix, you’re applying scaling, rotation, and translation to that point all at once.
If you do want to understand more, you can use ICE to visualize what goes into a transformation matrix:
And you can do some reading 🙂
The Fibonacci series is a sequence of numbers starting with 0, 1 and where each subsequent number is the sum of the previous two:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...
Thanks to Binet’s Fibonacci number formula, I didn’t have to use a Repeat node 😉
Here’s one way to calculate array indices when you’re storing a “2D array” in a flat one-dimensional array.
In ICE, we often work with point or particle positions, and these positions are 3D Vectors.
Now, in general, a vector is something that has both value and direction (for example, any cyclist knows that the wind has both a magnitude and a direction, and together they really define the wind 🙂
When you’re working with point/particle positions, you’re really working with position vectors that specify a unique position in space. You’re not really interested in the magnitude of the vector, just the head and tail of the vector.
For any position vector, the tail is the origin: the point (0, 0, 0).
The head of the vector is the position in space.
When you’re working with position vectors in ICE, it’s important to understand what coordinate system you are working in, because that determines the origin. For example, here’s two different position vectors for the same point:
In this video I take a quick look at how Rotate Vector works, but more importantly, I dive into some issues related to different coordinate systems. In many scenarios where you use Rotate Vector (eg to rotate polygons), you have to understand what coordinates you’re working with.
Hopefully, this will be the first in a series of vids.
As an exercise, I built this ICE tree that prevents any overlapping particles (for non-rotated particles only). It works by comparing the X, Y, and Z values of the vector between two points with the combined size of the two particle shapes (which are boxes in this example).
The compound node returns an array of booleans, one for each neighbour. The boolean flags indicate whether or not the particles would overlap, so if at least one is True, then I delete the particle. If you must see it, here’s the compound:
In general, there isn’t a unique definition for the multiplication of one vector by another, but there are several common “vector products”, such as the dot product and the cross-product.
The dot product of the two vectors (x, y, z) and (a, b, c) is ax + by + cz.
I kinda assumed that in ICE, the Multiply node would give me the same result, but it turns out that Multiply gives (ax, by, cz):