Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4BSplineSurface.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id$
28 //
29 // ----------------------------------------------------------------------
30 // Class G4BSplineSurface
31 //
32 // Class description:
33 //
34 // Definition of a generic BSpline surface.
35 
36 // Authors: J.Sulkimo, P.Urban.
37 // Revisions by: L.Broglia, G.Cosmo.
38 // ----------------------------------------------------------------------
39 #ifndef __BSPLINESURFACE_H
40 #define __BSPLINESURFACE_H
41 
42 #include "G4Point3D.hh"
43 #include "G4PointRat.hh"
44 #include "G4Surface.hh"
45 #include "G4ProjectedSurface.hh"
46 #include "G4UVHit.hh"
47 
49 {
50 
51  public: // with description
52 
54  G4BSplineSurface(const char* nurbfilename, G4Ray& rayref);
56  G4ControlPoints& cp);
57  virtual ~G4BSplineSurface();
58  // Constructors & destructor.
59 
60  G4int Intersect(const G4Ray&);
61  void CalcBBox();
62  // Finds the bounds of the b-spline surface.
63  // The bounding box is used for a preliminary check of intersection.
64 
65  inline G4double GetUHit() const;
66  inline G4double GetVHit() const;
67 
69 
70  inline void Reset();
71 
72  inline G4int GetRows() const;
73  inline G4int GetCols() const;
74  inline G4Point3D GetControlPoint(G4int a, G4int b) const;
75  // Accessors for control points.
76 
77 public:
78 
79  inline G4int MyType() const;
80 
81 private:
82 
84  G4BSplineSurface& operator=(const G4BSplineSurface&);
85  // Private copy constructor and assignment operator.
86 
87  void FindIntersections(const G4Ray&);
88 
89  inline G4int GetOrder(G4int direction) const;
90  inline void PutOrder(G4int direction, G4int value);
91 
92  void AddHit(G4double u, G4double v);
93  void ProjectNURBSurfaceTo2D( const G4Plane& ,const G4Plane&,
94  register G4ProjectedSurface*);
95  // Projects the nurb surface so that the z-axis = ray.
96 
97  G4ProjectedSurface* CopyToProjectedSurface(const G4Ray&);
98  G4Point3D FinalIntersection();
99 
100  // L. Broglia
101  // Because G4BSplineSurface::Evaluate hides the virtual function
102  // G4Surface::Evaluate(const G4Ray&), I modified the function name
103  // G4Point3D Evaluate();
104  G4Point3D BSEvaluate();
105 
106  G4PointRat& InternalEvalCrv(G4int i, G4ControlPoints *crv);
107 
108  G4Point3D Evaluation(const G4Ray&);
109 
110  inline G4Vector3D SurfaceNormal(const G4Point3D& Pt) const;
111 
112 private:
113 
114  G4SurfaceList bezier_list;
115  G4SurfaceList projected_list;
116  short dir;
117  G4int order[2];
118  G4KnotVector *u_knots;
119  G4KnotVector *v_knots;
120  G4KnotVector *tmp_knots;
121  G4ControlPoints *ctl_points;
122  G4UVHit* Hit;
123  G4UVHit* first_hit;
124  G4int ord;
125  G4int k_index;
126  G4double param;
127  G4int Rational;
128 };
129 
130 #include "G4BSplineSurface.icc"
131 
132 #endif