Lingo Dictionary
199
dotProduct()
Syntax
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.
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
doubleClick
Syntax
the doubleClick
Description
Function; tests whether two mouse clicks within the time set for a double-click occurred as a
double-click rather than two single clicks (
TRUE
), or if they didn’t occur within the time set, treats
them as single clicks (
FALSE
).
Examples
This statement branches the playhead to the frame Enter Bid when the user double-clicks the
mouse button:
if the doubleClick then go to frame "Enter Bid"
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...