#include <G4BSplineSurface.hh>
Inheritance diagram for G4BSplineSurface:
Public Member Functions | |
G4BSplineSurface () | |
G4BSplineSurface (const char *nurbfilename, G4Ray &rayref) | |
G4BSplineSurface (G4int u, G4int v, G4KnotVector &u_kv, G4KnotVector &v_kv, G4ControlPoints &cp) | |
virtual | ~G4BSplineSurface () |
G4int | Intersect (const G4Ray &) |
void | CalcBBox () |
G4double | GetUHit () const |
G4double | GetVHit () const |
G4double | ClosestDistanceToPoint (const G4Point3D &) |
void | Reset () |
G4int | GetRows () const |
G4int | GetCols () const |
G4Point3D | GetControlPoint (G4int a, G4int b) const |
G4int | MyType () const |
Definition at line 48 of file G4BSplineSurface.hh.
G4BSplineSurface::G4BSplineSurface | ( | ) |
Definition at line 41 of file G4BSplineSurface.cc.
References G4Surface::distance, and ROW.
00042 : ord(0), k_index(0), param(0.), Rational(0) 00043 { 00044 distance = kInfinity; 00045 dir=ROW; 00046 first_hit = Hit = (G4UVHit*)0; 00047 order[0] = 0; order[1] = 0; 00048 ctl_points = (G4ControlPoints*)0; 00049 u_knots = v_knots = tmp_knots = (G4KnotVector*)0; 00050 }
G4BSplineSurface::G4BSplineSurface | ( | const char * | nurbfilename, | |
G4Ray & | rayref | |||
) |
Definition at line 53 of file G4BSplineSurface.cc.
References G4Surface::distance.
00054 : dir(0), ord(0), k_index(0), param(0.), Rational(0) 00055 { 00056 distance = kInfinity; 00057 first_hit = Hit = (G4UVHit*)0; 00058 order[0] = 0; order[1] = 0; 00059 ctl_points = (G4ControlPoints*)0; 00060 u_knots = v_knots = tmp_knots = (G4KnotVector*)0; 00061 }
G4BSplineSurface::G4BSplineSurface | ( | G4int | u, | |
G4int | v, | |||
G4KnotVector & | u_kv, | |||
G4KnotVector & | v_kv, | |||
G4ControlPoints & | cp | |||
) |
Definition at line 64 of file G4BSplineSurface.cc.
00066 : dir(0), ord(0), k_index(0), param(0.), Rational(0) 00067 { 00068 first_hit = Hit = (G4UVHit*)0; 00069 00070 order[0] = u+1; order[1] = v+1; 00071 00072 u_knots = new G4KnotVector(u_kv); 00073 v_knots = new G4KnotVector(v_kv); 00074 tmp_knots = (G4KnotVector*)0; 00075 00076 ctl_points = new G4ControlPoints(cp); 00077 }
G4BSplineSurface::~G4BSplineSurface | ( | ) | [virtual] |
Definition at line 80 of file G4BSplineSurface.cc.
References G4UVHit::GetNext().
00081 { 00082 delete u_knots; 00083 delete v_knots; 00084 delete ctl_points; 00085 G4UVHit* temphit=Hit; 00086 Hit = first_hit; 00087 while(Hit!=(G4UVHit*)0) 00088 { 00089 Hit=Hit->GetNext(); 00090 delete temphit; 00091 temphit=Hit; 00092 } 00093 // delete temphit;// remove last 00094 00095 }
void G4BSplineSurface::CalcBBox | ( | ) | [virtual] |
Reimplemented from G4Surface.
Definition at line 260 of file G4BSplineSurface.cc.
References G4Surface::bbox, G4ControlPoints::Get3D(), G4ControlPoints::GetCols(), G4ControlPoints::GetRows(), and PINFINITY().
00261 { 00262 00263 // Finds the bounds of the b-spline surface iow 00264 // calculates the bounds for a bounding box 00265 // to the surface. The bounding box is used 00266 // for a preliminary check of intersection. 00267 00268 G4Point3D box_min = G4Point3D( PINFINITY); 00269 G4Point3D box_max = G4Point3D(-PINFINITY); 00270 00271 // Loop to search the whole control point mesh 00272 // for the minimum and maximum values for x, y and z. 00273 00274 for(register int a = ctl_points->GetRows()-1; a>=0;a--) 00275 for(register int b = ctl_points->GetCols()-1; b>=0;b--) 00276 { 00277 G4Point3D tmp = ctl_points->Get3D(a,b); 00278 if((box_min.x()) > (tmp.x())) box_min.setX(tmp.x()); 00279 if((box_min.y()) > (tmp.y())) box_min.setY(tmp.y()); 00280 if((box_min.z()) > (tmp.z())) box_min.setZ(tmp.z()); 00281 if((box_max.x()) < (tmp.x())) box_max.setX(tmp.x()); 00282 if((box_max.y()) < (tmp.y())) box_max.setY(tmp.y()); 00283 if((box_max.z()) < (tmp.z())) box_max.setZ(tmp.z()); 00284 } 00285 bbox = new G4BoundingBox3D( box_min, box_max); 00286 }
Reimplemented from G4Surface.
Definition at line 641 of file G4BSplineSurface.cc.
References G4ControlPoints::ClosestDistanceToPoint().
00642 { 00643 G4double PointDistance=0; 00644 PointDistance = ctl_points->ClosestDistanceToPoint(Pt); 00645 return PointDistance; 00646 }
G4int G4BSplineSurface::GetCols | ( | ) | const [inline] |
Definition at line 72 of file G4BSplineSurface.icc.
References G4ControlPoints::GetCols().
00073 { 00074 return ctl_points->GetCols(); 00075 }
Definition at line 78 of file G4BSplineSurface.icc.
References G4ControlPoints::Get3D().
00079 { 00080 return ctl_points->Get3D(a,b); 00081 }
G4int G4BSplineSurface::GetRows | ( | ) | const [inline] |
Definition at line 66 of file G4BSplineSurface.icc.
References G4ControlPoints::GetRows().
00067 { 00068 return ctl_points->GetRows(); 00069 }
G4double G4BSplineSurface::GetUHit | ( | ) | const [inline, virtual] |
Reimplemented from G4Surface.
Definition at line 38 of file G4BSplineSurface.icc.
References G4UVHit::GetU().
00039 { 00040 return Hit->GetU(); 00041 }
G4double G4BSplineSurface::GetVHit | ( | ) | const [inline, virtual] |
Reimplemented from G4Surface.
Definition at line 44 of file G4BSplineSurface.icc.
References G4UVHit::GetV().
00045 { 00046 return Hit->GetV(); 00047 }
Reimplemented from G4Surface.
Definition at line 98 of file G4BSplineSurface.cc.
References G4Surface::active, G4BezierSurface::AveragePoint(), G4Surface::closest_hit, G4Surface::distance, G4Surface::GetDistance(), G4SurfaceList::GetSize(), G4SurfaceList::GetSurface(), G4Surface::Intersected, G4Surface::IsActive(), G4SurfaceList::MoveToFirst(), G4Surface::SetActive(), and G4SurfaceList::Step().
00099 { 00100 Intersected = 1; 00101 FindIntersections(rayref); 00102 G4BezierSurface *bez_ptr; 00103 bezier_list.MoveToFirst(); 00104 distance = kInfinity; 00105 00106 while( bezier_list.GetSurface() != (G4Surface*)0) 00107 { 00108 bez_ptr = (G4BezierSurface*)bezier_list.GetSurface(); 00109 00110 if(bez_ptr->IsActive()) 00111 { 00112 if(distance > bez_ptr->GetDistance()) 00113 { 00114 // Put data from closest bezier to b-spline data struct 00115 closest_hit = bez_ptr->AveragePoint(); 00116 distance = bez_ptr->GetDistance(); 00117 } 00118 else 00119 { 00120 // Set other beziers as inactive 00121 bez_ptr->SetActive(0); 00122 00123 // Remove beziers that are not closest 00124 // bezier_list.RemoveSurface(bez_ptr); 00125 } 00126 } 00127 00128 bezier_list.Step(); 00129 } 00130 00131 bezier_list.MoveToFirst(); 00132 00133 if(bezier_list.GetSize()) 00134 return 1; 00135 else 00136 { 00137 active=0; 00138 return 0; 00139 } 00140 }
G4int G4BSplineSurface::MyType | ( | ) | const [inline, virtual] |
void G4BSplineSurface::Reset | ( | ) | [inline, virtual] |
Reimplemented from G4Surface.
Definition at line 56 of file G4BSplineSurface.icc.
References G4Surface::active, G4Surface::distance, G4SurfaceList::EmptyList(), and G4Surface::Intersected.
00057 { 00058 active=1; 00059 bezier_list.EmptyList(); 00060 projected_list.EmptyList(); 00061 Intersected=0; 00062 distance = kInfinity; 00063 }