PHSphPoint.C
//---------------------------------------------------------------------------------------
// Class: PHSphPoint.C
//
// Created by: Jane M. Burward-Hoy and Federica Messer
//
// Purpose: The Phenix 3D Spherical Point
//
// Last update: 10/19/99
//--------------------------------------------------------------------------------------
#include "PHSphPoint.h"
#include "PHGeometron.h"
PHSphPoint::PHSphPoint()
{
r = 0;
phi = 0;
theta = 0;
}
PHSphPoint::PHSphPoint(double r0, double p0, double t0)
{
r = r0;
phi = p0;
theta = t0;
}
PHSphPoint::PHSphPoint(double r0, PHAngle p0, PHAngle t0)
{
r = r0;
phi = p0;
theta = t0;
}
PHSphPoint::PHSphPoint(const PHSphPoint &rhs)
{
r = rhs.r;
phi = rhs.phi;
theta = rhs.theta;
}
PHSphPoint::PHSphPoint(const PHPoint &rhs)
{
PHGeometron* geometry = PHGeometron::instance();
geometry->cartesianToSpherical(rhs,*this);
}
PHSphPoint::PHSphPoint(const PHCylPoint &rhs)
{
PHGeometron* geometry = PHGeometron::instance();
geometry->cylindricalToSpherical(rhs,*this);
}
PHSphPoint::~PHSphPoint()
{
}
void PHSphPoint::print() const
{
cout << " ( " << r << ", " << phi << ", " << theta << " ) " << endl;
}
ostream& operator<< (ostream& os , PHSphPoint& point)
{
os << " ( " << point.r << ", " << point.phi << ", " << point.theta << " ) " ;
return os;
}
double dist(const PHSphPoint &sp)
{
cout << "not implemented " << endl;
return 0;
}
PHSphPoint& PHSphPoint::operator= (const PHSphPoint &rhs)
{
r = rhs.r;
phi = rhs.phi;
theta = rhs.theta;
return *this;
}
PHSphPoint& PHSphPoint::operator= (const PHPoint &rhs)
{
PHGeometron* geometry = PHGeometron::instance();
geometry->cartesianToSpherical(rhs,*this);
return *this;
}
PHSphPoint& PHSphPoint::operator= (const PHCylPoint &rhs)
{
PHGeometron* geometry = PHGeometron::instance();
geometry->cylindricalToSpherical(rhs,*this);
return *this;
}