Controlling the 3D World
525
Vector creation commands
Use these functions to create vectors:
Vector properties
Use these properties to work with vectors:
Vector commands
Use these commands to work with vectors:
Function
Description
Returns
vector
(x,y,z)
Creates a vector from arguments representing all axes.
A vector object
random
Vector()
Creates a vector describing a randomly chosen point on the
surface of a unit sphere. Differs from
vector(random(10)/
10.0
,
random(10)/10.0
,
random(10)/10.0)
because
the
randomVector()
method always results in a unit vector.
A unit vector
Property
Access
Description
magnitude
Get
The magnitude of the vector. Equivalent to the length of the
vector.
length
Get
The length of the vector. Equivalent to the magnitude of the
vector.
[
index
]
Get and set
Returns the value of a vector at a specified point in an index
between 1 and 3.
x
Get and set
The
x
component of a vector.
y
Get and set
The
y
component of a vector.
z
Get and set
The
z
component of a vector.
Command
Description
Returns
normalize()
Normalizes the vector by modifying it into a unit vector of length
1. This is done by dividing each component of the vector by the
vector’s original length. That original length is the square root of
the sum of the squares of each component.
Nothing. Vector is
modified.
get
Normalized()
Returns a normalized version of the vector.
A new vector object.
dot(
vector2
)
Returns the dot (inner) product of the first vector and the second
vector (
vector2
). If both vectors are of unit length, the result is
the cosine of the angle between the two vectors.
Dot product of the two
vectors.
angleBetween
(
vector2
)
Returns the angle between
vector
and
vector2
, in degrees.
Value of the angle in
degrees.
cross(
vector2
)
or
crossProduct
(
vector2
)
or
perpendicular
To(
vector2
)
Returns a vector perpendicular to the original vector and to
vector2
.
A new vector object.
Summary of Contents for DIRECTOR MX-USING DIRECTOR MX
Page 1: ...Using Director MX Macromedia Director MX...
Page 12: ...Contents 12...
Page 156: ...Chapter 4 156...
Page 202: ...Chapter 6 202...
Page 244: ...Chapter 7 244...
Page 292: ...Chapter 10 292...
Page 330: ...Chapter 12 330...
Page 356: ...Chapter 13 356...
Page 372: ...Chapter 14 372...
Page 442: ...Chapter 16 442...
Page 472: ...Chapter 18 472...
Page 520: ...Chapter 19 520...
Page 536: ...Chapter 20 536...
Page 562: ...Chapter 23 562...
Page 566: ...Chapter 24 566...
Page 602: ...Chapter 27 602...