#include <RevolutionSurfaceUtil.h>
|
| 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 ¢er) |
Definition at line 11 of file RevolutionSurfaceUtil.h.
◆ 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 }
◆ 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
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
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
69 if (dphi >= 0.5*
M_PI || rmin==0.0f ) {
70
75 } else {
76
77 double x1 = rmin*cosanglestart;
78 double y1 = rmin*sinanglestart;
79 double x2 = rmin*cosangleend;
80 double y2 = rmin*sinangleend;
89 }
92 box.setBounds(vmin,vmax);
93 }
94 }
The documentation for this class was generated from the following file: