VecAngle.C File Reference

Implement vector, angle, and coordinate frame functions. More...

#include <cmath>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include "VecAngle.H"
#include "debug.H"

Functions

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, vector< float > &xyz)

Variables

static const UNUSED char * RCSid = "@(#) $Id: VecAngle.C,v 1.3 2004/11/03 00:42:35 schwehr Exp $"
 Let the debugger find out which version is being used.


Detailed Description

Implement vector, angle, and coordinate frame functions.


Function Documentation

void ldi2xyz (  const float  len,
const float  dec,
const float  inc,
vector< float > &  xyz
) 
 

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

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


Variable Documentation

const UNUSED char* RCSid = "@(#) $Id: VecAngle.C,v 1.3 2004/11/03 00:42:35 schwehr Exp $" [static]
 

Let the debugger find out which version is being used.


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