Vector2D Struct Reference

#include <Vector2D.h>

Inheritance diagram for Vector2D:
Object

# Static Public Member Functions

static Vector2D zero ()
static Vector2D unit (uint16 axis)
static Vector2D normalize (Vector2D vector)
static Vector2D get (Vector2D from, Vector2D to)
static Vector2D sum (Vector2D a, Vector2D b)
static Vector2D sub (Vector2D a, Vector2D b)
static Vector2D intermediate (Vector2D a, Vector2D b)
static Vector2D perpendicular (Vector2D a, bool left)
static Vector2D scale (Vector2D vector, Scale scale)
static Vector2D scalarProduct (Vector2D vector, fixed_t scalar)
static Vector2D scalarDivision (Vector2D vector, fixed_t scalar)
static Vector2D getRelativeToCamera (Vector2D vector)
static Vector2D projectOnto (Vector2D p, Vector2D a, Vector2D b)
static Vector2D projectOntoHighPrecision (Vector2D p, Vector2D a, Vector2D b)
static Vector2D rotate (Vector2D vector, int16 degrees)
static Vector2D getFromVector3D (Vector3D vector3D)
static Vector2D getFromPixelVector (PixelVector screenVector)
static Vector2D getFromScreenPixelVector (ScreenPixelVector screenPixelVector)
static fixed_t length (Vector2D vector)
static fixed_ext_t squareLength (Vector2D vector)
static fixed_t lengthProduct (Vector2D vectorA, Vector2D vectorB)
static fixed_ext_t dotProduct (Vector2D vectorA, Vector2D vectorB)
static fix19_13 dotProductHighPrecision (Vector2D vectorA, Vector2D vectorB)
static fixed_t getScale (fixed_t z, bool applyScalingMultiplier)
static bool isLeft (Vector2D a, Vector2D b, Vector2D p)
static bool isRight (Vector2D a, Vector2D b, Vector2D p)
static bool areEqual (Vector2D a, Vector2D b)
static bool isValueInRange (fixed_t number, fixed_t limitA, fixed_t limitB)
static bool isVectorInsideLine (Vector2D p, Vector2D a, Vector2D b)
static void print (Vector2D vector, int32 x, int32 y)
static void printRaw (Vector2D vector, int32 x, int32 y)

# Public Attributes

int16 x
int16 y

# Additional Inherited Members

- Private Member Functions inherited from Object
void constructor ()
 Class' constructor.
const void * getVTable ()
bool mutateTo (const void *targetClass)
- Static Private Member Functions inherited from Object
static Object getCast (void *object, ClassPointer targetClassGetClassMethod, ClassPointer baseClassGetClassMethod)
- Private Attributes inherited from Object
void * vTable
 Pointer to the class's virtual table.

# Detailed Description

Class Vector2D

Inherits from Object

Implements methods to operate on Vector2D structs.

Definition at line 32 of file Vector2D.h.

# Member Function Documentation

# areEqual()

static bool Vector2D::areEqual ( Vector2D a,
Vector2D b )
inlinestatic

Test if two vectors are equal.

Parameters
aFirst vector
bSecond vector
Returns
True if all the components of both vectors are equal; false otherwise

Definition at line 548 of file Vector2D.h.

# dotProduct()

static fixed_ext_t Vector2D::dotProduct ( Vector2D vectorA,
Vector2D vectorB )
inlinestatic

Compute the dot product of the provided vectors.

Parameters
vectorAFirst vector
vectorBSecond vector
Returns
Dot product of the provided vectors

Definition at line 485 of file Vector2D.h.

# dotProductHighPrecision()

static fix19_13 Vector2D::dotProductHighPrecision ( Vector2D vectorA,
Vector2D vectorB )
inlinestatic

Compute with higher decimal precision the dot product of the provided vectors.

Parameters
vectorAFirst vector
vectorBSecond vector
Returns
Dot product of the provided vectors

Definition at line 492 of file Vector2D.h.

# get()

static Vector2D Vector2D::get ( Vector2D from,
Vector2D to )
inlinestatic

Compute the difference vector between two provided vectors.

Parameters
fromStart vector
toEnd vector
Returns
Difference vector between the provided vectors

Definition at line 250 of file Vector2D.h.

# getFromPixelVector()

static Vector2D Vector2D::getFromPixelVector ( PixelVector screenVector)
inlinestatic

