#include <tgUtil.h>
|
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 ¢er) |
|
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, const btVector3 &fallbackAxis=btVector3(0, 0, 0)) |
|
static btVector3 | getCentroid (const std::vector< btVector3 > &points) |
|
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) |
|
static void | seedRandom () |
|
static void | seedRandom (int seed) |
|
Contains only static constants and static member functions deemed generally useful.
Definition at line 48 of file tgUtil.h.
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 274 of file tgUtil.h.
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 294 of file tgUtil.h.
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 306 of file tgUtil.h.
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] | from | a btVector3 |
[in] | to | a btVector3 |
[in] | precision | the number of decimal places; defaults to 5 if not supplied or negative |
Definition at line 182 of file tgUtil.h.
static btVector3 tgUtil::center |
( |
const btVector3 & |
start, |
|
|
const btVector3 & |
end |
|
) |
| |
|
inlinestatic |
Return a btVector3 halfway between start and end.
- Parameters
-
[in] | start | a btVector3 |
[in] | end | a btVector3 |
- Returns
- a btVector3 halfway between start and end
Definition at line 76 of file tgUtil.h.
static double tgUtil::deg2rad |
( |
double |
degrees | ) |
|
|
inlinestatic |
Convert degrees to radians.
- Parameters
-
[in] | degrees | an 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 335 of file tgUtil.h.
static std::string tgUtil::degSymbol |
( |
| ) |
|
|
inlinestatic |
Return a degree symbol
- Returns
- the unicode 'degrees' character
Definition at line 65 of file tgUtil.h.
static btVector3 tgUtil::getArbitraryNonParallelVector |
( |
btVector3 |
v | ) |
|
|
inlinestatic |
Return a random btVector3 that is not parallel to v.
- Parameters
-
[in] | v | a btVector3, passed by value |
- Returns
- a random btVector3 that is not parallel to v
Definition at line 261 of file tgUtil.h.
static btVector3 tgUtil::getCentroid |
( |
const std::vector< btVector3 > & |
points | ) |
|
|
inlinestatic |
Returns the mean position of a set of btVector3 points. (added to accommodate structures encoded in YAML)
- Parameters
-
[in] | points | a vector of btVector3, passed by reference |
- Returns
- a btVector3 that represents the centroid of the points vector
Definition at line 246 of file tgUtil.h.
static btQuaternion tgUtil::getQuaternionBetween |
( |
btVector3 |
a, |
|
|
btVector3 |
b, |
|
|
const btVector3 & |
fallbackAxis = btVector3(0,0,0) |
|
) |
| |
|
inlinestatic |
Return a quaternion that, if applied, would rotate vector a to align with vector b.
- Parameters
-
[in] | a | a btVector3, passed by value |
[in] | b | a btVector3, passed by value |
[in] | fallbackAxis | a btVector3, passed by reference |
- 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 199 of file tgUtil.h.
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] | axis | a btVector3, passed by value |
[in] | radius | unused |
[in] | traget | a 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 159 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] | start | a btVector3 |
[in] | end | a 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 92 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] | start | a btVector3 |
[in] | end | a btVector3 |
Definition at line 114 of file tgUtil.h.
static btVector3 tgUtil::getVector |
( |
const btVector3 & |
from, |
|
|
const btVector3 & |
to |
|
) |
| |
|
inlinestatic |
Get a vector that points from a to b.
- Parameters
-
[in] | from | a btVector3 |
[in] | to | a btVector3 |
- Returns
- the vector difference to - fromn
Definition at line 135 of file tgUtil.h.
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] | radians | an 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 324 of file tgUtil.h.
void tgUtil::seedRandom |
( |
int |
seed | ) |
|
|
static |
- Todo:
- is this necessary? If everyone uses the above function we can just change the definition of rdtsc to seed random everywhere.
Definition at line 52 of file tgUtil.cpp.
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] | degrees | a measure in degrees |
- Returns
- a string representation of the given number of degees with the degree symbol appended
Definition at line 347 of file tgUtil.h.
static btVector3 tgUtil::upVector |
( |
| ) |
|
|
inlinestatic |
Get an 'up' vector (y axis is up)
- Returns
- a btVector3 (0,1,0)
Definition at line 56 of file tgUtil.h.
The documentation for this class was generated from the following files: