Bottle 2D - Lua API 1.0.0
All you need to create games using bottle2D.
Public Member Functions | Public Attributes

Vector2D Class Reference

A simple vector in two dimentions. More...

#include <header.hpp>

List of all members.

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.

Detailed Description

A simple vector in two dimentions.


Constructor & Destructor Documentation

Vector2D::Vector2D ( number  x,
number  y 
)
Vector2D::Vector2D ( )

Member Function Documentation

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+ ( Vector2D  vect)

Add two vectors.

Vector2D Vector2D::operator- ( Vector2D  vect)

Subtract two vectors.

Vector2D Vector2D::operator/ ( number  nb)

Divide a Vector by a number.

bool Vector2D::operator== ( Vector2D  vect)

Check equality between two vectors.


Member Data Documentation

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.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables