ChirpSim
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Macros | Functions
mathutility.h File Reference
#include <QPointF>
#include <QList>
#include <Box2D/Box2D.h>
Include dependency graph for mathutility.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MATHUTILITY_H
 
#define DEGTORAD   0.0174532925199432957f
 
#define RADTODEG   57.295779513082320876f
 
#define PI   3.14159265359f
 

Functions

int sign (float x)
 Gets the sign of the floating point value. More...
 
float min (float x, float y)
 Returns the minimal value of x and y. More...
 
float max (float x, float y)
 Returns the maximal value of x and y. More...
 
float clamp (float x, float minValue, float maxValue)
 Clamps x between minValue and maxValue. More...
 
void b2Vec2ToQPointF (b2Vec2 *points, size_t num_points, QPointF *result)
 Converts an array of b2Vec2 into an array of QPointF. More...
 
void QPointFTob2Vec2 (QList< QPointF > points, b2Vec2 *result)
 Converts a list of QPointF into an array of b2Vec2. More...
 

Macro Definition Documentation

#define DEGTORAD   0.0174532925199432957f
#define MATHUTILITY_H
#define PI   3.14159265359f
#define RADTODEG   57.295779513082320876f

Function Documentation

void b2Vec2ToQPointF ( b2Vec2 *  points,
size_t  num_points,
QPointF *  result 
)

Converts an array of b2Vec2 into an array of QPointF.

Parameters
pointsArray of b2Vec2 to convert.
num_pointsNumber of points in the array.
resultArray to store the result in.
Note
Assumes that result is an array equal or larger than the points array.

Referenced by genericPaintFixture().

Here is the caller graph for this function:

float clamp ( float  x,
float  minValue,
float  maxValue 
)
inline

Clamps x between minValue and maxValue.

Parameters
xValue to be clamped.
minValueMinimum value x can have.
maxValueMaximum value x can have.
Returns
minValue if x < minValue. x if minValue < x < maxValue. maxValue if x > maxvalue.

References max(), and min().

Referenced by ChirpIrSensor::value().

Here is the call graph for this function:

Here is the caller graph for this function:

float max ( float  x,
float  y 
)
inline

Returns the maximal value of x and y.

Parameters
xFirst value.
ySecond value.
Returns
If x > y returns x. If y >= x returns y.

Referenced by clamp(), Chirp::computeBoundingRect(), and ChirpIrSensor::value().

Here is the caller graph for this function:

float min ( float  x,
float  y 
)
inline

Returns the minimal value of x and y.

Parameters
xFirst value.
ySecond value.
Returns
If x <= y returns x. If y < x returns y.

Referenced by clamp(), and Chirp::computeBoundingRect().

Here is the caller graph for this function:

void QPointFTob2Vec2 ( QList< QPointF >  points,
b2Vec2 *  result 
)

Converts a list of QPointF into an array of b2Vec2.

Parameters
pointsSource list to convert.
resultArray to store the result in.
Note
Assumes that result is an array equal or larger than the points array.

Referenced by PushableObject::PushableObject(), and Wall::Wall().

Here is the caller graph for this function:

int sign ( float  x)
inline

Gets the sign of the floating point value.

Parameters
xValue to get the sign of.
Returns
-1 if x < 0, 0 if x == 0, 1 if x > 0.

Referenced by SimulatorView::wheelEvent(), and SimulatorView::zoom().

Here is the caller graph for this function: