VectorsAPI

A global API which provides functions dedicated to creating and otherwise manipulating vectors
Accessed using the name "vectors"

VectorsAPI.vec

Creates and returns a vector of the appropriate size to hold the arguments passed in
For example; if you call vec(3,
4, 0, 2), then the function will return a Vector4 containing those values
There is a global alias "vec" for this function,
meaning the "vectors." can be omitted
overload 1:
vectors.vec(x, y)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
Return Value a Vector2
overload 2:
vectors.vec(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value a Vector3
overload 3:
vectors.vec(x, y, z, w)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
w accepts a Number
Return Value a Vector4

VectorsAPI.rotateAroundAxis

Rotates a vector relative to a rotation vector
overload 1:
vectors.rotateAroundAxis(angle, vec, axis)
Method Property Fluent Description Representation
angle accepts a Number
vec accepts a Vector3
axis accepts a Vector3
Return Value a Vector3
overload 2:
vectors.rotateAroundAxis(angle, x, y, z, axis)
Method Property Fluent Description Representation
angle accepts a Number
x accepts a Number
y accepts a Number
z accepts a Number
axis accepts a Vector3
Return Value a Vector3
overload 3:
vectors.rotateAroundAxis(angle, vec, axisX, axisY, axisZ)
Method Property Fluent Description Representation
angle accepts a Number
vec accepts a Vector3
axisX accepts a Number
axisY accepts a Number
axisZ accepts a Number
Return Value a Vector3
overload 4:
vectors.rotateAroundAxis(angle, x, y, z, axisX, axisY, axisZ)
Method Property Fluent Description Representation
angle accepts a Number
x accepts a Number
y accepts a Number
z accepts a Number
axisX accepts a Number
axisY accepts a Number
axisZ accepts a Number
Return Value a Vector3

VectorsAPI.hexToRGB

Parses a Hex string color into an RGB format vector
The hex "#" is optional,
and it can have any length, however only the first 6 hex digits are evaluated, short hex (length 3) is also supported
For example,
"#42" is the same as "420000", and "F0B" is the same as "FF00BB"
overload 1:
vectors.hexToRGB(hex)
Method Property Fluent Description Representation
hex accepts a String
Return Value a Vector3

VectorsAPI.worldToScreenSpace

Converts a position in the world into a position relative to the viewer's screen
overload 1:
vectors.worldToScreenSpace(vec)
Method Property Fluent Description Representation
vec accepts a Vector3
Return Value a Vector4
overload 2:
vectors.worldToScreenSpace(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value a Vector4

VectorsAPI.toCameraSpace

Converts a position in the world into a position relative to the viewer's camera
overload 1:
vectors.toCameraSpace(vec)
Method Property Fluent Description Representation
vec accepts a Vector3
Return Value a Vector3
overload 2:
vectors.toCameraSpace(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value a Vector3

VectorsAPI.vec3

Creates and returns a Vector3 with the given values
Nil values become zero
overload 1:
vectors.vec3(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value a Vector3

VectorsAPI.vec2

Creates and returns a Vector2 with the given values
Nil values become zero
overload 1:
vectors.vec2(x, y)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
Return Value a Vector2

VectorsAPI.rgbToInt

Converts the given color from RGB format to Integer format
overload 1:
vectors.rgbToInt(rgb)
Method Property Fluent Description Representation
rgb accepts a Vector3
Return Value an Integer
overload 2:
vectors.rgbToInt(r, g, b)
Method Property Fluent Description Representation
r accepts a Number
g accepts a Number
b accepts a Number
Return Value an Integer

VectorsAPI.intToRGB

Converts the given color from Integer format to RGB format
overload 1:
vectors.intToRGB(color)
Method Property Fluent Description Representation
color accepts an Integer
Return Value a Vector3

VectorsAPI.rgbToHSV

Converts the given color from RGB format to HSV format
overload 1:
vectors.rgbToHSV(rgb)
Method Property Fluent Description Representation
rgb accepts a Vector3
Return Value a Vector3
overload 2:
vectors.rgbToHSV(r, g, b)
Method Property Fluent Description Representation
r accepts a Number
g accepts a Number
b accepts a Number
Return Value a Vector3

VectorsAPI.hsvToRGB

Converts the given color from HSV format to RGB format
overload 1:
vectors.hsvToRGB(hsv)
Method Property Fluent Description Representation
hsv accepts a Vector3
Return Value a Vector3
overload 2:
vectors.hsvToRGB(h, s, v)
Method Property Fluent Description Representation
h accepts a Number
s accepts a Number
v accepts a Number
Return Value a Vector3

VectorsAPI.rgbToHex

Converts the given color from RGB format to Hex format
The "#" is not included on the return value
overload 1:
vectors.rgbToHex(rgb)
Method Property Fluent Description Representation
rgb accepts a Vector3
Return Value a String
overload 2:
vectors.rgbToHex(r, g, b)
Method Property Fluent Description Representation
r accepts a Number
g accepts a Number
b accepts a Number
Return Value a String

VectorsAPI.vec4

Creates and returns a Vector4 with the given values
Nil values become zero
overload 1:
vectors.vec4(x, y, z, w)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
w accepts a Number
Return Value a Vector4
a a