#include <Sphere.h>
Public Member Functions | |
Sphere (double innerRadius, double outerRadius, double startPhi, double deltaPhi, double startZ, double deltaZ) | |
void | stream (std::ostream &) const |
double | volume () const |
DDI::Sphere::Sphere | ( | double | innerRadius, |
double | outerRadius, | ||
double | startPhi, | ||
double | deltaPhi, | ||
double | startZ, | ||
double | deltaZ | ||
) |
void DDI::Sphere::stream | ( | std::ostream & | os | ) | const [virtual] |
double DDI::Sphere::volume | ( | ) | const [virtual] |
Reimplemented from DDI::Solid.
Definition at line 37 of file Sphere.cc.
References funct::cos(), and Geom::pi().
{ double volume(0.); if ( std::fabs(p_[3]) <= 2.*Geom::pi() && std::fabs(p_[5]) <= Geom::pi() ) { volume = std::fabs((p_[1]*p_[1]*p_[1] - p_[0]*p_[0]*p_[0])/3. * (std::cos(p_[4]+p_[5]) - std::cos(p_[4]))*p_[3]); } else if (std::fabs(p_[3]) <= 2.*Geom::pi() && std::fabs(p_[5]) > Geom::pi() ) { volume = std::fabs((p_[1]*p_[1]*p_[1] - p_[0]*p_[0]*p_[0])/3. * (std::cos(p_[4]+p_[5]-180.*deg) - std::cos(p_[4]))*p_[3]); } else if (std::fabs(p_[3]) > 2.*Geom::pi() && std::fabs(p_[5]) <= Geom::pi() ) { volume = std::fabs((p_[1]*p_[1]*p_[1] - p_[0]*p_[0]*p_[0])/3. * (std::cos(p_[4]+p_[5]) - std::cos(p_[4]))*(p_[3]-p_[2])); } return volume; }