G4BSplineSurface.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 G4BSplineSurface
00031 //
00032 // Class description:
00033 // 
00034 // Definition of a generic BSpline surface.
00035 
00036 // Authors: J.Sulkimo, P.Urban.
00037 // Revisions by: L.Broglia, G.Cosmo.
00038 // ----------------------------------------------------------------------
00039 #ifndef __BSPLINESURFACE_H
00040 #define __BSPLINESURFACE_H
00041 
00042 #include "G4Point3D.hh"
00043 #include "G4PointRat.hh"
00044 #include "G4Surface.hh"
00045 #include "G4ProjectedSurface.hh"
00046 #include "G4UVHit.hh"
00047 
00048 class G4BSplineSurface : public G4Surface
00049 {
00050 
00051  public:  // with description
00052 
00053   G4BSplineSurface();
00054   G4BSplineSurface(const char* nurbfilename, G4Ray& rayref);
00055   G4BSplineSurface(G4int u, G4int v, G4KnotVector& u_kv, G4KnotVector& v_kv, 
00056                    G4ControlPoints& cp);    
00057   virtual ~G4BSplineSurface();
00058     // Constructors & destructor.
00059 
00060   G4int Intersect(const G4Ray&);
00061   void CalcBBox();
00062     // Finds the bounds of the b-spline surface.
00063     // The bounding box is used for a preliminary check of intersection.
00064   
00065   inline G4double GetUHit() const;
00066   inline G4double GetVHit() const;
00067          
00068   G4double ClosestDistanceToPoint(const G4Point3D&);
00069 
00070   inline void Reset();
00071 
00072   inline G4int GetRows() const;
00073   inline G4int GetCols() const;
00074   inline G4Point3D GetControlPoint(G4int a, G4int b) const;
00075     // Accessors for control points.
00076 
00077 public:
00078  
00079   inline G4int MyType() const;
00080 
00081 private:
00082 
00083   G4BSplineSurface(const G4BSplineSurface&);
00084   G4BSplineSurface& operator=(const G4BSplineSurface&);
00085     // Private copy constructor and assignment operator.
00086 
00087   void FindIntersections(const G4Ray&);
00088 
00089   inline G4int GetOrder(G4int direction) const;
00090   inline void PutOrder(G4int direction, G4int value);
00091 
00092   void AddHit(G4double u, G4double v);
00093   void ProjectNURBSurfaceTo2D( const G4Plane& ,const G4Plane&,
00094                                register G4ProjectedSurface*);
00095     // Projects the nurb surface so that the z-axis = ray. 
00096 
00097   G4ProjectedSurface* CopyToProjectedSurface(const G4Ray&);
00098   G4Point3D  FinalIntersection();
00099 
00100   // L. Broglia
00101   // Because  G4BSplineSurface::Evaluate hides the virtual function 
00102   // G4Surface::Evaluate(const G4Ray&), I modified the function name
00103   // G4Point3D  Evaluate();  
00104   G4Point3D  BSEvaluate();
00105 
00106   G4PointRat& InternalEvalCrv(G4int i, G4ControlPoints *crv);
00107   
00108   G4Point3D   Evaluation(const G4Ray&);
00109 
00110   inline G4Vector3D  SurfaceNormal(const G4Point3D& Pt) const;
00111   
00112 private:
00113   
00114   G4SurfaceList bezier_list;
00115   G4SurfaceList projected_list;
00116   short dir;
00117   G4int order[2];
00118   G4KnotVector *u_knots;
00119   G4KnotVector *v_knots;
00120   G4KnotVector *tmp_knots;
00121   G4ControlPoints *ctl_points;
00122   G4UVHit* Hit;
00123   G4UVHit* first_hit;
00124   G4int ord;
00125   G4int k_index;
00126   G4double param;
00127   G4int Rational;
00128 }; 
00129 
00130 #include "G4BSplineSurface.icc"
00131 
00132 #endif

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