41 :
G4Surface(), ctl_points(0), dir(0), u_knots(0), v_knots(0),
42 projected_list(0), bezier_list(0), new_knots(0), ord(0),
43 lower(0), upper(0), oslo_m(0)
46 order[0] = order[1] = 0;
74 :
G4Surface(), ctl_points(0), dir(0), u_knots(0), v_knots(0),
75 projected_list(0), bezier_list(0), new_knots(0), ord(0),
76 lower(0), upper(0), oslo_m(0)
109 G4double box_minx,box_miny,box_maxx,box_maxy;
110 box_minx = kInfinity;
111 box_miny = kInfinity;
112 box_maxx = -kInfinity;
113 box_maxy = -kInfinity;
115 G4double bminx,bminy,bmaxx,bmaxy,tmpx,tmpy;
116 bminx = box_minx; bminy = box_miny;
117 bmaxx = box_maxx; bmaxy = box_maxy;
127 tmpx = tmp.
x(); tmpy = tmp.
y();
128 if(bminx > tmpx) box_minx=tmpx;
129 if(bmaxx < tmpx) box_maxx=tmpx;
130 if(bminy > tmpy) box_miny=tmpy;
131 if(bmaxy < tmpy) box_maxy=tmpy;
142void G4ProjectedSurface::ConvertToBezier(
G4SurfaceList& proj_list,
145 projected_list = &proj_list;
146 bezier_list = &bez_list;
164 G4double dMaxMinusdMin = dMax - dMin;
168 if( dMaxMinusdMin > 0.8 )
186 if( dMin > 0.0 || dMax < 0.0 )
196 if(dMaxMinusdMin < kCarTolerance && dMaxMinusdMin > -
kCarTolerance)
202 bez_ptr->LocalizeClipValues();
203 bez_ptr->SetValues();
211 dMin = bez_ptr->
SMin();
212 dMax = bez_ptr->
SMax();
213 dMaxMinusdMin = dMax-dMin;
218 if( (dMaxMinusdMin) > 0.8 )
230 if( dMin > 1.0 || dMax < 0.0 )
238 if(dMaxMinusdMin < kCarTolerance && dMaxMinusdMin > -
kCarTolerance)
244 bez_ptr->LocalizeClipValues();
245 bez_ptr->SetValues();
246 bez_ptr->CalcAverage();
258G4int G4ProjectedSurface::CheckBezier()
266 if( u_knots->
GetSize() > (2.0 * GetOrder(
ROW)))
269 if( v_knots->
GetSize() > (2.0 * GetOrder(
COL)))
276void G4ProjectedSurface::SplitNURBSurface()
285 register G4int k_index=0;
287 register G4int nr,nc;
293 for( i = 0; i < u_knots->
GetSize(); i++)
303 k_index = GetOrder(
ROW);
317 k_index + srf1->GetOrder(
ROW),0);
319 nr= srf1->v_knots->
GetSize() - srf1->GetOrder(
COL);
320 nc= srf1->u_knots->
GetSize() - srf1->GetOrder(
ROW);
331 new_knots->
GetSize(), k_index);
333 nr= srf2->v_knots->
GetSize() - srf2->GetOrder(
COL);
334 nc= srf2->u_knots->
GetSize() - srf2->GetOrder(
ROW);
344 upper = new_knots->
GetSize() - srf2->GetOrder(
ROW);
351 for( i = 0; i < v_knots->
GetSize(); i++)
361 k_index = GetOrder(
COL);
375 k_index + srf1->GetOrder(
COL), 0);
377 nr = srf1->v_knots->
GetSize() - srf1->GetOrder(
COL);
378 nc = srf1->u_knots->
GetSize() - srf1->GetOrder(
ROW);
390 nr = srf2->v_knots->
GetSize() - srf2->GetOrder(
COL);
391 nc = srf2->u_knots->
GetSize() - srf2->GetOrder(
ROW);
401 upper = new_knots->
GetSize() - srf2->GetOrder(
COL);
426 G4double pointDist1 = pt1.distance2(pt2);
427 G4double pointDist2 = pt1.distance2(pt3);
456 pointDist1 = pt1.distance2(pt2);
457 pointDist2 = pt1.distance2(pt3);
470void G4ProjectedSurface::CalcOsloMatrix()
481 register G4int mu, muprim;
483 register G4int iu, il, ih, n1;
492 n1 = new_knots->
GetSize() - ord;
518 for (j = 0; j < n1; j++)
534 while ( ((std::abs(new_knots->
GetKnot(i) - old_knots->
GetKnot(muprim))) <
543 for (v = 0, p = 1; p < ord; p++)
546 if ( (std::abs((new_knots->
GetKnot(j + p)) - (old_knots->
GetKnot(ih)))) <
553 ahi = AhIndex(0, ord - 1,ord);
556 for (p = 1; p <= v; p++)
563 beta1 = AhIndex(p - 1, ord - muprim,ord);
564 beta1 = ((tj - old_knots->
GetKnot(0)) * beta1) /
571 iu = Amin (muprim, i);
573 for (i = il; i <= iu; i++)
578 d1 = tj - old_knots->
GetKnot(i);
579 d2 = old_knots->
GetKnot(i + p + ord - v - 1) - tj;
581 beta = ah->
GetKnot(AhIndex(p - 1, i + ord - muprim - 1,ord)) /
584 ah->
PutKnot(AhIndex(p, i + ord - muprim - 2,ord), d2 * beta + beta1) ;
588 ah->
PutKnot(AhIndex(p, iu + ord - muprim - 1,ord), beta1);
595 kkk = old_knots->
GetKnot(n1 - 1 + ord);
596 ahv = AhIndex (p - 1, iu + ord - muprim,ord);
597 ah->
PutKnot(AhIndex(p, iu + ord - muprim - 1,ord),
598 beta1 + (kkk - tj) * ahv /
599 (kkk - old_knots->
GetKnot(iu + 1)));
608 for ( i = v, p = 0; i >= 0; i--)
650 for(
register G4int a=0; a<size;a++)
653 for ( i = 0, o_ptr = oslo_m; i < lower; i++, o_ptr = o_ptr->
GetNextNode()){;}
659 for ( j = lower; j < upper; j++, o_ptr = o_ptr->GetNextNode())
671 o_scale = o_ptr->GetKnotVector()->GetKnot(0);
673 tempc.
setX(o_pts.
x() * o_scale);
674 tempc.
setY(o_pts.
y() * o_scale);
676 for ( i = 1; i <= o_ptr->GetSize(); i++)
678 o_scale = o_ptr->GetKnotVector()->GetKnot(i);
686 o_pts = old_pts->
Get3D(x,i+o_ptr->GetOffset());
687 tempc.
setX(tempc.
x() + o_scale * o_pts.
x());
688 tempc.
setY(tempc.
y() + o_scale * o_pts.
y());
691 c_ptr->
put(a,(j)%upper-lower,tempc);
696 for ( j = lower; j < upper; j++, o_ptr = o_ptr->GetNextNode())
709 o_scale = o_ptr->GetKnotVector()->GetKnot(0);
711 tempc.
setX(o_pts.
x() * o_scale);
712 tempc.
setY(o_pts.
y() * o_scale);
714 for ( i = 1; i <= o_ptr->GetSize(); i++)
716 o_scale = o_ptr->GetKnotVector()->GetKnot(i);
717 o_pts= old_pts->
Get3D(i+o_ptr->GetOffset(),a);
719 tempc.
setX(tempc.
x() + o_scale * o_pts.
x());
720 tempc.
setY(tempc.
y() + o_scale * o_pts.
y());
723 c_ptr->
put((j)%upper-lower,a,tempc);
void PutOrder(G4int direction, G4int value)
G4Point3D Get3D(G4int i, G4int j) const
void put(G4int i, G4int j, const G4Point3D &tmp)
void ExtractKnotVector(G4KnotVector *kv, G4int upper, G4int lower)
G4double GetKnot(G4int knot_number) const
G4KnotVector * MultiplyKnotVector(G4int num, G4double value)
void PutKnot(G4int knot_number, G4double value)
void SetKnotVector(G4KnotVector *)
G4OsloMatrix * GetNextNode()
void SetNextNode(G4OsloMatrix *)
G4KnotVector * GetKnotVector()
virtual ~G4ProjectedSurface()
G4ControlPoints * ctl_points
friend void CopySurface(G4ProjectedSurface &proj)
void AddSurface(G4Surface *srf)
const G4Surface * GetLastSurface() const
void RemoveSurface(G4Surface *srf)
void SetDistance(G4double Dist)