Documentation

2D Vector - Open Dev Kit Documentation

Open Dev Kit Documentation :: General :: 2D Vector

Root.Vector2
Two-dimensional vector. Consists of an X component and a Y component and can be used to represent positions or directions in 2D space

Functions

Constructor ( X Float, Y Float )
Constructor ( Other 3D Vector )
Add ( Vector 1 2D Vector, Vector 2 2D Vector ) 2D Vector
Returns the addition of two vectors
Subtract ( Vector 1 2D Vector, Vector 2 2D Vector ) 2D Vector
Returns the subtraction of the first vector by the second vector
Divide ( Vector 2D Vector, Scalar Float ) 2D Vector
Returns the vector divided by a scalar
Scale ( Vector 2D Vector, Scalar Float ) 2D Vector
Returns the vector multiplied by a scalar
Multiply ( Vector 1 2D Vector, Vector 2 2D Vector ) 2D Vector
Returns the mulitplication of the vectors' components
Distance ( Vector 1 2D Vector, Vector 2 2D Vector ) Float
Returns the distance between two vectors
Scale Aspect ( Vector 2D Vector, Scalar 2D Vector ) 2D Vector
Returns the vector scaled to fit inside the specified vector
Linear Interpolate ( Vector 1 2D Vector, Vector 2 2D Vector, Factor Double ) 2D Vector
Returns Vector 1 if Factor is 0, Vector 2 if Factor is 1 and the average of Vector 1 and 2 if Factor is 0.5, with everything in between using vector interpolation
Snap ( Vector 2D Vector, Snap 2D Vector ) 2D Vector
Returns the vector snapped to the other vector as grid

Properties

X Float
X component of the vector
Y Float
Y component of the vector
Normalized 2D Vector
vector with a length of 1.0
Negated 2D Vector
negated vector
Length Float
length of the vector
Length Squared Float
length of the vector squared; calculated faster and better to use against other lengths which can also easily be squared
Scaled by Dpi 2D Vector
vector with system's dpi factored (screen co-ordinates)
Unscaled by Dpi 2D Vector
vector with system's dpi inversely factored (logical co-ordinates)
Only X 2D Vector
vector with only X-component included
Only Y 2D Vector
vector with only X-component included

If you think anything is missing, please feel free to: submit documentation feedback on this page