WARPXM v1.10.0
Loading...
Searching...
No Matches
SphericalPositionVector Class Reference

This class computes Cartesian and Spherical components of a poition vector in space emanating from origin. More...

#include <wxmspherical.h>

Detailed Description

This class computes Cartesian and Spherical components of a poition vector in space emanating from origin.

Public Member Functions

 SphericalPositionVector (const std::vector< real > n)
 Initialize the position vector with Cartesian components (typically a normal)
 
 SphericalPositionVector (const real r, const real theta, const real phi)
 Initialize the position vector with Sphherical components.
 
void CalculateFromRTHETAPHI (real r, real theta, real phi)
 
real get_r () const
 getter of r
 
real get_theta () const
 getter of theta
 
real get_phi () const
 getter of phi
 
real get_x () const
 getter of x
 
real get_y () const
 getter of y
 
real get_z () const
 getter of z
 
void print (std::stringstream &ss)
 Print attributes.
 

Protected Member Functions

void set_r (real r)
 Setters: Shouldn't do these without recalculating all attributes.
 
void set_theta (real theta)
 setter of theta
 
void set_phi (real phi)
 setter of phi
 
real calculate_r ()
 r is the length of the vector (assumed to emanate from origin) should be sqrt (x**2 + y**2 + z**2)
 
real calculate_theta ()
 theta is the angle off the z axis (gives lattitude) is arccos(z/r) or equivalently arctan2(sqrt(x^2+y^2)/z)
 
real calculate_phi ()
 phi is the longitude angle along x-y plane is arctan2(y/x)
 
real calculate_x ()
 calculate x component is r*sin(theta)*cos(phi)
 
real calculate_y ()
 calculate y component is r*sin(theta)*sin(phi)
 
real calculate_z ()
 calculate z component is r*cos(theta)
 
std::vector< realcalculate_vec ()
 

Protected Attributes

std::vector< real_vec
 
real _r
 
real _theta
 
real _phi
 

Constructor & Destructor Documentation

◆ SphericalPositionVector() [1/2]

SphericalPositionVector::SphericalPositionVector ( const std::vector< real n)

Initialize the position vector with Cartesian components (typically a normal)

Parameters
nThe normal with 3 Cartesian components n[0] is x n[1] is y n[2] is z
nNormal vector

◆ SphericalPositionVector() [2/2]

SphericalPositionVector::SphericalPositionVector ( const real  r,
const real  theta,
const real  phi 
)

Initialize the position vector with Sphherical components.

Parameters
rLength of vector
thetaangle from z axis (latitude)
phiangle on x-y plane from x direction (longitude)

Member Function Documentation

◆ calculate_phi()

real SphericalPositionVector::calculate_phi ( )
protected

phi is the longitude angle along x-y plane is arctan2(y/x)

◆ calculate_r()

real SphericalPositionVector::calculate_r ( )
protected

r is the length of the vector (assumed to emanate from origin) should be sqrt (x**2 + y**2 + z**2)

◆ calculate_theta()

real SphericalPositionVector::calculate_theta ( )
protected

theta is the angle off the z axis (gives lattitude) is arccos(z/r) or equivalently arctan2(sqrt(x^2+y^2)/z)

◆ calculate_vec()

std::vector< real > SphericalPositionVector::calculate_vec ( )
protected

◆ calculate_x()

real SphericalPositionVector::calculate_x ( )
protected

calculate x component is r*sin(theta)*cos(phi)

◆ calculate_y()

real SphericalPositionVector::calculate_y ( )
protected

calculate y component is r*sin(theta)*sin(phi)

◆ calculate_z()

real SphericalPositionVector::calculate_z ( )
protected

calculate z component is r*cos(theta)

◆ CalculateFromRTHETAPHI()

void SphericalPositionVector::CalculateFromRTHETAPHI ( real  r,
real  theta,
real  phi 
)

◆ get_phi()

real SphericalPositionVector::get_phi ( ) const
inline

getter of phi

◆ get_r()

real SphericalPositionVector::get_r ( ) const
inline

getter of r

◆ get_theta()

real SphericalPositionVector::get_theta ( ) const
inline

getter of theta

◆ get_x()

real SphericalPositionVector::get_x ( ) const
inline

getter of x

◆ get_y()

real SphericalPositionVector::get_y ( ) const
inline

getter of y

◆ get_z()

real SphericalPositionVector::get_z ( ) const
inline

getter of z

◆ print()

void SphericalPositionVector::print ( std::stringstream &  ss)

Print attributes.

◆ set_phi()

void SphericalPositionVector::set_phi ( real  phi)
inlineprotected

setter of phi

◆ set_r()

void SphericalPositionVector::set_r ( real  r)
inlineprotected

Setters: Shouldn't do these without recalculating all attributes.

setter of r

◆ set_theta()

void SphericalPositionVector::set_theta ( real  theta)
inlineprotected

setter of theta

Member Data Documentation

◆ _phi

real SphericalPositionVector::_phi
protected

◆ _r

real SphericalPositionVector::_r
protected

◆ _theta

real SphericalPositionVector::_theta
protected

◆ _vec

std::vector<real> SphericalPositionVector::_vec
protected

The documentation for this class was generated from the following file: