PHCylinder.C
//---------------------------------------------------------------------------------------
// Class: PHCylinder
//
// Written by: Jane M. Burward-Hoy and Federica Messer
//
// Purpose: A Cylinder
//
// Last update: 10/28/99
//
// Pioneered by J. Mitchell
//
// Details: the cylinder is defined by its center, its radius and a not
// normalized direction vector, the length of which is the cylinder half-length
//----------------------------------------------------------------------------
#include "PHCylinder.h"
PHCylinder::PHCylinder()
{
radius = 1;
axis.setZ(1);
}
PHCylinder::PHCylinder(double r,const PHPoint point, const PHVector vector)
{
radius = r;
center = point;
axis = vector;
}
PHCylinder::PHCylinder(const PHCylinder &cyl)
{
center = cyl.center;
axis = cyl.axis;
radius = cyl.radius;
}
PHCylinder::~PHCylinder()
{
}
PHCylinder& PHCylinder::operator= (const PHCylinder &cyl)
{
center = cyl.center;
axis = cyl.axis;
radius = cyl.radius;
return *this;
}
void PHCylinder::print() const
{
cout << "Radius : " << radius << " " << center << " " << axis << endl;
}
ostream& operator<<(ostream& os, const PHCylinder &cylinder)
{
os << "Radius : " << cylinder.radius << " " << cylinder.center << " " << cylinder.axis << endl;
return os;
}