Vector3D Struct Reference

#include <Vector3D.h>

Inheritance diagram for Vector3D:
Object

# Static Public Member Functions

static Vector3D zero ()
static Vector3D unit (uint16 axis)
static Vector3D normalize (Vector3D vector)
static Vector3D get (Vector3D from, Vector3D to)
static Vector3D sum (Vector3D a, Vector3D b)
static Vector3D sub (Vector3D a, Vector3D b)
static Vector3D absolute (Vector3D vector)
static Vector3D intermediate (Vector3D a, Vector3D b)
static Vector3D perpendicularXPlane (Vector3D a, bool left)
static Vector3D perpendicularYPlane (Vector3D a, bool left)
static Vector3D perpendicularZPlane (Vector3D a, bool left)
static Vector3D scale (Vector3D vector, Scale scale)
static Vector3D scalarProduct (Vector3D vector, fixed_t scalar)
static Vector3D scalarDivision (Vector3D vector, fixed_t scalar)
static Vector3D getRelativeToCamera (Vector3D vector)
static Vector3D getPlaneNormal (Vector3D vectorA, Vector3D vectorB, Vector3D vectorC)
static Vector3D projectOnto (Vector3D p, Vector3D a, Vector3D b)
static Vector3D projectOntoHighPrecision (Vector3D p, Vector3D a, Vector3D b)
static Vector3D rotate (Vector3D vector, Rotation rotation)
static Vector3D rotateXAxis (Vector3D vector, int16 degrees)
static Vector3D rotateYAxis (Vector3D vector, int16 degrees)
static Vector3D rotateZAxis (Vector3D vector, int16 degrees)
static Vector3D getFromVector2D (Vector2D vector2D, fixed_t z)
static Vector3D getFromPixelVector (PixelVector pixelVector)
static Vector3D getFromScreenPixelVector (ScreenPixelVector screenPixelVector)
static fixed_t length (Vector3D vector)
static fixed_ext_t squareLength (Vector3D vector)
static fixed_t lengthProduct (Vector3D vectorA, Vector3D vectorB)
static fixed_ext_t dotProduct (Vector3D vectorA, Vector3D vectorB)
static fix19_13 dotProductHighPrecision (Vector3D vectorA, Vector3D vectorB)
static fixed_t getScale (fixed_t z, bool applyScalingMultiplier)
static bool isLeft (Vector3D a, Vector3D b, Vector3D p)
static bool isRight (Vector3D a, Vector3D b, Vector3D p)
static bool areEqual (Vector3D a, Vector3D b)
static bool isValueInRange (fixed_t number, fixed_t limitA, fixed_t limitB)
static bool isVectorInsideLine (Vector3D p, Vector3D a, Vector3D b)
static void print (Vector3D vector, int32 x, int32 y)
static void printRaw (Vector3D vector, int32 x, int32 y)

# Public Attributes

int16 x
int16 y
int16 z

# 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 Vector3D

Inherits from Object

Implements methods to operate on Vector3D structs.

Definition at line 32 of file Vector3D.h.

# Member Function Documentation

# absolute()

static Vector3D Vector3D::absolute ( Vector3D vector)
inlinestatic

Compute the absulte values for the vector's components.

Parameters
vectorVector to convert
Returns
Vector whose components are all absolute

Definition at line 316 of file Vector3D.h.

# areEqual()

static bool Vector3D::areEqual ( Vector3D a,
Vector3D 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 792 of file Vector3D.h.

# dotProduct()

static fixed_ext_t Vector3D::dotProduct ( Vector3D vectorA,
Vector3D 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 715 of file Vector3D.h.

# dotProductHighPrecision()

static fix19_13 Vector3D::dotProductHighPrecision ( Vector3D vectorA,
Vector3D 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 725 of file Vector3D.h.

# get()

static Vector3D Vector3D::get ( Vector3D from,
Vector3D 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 295 of file Vector3D.h.

# getFromPixelVector()

static Vector3D Vector3D::getFromPixelVector ( PixelVector pixelVector)
inlinestatic

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

Parameters
pixelVectorVector to transform
Returns
3D vector

Definition at line 650 of file Vector3D.h.

# getFromScreenPixelVector()

static Vector3D Vector3D::getFromScreenPixelVector ( ScreenPixelVector screenPixelVector)
inlinestatic

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

Parameters
screenPixelVectorVector to transform
Returns
3D vector

Definition at line 662 of file Vector3D.h.

# getFromVector2D()

static Vector3D Vector3D::getFromVector2D ( Vector2D vector2D,
fixed_t z )
inlinestatic

Extend the provided 2D vector to 3D.

Parameters
vector2D2D vector to extend
zZ coordinate for the extended vector
Returns
Extended vector

Definition at line 643 of file Vector3D.h.

# getPlaneNormal()

static Vector3D Vector3D::getPlaneNormal ( Vector3D vectorA,
Vector3D vectorB,
Vector3D vectorC )
inlinestatic

Compute the normal to the plane defined by the provided vectors.

Parameters
vectorACommon vector
vectorBSecond vector
vectorCThird vector
Returns
Normal vector to the plane defined by AB and AC

Definition at line 452 of file Vector3D.h.

# getRelativeToCamera()

static Vector3D Vector3D::getRelativeToCamera ( Vector3D 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 441 of file Vector3D.h.

# getScale()

static fixed_t Vector3D::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 735 of file Vector3D.h.

# intermediate()

static Vector3D Vector3D::intermediate ( Vector3D a,
Vector3D 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 328 of file Vector3D.h.

# isLeft()

static bool Vector3D::isLeft ( Vector3D a,
Vector3D b,
Vector3D 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 778 of file Vector3D.h.

# isRight()

static bool Vector3D::isRight ( Vector3D a,
Vector3D b,
Vector3D 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 785 of file Vector3D.h.

# isValueInRange()

static bool Vector3D::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 799 of file Vector3D.h.

# isVectorInsideLine()

static bool Vector3D::isVectorInsideLine ( Vector3D p,
Vector3D a,
Vector3D 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 811 of file Vector3D.h.

# length()

static fixed_t Vector3D::length ( Vector3D 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 674 of file Vector3D.h.

# lengthProduct()

static fixed_t Vector3D::lengthProduct ( Vector3D vectorA,
Vector3D 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 696 of file Vector3D.h.

# normalize()

static Vector3D Vector3D::normalize ( Vector3D vector)
inlinestatic

Normalize the provided vector.

Parameters
vectorVector to normalize
Returns
Normalized vector

Definition at line 288 of file Vector3D.h.

# perpendicularXPlane()

static Vector3D Vector3D::perpendicularXPlane ( Vector3D a,
bool left )
inlinestatic

Compute the perpendicular vector to the X plane in the provided direction.

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

Definition at line 340 of file Vector3D.h.

# perpendicularYPlane()

static Vector3D Vector3D::perpendicularYPlane ( Vector3D a,
bool left )
inlinestatic

Compute the perpendicular vector to the Y plane in the provided direction.

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

Definition at line 360 of file Vector3D.h.

# perpendicularZPlane()

static Vector3D Vector3D::perpendicularZPlane ( Vector3D a,
bool left )
inlinestatic

Compute the perpendicular vector to the Z plane in the provided direction.

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

Definition at line 380 of file Vector3D.h.

# print()

static void Vector3D::print ( Vector3D 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 Vector3D.c.

# printRaw()

static void Vector3D::printRaw ( Vector3D 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 40 of file Vector3D.c.

# projectOnto()

static Vector3D Vector3D::projectOnto ( Vector3D p,
Vector3D a,
Vector3D 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 478 of file Vector3D.h.

# projectOntoHighPrecision()

static Vector3D Vector3D::projectOntoHighPrecision ( Vector3D p,
Vector3D a,
Vector3D 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 517 of file Vector3D.h.

# rotate()

static Vector3D Vector3D::rotate ( Vector3D vector,
Rotation rotation )
inlinestatic

Rotate the vector according to the provided rotation.

Parameters
vectorVector to rotate
rotationRotation to apply to the vector
Returns
Rotated vector

Definition at line 565 of file Vector3D.h.

# rotateXAxis()

static Vector3D Vector3D::rotateXAxis ( Vector3D vector,
int16 degrees )
inlinestatic

Rotate the vector around the X axis.

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

Definition at line 589 of file Vector3D.h.

# rotateYAxis()

static Vector3D Vector3D::rotateYAxis ( Vector3D vector,
int16 degrees )
inlinestatic

Rotate the vector around the Y axis.

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

Definition at line 607 of file Vector3D.h.

# rotateZAxis()

static Vector3D Vector3D::rotateZAxis ( Vector3D vector,
int16 degrees )
inlinestatic

Rotate the vector around the Z axis.

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

Definition at line 625 of file Vector3D.h.

# scalarDivision()

static Vector3D Vector3D::scalarDivision ( Vector3D 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 424 of file Vector3D.h.

# scalarProduct()

static Vector3D Vector3D::scalarProduct ( Vector3D 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 412 of file Vector3D.h.

# scale()

static Vector3D Vector3D::scale ( Vector3D vector,
Scale scale )
inlinestatic

Scale the provided vector's components

Parameters
vectorVector to scale
scaleScale to apply to the vector's components
Returns
Scaled vector

Definition at line 400 of file Vector3D.h.

# squareLength()

static fixed_ext_t Vector3D::squareLength ( Vector3D 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 686 of file Vector3D.h.

# sub()

static Vector3D Vector3D::sub ( Vector3D a,
Vector3D 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 309 of file Vector3D.h.

# sum()

static Vector3D Vector3D::sum ( Vector3D a,
Vector3D 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 302 of file Vector3D.h.

# unit()

static Vector3D Vector3D::unit ( uint16 axis)
inlinestatic

Get a unit vector on the provided axis.

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

Definition at line 276 of file Vector3D.h.

# zero()

static Vector3D Vector3D::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 Vector3D::x

Definition at line 100 of file Types.h.

# y

int16 Vector3D::y

Definition at line 101 of file Types.h.

# z

int16 Vector3D::z

Definition at line 102 of file Types.h.


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