Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Vector Class Reference

Inherits ScriptObject.

Public Member Functions

 Vector ()
 
 Vector (Number x, Number y, Number z)
 
Number getX ()
 
 setX (Number x)
 
Number getY ()
 
 setY (Number y)
 
Number getZ ()
 
 setZ (Number z)
 
Number getCoordinate (Integer coordinate)
 
 setCoordinate (Integer coordinate, Number value)
 
 add (Vector value)
 
 add (Number x, Number y, Number z)
 
 subtract (Vector value)
 
 subtract (Number x, Number y, Number z)
 
 multiply (Number value)
 
 divide (Number value)
 
Boolean isNonZero ()
 
Boolean isZero ()
 
Number getXYAngle ()
 
Number getZAngle ()
 
Number getLength ()
 
Number getLength2 ()
 
 normalize ()
 
Vector getNormalized ()
 
 negate ()
 
Vector getNegated ()
 
Vector getAbsolute ()
 
Number getMinimum ()
 
Number getMaximum ()
 
String toString ()
 
Vector toDeg ()
 
Vector toRad ()
 

Static Public Member Functions

static Vector sum (Vector left, Vector right)
 
static Vector diff (Vector left, Vector right)
 
static Vector product (Vector left, Number right)
 
static Number dot (Vector left, Vector right)
 
static Number getAngle (Vector v1, Vector v2)
 
static Vector cross (Vector left, Vector right)
 
static Number getDistance (Vector left, Vector right)
 
static Number getDistance2 (Vector left, Vector right)
 
static Vector lerp (Vector left, Vector right, Number u)
 
static Vector getBySpherical (Number xyAngle, Number zAngle, Number radius)
 

Public Attributes

Number x
 The X coordinate.
 
Number y
 The Y coordinate.
 
Number z
 The Z coordinate.
 
Number length
 The length of the vector.
 
Number length2
 The square of the length of the vector.
 
Vector negated
 The negated vector.
 
Vector abs
 The vector with the absolute coordinates.
 
Vector normalized
 The vector normalized to length 1.
 

Detailed Description

A 3D vector (X, Y, and Z coordinates).

Constructor & Destructor Documentation

◆ Vector() [1/2]

Vector ( )

Constructs a (0, 0, 0) vector.

◆ Vector() [2/2]

Vector ( Number  x,
Number  y,
Number  z 
)

Constructs a vector with the specified x, y, and z coordinates.

Member Function Documentation

◆ add() [1/2]

add ( Vector  value)

Adds the specified vector.

◆ add() [2/2]

add ( Number  x,
Number  y,
Number  z 
)

Adds the specified X, Y, and Z coordinates.

◆ cross()

static Vector cross ( Vector  left,
Vector  right 
)
static

Returns the cross product of this vector and the specified vector.

◆ diff()

static Vector diff ( Vector  left,
Vector  right 
)
static

Returns the difference of the specified vectors.

◆ divide()

divide ( Number  value)

Divides the vector by the specified value.

◆ dot()

static Number dot ( Vector  left,
Vector  right 
)
static

Returns the dot product of this vector and the specified vector.

◆ getAbsolute()

Vector getAbsolute ( )

Returns the vector with the absolute values of the coordinates.

◆ getAngle()

static Number getAngle ( Vector  v1,
Vector  v2 
)
static

Returns the angle between the specified vectors.

◆ getBySpherical()

static Vector getBySpherical ( Number  xyAngle,
Number  zAngle,
Number  radius 
)
static

Returns the vector for the specified spherical coordinates.

◆ getCoordinate()

Number getCoordinate ( Integer  coordinate)

Returns the specified coordinate (0:X, 1:Y, and 2:Z).

◆ getDistance()

static Number getDistance ( Vector  left,
Vector  right 
)
static

Returns the distance between the specified vectors.

◆ getDistance2()

static Number getDistance2 ( Vector  left,
Vector  right 
)
static

Returns the square of the distance between the specified vectors.

◆ getLength()

Number getLength ( )

Returns the length of this vector.

◆ getLength2()

Number getLength2 ( )

Returns the square length of this vector.

◆ getMaximum()

Number getMaximum ( )

Returns the value for the maximum coordinate.

◆ getMinimum()

Number getMinimum ( )

Returns the value for the minimum coordinate.

◆ getNegated()

Vector getNegated ( )

Returns the negated vector.

◆ getNormalized()

Vector getNormalized ( )

Returns the normalized vector.

◆ getX()

Number getX ( )

Returns the X coordinate.

◆ getXYAngle()

Number getXYAngle ( )

Returns the angle in the X-Y plane (spherical coordinate).

◆ getY()

Number getY ( )

Returns the Y coordinate.

◆ getZ()

Number getZ ( )

Returns the Z coordinate.

◆ getZAngle()

Number getZAngle ( )

Returns the Z angle relative to the X-Y plane (spherical coordinate).

◆ isNonZero()

Boolean isNonZero ( )

Returns true if the vector has non-zero length.

◆ isZero()

Boolean isZero ( )

Returns true if the vector has non-zero length.

◆ lerp()

static Vector lerp ( Vector  left,
Vector  right,
Number  u 
)
static

Linear interpolation between the specified vectors. The U coordinate is clamped to the range [0; 1]. U equal to 0 and 1 corresponds to the left vector and the right vector, respectively.

◆ multiply()

multiply ( Number  value)

Multiplies the specified value.

◆ negate()

negate ( )

Negates the vector.

◆ normalize()

normalize ( )

Normalizes the vector.

◆ product()

static Vector product ( Vector  left,
Number  right 
)
static

Returns the product of the specified vector and number.

◆ setCoordinate()

setCoordinate ( Integer  coordinate,
Number  value 
)

Sets the specified coordinate (0:X, 1:Y, and 2:Z).

◆ setX()

setX ( Number  x)

Sets the X coordinate.

◆ setY()

setY ( Number  y)

Sets the Y coordinate.

◆ setZ()

setZ ( Number  z)

Sets the Z coordinate.

◆ subtract() [1/2]

subtract ( Vector  value)

Subtracts the specified vector.

◆ subtract() [2/2]

subtract ( Number  x,
Number  y,
Number  z 
)

Subtracts the specified X, Y, and Z coordinates.

◆ sum()

static Vector sum ( Vector  left,
Vector  right 
)
static

Returns the sum of the specified vectors.

◆ toDeg()

Vector toDeg ( )

Returns the value converted from radians to degrees.

◆ toRad()

Vector toRad ( )

Returns the value converted from degrees to radians.

◆ toString()

String toString ( )

Converts the vector to a string (e.g. (1, 2, 3)).



Generated by Autodesk, Inc. 12 April 2024
Copyright (c) 2012-2024 by Autodesk, Inc.