PHGeometron.h
#ifndef PHGEOMETRON_H
#define PHGEOMETRON_H
//---------------------------------------------------------------------------------------
//
// Includes: PHGeometron.h
//
// Created by: Jane M. Burward-Hoy and Federica Messer
//
// Purpose: Singleton for Geometry transformations
//
// Last update: 10/19/99
//
//----------------------------------------------------------------------------------------
#include "phool.h"
#include <math.h>
#include "PHPoint.h"
#include "PHCylPoint.h"
#include "PHSphPoint.h"
#include "PHVector.h"
#include "PHAngle.h"
#include "PHPlane.h"
#include "PHCylinder.h"
#include "PHSphere.h"
#include "PHFrame.h"
#include "PHPolyLine.h"
#include "PHLine.h"
class PHGeometron
{
public:
~PHGeometron();
static PHGeometron * instance();
private:
PHGeometron();
public:
// template: functionName (input, output);
// coordinate transformation Cart, Spher, Cyl
void cartesianToCylindrical(const PHPoint &cart, PHCylPoint& cyl);
void cylindricalToCartesian(const PHCylPoint& cyl, PHPoint& cart);
void cartesianToSpherical(const PHPoint &cart, PHSphPoint& sph);
void sphericalToCartesian(const PHSphPoint& sph, PHPoint& cart);
void cylindricalToSpherical(const PHCylPoint& cyl,PHSphPoint &sph);
void sphericalToCylindrical(const PHSphPoint &sph,PHCylPoint& cyl);
// distance Point to Point
double distancePointToPoint(const PHPoint& , const PHPoint &);
double distancePointToPoint2D(const PHPoint& , const PHPoint &);
double distancePointToPoint(const PHSphPoint&, const PHSphPoint&);
double distancePointToPoint(const PHCylPoint&, const PHCylPoint&);
// vectorOperation
double dot(const PHVector&,const PHVector&);
PHVector cross(const PHVector&,const PHVector&);
PHAngle angle(const PHVector&, const PHVector&);
// Line and Points
PHBoolean intersectionLinePlane(const PHLine&, const PHPlane&, PHPoint&);
PHBoolean intersectionLinePlane2D(const PHLine&, const PHPlane&, PHPoint&);
double distanceLinePoint(const PHLine&, const PHPoint &);
double distanceLinePoint2D(const PHLine&, const PHPoint &);
double distanceLineLine(const PHLine&, const PHLine &);
//Line and Points (Jane)
// PHBoolean intersectionLineLine2D(const PHLine&, const PHLine &, PHPoint&);
// PHBoolean intersectionLineLineOnPlane(const PHLine&, const PHLine&, const PHPlane&, PHPoint&);
PHLine projectLineIntoPlane(const PHLine&, const PHPlane&);
PHPoint transformPoint(const PHFrame&, const PHPoint&, const PHFrame&);
PHVector transformVector(const PHFrame&, const PHVector&, const PHFrame&);
PHLine transformLine(const PHFrame&, const PHLine&, const PHFrame&);
//Per Tom's request -- translate line to point or vector
PHLine translateLinePoint(const PHLine&, const PHPoint& );
PHLine translateLineVector(const PHLine&, const PHVector& );
// Sphere and Cylinder
short intersectionLineCylinder(const PHLine&, const PHCylinder&, PHPoint&, PHPoint&);
short intersectionLineSphere(const PHLine&, const PHSphere&, PHPoint&, PHPoint&);
//
short lineLineIntersection(const PHLine&, const PHLine &, PHPoint& );
double distToPointXY(PHPoint &) const;
double distToLineXY(PHLine &) const;
//
//EXISTS BUT NEEDS TO BE DEBUGGED
// PolyLine
double lengthPolyLine(const PHPolyLine & );
/* PHBoolean intersectionPolyLinePlane(const PHPolyLine & , const PHPlane&, PHPoint&); */
//NEEDS TO BE IMPLEMENTED
// Sphere and Cylinder for PolyLine
// short intersectionPolyLineCylinder(const PHPolyLine&, const PHCylinder&, PHPoint&, PHPoint&);
// short intersectionPolyLineSphere(const PHPolyLine&, const PHSphere&, PHPoint&, PHPoint&);
private:
static PHGeometron* _instance;
};
#endif /* PHGEOMTRON_H*/