Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

rdMath Class Reference

This class provides basic math functions and constants. More...

#include <rdMath.h>

List of all members.

Static Public Member Functions

double CopySign (double aMag, double aSign)
 Return the magnitude of aMag with the sign of aSign.

bool IsZero (double aValue)
 Return wheter or not an argument is closer to zero than the constant rdMath::ZERO.

double SigmaUp (double tau, double to, double t)
 A smooth step-up function using exponentials.

double SigmaDn (double tau, double to, double t)
 A smooth step-down function using exponentials.

int FitParabola (double aX1, double aY1, double aX2, double aY2, double aX3, double aY3, double *rC0, double *rC1, double *rC2)
 Fit a parabola of the form y = c0 + c1*x + c2*x^2 to three points (x1,y1), (x2,y2), (x3,y3).

int ComputeIntersection (const rdLine *aLine, const rdPlane *aPlane, double rPoint[3])
 Compute the intersection of a line with a plane.

void ComputeNormal (double aP1X, double aP1Y, double aP1Z, double aP2X, double aP2Y, double aP2Z, double aP3X, double aP3Y, double aP3Z, double rNormal[3])
 Compute a normal to the plane described by three points (P1, P2, P3).


Static Public Attributes

const double PI = acos(-1.0)
const double RTD = 180.0/PI
const double DTR = PI/180.0
const double SMALL = 1.0e-8
const double ZERO = 1.0e-14
const double NAN = 1.357931415e-29
const double INFINITY = 1.0e30
const double MINUS_INFINITY = -INFINITY
const double PLUS_INFINITY = INFINITY


Detailed Description

This class provides basic math functions and constants.


Member Function Documentation

int rdMath::ComputeIntersection const rdLine aLine,
const rdPlane aPlane,
double  rPoint[3]
[static]
 

Compute the intersection of a line with a plane.

The line and plane can either intersect at a point, not intersect at all, or be coincident.

Parameters:
aLine Line.
aPlane Plane.
rPoint Point of intersection. rPoint is set to the "zero" point of the line in the event that line and plane are coincident; it is unchanged if the line and plane do not intersect.
Returns:
-1 if the line and plane do not intersect; 0 if the line and plane intersect at a point; 1 if the line is coincident with the plane.

void rdMath::ComputeNormal double  aP1X,
double  aP1Y,
double  aP1Z,
double  aP2X,
double  aP2Y,
double  aP2Z,
double  aP3X,
double  aP3Y,
double  aP3Z,
double  rNormal[3]
[static]
 

Compute a normal to the plane described by three points (P1, P2, P3).

The normal is computed by taking the cross product:

n = (p2-p1) x (p3-p2) / | (p2-p1) x (p3-p2) |

The three points should be distinct.

Parameters:
aP1X X component of point 1..
aP1Y Y component of point 1.
aP1Z Z component of point 1.
aP2X X component of point 2.
aP2Y Y component of point 2.
aP2Z Z component of point 2.
aP3X X component of point 3.
aP3Y Y component of point 3.
aP3Z Z component of point 3.
rNormal Unit vector normal to the plane defined by P1, P2, and P3.

double rdMath::CopySign double  aMag,
double  aSign
[static]
 

Return the magnitude of aMag with the sign of aSign.

Note that if aSign has a value of 0.0, or aMag has a value of 0.0, the sign of aMag is not changed.

Parameters:
aMag Magnitude
aSign Sign
Returns:
Value with size of aMag and sign of aSign.

int rdMath::FitParabola double  aX1,
double  aY1,
double  aX2,
double  aY2,
double  aX3,
double  aY3,
double *  rC0,
double *  rC1,
double *  rC2
[static]
 

Fit a parabola of the form y = c0 + c1*x + c2*x^2 to three points (x1,y1), (x2,y2), (x3,y3).

It is required that x3 > x2 > x1. If this condition is not met, -1 is returned. Otherwise, 0 is returned.

To imporove numerical accuracy, the independent variables are mapped to a new set of variables such that x1 -> 1.0, x3 -> 2.0, and x2 is mapped to some number in between.

bool rdMath::IsZero double  aValue  )  [static]
 

Return wheter or not an argument is closer to zero than the constant rdMath::ZERO.

Parameters:
aMag Magnitude
aSign Sign
Returns:
Value with size of aMag and sign of aSign.

double rdMath::SigmaDn double  tau,
double  to,
double  t
[static]
 

A smooth step-down function using exponentials.

Parameters:
tau Rise and fall time constant.
to Location of the midpoint of the step.
t Independent variable

double rdMath::SigmaUp double  tau,
double  to,
double  t
[static]
 

A smooth step-up function using exponentials.

Parameters:
tau Rise and fall time constant.
to Location of the midpoint of the step.
t Independent variable


The documentation for this class was generated from the following files:
Generated on Wed Aug 20 02:17:11 2003 for Simulation Software by doxygen1.3