3D Lingo Dictionary > O-S > perpendicularTo |  |

perpendicularTo

Syntax

    vector1.perpendicularTo(vector2)

Description

3D vector command; returns a vector perpendicular to both the original vector and a second vector `(``vector2``)`. This command is equivalent to the vector `crossProduct` command. See `crossProduct()`.

Example

In this example, pos1 is a vector on the x axis and pos2 is a vector on the y axis. The value returned by `pos1.perpendicularTo(pos2)` is `vector( 0.0000, 0.0000, 1.00000e4 )`. The last two lines of the example show the vector which is perpendicular to both pos1 and pos2.

    pos1 = vector(100, 0, 0)
    pos2 = vector(0, 100, 0)
    put pos1.perpendicularTo(pos2)
    -- vector( 0.0000, 0.0000, 1.00000e4 )

See also

`crossProduct()`, `cross`