00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
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:
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
00059
00060 G4int Intersect(const G4Ray&);
00061 void CalcBBox();
00062
00063
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
00076
00077 public:
00078
00079 inline G4int MyType() const;
00080
00081 private:
00082
00083 G4BSplineSurface(const G4BSplineSurface&);
00084 G4BSplineSurface& operator=(const G4BSplineSurface&);
00085
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
00096
00097 G4ProjectedSurface* CopyToProjectedSurface(const G4Ray&);
00098 G4Point3D FinalIntersection();
00099
00100
00101
00102
00103
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