VecAngle.H File Reference

Utilities for vectors and angles. More...

#include <math.h>

Go to the source code of this file.

Functions

double rad2deg (const float &rad)
 Converter radians to degrees.
double deg2rad (const float &deg)
 Converter degrees to radians.
void flip (double &dec, double &dip)
 put a vector in the lower hemisphere
void flip (float &dec, float &dip)
 put a vector in the lower hemisphere
float normRadAngle (float angleRad)
 renormalize an angle to be in [0..2*M_PI]
void rotateXY (const float x1, const float y1, const float angleRad, float &x2, float &y2)
 rotate an XY vector about the origin
void xyz2tpr (const double x, const double y, const double z, double &theta, double &phi, double &radius)
 convert xyz to theta (t) and phi(p) in radians. Go polar.
void ldi2xyz (const float len, const float dec, const float inc, std::vector< float > &xyz)
 Takes a triple that comes from the output of s_eigs and gives the cartesian coordinates.
bool isEqual (const float a, const float b, const float del)
 Compare two floats to see if they are close to each other.


Detailed Description

Utilities for vectors and angles.


Function Documentation

double deg2rad const float &  deg  )  [inline]
 

Converter degrees to radians.

Parameters:
deg Angle in degrees.
Returns:
Angle in radians.
Note: does not force the radians to be in [0..2PI]

void flip float &  dec,
float &  dip
 

put a vector in the lower hemisphere

Parameters:
dec Declination from north clockwise. angle in degrees
dip Dip of vector. Returns 0 is horizontal, 90 is vertical, down

void flip double &  dec,
double &  dip
 

put a vector in the lower hemisphere

Parameters:
dec Declination from north clockwise. angle in degrees
dip Dip of vector. Returns 0 is horizontal, 90 is vertical, down
Bug:
Should this be a template?

bool isEqual const float  a,
const float  b,
const float  del
[inline]
 

Compare two floats to see if they are close to each other.

Parameters:
a,b values to compare
del how much are a and b allowed to differ
Returns:
true if the two values are within del of each other

void ldi2xyz const float  len,
const float  dec,
const float  inc,
std::vector< float > &  xyz
 

Takes a triple that comes from the output of s_eigs and gives the cartesian coordinates.

Parameters:
len Eigen value
dec Declination in degrees. 0 is north (+y), 90, is east (+x), 180 is south (-y)
inc Inclination in degrees. 0 is horizontal, while 90 is straight down.
xyz Return values of x (East), y (North), z (Up)

float normRadAngle float  angleRad  ) 
 

renormalize an angle to be in [0..2*M_PI]

Parameters:
angleRad Angle in radians. No limit to the value
Returns:
angle in [0..2*M_PI]
Bug:
will be slow for angles that are very far from the returned range. 1000000*M_PI would take a while

double rad2deg const float &  rad  )  [inline]
 

Converter radians to degrees.

Parameters:
rad Angle in radians.
Returns:
Angle in degrees
Note: does not force the degrees to be in [0..360]

void rotateXY const float  x1,
const float  y1,
const float  angleRad,
float &  x2,
float &  y2
 

rotate an XY vector about the origin

Parameters:
x1 Input x value
y1 Input y value
angleRad Angle in radians to rotate by. Right handed rotation.
x2 Output x value
y2 Output y value
An example... rotateXY (1.0, 0.0, M_PI/4, x2, y2) will give: (0.0, 1.0)

void xyz2tpr const double  x,
const double  y,
const double  z,
double &  theta,
double &  phi,
double &  radius
 

convert xyz to theta (t) and phi(p) in radians. Go polar.

Parameters:
x Cartesian x coord.
y Cartesian y coord.
z Cartesian z coord.
theta Angle in radians from horizontal. 0 is vertical, PI/2 is horizontal, PI is down;
phi Angle in radians in the horizontal plane. 0 is +x, PI is -x, PI/2 is +y.
radius Distance from the origin


Generated on Thu Mar 2 17:55:25 2006 for density by  doxygen 1.4.6