You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
810 B
45 lines
810 B
#include <math.h>
|
|
#include "transform.h"
|
|
#include "Constants.h"
|
|
|
|
vtr RDirection(double theta, double phi)
|
|
{
|
|
double theta_in_rad, phi_in_rad;
|
|
|
|
theta_in_rad = theta * Pi / 180.0;
|
|
phi_in_rad = phi * Pi / 180.0;
|
|
|
|
vtr vv(sin(theta_in_rad) * cos(phi_in_rad),
|
|
sin(theta_in_rad) * sin(phi_in_rad),
|
|
cos(theta_in_rad));
|
|
|
|
return vv;
|
|
}
|
|
|
|
vtr ThetaDirection(double theta, double phi)
|
|
{
|
|
double theta_in_rad, phi_in_rad;
|
|
|
|
theta_in_rad = theta * Pi / 180.0;
|
|
phi_in_rad = phi * Pi / 180.0;
|
|
|
|
vtr vv(cos(theta_in_rad) * cos(phi_in_rad),
|
|
cos(theta_in_rad) * sin(phi_in_rad),
|
|
-sin(theta_in_rad));
|
|
|
|
return vv;
|
|
}
|
|
|
|
vtr PhiDirection(double theta, double phi)
|
|
{
|
|
double theta_in_rad, phi_in_rad;
|
|
|
|
phi_in_rad = phi * Pi / 180.0;
|
|
|
|
vtr vv(-sin(phi_in_rad),
|
|
cos(phi_in_rad),
|
|
0.0);
|
|
|
|
return vv;
|
|
}
|
|
|
|
|