G4VisExtent.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // 
00030 // A.Walkden 28/11/95
00031 
00032 // Class Description:
00033 // G4VisExtent defines a bounding box in a visualisable object's local
00034 // coordinate system which includes the object.
00035 // WARNING: it also attempts to support the concept of a bounding
00036 // sphere.  (This is used extensively in the G4 Visualisation System
00037 // to calculate camera parameters, etc.)  Be aware that this involves
00038 // loss of information.  Given a bounding box, one can calculate the
00039 // bounding sphere; inverting this will produce a cube which *might*
00040 // *not* include the object.  E.g., a long thin object of length l
00041 // will have a bounding sphere of diameter l; the corresponding cube
00042 // will have side l/std::sqrt(3) so that the bounding sphere diameter is
00043 // still l.  Thus the long thin object will stick out of the cube.
00044 // So, if you once use the concept of bounding sphere you must stick
00045 // with it and abandon the concept of bounding box.
00046 // Class Description - End:
00047 
00048 #ifndef G4VISEXTENT_HH
00049 #define G4VISEXTENT_HH
00050 
00051 #include "globals.hh"
00052 #include "G4Point3D.hh"
00053 
00054 class G4VisExtent
00055 {
00056 public: // With description
00057 
00058   G4VisExtent (G4double xmin = 0., G4double xmax = 0., 
00059                G4double ymin = 0., G4double ymax = 0., 
00060                G4double zmin = 0., G4double zmax = 0.);
00061   G4VisExtent (const G4Point3D& centre, G4double radius);
00062   ~G4VisExtent ();
00063   G4bool operator != (const G4VisExtent& e) const;
00064   G4double  GetXmin         () const;
00065   G4double  GetXmax         () const;
00066   G4double  GetYmin         () const;
00067   G4double  GetYmax         () const;
00068   G4double  GetZmin         () const;
00069   G4double  GetZmax         () const;
00070   const G4Point3D& GetExtentCentre () const;
00071   const G4Point3D& GetExtentCenter () const;
00072   G4double  GetExtentRadius () const;
00073   void SetXmin (G4double xmin);
00074   void SetXmax (G4double xmax);
00075   void SetYmin (G4double ymin);
00076   void SetYmax (G4double ymax);
00077   void SetZmin (G4double zmin);
00078   void SetZmax (G4double zmax);
00079   friend std::ostream& operator << (std::ostream& os, const G4VisExtent& e);
00080   static const G4VisExtent NullExtent;
00081 
00082 private:
00083   G4double fXmin, fXmax, fYmin, fYmax, fZmin, fZmax;
00084   mutable G4bool fRadiusCached, fCentreCached;
00085   mutable G4double fRadius;
00086   mutable G4Point3D fCentre;
00087 };
00088 
00089 inline G4double G4VisExtent::GetXmin () const { return fXmin; }
00090 inline G4double G4VisExtent::GetXmax () const { return fXmax; }
00091 inline G4double G4VisExtent::GetYmin () const { return fYmin; }
00092 inline G4double G4VisExtent::GetYmax () const { return fYmax; }
00093 inline G4double G4VisExtent::GetZmin () const { return fZmin; }
00094 inline G4double G4VisExtent::GetZmax () const { return fZmax; }
00095 
00096 inline const G4Point3D& G4VisExtent::GetExtentCenter () const {
00097   return GetExtentCentre ();
00098 }
00099 
00100 inline void G4VisExtent::SetXmin (G4double xmin)
00101 {fXmin = xmin; fRadiusCached = false; fCentreCached = false;}
00102 inline void G4VisExtent::SetXmax (G4double xmax)
00103 {fXmax = xmax; fRadiusCached = false; fCentreCached = false;}
00104 inline void G4VisExtent::SetYmin (G4double ymin)
00105 {fYmin = ymin; fRadiusCached = false; fCentreCached = false;}
00106 inline void G4VisExtent::SetYmax (G4double ymax)
00107 {fYmax = ymax; fRadiusCached = false; fCentreCached = false;}
00108 inline void G4VisExtent::SetZmin (G4double zmin)
00109 {fZmin = zmin; fRadiusCached = false; fCentreCached = false;}
00110 inline void G4VisExtent::SetZmax (G4double zmax)
00111 {fZmax = zmax; fRadiusCached = false; fCentreCached = false;}
00112 
00113 #endif

Generated on Mon May 27 17:50:16 2013 for Geant4 by  doxygen 1.4.7