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.
Содержание DIRECTOR MX-USING DIRECTOR MX
Страница 1: ...Using Director MX Macromedia Director MX...
Страница 12: ...Contents 12...
Страница 156: ...Chapter 4 156...
Страница 202: ...Chapter 6 202...
Страница 244: ...Chapter 7 244...
Страница 292: ...Chapter 10 292...
Страница 330: ...Chapter 12 330...
Страница 356: ...Chapter 13 356...
Страница 372: ...Chapter 14 372...
Страница 442: ...Chapter 16 442...
Страница 472: ...Chapter 18 472...
Страница 520: ...Chapter 19 520...
Страница 536: ...Chapter 20 536...
Страница 562: ...Chapter 23 562...
Страница 566: ...Chapter 24 566...
Страница 602: ...Chapter 27 602...