Changeset 111 in svn for trunk/Utilities/FROG/Includes
- Timestamp:
- Dec 24, 2008, 11:08:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Utilities/FROG/Includes/FROG/FROG_Element_Primitive_Cone.h
r102 r111 8 8 float Radius; 9 9 float PosX; float PosY; float PosZ; 10 float LengthX; float LengthY; float LengthZ; 11 unsigned short NPhi;unsigned char Endcap; 10 float LengthX; float LengthY; float LengthZ; int Side; 11 unsigned short NPhi;unsigned char Endcap; 12 12 FROG_Objects* frogObjects_; 13 13 14 14 virtual bool isCompactible(){ return true; } 15 15 16 static unsigned int sizeOf(){ return FROG_Element_Base_With_DetId::sizeOf() + 7*sizeof(float) + sizeof( unsigned short) + sizeof(unsigned char);}16 static unsigned int sizeOf(){ return FROG_Element_Base_With_DetId::sizeOf() + 7*sizeof(float) + sizeof(int) + sizeof(unsigned short) + sizeof(unsigned char);} 17 17 18 18 FROG_Element_Primitive_Cone( 19 19 unsigned int detId, float radius, 20 20 float posX, float posY, float posZ, 21 float lengthX, float lengthY, float lengthZ, 21 float lengthX, float lengthY, float lengthZ, int side, 22 22 unsigned short nPhi=10, unsigned char endcap=0) : 23 23 FROG_Element_Base_With_DetId(C_PRIMITIVE_CONE,detId), 24 24 Radius(radius), 25 PosX(posX), PosY(posY), PosZ(posZ), 26 LengthX(lengthX), LengthY(lengthY), LengthZ(lengthZ), 25 PosX(posX), PosY(posY), PosZ(posZ), 26 LengthX(lengthX), LengthY(lengthY), LengthZ(lengthZ), Side(side), 27 27 NPhi(nPhi), Endcap(endcap) 28 28 { … … 41 41 fread(&LengthY ,sizeof(LengthY) ,1,pFile); 42 42 fread(&LengthZ ,sizeof(LengthZ) ,1,pFile); 43 fread(&Side ,sizeof(Side) ,1,pFile); 43 44 fread(&NPhi ,sizeof(NPhi) ,1,pFile); 44 45 fread(&Endcap ,sizeof(Endcap) ,1,pFile); … … 56 57 data_ = FillBuffer( data_, &LengthY, sizeof(LengthY)); 57 58 data_ = FillBuffer( data_, &LengthZ, sizeof(LengthZ)); 59 data_ = FillBuffer( data_, &Side, sizeof(Side)); 58 60 data_ = FillBuffer( data_, &NPhi, sizeof(NPhi)); 59 61 data_ = FillBuffer( data_, &Endcap, sizeof(Endcap)); … … 81 83 glRotatef(rotTheta,1,0,0); 82 84 double theta=atan(L/Radius); 85 if(Side==1){ 83 86 glBegin (GL_QUADS); 84 87 for(double phi=0; phi<=6.2831;phi+=dphi){ … … 104 107 105 108 if(Endcap<2){// we have to draw internal face because cylinder is open 106 glBegin (GL_TRIANGLES);107 for(double phi=0; phi<=6.2831;phi+=dphi){108 glNormal3f (0,0,-1);109 glVertex3f (Radius*cos(phi+dphi) ,Radius*sin(phi+dphi) , L*0.5); // ENDCAP1 INNER FACE110 glVertex3f (Radius*cos(phi) ,Radius*sin(phi) , L*0.5);111 glVertex3f (0 ,0 , L*0.5);112 }113 glEnd();114 109 115 110 glBegin (GL_QUADS); … … 124 119 } 125 120 glPopMatrix(); 121 } 122 else{ 123 glBegin (GL_QUADS); 124 for(double phi=0; phi<=6.2831;phi+=dphi){ 125 glNormal3f ( cos(phi) ,sin(phi) ,0); 126 glVertex3f (0,0 ,-L*0.5); // BARREL OUTER FACE 127 glVertex3f (0,0 ,-L*0.5); 128 glVertex3f (Radius*cos(phi) ,Radius*sin(phi) , L*0.5); 129 glVertex3f (Radius*cos(phi+dphi) ,Radius*sin(phi+dphi) , L*0.5); 130 } 131 glEnd(); 132 133 134 if(Endcap>1){ 135 for(double phi=0; phi<=6.2831;phi+=dphi){ 136 glNormal3f (0,0,-1); 137 glVertex3f (Radius*cos(phi+dphi) ,Radius*sin(phi+dphi) , -L*-0.5); // ENDCAP1 INNER FACE 138 glVertex3f (Radius*cos(phi) ,Radius*sin(phi) , -L*-0.5); 139 glVertex3f (0 ,0 , -L*-0.5); 140 } 141 } 142 glEnd(); 143 144 145 if(Endcap<2){// we have to draw internal face because cylinder is open 146 147 glBegin (GL_QUADS); 148 for(double phi=0; phi<=6.2831;phi+=dphi){ 149 glNormal3f ( -cos(phi) ,- sin(phi) ,0); 150 glVertex3f (0,0 ,-L*0.5); // BARREL OUTER FACE 151 glVertex3f (Radius*cos(phi) ,Radius*sin(phi) , L*0.5); 152 glVertex3f (Radius*cos(phi+dphi) ,Radius*sin(phi+dphi) , L*0.5); 153 glVertex3f (0,0 ,-L*0.5); 154 } 155 glEnd(); 156 } 157 glPopMatrix(); 158 } 159 126 160 } 127 161 #endif
Note:
See TracChangeset
for help on using the changeset viewer.