296
Chapter 12: Methods
dotProduct()
Usage
vector1.
dotProduct(
vector2
)
Description
3D vector method; returns the sum of the products of the x, y, and z components of two vectors.
If both vectors are normalized, the
dotproduct
is the cosine of the angle between the two vectors.
To manually arrive at the dot of two vectors, multiply the x component of
vector1
by the x
component of
vector2
, then multiply the y component of
vector1
by the y component of
vector2
, then multiply the z component of
vector1
by the z component of
vector2
, and finally
add the three products together.
This method is identical to
dot()
function.
Parameters
vector2
Required. The second vector from which a sum is returned.
Example
In this example, the angle between the vectors
pos5
and
pos6
is 45°. The
getNormalized
function returns the normalized values of
pos5
and
pos6
, and stores them in the variables
norm1
and
norm2
. The
dotProduct
of
norm1
and
norm2
is 0.7071, which is the cosine of 45°.
pos5 = vector(100, 100, 0)
pos6 = vector(0, 100, 0)
put pos5.angleBetween(pos6)
-- 45.0000
norm1 = pos5.getNormalized()
put norm1
-- vector( 0.7071, 0.7071, 0.0000 )
norm2 = pos6.getNormalized()
put norm2
-- vector( 0.0000, 1.0000, 0.0000 )
put norm1.dotProduct(norm2)
-- 0.7071
See also
dot()
,
getNormalized
,
normalize
downloadNetThing
Usage
downloadNetThing
URL
,
localFile
Description
Command; copies a file from the Internet to a file on the local disk, while the current movie
continues playing. Use
netDone
to find out whether downloading is finished.
Director movies in authoring mode and projectors support the
downLoadNetThing
command,
but the Shockwave Player does not. This protects users from unintentionally copying files from
the Internet.
Summary of Contents for DIRECTOR MX 2004
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...