Qubet  1.0
The ultimate QGL addicting videogame!
 All Classes Functions Variables Pages
Public Member Functions | Public Attributes | List of all members
Vector3f Struct Reference

Structure that rapresents a Vector of float in a 3-D space. More...

#include <vector3f.h>

Collaboration diagram for Vector3f:
Collaboration graph

Public Member Functions

 Vector3f ()
 Create a new Vector3f in coordinates (0, 0, 0).
 
 Vector3f (const Vector3f &v)
 Create a new Vector3f copying the coordinates of v. More...
 
 Vector3f (const Vector3f *v)
 Create a new Vector3f copying the coordinates of v. More...
 
 Vector3f (const GLfloat _x, const GLfloat _y, const GLfloat _z)
 Create a Vector3f using the coordinates of parameters. More...
 
 Vector3f (const GLfloat a[3])
 Create a Vector3f using the coordinates of array a[]. More...
 
GLvoid operator= (const GLfloat a[3])
 Operator = overloading function. More...
 
GLvoid operator+= (const Vector3f a)
 Operator += overloading function. More...
 
GLvoid copyInto (GLfloat a[3])
 Copy the array a content in the vector. More...
 
GLfloat & operator[] (GLint i)
 Operator [] overloading function. More...
 
const GLfloat & operator[] (GLint i) const
 Operator [] overloading function. More...
 
GLfloat lengthSq ()
 Compute the length^2 of the vector. More...
 
GLfloat length ()
 Compute the length of the vector. More...
 
GLvoid normalize ()
 Normalize a vector.
 
GLvoid zero ()
 Set all cordinates of the vector to zero.
 
GLboolean isZero ()
 Check if the vector is (0, 0, 0). More...
 
GLvoid set (const GLfloat _x, const GLfloat _y, const GLfloat _z)
 Set the vector coordinates. More...
 
GLfloat dot (const Vector3f &v)
 Compute the dot product of the vector with the vector v. More...
 
Vector3fcross (const Vector3f &v)
 Compute the cross product of the vector with the vector v. More...
 
GLvoid projectOnXY ()
 Compute the XY plan projection.
 
GLvoid projectOnYX ()
 Compute the YX plan projection.
 
GLvoid projectOnXZ ()
 Compute the XZ plan projection.
 
GLvoid projectOnZX ()
 Compute the ZX plan projection.
 
GLvoid projectOnYZ ()
 Compute the YZ plan projection.
 
GLvoid projectOnZY ()
 Compute the ZY plan projection.
 
GLvoid rotateX (const GLfloat angle)
 Rotate on the x axis. More...
 
GLvoid rotateY (const GLfloat angle)
 Rotate on the y axis. More...
 
GLvoid rotateZ (const GLfloat angle)
 Rotate on the z axis. More...
 
GLvoid rotate (const Vector3f &axis, const GLfloat angle)
 Rotate on the parameter given axis. More...
 
Vector3fgetOneOrthogonal ()
 Compute one of the orthogonal vectors of the vector. More...
 
QString toString ()
 Return the QString of coordinates. More...
 

Public Attributes

GLfloat x
 
GLfloat y
 
GLfloat z
 

Detailed Description

Structure that rapresents a Vector of float in a 3-D space.

Version
1.0
Author
#34

Constructor & Destructor Documentation

Vector3f::Vector3f ( const Vector3f v)
inline

Create a new Vector3f copying the coordinates of v.

Parameters
vis the other vector to copy coordinates.
Vector3f::Vector3f ( const Vector3f v)
inline

Create a new Vector3f copying the coordinates of v.

Parameters
vis the other vector to copy coordinates.
Vector3f::Vector3f ( const GLfloat  _x,
const GLfloat  _y,
const GLfloat  _z 
)
inline

Create a Vector3f using the coordinates of parameters.

Parameters
_xis the coordinate of x.
_yis the coordinate of y.
_zis the coordinate of z.
Vector3f::Vector3f ( const GLfloat  a[3])
inline

Create a Vector3f using the coordinates of array a[].

Parameters
a[]is the array to copy coordinates.

Member Function Documentation

GLvoid Vector3f::copyInto ( GLfloat  a[3])
inline

Copy the array a content in the vector.

Parameters
a[]is the array to copy coordinates.
Vector3f* Vector3f::cross ( const Vector3f v)
inline

Compute the cross product of the vector with the vector v.

Parameters
vthe other vector to compute the cross product.
Returns
Vector3f* the cross product.

Here is the call graph for this function:

GLfloat Vector3f::dot ( const Vector3f v)
inline

Compute the dot product of the vector with the vector v.

Parameters
vthe other vector to compute the dot product.
Returns
GLfloat the dot product.
Vector3f* Vector3f::getOneOrthogonal ( )
inline

Compute one of the orthogonal vectors of the vector.

Returns
Vector3f* an orthogonal vector.

Here is the call graph for this function:

GLboolean Vector3f::isZero ( )
inline

Check if the vector is (0, 0, 0).

Returns
GLboolean true if it is (0, 0, 0), else false.
GLfloat Vector3f::length ( )
inline

Compute the length of the vector.

If you have to check only which vector among others is longer you can use the lengthSq() function that is less resource expensive.

Returns
GLfloat length of the vector.

Here is the call graph for this function:

Here is the caller graph for this function:

GLfloat Vector3f::lengthSq ( )
inline

Compute the length^2 of the vector.

The length^2 is less resource expensive then length(). You can use it for check which vector is longer.

Returns
GLfloat length^2 of vector.

Here is the caller graph for this function:

GLvoid Vector3f::operator+= ( const Vector3f  a)
inline

Operator += overloading function.

Parameters
ais the vector to sum to the current vector.
GLvoid Vector3f::operator= ( const GLfloat  a[3])
inline

Operator = overloading function.

Parameters
a[]is the array to copy coordinates.
GLfloat& Vector3f::operator[] ( GLint  i)
inline

Operator [] overloading function.

Parameters
iis the index [1, 3].
Returns
GLfloat coordinate.
const GLfloat& Vector3f::operator[] ( GLint  i) const
inline

Operator [] overloading function.

Parameters
iis the index [1, 3].
Returns
const GLfloat coordinate
GLvoid Vector3f::rotate ( const Vector3f axis,
const GLfloat  angle 
)
inline

Rotate on the parameter given axis.

Parameters
axisis the axis on which compute the rotation.
angleis the angle of rotation.

Here is the call graph for this function:

GLvoid Vector3f::rotateX ( const GLfloat  angle)
inline

Rotate on the x axis.

Parameters
angleis the angle of rotation.

Here is the caller graph for this function:

GLvoid Vector3f::rotateY ( const GLfloat  angle)
inline

Rotate on the y axis.

Parameters
angleis the angle of rotation.
GLvoid Vector3f::rotateZ ( const GLfloat  angle)
inline

Rotate on the z axis.

Parameters
angleis the angle of rotation.

Here is the caller graph for this function:

GLvoid Vector3f::set ( const GLfloat  _x,
const GLfloat  _y,
const GLfloat  _z 
)
inline

Set the vector coordinates.

Parameters
_xis the coordinate of x.
_yis the coordinate of y.
_zis the coordinate of z.
QString Vector3f::toString ( )
inline

Return the QString of coordinates.

Returns
QString are the coordinates.

Member Data Documentation

GLfloat Vector3f::x

It is the x coordinate.

GLfloat Vector3f::y

It is the y coordinate.

GLfloat Vector3f::z

It is the z coordinate.


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