Transform the provided vector in pixel coordinates into a normal 2D vector.

Parameters
screenVectorVector to transform
Returns
2D vector

Definition at line 435 of file Vector2D.h.

# getFromScreenPixelVector()

static Vector2D Vector2D::getFromScreenPixelVector ( ScreenPixelVector screenPixelVector)
inlinestatic

Transform the provided vector in screen coordinates into a normal 2D vector.

Parameters
screenPixelVectorVector to transform
Returns
2D vector

Definition at line 446 of file Vector2D.h.

# getFromVector3D()

static Vector2D Vector2D::getFromVector3D ( Vector3D vector3D)
inlinestatic

Reduce the provided 3D vector to 2D by discarding the Z coordinate

Parameters
vector3D3D vector to reduce
Returns
Reduced vector

Definition at line 428 of file Vector2D.h.

# getRelativeToCamera()

static Vector2D Vector2D::getRelativeToCamera ( Vector2D vector)
inlinestatic

Compute the vector relative to the camera's position.

Parameters
vectorVector to compute the relative vector of
Returns
Vector relative to the camera's position

Definition at line 328 of file Vector2D.h.

# getScale()

static fixed_t Vector2D::getScale ( fixed_t z,
bool applyScalingMultiplier )
inlinestatic

Compute the scale factor for the provided z coordinate.

Parameters
zZ coordinate
applyScalingMultiplierFlag to determine if the optics' scaling multiplier is applied to the result
Returns
Computed scale

Definition at line 500 of file Vector2D.h.

# intermediate()

static Vector2D Vector2D::intermediate ( Vector2D a,
Vector2D b )
inlinestatic

Compute the intermediate vector between two provided vectors.

Parameters
aFirst vector
bSecond vector
Returns
Intermediate vector between the provided vectors

Definition at line 271 of file Vector2D.h.

# isLeft()

static bool Vector2D::isLeft ( Vector2D a,
Vector2D b,
Vector2D p )
inlinestatic

Test if the vector point b is to the left of the vector ab.

Parameters
aFirst vector
bSecond vector
pVector point to test
Returns
True if p is to the left of ab; false otherwise

Definition at line 534 of file Vector2D.h.

# isRight()

static bool Vector2D::isRight ( Vector2D a,
Vector2D b,
Vector2D p )
inlinestatic

Test if the vector point b is to the right of the vector ab.

Parameters
aFirst vector
bSecond vector
pVector point to test
Returns
True if p is to the right of ab; false otherwise

Definition at line 541 of file Vector2D.h.

# isValueInRange()

static bool Vector2D::isValueInRange ( fixed_t number,
fixed_t limitA,
fixed_t limitB )
inlinestatic

Test if a number is within a range.

Parameters
numberNumber to test
limitAFirst limit of the range
limitBSecond limit of the range
Returns
True if all the provided number is within the provided limits

Definition at line 555 of file Vector2D.h.

# isVectorInsideLine()

static bool Vector2D::isVectorInsideLine ( Vector2D p,
Vector2D a,
Vector2D b )
inlinestatic

Test if vector point p is within the vector ab

Parameters
pVector point to test
aFirst vector point of the vector onto which to test p
bSecond vector point of the vector onto which to test p
Returns
True if p lies in ab; false otherwise

Definition at line 567 of file Vector2D.h.

# length()

static fixed_t Vector2D::length ( Vector2D vector)
inlinestatic

Compute the length of the provided vector.

Parameters
vectorVector to compute the length of
Returns
Length of the provided vector

Definition at line 457 of file Vector2D.h.

# lengthProduct()

static fixed_t Vector2D::lengthProduct ( Vector2D vectorA,
Vector2D vectorB )
inlinestatic

Compute the product of the lengths of the provided vectors.

Parameters
vectorAFirst vector
vectorBSecond vector
Returns
Product of the lengths of the provided vectors

Definition at line 473 of file Vector2D.h.

# normalize()

static Vector2D Vector2D::normalize ( Vector2D vector)
inlinestatic

Normalize the provided vector.

Parameters
vectorVector to normalize
Returns
Normalized vector

Definition at line 243 of file Vector2D.h.

# perpendicular()

static Vector2D Vector2D::perpendicular ( Vector2D a,
bool left )
inlinestatic

Compute the perpendicular vector towards the provided direction.

