Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4BezierSurface.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 G4BezierSurface
31 //
32 // Class description:
33 //
34 // Definition of a generic Bezier surface.
35 
36 // Authors: J.Sulkimo, P.Urban.
37 // Revisions by: L.Broglia, G.Cosmo.
38 // ----------------------------------------------------------------------
39 #ifndef __BEZIERSURFACE_H
40 #define __BEZIERSURFACE_H
41 
42 #include "G4Ray.hh"
43 #include "G4ControlPoints.hh"
44 #include "G4SurfaceList.hh"
45 #include "G4PointRat.hh"
46 #include "G4OsloMatrix.hh"
47 #include "G4KnotVector.hh"
48 
49 class G4ProjectedSurface;
50 
51 class G4BezierSurface : public G4Surface
52 {
53  friend class G4BSplineSurface;
54  friend class G4ProjectedSurface;
55 
56 public: // with description
57 
59  virtual ~G4BezierSurface();
60  // Constructor & destructor
61 
62  inline G4Point3D AveragePoint() const;
63  inline void SetAveragePoint(G4Point3D p);
64 
65  inline G4double UAverage() const;
66  inline G4double VAverage() const;
67 
68  inline void Dir(G4int d);
69  inline void ChangeDir();
70 
71  inline G4double SMin() const;
72  inline G4double SMax() const;
73 
74  inline G4int GetOrder(G4int direction) const;
75  inline void PutOrder(G4int direction, G4int value);
76 
77  inline G4double GetU() const;
78  inline G4double GetV() const;
79 
80  void CalcBBox();
81 
83 
85  void ClipSurface();
86 
87  virtual G4Vector3D SurfaceNormal(const G4Point3D& Pt) const;
88 
89  friend void CopySurface(G4BezierSurface& bez);
90 
91 protected: // without description
92 
94 
95  static G4int Clips;
96  static G4int Splits;
98  // Test variables
99 
100 private:
101 
102  void CalcAverage();
103  void CalcDistance(const G4Point3D&);
104  void SetValues();
105  inline void LocalizeClipValues();
106 
107  void SplitNURBSurface();
108  void GetClippedRegionFromSurface();
109  void RefineSurface();
110  void CalcOsloMatrix();
111  void MapSurface(G4Surface*);
112 
113  inline G4double Findzero(G4double x0, G4double x1,
114  G4double y0, G4double y1) const;
115  inline G4int Sign(G4double a) const;
116  // For ClipSurface...
117 
118  inline G4int Amax(G4int i, G4int j) const;
119  inline G4int Amin(G4int i, G4int j) const;
120  inline G4int AhIndex(G4int j, G4int t, G4int iorder) const;
121  // For calc_G4OsloMatrix...
122 
123 private:
124 
126  G4BezierSurface& operator=(const G4BezierSurface &);
127  // Private copy constructor and assignment operator.
128 
129 private:
130 
131  G4int order[2];
132  G4double smin;
133  G4double smax;
134  G4Point3D line;
135  G4double average_u;
136  G4double average_v;
137  G4Point3D average_pt;
138  G4int dir;
139  G4KnotVector *u_knots;
140  G4KnotVector *v_knots;
142 
143  G4KnotVector *new_knots;
144  G4int ord;
145  G4OsloMatrix * oslo_m;
146  G4int lower,upper;
147  G4double u[2];
148  G4double v[2];
149  G4double u_min;
150  G4double u_max;
151  G4double v_min;
152  G4double v_max;
153  G4ControlPoints* old_points;
154 
155 };
156 
157 #include "G4BezierSurface.icc"
158 
159 #endif