ATLAS Offline Software
Loading...
Searching...
No Matches
RevolutionSurfaceUtil Class Reference

#include <RevolutionSurfaceUtil.h>

Collaboration diagram for RevolutionSurfaceUtil:

Static Public Member Functions

static int nphiDivisions (const float &dphi, const float &complexity, int OverrideNPhi=0)
static void setBBoxPars (const float &sphi, const float &dphi, const float &rmin, const float &rmax, const float &zmin, const float &zmax, SbBox3f &box, SbVec3f &center)

Detailed Description

Definition at line 11 of file RevolutionSurfaceUtil.h.

Member Function Documentation

◆ nphiDivisions()

int RevolutionSurfaceUtil::nphiDivisions ( const float & dphi,
const float & complexity,
int OverrideNPhi = 0 )
inlinestatic

Definition at line 21 of file RevolutionSurfaceUtil.h.

21 {
22 int NPHI = ( OverrideNPhi > 0 ? OverrideNPhi : std::max(3,static_cast<int>(fabs(20.0*complexity*dphi/M_PI)) ) );
23 int lim1 = static_cast<int>(dphi*8.0/(2*M_PI)+0.5);
24 if (NPHI<lim1) {
25 if (OverrideNPhi<=0) {
26 NPHI = lim1;
27 } else {
28 int lim2 = static_cast<int>(dphi*5.0/(2*M_PI)+0.5);
29 if (NPHI<lim2)
30 NPHI = lim2;
31 }
32 }
33 if (NPHI<2)
34 NPHI = 2;
35 return NPHI;
36 }
#define M_PI

◆ setBBoxPars()

void RevolutionSurfaceUtil::setBBoxPars ( const float & sphi,
const float & dphi,
const float & rmin,
const float & rmax,
const float & zmin,
const float & zmax,
SbBox3f & box,
SbVec3f & center )
inlinestatic

Definition at line 40 of file RevolutionSurfaceUtil.h.

41 {
42
43
44 if (dphi>(2.0*M_PI*0.99)) {
45 SbVec3f vmin(-rmax,-rmax,zmin),
46 vmax( rmax, rmax, zmax);
47 center.setValue(0,0,0);
48 box.setBounds(vmin,vmax);
49 } else {
50 //Get start/end angle in correct interval:
51 float anglestart = sphi;
52 while (anglestart < 0.0) anglestart += 2*M_PI;
53 while (anglestart > 2*M_PI) anglestart -= 2*M_PI;
54 if (anglestart<0.0) anglestart = 0.0;
55 float angleend = anglestart + dphi;
56
57 //Get bounds:
58 double cosanglestart(cos(anglestart));
59 double cosangleend(cos(angleend));
60 double sinanglestart(sin(anglestart));
61 double sinangleend(sin(angleend));
62
63 float ymax = rmax * ( (0.5*M_PI>=anglestart&&0.5*M_PI<=angleend) ? 1.0 : std::max(sinanglestart,sinangleend) );
64 float ymin = rmax * ( (1.5*M_PI>=anglestart&&1.5*M_PI<=angleend) ? -1.0 : std::min(sinanglestart,sinangleend) );
65 float xmax = rmax * ( (anglestart <= 0.0 || angleend >= 2*M_PI) ? 1.0 : std::max(cosanglestart,cosangleend) );
66 float xmin = rmax * ( (M_PI>=anglestart&&M_PI<=angleend) ? -1.0 : std::min(cosanglestart,cosangleend) );
67
68 //Not only the bounds of the arc - also of the lines to the center:
69 if (dphi >= 0.5*M_PI || rmin==0.0f ) {
70 //(0,0) is included
71 if (ymax<0.0) ymax = 0.0;
72 if (ymin>0.0) ymin = 0.0;
73 if (xmax<0.0) xmax = 0.0;
74 if (xmin>0.0) xmin = 0.0;
75 } else {
76 //The two inner "corners" must be included
77 double x1 = rmin*cosanglestart;
78 double y1 = rmin*sinanglestart;
79 double x2 = rmin*cosangleend;
80 double y2 = rmin*sinangleend;
81 if (xmax<x1) xmax = x1;
82 if (xmax<x2) xmax = x2;
83 if (xmin>x1) xmin = x1;
84 if (xmin>x2) xmin = x2;
85 if (ymax<y1) ymax = y1;
86 if (ymax<y2) ymax = y2;
87 if (ymin>y1) ymin = y1;
88 if (ymin>y2) ymin = y2;
89 }
90 SbVec3f vmin(xmin,ymin,zmin), vmax( xmax, ymax, zmax);
91 center.setValue(0.5*(xmin+xmax),0.5*(ymin+ymax),0.5*(zmin+zmax));
92 box.setBounds(vmin,vmax);
93 }
94 }
double xmax
Definition listroot.cxx:61
double ymin
Definition listroot.cxx:63
double xmin
Definition listroot.cxx:60
double ymax
Definition listroot.cxx:64

The documentation for this class was generated from the following file: