Skip to main content

vrvec2

Module: Maths

A vector.

#include <lua_api.h>

Public Functions​

TypeName
Anycopy()
(vrCopy) Returns a copy of a Vector, Matrix, Ray, Sphere, AABBox, Quaternion or Plane
vrvec3cross(Any vec2)
(vrCross) Returns the cross product of two vectors. Both vectors must be the same type
numberdot(Any vec2)
(vrDot) Returns the dot product of two vectors. Both vectors must be the same type
numbergetLength()
(vrLength) Returns the length of a vector.
numbergetLengthSq()
(vrLengthSquared) Returns the squared length of a vector.
Anynormalise()
(vrNormalise) Returns normalised vector/matrix.
Anyoperator*()
Anyoperator+()
Anyoperator-()
Anyoperator/()
Anyoperator=()

Public Attributes​

TypeName
numberx
x element
vrvec2xy
xy elements
numbery
y element
vrvec2yx
yx elements

Public Functions Documentation​

copy​

Any copy()

(vrCopy) Returns a copy of a Vector, Matrix, Ray, Sphere, AABBox, Quaternion or Plane

cross​

vrvec3 cross(
Any vec2
)

(vrCross) Returns the cross product of two vectors. Both vectors must be the same type

Parameters:

  • vec2 Vector 2 {x, y} or {x, y, z}.

dot​

number dot(
Any vec2
)

(vrDot) Returns the dot product of two vectors. Both vectors must be the same type

Parameters:

  • vec2 Vector 2 {x, y} or {x, y, z}.

getLength​

number getLength()

(vrLength) Returns the length of a vector.

getLengthSq​

number getLengthSq()

(vrLengthSquared) Returns the squared length of a vector.

normalise​

Any normalise()

(vrNormalise) Returns normalised vector/matrix.

Return: Normalised vector or matrix depending on the type passed in

operator*​

Any operator*()

operator+​

Any operator+()

operator-​

Any operator-()

operator/​

Any operator/()

operator=​

Any operator=()

Public Attributes Documentation​

x​

number x;

x element

xy​

vrvec2 xy;

xy elements

y​

number y;

y element

yx​

vrvec2 yx;

yx elements