In our last article, we talked about multiple coordinate spaces. You can go back there and brush up in case you missed it. One more thing before we proceed. If you are not up to speed entirely with this series you can go over and get started with the introduction to 3D Math for computer graphics here.
The Thing About Nested Coordinate Spaces
One thing to note is that every object in your 3D world has its own coordinate space. With a coordinate space, it means each object also has its own origin and axes. The location of the original is up for debate as it could vary depending on the scenario. For now, we can generally assume it is at the center of mass of the object.
The axes, therefore, can be determined based on the origin and what the object considers as it’s “up”, “front”, and “side”. Once the object has its origin and axes determined, it cannot exist in its own world. The object must interact with other objects in the greater world space. Each of these objects having their own coordinate spaces.
Each object, therefore, exists in the world coordinate space which is also the parent coordinate space of the object. To complicate things a little more, the object can interact within the world space by moving within any of the axes within the object. To illustrate let us take a person as our object.
A person can turn left or right where he stands affecting his orientation within his object coordinate space. Heck! He can even do a backflip. It gets better. Our fellow can walk or run from one point to another. This allows him to change his position in the world coordinate space.
Back to our fellow. Due to the nature of his body, he can exhibit many nested coordinate spaces within himself. As he walks the complexity of his arms swinging back and forth come into play. He has legs which move with every step he takes. On top of that, he may be turning his neck left and right admiring the scenery around him.
All these contribute to nested coordinate spaces in that his hands’ legs, feet, head and other body members each have their various coordinate spaces. Many coordinate spaces because our man object is an abstract object with several unique moving parts. When our guy did the backflip, he added more complexities into the mix.
All these things have to be mastered by the 3D artist and animators to get the desired effects.
How to Specify Coordinate Spaces
Coordinate spaces are easily defined. All you need to define these space are the three axes relative to the origin of the object. Whether you are dealing with world coordinate spaces, inertial coordinate spaces or object coordinate spaces, the one thing they all have in common is the origin. The origin is always specified as (0, 0, 0) in (X, Y, Z) axes positioning.
It is the work of the 3D artist to determine which directions the X, Y and Z axes point towards. Once this has been determined the rest comes easy. You can refer to previous articles in the series to understand how to specify these coordinates using the links above.
How to Handle Coordinate Space Transformations
Once you determine the origin and the axes of the objects within the world coordinate space, transforming objects from one point to another becomes a trivial task. To transform an object, all you need to keep track of is the origin. You will then simply move that origin by the specified number of points in the desired direction along one or more of its axes. This is known as the change of location and it normally happens within the inertial coordinate space.
Additionally, you will have to look for any rotations within the object where on one moment for example taking the X-axis of the object. The X-axis may point in the same direction the X-axis of the world coordinate space points towards. A rotation would cause the X-axis of the object to point in a different direction. Rotation can happen in one or more axes at the same time.
Scaling can also happen to a transformed object. Scaling is where an object shrinks or increases in size in one or more axes at the same time. A real-world example would be something like a balloon being inflated.
Change of location, rotation, and scaling can all happen simultaneously in one or more axes to complete an object transformation.
Well, that’s it for this part of nested coordinate spaces in this series on 3D math for computer graphics. Next, we will be kicking off with a brand new topic on Vectors. I think we have built up a foundation strong enough to discuss vectors which are a very important part of understanding animation in computer graphics.