Fork me on GitHub

Changeset 111 in svn for trunk/Utilities


Ignore:
Timestamp:
Dec 24, 2008, 11:08:53 AM (16 years ago)
Author:
severine ovyn
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Utilities/FROG/Includes/FROG/FROG_Element_Primitive_Cone.h

    r102 r111  
    88        float Radius;           
    99        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;  
    1212        FROG_Objects*  frogObjects_;
    1313       
    1414        virtual bool isCompactible(){ return true; }
    1515
    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);}
    1717
    1818        FROG_Element_Primitive_Cone(
    1919        unsigned int detId,     float radius,
    2020        float posX,                     float posY,    float posZ,
    21         float lengthX,          float lengthY, float lengthZ,
     21        float lengthX,          float lengthY, float lengthZ, int side,
    2222        unsigned short nPhi=10, unsigned char endcap=0) :
    2323        FROG_Element_Base_With_DetId(C_PRIMITIVE_CONE,detId),   
    2424        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),
    2727        NPhi(nPhi), Endcap(endcap)
    2828        {   
     
    4141                fread(&LengthY          ,sizeof(LengthY)         ,1,pFile);
    4242                fread(&LengthZ          ,sizeof(LengthZ)         ,1,pFile);
     43                fread(&Side             ,sizeof(Side)            ,1,pFile);
    4344                fread(&NPhi             ,sizeof(NPhi)            ,1,pFile);             
    4445                fread(&Endcap           ,sizeof(Endcap)          ,1,pFile);             
     
    5657                data_ = FillBuffer( data_, &LengthY,                    sizeof(LengthY));
    5758                data_ = FillBuffer( data_, &LengthZ,                    sizeof(LengthZ));
     59                data_ = FillBuffer( data_, &Side,                       sizeof(Side));
    5860                data_ = FillBuffer( data_, &NPhi,                               sizeof(NPhi));         
    5961                data_ = FillBuffer( data_, &Endcap,                             sizeof(Endcap));               
     
    8183                glRotatef(rotTheta,1,0,0);
    8284                double theta=atan(L/Radius);
     85                if(Side==1){
    8386                glBegin (GL_QUADS);                     
    8487                        for(double phi=0; phi<=6.2831;phi+=dphi){       
     
    104107
    105108                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 FACE
    110                                 glVertex3f (Radius*cos(phi)              ,Radius*sin(phi)               , L*0.5);
    111                                 glVertex3f (0                                    ,0                                             , L*0.5);
    112                         }
    113                         glEnd();
    114109
    115110                        glBegin (GL_QUADS);                     
     
    124119                }
    125120                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
    126160        }
    127161        #endif
Note: See TracChangeset for help on using the changeset viewer.