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 G4BezierSurface 00031 // 00032 // Class description: 00033 // 00034 // Definition of a generic Bezier surface. 00035 00036 // Authors: J.Sulkimo, P.Urban. 00037 // Revisions by: L.Broglia, G.Cosmo. 00038 // ---------------------------------------------------------------------- 00039 #ifndef __BEZIERSURFACE_H 00040 #define __BEZIERSURFACE_H 00041 00042 #include "G4Ray.hh" 00043 #include "G4ControlPoints.hh" 00044 #include "G4SurfaceList.hh" 00045 #include "G4PointRat.hh" 00046 #include "G4OsloMatrix.hh" 00047 #include "G4KnotVector.hh" 00048 00049 class G4ProjectedSurface; 00050 00051 class G4BezierSurface : public G4Surface 00052 { 00053 friend class G4BSplineSurface; 00054 friend class G4ProjectedSurface; 00055 00056 public: // with description 00057 00058 G4BezierSurface(); 00059 virtual ~G4BezierSurface(); 00060 // Constructor & destructor 00061 00062 inline G4Point3D AveragePoint() const; 00063 inline void SetAveragePoint(G4Point3D p); 00064 00065 inline G4double UAverage() const; 00066 inline G4double VAverage() const; 00067 00068 inline void Dir(G4int d); 00069 inline void ChangeDir(); 00070 00071 inline G4double SMin() const; 00072 inline G4double SMax() const; 00073 00074 inline G4int GetOrder(G4int direction) const; 00075 inline void PutOrder(G4int direction, G4int value); 00076 00077 inline G4double GetU() const; 00078 inline G4double GetV() const; 00079 00080 void CalcBBox(); 00081 00082 G4int BIntersect(G4SurfaceList&); 00083 00084 G4int ClipBothDirs(); 00085 void ClipSurface(); 00086 00087 virtual G4Vector3D SurfaceNormal(const G4Point3D& Pt) const; 00088 00089 friend void CopySurface(G4BezierSurface& bez); 00090 00091 protected: // without description 00092 00093 G4SurfaceList* bezier_list; 00094 00095 static G4int Clips; 00096 static G4int Splits; 00097 static G4double Tolerance; 00098 // Test variables 00099 00100 private: 00101 00102 void CalcAverage(); 00103 void CalcDistance(const G4Point3D&); 00104 void SetValues(); 00105 inline void LocalizeClipValues(); 00106 00107 void SplitNURBSurface(); 00108 void GetClippedRegionFromSurface(); 00109 void RefineSurface(); 00110 void CalcOsloMatrix(); 00111 void MapSurface(G4Surface*); 00112 00113 inline G4double Findzero(G4double x0, G4double x1, 00114 G4double y0, G4double y1) const; 00115 inline G4int Sign(G4double a) const; 00116 // For ClipSurface... 00117 00118 inline G4int Amax(G4int i, G4int j) const; 00119 inline G4int Amin(G4int i, G4int j) const; 00120 inline G4int AhIndex(G4int j, G4int t, G4int iorder) const; 00121 // For calc_G4OsloMatrix... 00122 00123 private: 00124 00125 G4BezierSurface(const G4BezierSurface&); 00126 G4BezierSurface& operator=(const G4BezierSurface &); 00127 // Private copy constructor and assignment operator. 00128 00129 private: 00130 00131 G4int order[2]; 00132 G4double smin; 00133 G4double smax; 00134 G4Point3D line; 00135 G4double average_u; 00136 G4double average_v; 00137 G4Point3D average_pt; 00138 G4int dir; 00139 G4KnotVector *u_knots; 00140 G4KnotVector *v_knots; 00141 G4ControlPoints *ctl_points; 00142 00143 G4KnotVector *new_knots; 00144 G4int ord; 00145 G4OsloMatrix * oslo_m; 00146 G4int lower,upper; 00147 G4double u[2]; 00148 G4double v[2]; 00149 G4double u_min; 00150 G4double u_max; 00151 G4double v_min; 00152 G4double v_max; 00153 G4ControlPoints* old_points; 00154 00155 }; 00156 00157 #include "G4BezierSurface.icc" 00158 00159 #endif