Class: Vector3

olympe.df. Vector3

The Vector3 class represents a 3 dimensional vector. It wraps up a trio of numbers (x,y,z).


new Vector3( [x] [, y] [, z])

Creates a 3 dimensional vector.

Parameters:
Name Type Argument Description
x olympe.df.PONumber | number <optional>

the value for the 'x' coordinate

y olympe.df.PONumber | number <optional>

the value for the 'y' coordinate

z olympe.df.PONumber | number <optional>

the value for the 'z' coordinate

Methods


addScalar(scalar)

Adds a scalar to all 3 coordinates (x,y,z) of the vector and returns the resulting Vector3.

Parameters:
Name Type Description
scalar olympe.df.PONumber | number | olympe.df.Node

the scalar to add

Returns:

the resulting Vector3

Type
olympe.df.PVector3

ceil()

Constructs a Vector3 by applying ceil() to the coordinates of this vector.

See:
Returns:

the resulting Vector3

Type
olympe.df.PVector3

divideScalar(scalar)

Divides this Vector3 by a scalar and returns the resulting Vector3.

Parameters:
Name Type Description
scalar olympe.df.PONumber | number | olympe.df.Node

the scalar to divide the Vector3 by

Returns:

the resulting Vector3

Type
olympe.df.PVector3

equals(obj)

Checks whether this Vector3 is the same as another Object.

Parameters:
Name Type Description
obj *

Object to be compared.

Returns:

true if this Vector3 and obj are the same.

Type
boolean

floor()

Constructs a Vector3 by applying floor() to the coordinates of this vector.

See:
Returns:

the resulting Vector3

Type
olympe.df.PVector3

getX()

Gets the 'x' coordinate of this vector.

Returns:

the 'x' coordinate

Type
olympe.df.PONumber

getY()

Gets the 'y' coordinate of this vector.

Returns:

the 'y' coordinate

Type
olympe.df.PONumber

getZ()

Gets the 'z' coordinate of this vector.

Returns:

the 'z' coordinate

Type
olympe.df.PONumber

minus(otherVect)

Returns the result of the subtraction of another vector from this vector.

Parameters:
Name Type Description
otherVect olympe.df.PVector3

the Vector3 to subtract from this vector

Returns:

the resulting Vector3

Type
olympe.df.PVector3

multiplyScalar(scalar)

Multiplies this Vector3 by a scalar and returns the resulting Vector3.

Parameters:
Name Type Description
scalar olympe.df.PONumber | number | olympe.df.Node

the scalar to multiply the Vector3 by

Returns:

the resulting Vector3

Type
olympe.df.PVector3

negate()

Returns the inverse of this vector, i.e. (-x, -y, -z).

Returns:

the resulting Vector3

Type
olympe.df.PVector3

plus(otherVect)

Returns the result of the addition of this Vector with another vector.

Parameters:
Name Type Description
otherVect olympe.df.PVector3

the Vector3 to add to this vector

Returns:

the resulting Vector3

Type
olympe.df.PVector3

round()

Constructs a Vector3 by applying round() to the coordinates of this vector.

See:
Returns:

the resulting Vector3

Type
olympe.df.PVector3

setX(x)

Sets the 'x' coordinate of this vector.

Parameters:
Name Type Description
x olympe.df.PONumber | number | olympe.df.Node

the value to set 'x' to


setY(y)

Sets the 'y' coordinate of this vector.

Parameters:
Name Type Description
y olympe.df.PONumber | number | olympe.df.Node

the value to set 'y' to


setZ(z)

Sets the 'z' coordinate of this vector.

Parameters:
Name Type Description
z olympe.df.PONumber | number | olympe.df.Node

the value to set 'z' to


toOString()

Construct a string representation of this Vector3 and returns it as an OString. Will be in the form "Vector3[x, y, z]".

Returns:

the string representation.

Type
olympe.df.POString

toString()

Gets a string representation of the vector. Will be in the form "Vector3[x, y, z]".

Returns:
Type
string