Lord And Savior
Here is how I made the individual 3D pictures used in the animation: vm.xls.
I combined 41 seperately rotated pictures, each one degree apart, using ULead GIF Animator from XOOM, to make the animated 3D picture above.
Wouldn't it be great if you could "visualize" how mathematics worked?
For instance, take the equation for the volume of a cube.
It is an intuitively obvious, simple and straight forward equation, is it not?
Volume = length * width * height = lwh
Volume = xyz in Cartesian coordinates
Now increase the length of each side of the cube by the amounts dx, dy and dz.
What you get is a rather imposing looking equation with eight terms in it instead of one.
Is there a geometric equivalent to each term in the equation, and, if so, could we visualize them?
Equation for the old volume of a simple cube:
Vold = xyz
Equation for the new volume of a simple cube expanded on all three sides by the amounts dx, dy and dz:
Vnew = (x + dx)(y + dy)(z + dz)
Vnew = [x(y + dy) + dx(y + dy)](z + dz)
Vnew = [xy + xdy + dxy + dxdy](z + dz)
Vnew = [xy + xdy + dxy + dxdy]z + [xy + xdy + dxy + dxdy]dz
Vnew = xyz + xdyz + dxyz + dxdyz + xydz + xdydz + dxydz + dxdydz
Difference in terms:
Vnew - Vold = (xyz + xdyz + dxyz + dxdyz + xydz + xdydz + dxydz + dxdydz) - xyz
Vnew - Vold = xdyz + dxyz + dxdyz + xydz + xdydz + dxydz + dxdydz
Note that the expanding cube in the picture to the left has seven additional segments, one for each term in the difference in terms result!
How did I get the cube to rotate in 3D?
Here's are the equations for 3D rotations:
x1 = cos(ry) * xs - sin(ry) * zs
x1, y1 and z1 are intermediate results used to simplify the equations.
z1 = sin(ry) * xs + cos(ry) * zs
xr = cos(rz) * x1 + sin(rz) * ys
y1 = cos(rz) * ys - sin(rz) * x1
zr = cos(rx) * z1 - sin(rx) * y1
yr = sin(rx) * z1 + cos(rx) * y1
rx, ry and rz are the amount of rotation in degrees you want for points xs, ys and zs respectively.
xs, ys and zs are the static coordinates of the points you want to rotate.
xr, yr and zr are the rotated points.
To create a wire frame representation of an object in 3D:
How did I get the extra seven segments to rotate and move away from the cube at the same time?
I defined their static distances from the cube as a function (delta) of the angle of rotation.
As the cube rotates the segments move away from it.
- Define the corners of the object in 3D
- Define which pairs of points form the endpoints of the lines that make up the object
- Plot the rotating pairs of points (lines). I used an xy scatter plot with blank lines between the pairs of points to create lines.
- Vary rx, ry and rz to rotate the object.