#ifndef __CALC_HH__ #define __CALC_HH__ //--- C++ include --- #include typedef double rotate_t[3][3]; typedef double xlate_t[3]; class CoordType { public: double x, y, z; public: //--- Constructors --- CoordType() : x(0),y(0),z(0) { } CoordType(double x,double y,double z); CoordType(const CoordType& a); CoordType(CoordType* point); //--- Getters --- inline double X() const { return x; } inline double Y() const { return y; } inline double Z() const { return z; } //--- Operators --- CoordType& operator = (const CoordType &); CoordType* add(CoordType *a); CoordType* set(CoordType *a); double distTo(CoordType *a); double dist2To(CoordType *a); bool closerToThen(CoordType *a,double dist); bool closerToThen(CoordType *a,double dist,double dist2); CoordType* multiply(double b); CoordType getRotatedCoor(double* rotate,double* translate); CoordType getRotatedCoor(double rotate[3][3],double translate[3]); double dot(const CoordType& vector); CoordType cross(CoordType& ); void print(ostream& ); CoordType* normalize(); inline double length2(); inline double length(); double norma(); void rotate(rotate_t rotate,xlate_t translate); bool isInTriangle(CoordType& p1,CoordType& p2,CoordType& p3); }; CoordType operator + (const CoordType& a,const CoordType& b); CoordType operator - (const CoordType& a,const CoordType& b); CoordType operator * (const CoordType& p,double a); CoordType operator * (double a,const CoordType& p); double operator * (CoordType& a,CoordType& b); // typedef float_t rotate_t[3][3]; // typedef float_t xlate_t[3]; struct SCoordType : CoordType { char res; int num; }; double fitpoints(rotate_t u,xlate_t t, CoordType** a,CoordType** b,const int npts); double fitpoints(rotate_t u, xlate_t t, CoordType *a, CoordType *b, const int npts); double prob(double chi2,int ndf); double skymol_erfc(double x); double integrateGausTo(double x); double integrateGausFrom(double x); #endif