// -*- mode: c++ -*- // // $Id: BrVector3D.h,v 1.2 2001/08/14 19:27:52 pchristi Exp $ // $Author: pchristi $ // $Date: 2001/08/14 19:27:52 $ // $Copyright: (C) 2001 BRAHMS Collaboration // #ifndef BRAT_BrVector3D #define BRAT_BrVector3D #ifndef ROOT_TObject #include "TObject.h" #endif #ifndef WIN32 #include #else #include #endif // // ////////////////////////////////////////////////////////////////////////////// // // BrVector3D // // 3D Vector. Part of the Geometry classes Points, Vector, Lines, Planes. // // Author: F.Videbaek // Created: July 1998 // // ///////////////////////////////////////////////////////////////////////////// class BrVector3D : public TObject { public: // constructors and destructors // BrVector3D(const Double_t x=0.0, const Double_t y =0.0 , const Double_t z=0.0) : fX(x), fY(y), fZ(z) {}; BrVector3D(const Float_t *pos) {fX=pos[0];fY=pos[1];fZ=pos[2];}; BrVector3D(const Double_t *pos) : fX(pos[0]), fY(pos[1]), fZ(pos[2]) {}; // ~BrVector3D(){}; // BrVector3D(const BrVector3D& vec) : // fX(vec.fX), fY(vec.fY), fZ(vec.fZ) {}; // BrVector3D& operator = (const BrVector3D&); // // general field operators BrVector3D& operator +=(const BrVector3D&); BrVector3D& operator -=(const BrVector3D&); BrVector3D operator - () const; BrVector3D operator + () const; const Double_t& operator [] (size_t) const; Double_t& operator [] (size_t); const Double_t& operator () (size_t) const; Double_t& operator () (size_t); Bool_t operator == (const BrVector3D&) const; Bool_t operator != (const BrVector3D&) const; // access methods Double_t GetX() const {return fX;}; Double_t GetY() const {return fY;}; Double_t GetZ() const {return fZ;}; Double_t X() const {return fX;}; Double_t Y() const {return fY;}; Double_t Z() const {return fZ;}; void SetX(Double_t value) { fX = value;}; void SetY(Double_t value) { fY = value;}; void SetZ(Double_t value) { fZ = value;}; // // vector operations Double_t Norm() const; Double_t NormSq() const; Double_t Dot(const BrVector3D&) const; BrVector3D Cross(const BrVector3D&) const; BrVector3D Unit() const; Double_t Theta() const; Double_t Phi() const; virtual void Print(Option_t* option = "") const; //Distance between points Double_t Distance(const BrVector3D &vect) const; private: Double_t fX; // 1. Vector Element Double_t fY; // 2. Vector Element Double_t fZ; // 3. Vector Element friend BrVector3D operator+(const BrVector3D& v1, const BrVector3D& v2); friend BrVector3D operator-(const BrVector3D& v1, const BrVector3D& v2); friend BrVector3D operator*(Double_t a, const BrVector3D& v2); friend BrVector3D operator*(const BrVector3D& v1, Double_t a); friend BrVector3D operator/(const BrVector3D& v1, Double_t a); ClassDef(BrVector3D,1) }; // // Related Global functions // ostream& operator<<(ostream& str, const BrVector3D&); istream& operator>>(istream& str, BrVector3D&); BrVector3D Cross(const BrVector3D&, const BrVector3D&); #endif // // $Log: BrVector3D.h,v $ // Revision 1.2 2001/08/14 19:27:52 pchristi // Removed copy constructors and destructors where the default was good enough. // // Revision 1.1.1.1 2001/06/21 14:55:20 hagel // Initial revision of brat2 // // Revision 1.15 2001/06/17 17:09:55 pchristi // Cleaned up and modified the line 3D and vector3D classes. // No major new stuff. // // Revision 1.14 2000/09/18 21:25:59 videbaek // Modified internal structure of BrDetectorvolume // Associated changes. // // Revision 1.13 1999/01/27 22:59:42 hagel // Added Distance() // // Revision 1.12 1999/01/27 22:41:57 hagel // Added yet another constructor to BrVector3D // // Revision 1.11 1999/01/27 22:38:48 hagel // Added another constructor to BrVector3D // // Revision 1.10 1999/01/21 23:23:24 hagel // 1. Changed convention for checking includes. Current convention is: // BRAT_Br...... eg BRAT_BrModule ala ROOT. // 2. Added CVS logs to .h files that didn't have them. // 3. Moved checking of include definition to first line for easier reading // 4. Put checks before all includes in the include files as per // BRAT specifications // 5. Added BrGeantHeader to Geant Makefile // 6. All changes have been checked to compile on NT ala Cygnus // // Revision 1.9 1998/12/01 20:49:58 videbaek // Added several classes to Geometry. Updated source and makefile(s) // - BrLine3D // - BrCoordinateSystem // - BrRotMatrix // // Revision 1.8 1998/11/13 19:28:01 videbaek // Added operators for setting vector elements by index; i.e. // vector[2]=x; and vector(i)=cv[i]; as example. // // Revision 1.7 1998/09/18 15:44:50 videbaek // Removed BrPoint3D class // Added iostream operator to BrVector3Dn // // Revision 1.6 1998/09/15 13:08:33 videbaek // Id and Log had disappeared from header // // Revision 1.4 1998/07/28 21:30:12 videbaek // Added Theta() and Phi() members // // Revision 1.3 1998/07/27 14:41:41 videbaek // small fixes to vector class // // Revision 1.2 1998/07/24 13:18:21 videbaek // Added many functions to vector and point // // Revision 1.1 1998/07/20 17:35:49 videbaek // simple geometry class //