G4FPlane.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 // Class G4FPlane
00031 //
00032 // Class Description:
00033 //   
00034 // A G4FPlane is a plane created by 3 points or by an origin, an axis and 
00035 // a direction. The plane created is a G4Plane, where his coefficient a, b, 
00036 // c and d are stored. The equation of the plane is:
00037 //                ax + by + cz = d
00038 // 
00039 // This class contain 2 intersection functions :
00040 //       - closest intersection 
00041 //       - intersection by a ray
00042 
00043 // Authors: J.Sulkimo, P.Urban.
00044 // Revisions by: L.Broglia, S.Giani, G.Cosmo.
00045 // ----------------------------------------------------------------------
00046 //
00047 // History
00048 // -------
00049 // - SurfaceNormal always returns the direction of NormalX, always containing
00050 //   the correct orientation for all faces (S.Giani).
00051 // - Addition of default argument sense = 1 in the second constructor (S.Giani).
00052 // - The constructor using iVec now properly stores both the internal and
00053 //   external boundaries in the bounds vector (S.Giani).
00054 // - Proper initialization of sameSense in both the constructors (S.Giani). 
00055 // - Addition of third argument (sense) in the second constructor to ensure
00056 //   consistent setting of the normal in all the client code (S.Giani).
00057 // - Proper use of the tolerance in the Intersect function (S.Giani).
00058 // ----------------------------------------------------------------------
00059 #ifndef __PLANESURFACE_H
00060 #define __PLANESURFACE_H
00061 
00062 #include "G4Axis2Placement3D.hh"
00063 #include "G4Plane.hh"
00064 #include "G4Surface.hh"
00065 
00066 
00067 class G4FPlane : public G4Surface
00068 {
00069 
00070 public:  // with description
00071 
00072   G4FPlane();
00073   virtual ~G4FPlane();
00074     // Default constructor & destructor.
00075 
00076   G4FPlane( const G4Vector3D& direction, 
00077             const G4Vector3D& axis     ,           
00078             const G4Point3D&  Pt0,
00079       G4int sense = 1 );
00080     // Normal constructor.
00081 
00082   G4FPlane(const G4Point3DVector* pVec, 
00083            const G4Point3DVector* iVec= 0,
00084            G4int sense = 1);
00085     // Constructor used by G4BREPSolidBox and G4BREPSolidPolyhedra.
00086 
00087   G4int Intersect(const G4Ray& G4Rayref);
00088     // Calculates the intersection of the plane and a ray.
00089 
00090   void CalcBBox();
00091     // Calculates bounding box.
00092 
00093   void Project();
00094     // Computes the projection of the plane.
00095   
00096   inline G4int GetConvex() const;
00097     // Return plane's convexity, if so.
00098 
00099   inline G4int GetNumberOfPoints() const;
00100     // Gets the number of the points on the surface boundary.
00101 
00102   inline G4Point3D GetSrfPoint() const;
00103     // Gets the location point on the surface.
00104 
00105   inline const G4Point3D& GetPoint(G4int Count) const;
00106     // Gets a surface boundary point.
00107 
00108   void CalcNormal();
00109     // Computes normal to surface.
00110 
00111   inline G4Vector3D SurfaceNormal(const G4Point3D& Pt) const;
00112     // Returns normal to surface.
00113 
00114   inline const char* Name() const;
00115     // Returns the type identifier.
00116 
00117   G4double ClosestDistanceToPoint(const G4Point3D& Pt);
00118     // Returns the closest distance from point Pt.
00119 
00120   G4double HowNear( const G4Vector3D& x ) const ;
00121     // Computes the shortest distance from the point x to the G4FPlane.
00122     // The distance will always be positive.
00123 
00124   inline G4Axis2Placement3D GetPplace() const;
00125   inline G4Plane GetPplane() const;
00126     // Accessors to geometrical data.
00127 
00128 public:  // without description
00129 
00130   inline G4int MyType() const;
00131     // Returns the shape type (used in G4BREPSolid).
00132   
00133   G4int IsConvex() const; 
00134     // Returns -1.  (?)
00135 
00136   inline void Deactivate();
00137     // Deactive, used in G4Surface.
00138 
00139   inline G4Ray* Norm();
00140     // Returns the normal (used in BREPSolid).
00141 
00142   inline const G4Point3D& GetHitPoint() const;
00143     // Returns the hit point of the ray on the surface.
00144 
00145 protected:
00146 
00147   void InitBounded();
00148 
00149 protected:
00150   
00151   G4Point3D hitpoint;
00152     // Hit point of the ray on the surface.
00153 
00154 private:
00155 
00156   G4FPlane(const G4FPlane&);
00157   G4FPlane& operator=(const G4FPlane&);
00158     // Private copy constructor and assignment operator.
00159 
00160   inline G4int Sign(G4double a) const;
00161 
00162 private:
00163 
00164   G4Axis2Placement3D pplace;
00165   G4Plane            Pl;
00166   G4Ray*             NormalX;
00167   G4int              Convex;
00168   G4SurfaceBoundary* projectedBoundary;
00169 
00170 };
00171 
00172 #include "G4FPlane.icc"
00173 
00174 #endif

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