5 #ifndef REVOLUTIONSURFACEUTIL_H
6 #define REVOLUTIONSURFACEUTIL_H
21 static int nphiDivisions(
const float& dphi,
const float& complexity,
int OverrideNPhi = 0 ) {
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);
25 if (OverrideNPhi<=0) {
28 int lim2 =
static_cast<int>(dphi*5.0/(2*
M_PI)+0.5);
40 static void setBBoxPars(
const float& sphi,
const float& dphi,
const float& rmin,
const float& rmax,
41 const float&
zmin,
const float&
zmax, SbBox3f &box, SbVec3f ¢er ) {
44 if (dphi>(2.0*
M_PI*0.99)) {
47 center.setValue(0,0,0);
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;
58 double cosanglestart(
cos(anglestart));
59 double cosangleend(
cos(angleend));
60 double sinanglestart(
sin(anglestart));
61 double sinangleend(
sin(angleend));
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) );
69 if (dphi >= 0.5*
M_PI || rmin==0.0
f ) {
77 double x1 = rmin*cosanglestart;
78 double y1 = rmin*sinanglestart;
79 double x2 = rmin*cosangleend;
80 double y2 = rmin*sinangleend;