Autodesk Creative Platform Core Version 1.19.0
A broad and deep collection of 2D and 3D capabilities.

Vector3D Overview

Implements Interfaces: IDebuggable

A vector in 3D Space.

Introduced in Version: 1.1.0

Class Member Summary

Class Member Details

• Vector3D (x, y, z) | Constructor

The following parameters can be specified in the constructor:
  • x: Number - The X magnitude of the vector.
  • y: Number - The Y magnitude of the vector.
  • z: Number - The Z magnitude of the vector.

Vector3D add (vec) | Chainable

Adds the vector by the input vector.
  • vec: Vector3D or Array [ Number ] - A Vector3D or an Array of 3 numbers to construct a Vector3D from.

Vector3D clone()

Creates a copy of this object and returns it.

Vector3D cross (vec)

Return the cross result of this vector and the passed one.
  • vec: Vector3D or Array [ Number ] - A Vector3D or an Array of 3 numbers to construct a Vector3D from.

• debug()

Instructs the object to present useful debugging information via a series of calls to Debug.point, Debug.line and Debug.triangles.

Number dot (vec)

Return the dot result of this vector and the passed one.
  • vec: Vector3D or Array [ Number ] - A Vector3D or an Array of 3 numbers to construct a Vector3D from.

Boolean equals (other)

Returns true if the objects are equal, otherwise false.

Number length()

The length of the vector.

Vector3D negate() | Chainable

Negate this vector

Vector3D normalize() | Chainable

Normalize this vector

Vector3D scale (scale, [y], [z]) | Chainable

Scales the vector magnitude.
  • scale: Vector3D or Array [ Number ] or Number - A scale defined by a Vector3D, an Array with 3 values (X, Y and Z), or a number representing the X scale (and Y, Z scale if no additional parameter is specified.)
  • y: Number - An option Y scale to use if an X scale was specified as the first argument. If this argument is not specified then uniform scaling is assumed. | Optional
  • z: Number - An option Z scale to use if an X scale was specified as the first argument. If this argument is not specified then uniform scaling is assumed. | Optional

3 Examples:

// Scale the vector by given one scale number uniformly
vector.scale(0.5);
// Scale the vector by given X and Y scale numbers
vector.scale(0.5, 0.75, 0.85);
// Scale the vector by given a Vector3D object
var vec = new Vector3D(0.5, 0.75, 0.85);
vector.scale(vec);

Vector3D subtract (vec) | Chainable

Subtracts the vector by the input vector.
  • vec: Vector3D or Array [ Number ] - A Vector3D or an Array of 3 numbers to construct a Vector3D from.

Vector3D transform (matrix) | Chainable

Transforms the vector by a transformation matrix, or an array containing the elements of a transformation matrix.
  • matrix: Matrix3D or Array [ Number ] - A Matrix3D or an Array of 16 numbers to construct a Matrix3D from.

Number x

The X magnitude of the vector.

Number y

The Y magnitude of the vector.

Number z

The Z magnitude of the vector.