Featured FLA
» Author: Bugra Ozden
» Title: Skatalog v9 - product catalog
» Description: Create your product catalog easly and publish on your website or Create your image gallery, documents list, portfolio. Fully XML Driven
» More by Bugra Ozden
Featured Site
» Posted in the Flash Kit Links section
» Title: Creative DW Image Show PRO
» Description: Creative DW Image Show PRO is a Dreamweaver extension which enables the user to create multimedia presentations. It combines the features of the popular Creative DW Image Show with the ability to add professional text effects to slides (similar to After Effects). The product is very customizable: the user can choose the duration of the transition effects, the slide motion start and end position, zoom and panning type for both images and texts.
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 x-axis, y units along the y-axis and z units
along the z-axis. 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.