NTRT Simulator  v1.1
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgUtil Class Reference

#include <tgUtil.h>

Static Public Member Functions

static btVector3 upVector ()
 
static std::string degSymbol ()
 
static btVector3 center (const btVector3 &start, const btVector3 &end)
 
static btTransform getTransform (const btVector3 &startOrientation, const btVector3 &start, const btVector3 &end)
 
static btTransform getTransform (const btVector3 &start, const btVector3 &end)
 
static btTransform getTransform (const btVector3 &center)
 
static btVector3 getVector (const btVector3 &from, const btVector3 &to)
 
static btVector3 getRadiusVector (btVector3 axis, double radius, btVector3 target)
 
static bool almostEqual (const btVector3 &from, const btVector3 &to, int precision=5)
 
static btQuaternion getQuaternionBetween (btVector3 a, btVector3 b)
 
static btVector3 getArbitraryNonParallelVector (btVector3 v)
 
static void addRotation (btVector3 &v, const btVector3 &fixedPoint, const btVector3 &axis, double angle)
 
static void addRotation (btVector3 &v, const btVector3 &fixedPoint, const btVector3 &fromOrientation, const btVector3 &toOrientation)
 
static void addRotation (btVector3 &v, const btVector3 &fixedPoint, const btQuaternion &rotation)
 
static double rad2deg (double radians)
 
static double deg2rad (double degrees)
 
static std::string strDeg (double degrees)
 
static double round (double d, int precision=5)
 

Detailed Description

Contains only static constants and static member functions deemed generally useful.

Definition at line 46 of file tgUtil.h.

Member Function Documentation

static void tgUtil::addRotation ( btVector3 &  v,
const btVector3 &  fixedPoint,
const btVector3 &  axis,
double  angle 
)
inlinestatic

Rotate the provided vector (v) around a fixed point

Definition at line 252 of file tgUtil.h.

Here is the caller graph for this function:

static void tgUtil::addRotation ( btVector3 &  v,
const btVector3 &  fixedPoint,
const btVector3 &  fromOrientation,
const btVector3 &  toOrientation 
)
inlinestatic

Rotate the provided vector (v) around a fixed point

Definition at line 272 of file tgUtil.h.

Here is the call graph for this function:

static void tgUtil::addRotation ( btVector3 &  v,
const btVector3 &  fixedPoint,
const btQuaternion &  rotation 
)
inlinestatic

Rotate the provided vector (v) around a fixed point

Definition at line 284 of file tgUtil.h.

Here is the call graph for this function:

static bool tgUtil::almostEqual ( const btVector3 &  from,
const btVector3 &  to,
int  precision = 5 
)
inlinestatic

Check that two vectors are almost equal within a given precision (default is 5 decimal places).

Parameters
[in]froma btVector3
[in]toa btVector3
[in]precisionthe number of decimal places; defaults to 5 if not supplied or negative

Definition at line 180 of file tgUtil.h.

Here is the caller graph for this function:

static btVector3 tgUtil::center ( const btVector3 &  start,
const btVector3 &  end 
)
inlinestatic

Return a btVector3 halfway between start and end.

Parameters
[in]starta btVector3
[in]enda btVector3
Returns
a btVector3 halfway between start and end

Definition at line 74 of file tgUtil.h.

Here is the caller graph for this function:

static double tgUtil::deg2rad ( double  degrees)
inlinestatic

Convert degrees to radians.

Parameters
[in]degreesan angle measured in degrees
Returns
the angle as measured in radians
Todo:
Normalize the return value so that it is in [0.0, 2 * pi).

Definition at line 313 of file tgUtil.h.

static std::string tgUtil::degSymbol ( )
inlinestatic

Return a degree symbol

Returns
the unicode 'degrees' character

Definition at line 63 of file tgUtil.h.

Here is the caller graph for this function:

static btVector3 tgUtil::getArbitraryNonParallelVector ( btVector3  v)
inlinestatic

Return a random btVector3 that is not parallel to v.

Parameters
[in]va btVector3, passed by value
Returns
a random btVector3 that is not parallel to v

Definition at line 239 of file tgUtil.h.

Here is the caller graph for this function:

static btQuaternion tgUtil::getQuaternionBetween ( btVector3  a,
btVector3  b 
)
inlinestatic

Return a quaternion that, if applied, would rotate vector a to align with vector b.

Parameters
[in]aa btVector3, passed by value
[in]ba btVector3, passed by value
Returns
a quaternion that, if applied, would rotate vector a to align with vector b
Todo:
get some sensible value if a or b = (0, 0, 0). See getTransform

Definition at line 196 of file tgUtil.h.

Here is the call graph for this function:

static btVector3 tgUtil::getRadiusVector ( btVector3  axis,
double  radius,
btVector3  target 
)
inlinestatic

Return a vector that points to the closest point on the edge of a cylinder when it is added to a vector pointing to the top of the cylinder.

—> = returned vector, if the target is in this direction ^ | | | <- cylinder edge | <- cylinder center

Parameters
[in]axisa btVector3, passed by value
[in]radiusunused
[in]trageta btVector3, passed by value
Returns
a vector that points to the closest point on the edge of a cylinder when it is added to a vector pointing to the top of the cylinder
Note
This has not yet been tested as of 05/14/2013

Definition at line 157 of file tgUtil.h.

static btTransform tgUtil::getTransform ( const btVector3 &  startOrientation,
const btVector3 &  start,
const btVector3 &  end 
)
inlinestatic

Return the transform required to place a 'long' element (e.g., a cylinder), rotating from startOrientation, with center of mass between start and end.

Parameters
[in]starta btVector3
[in]enda btVector3
Returns
the transform required to place a 'long' element (e.g., a cylinder), rotating from startOrientation, with center of mass between start and end

Definition at line 90 of file tgUtil.h.

static btTransform tgUtil::getTransform ( const btVector3 &  start,
const btVector3 &  end 
)
inlinestatic

Get a transform using 'up()' as the starting orientation.

Parameters
[in]starta btVector3
[in]enda btVector3

Definition at line 112 of file tgUtil.h.

Here is the call graph for this function:

static btVector3 tgUtil::getVector ( const btVector3 &  from,
const btVector3 &  to 
)
inlinestatic

Get a vector that points from a to b.

Parameters
[in]froma btVector3
[in]toa btVector3
Returns
the vector difference to - fromn

Definition at line 133 of file tgUtil.h.

Here is the caller graph for this function:

static double tgUtil::rad2deg ( double  radians)
inlinestatic
Todo:
write a function that returns the normal of a vector without overwriting the original vector line btVector3's .normalize() functions

Convert radians to degrees.

Parameters
[in]radiansan angle measured in radians
Returns
the angle as measured in degrees
Todo:
Normalize the return value so that it is in [0.0, 360.0).

Definition at line 302 of file tgUtil.h.

static std::string tgUtil::strDeg ( double  degrees)
inlinestatic

Return a string representation of the given number of degees with the degree symbol appended.

Parameters
[in]degreesa measure in degrees
Returns
a string representation of the given number of degees with the degree symbol appended

Definition at line 325 of file tgUtil.h.

Here is the call graph for this function:

static btVector3 tgUtil::upVector ( )
inlinestatic

Get an 'up' vector (y axis is up)

Returns
a btVector3 (0,1,0)

Definition at line 54 of file tgUtil.h.

Here is the caller graph for this function:


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