The Math
This part of the tute is purely theoretical. It's a very simple explanation of the math I use
(actually you'll notice it's not an explanation at all but just a couple of formulas)You don't have to read it if you don't care about how the tute works, but it's kind of interesting
to know. On the other hand, if you want to know more, click here.
The math we use is coordinates geometry in space. Let's start out with some definitions.
Vector
A vector is an abstract kind of notion (that's an easy way of saying I don't know what it is) but very practical.
It basically consists of a line drawn from the origin (0,0,0) to a point (x,y,z). It can also be thought
of as a direction from one point to another: x units along the xaxis, y units along the yaxis and z units
along the zaxis. The vector is defined by the three coordinates x, y and z.
Line equation
A line can be described as all the points aligned with two points A (0x,0y,0z) and B. That way, it is defined
by its origin A and the vector (dx,dy,dz) going from A to B.
The equation looks like this:
point = org + k * dir
or with the coordinates (x,y,z) = (0x,0y,0z) + k * (dx,dy,dz) ,k being any real number.
Plane equation
A plane is a surface that can be described by a normal vector (dx,dy,dz), ie a direction the plane is facinng, and a value k,
indicating the position of the plane along this vector. The equation is:
point * normal = k
or with the coordinates (x,y,z) * (dx,dy,dz) = k, k being any real number.
Intersection of a plane and a line
The line equation looks like this: point = org + u * dir. We have to find the
value of u corresponding to the intersection. Using the plane equation, we find
u = (k  org * normal) / (dir * normal)
We then plug this into the line equation and find the coordinates of the point.
The rotations
For the rotations we just apply the following formulas:
Rotatation about the x axis:
x' = x
y' = (cos é * y)  (sin é * z)
z' = (sin é * y) + (cos é * z)
Rotation about the y axis:
x' = (cos é * x) + (sin é * z)
y' = y
z' = (sin é * x) + (cos é * z)
Rotation about the z axis:
x' = (cos é * x)  (sin é * y)
y' = (sin é * x) + (cos é * y)
z' = z
...é being the angle of the rotation.
» Level Advanced 
Added: 20001204 Rating: 9 Votes: 2631 
» Author 
KStor is a student living in France and working with Flash during his free time...that is, not very much. 
» Download 
Download the files used in this tutorial. 
Download (39 kb) 
» Forums 
More help? Search our boards for quick answers! 

You must have javascript enabled in order to post comments.
Comments
There are no comments yet. Be the first to comment!