// -*- mode: c++ -*-
//
// $Id: BrLine3D.h,v 1.3 2001/11/16 20:28:53 hagel Exp $
// $Author: hagel $
// $Date: 2001/11/16 20:28:53 $
// $Copyright: (C) 2001 BRAHMS Collaboration <brahmlib@rhic.bnl.gov>
//
#ifndef BRAT_BrLine3D
#define BRAT_BrLine3D

#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef BRAT_BrVector3D
#include "BrVector3D.h"
#endif

#ifndef WIN32
#include <iostream>
#else
#include <iostream.h>
#endif
#include <cassert>

class BrLine3D : public TObject
{
private:
  BrVector3D fOrigin;     //  Vector for line start
  BrVector3D fDirection;  //  Unit direction vector
  
public:
  BrLine3D();
  BrLine3D(const BrVector3D& origin, const BrVector3D& direction);
//    BrLine3D(const BrLine3D& line);
//    virtual ~BrLine3D();

  BrLine3D& operator = (const BrLine3D&);
  
  virtual BrVector3D        ClosestPoint(const BrVector3D&) const;
  virtual Double_t          Distance(const BrVector3D&) const;
  virtual const BrVector3D& GetOrigin() const {return fOrigin;};
  virtual const BrVector3D& GetDirection() const {return fDirection;};
  virtual Double_t          GetShortestDistanceBetween(const BrLine3D &line) const;
  virtual BrLine3D          GetShortestLineBetween(const BrLine3D &line) const;
  
  virtual void    Print(Option_t* option = "") const;
  virtual Float_t RelativeOverlap(const BrLine3D& line, Float_t zl, Float_t r);

  virtual void    SetOrigin(const BrVector3D& vector);
  virtual void    SetOrigin(Double_t x, Double_t y, Double_t z) 
                              { SetOrigin(BrVector3D(x, y, z));}
  virtual void    SetDirection(const BrVector3D& vector);
  virtual void    SetDirection(Double_t x, Double_t y, Double_t z) 
                              { SetDirection(BrVector3D(x, y, z));}

  friend ostream& operator<<(ostream& str, const BrLine3D*);
  friend ostream& operator<<(ostream& str, const BrLine3D&);

  ClassDef(BrLine3D, 2) // BRAT 3D line
};

extern ostream& operator<<(ostream& str, const BrLine3D*);
extern ostream& operator<<(ostream& str, const BrLine3D&);
#endif

//____________________________________________________________________
//
// $Log: BrLine3D.h,v $
// Revision 1.3  2001/11/16 20:28:53  hagel
// Implemented iostream for BrLine3D
//
// 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.6  2001/06/17 17:09:54  pchristi
// Cleaned up and modified the line 3D and vector3D classes.
// No major new stuff.
//
// Revision 1.5  1999/04/21 14:50:38  videbaek
// removed apostrophe from comments (emac does not like them)
//
// Revision 1.4  1999/04/15 18:00:49  hagel
// Made destructor virtual
//
// Revision 1.3  1999/01/31 21:41:33  hagel
// Added Methods to get shortest distance between two lines
//
// Revision 1.2  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 didnt 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.1  1998/12/01 20:49:58  videbaek
// Added several classes to Geometry. Updated source and makefile(s)
// - BrLine3D
// - BrCoordinateSystem
// - BrRotMatrix
//
//