Rotating vectors around the global X axis

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.


Integer division in ICE

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:


About transformation matrices…

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 πŸ™‚

You, ICE, and position vectors

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:

Intro to rotating vectors in ICE

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.

Deleting overlapping particles

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:

Vector multiplication in ICE versus the Dot Product

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):