Parameters
aVector to compute the perpendicular of
leftDirection of the perpendicular vector
Returns
Perpendicular vector

Definition at line 282 of file Vector2D.h.

# print()

static void Vector2D::print ( Vector2D vector,
int32 x,
int32 y )
inlinestatic

Print the vector's components.

Parameters
vectorVector to print
xScreen x coordinate where to print
yScreen y coordinate where to print

Definition at line 25 of file Vector2D.c.

# printRaw()

static void Vector2D::printRaw ( Vector2D vector,
int32 x,
int32 y )
inlinestatic

Print the vector's components without converting the underlying data type.

Parameters
vectorVector to print
xScreen x coordinate where to print
yScreen y coordinate where to print

Definition at line 38 of file Vector2D.c.

# projectOnto()

static Vector2D Vector2D::projectOnto ( Vector2D p,
Vector2D a,
Vector2D b )
inlinestatic

Project the point p onto the vector ab.

Parameters
pVector point to project
aFirst vector point of the vector onto which to project p
bSecond vector point of the vector onto which to project p
Returns
Projected vector point

Definition at line 338 of file Vector2D.h.

# projectOntoHighPrecision()

static Vector2D Vector2D::projectOntoHighPrecision ( Vector2D p,
Vector2D a,
Vector2D b )
inlinestatic

Project the point p onto the vector ab with higher decima precision.

Parameters
pVector point to project
aFirst vector point of the vector onto which to project p
bSecond vector point of the vector onto which to project p
Returns
Projected vector point

Definition at line 371 of file Vector2D.h.

# rotate()

static Vector2D Vector2D::rotate ( Vector2D vector,
int16 degrees )
inlinestatic

Rotate the vector according to the provided degrees.

Parameters
vectorVector to rotate
degreesAmount of degrees to rotate the vector
Returns
Rotated vector

Definition at line 404 of file Vector2D.h.

# scalarDivision()

static Vector2D Vector2D::scalarDivision ( Vector2D vector,
fixed_t scalar )
inlinestatic

Apply a scalar division over the vector's components

Parameters
vectorVector to scale
scalarScalar divisor
Returns
Scaled vector

Definition at line 316 of file Vector2D.h.

# scalarProduct()

static Vector2D Vector2D::scalarProduct ( Vector2D vector,
fixed_t scalar )
inlinestatic

Apply a scalar product over the vector's components

Parameters
vectorVector to scale
scalarScalar to multiply
Returns
Scaled vector

Definition at line 309 of file Vector2D.h.

# scale()

static Vector2D Vector2D::scale ( Vector2D vector,
Scale scale )
inlinestatic
Parameters
vectorVector to scale
scaleScale to apply to the vector's components
Returns
Scaled vector

Definition at line 302 of file Vector2D.h.

# squareLength()

static fixed_ext_t Vector2D::squareLength ( Vector2D vector)
inlinestatic

Compute the squared length of the provided vector.

Parameters
vectorVector to compute the square length of
Returns
Square length of the provided vector

Definition at line 466 of file Vector2D.h.

# sub()

static Vector2D Vector2D::sub ( Vector2D a,
Vector2D b )
inlinestatic

Compute the difference vector between two provided vectors.

Parameters
aEnd vector
bStart vector
Returns
Difference vector between the provided vectors

Definition at line 264 of file Vector2D.h.

# sum()

static Vector2D Vector2D::sum ( Vector2D a,
Vector2D b )
inlinestatic

Compute the addition vector between other two provided vectors.

Parameters
aFirst vector
bSecond vector
Returns
Addition vector between the provided vectors

Definition at line 257 of file Vector2D.h.

# unit()

static Vector2D Vector2D::unit ( uint16 axis)
inlinestatic

Get a unit vector on the provided axis.

Parameters
axisAxis on which the vector should be (__X_AXIS, __Y_AXIS)
Returns
Unit vector on the provided axis

Definition at line 232 of file Vector2D.h.

# zero()

static Vector2D Vector2D::zero ( )
inlinestatic

Get a vector with all its members initialized to zero.

Returns
Pixel vector with all its members initialized to zero

# Member Data Documentation

# x

int16 Vector2D::x

Definition at line 109 of file Types.h.

# y

int16 Vector2D::y

Definition at line 110 of file Types.h.


The documentation for this struct was generated from the following files: