Bottle 2D - Lua API 1.0.0
All you need to create games using bottle2D.
|
A simple vector in two dimentions. More...
#include <header.hpp>
Public Member Functions | |
Vector2D (number x, number y) | |
Vector2D () | |
Vector2D | operator+ (Vector2D vect) |
Add two vectors. | |
Vector2D | operator- (Vector2D vect) |
Subtract two vectors. | |
bool | operator== (Vector2D vect) |
Check equality between two vectors. | |
Vector2D | operator* (number nb) |
Multiply a Vector by a number. | |
Vector2D | operator/ (number nb) |
Divide a Vector by a number. | |
number | GetSquareSum () |
Get the sum of the squares of x and y (basicaly, x² + y²). | |
number | GetSize () |
Get the size of the Vector. | |
Vector2D | GetDirection () |
Get the normalised vector (direction). | |
number | GetDotProduct (Vector2D vector2) |
Get the dot product / scalar product of this vector with another one. | |
number | GetAngle () |
Get the angle between this vector and the x axis. | |
Vector2D | GetDirectNormal () |
Get the normal to the vector, in the direct direction (+ pi/2). | |
Vector2D | GetIndirectNormal () |
Get the normal to the vector, in the indirect direction (- pi/2). | |
Public Attributes | |
float | x |
Get the angle between the given vector (reference) and this vector. | |
float | y |
Access the y componant. |
A simple vector in two dimentions.
Vector2D::Vector2D | ( | number | x, |
number | y | ||
) |
Vector2D::Vector2D | ( | ) |
number Vector2D::GetAngle | ( | ) |
Get the angle between this vector and the x axis.
Vector2D Vector2D::GetDirection | ( | ) |
Get the normalised vector (direction).
Vector2D Vector2D::GetDirectNormal | ( | ) |
Get the normal to the vector, in the direct direction (+ pi/2).
The returned coordonates are Vector2D(-y, x).
number Vector2D::GetDotProduct | ( | Vector2D | vector2 | ) |
Get the dot product / scalar product of this vector with another one.
Vector2D Vector2D::GetIndirectNormal | ( | ) |
Get the normal to the vector, in the indirect direction (- pi/2).
The returned coordonates are Vector2D(y, -x).
number Vector2D::GetSize | ( | ) |
Get the size of the Vector.
number Vector2D::GetSquareSum | ( | ) |
Get the sum of the squares of x and y (basicaly, x² + y²).
This is useful to compare the vectors size without using a square root (which is more time consuming).
Vector2D Vector2D::operator* | ( | number | nb | ) |
Multiply a Vector by a number.
Vector2D Vector2D::operator/ | ( | number | nb | ) |
Divide a Vector by a number.
bool Vector2D::operator== | ( | Vector2D | vect | ) |
Check equality between two vectors.
float Vector2D::x |
Get the angle between the given vector (reference) and this vector.
Access the x componant
float Vector2D::y |
Access the y componant.