Page MenuHomeHEPForge

DrawPrimitive.h
No OneTemporary

DrawPrimitive.h

This document is not UTF8. It was detected as ISO-8859-1 (Latin 1) and converted to UTF8 for display.
void DrawSphere(double R, double Nphi, double Nteta, double posx, double posy, double posz) //Fonction permetant de dessiner une sphère centré en posx,posy,posz
{
double dphi = 6.283185307179586476925286766559/Nphi;
double dtet = 3.1415926535897932384626433832795/Nteta;
for(double tet=0; tet<=2*3.1416-dtet;tet+=dtet){
for(double phi=0; phi<=6.2831-dphi;phi+=dphi){
glBegin (GL_QUADS);
glVertex3d (posx+R*cos(tet)*cos(phi) ,posy+R*cos(tet)*sin(phi) ,posz+R*sin(tet));
glVertex3d (posx+R*cos(tet)*cos(phi+dphi) ,posy+R*cos(tet)*sin(phi+dphi) ,posz+R*sin(tet));
glVertex3d (posx+R*cos(tet+dtet)*cos(phi+dphi) ,posy+R*cos(tet+dtet)*sin(phi+dphi) ,posz+R*sin(tet+dtet));
glVertex3d (posx+R*cos(tet+dtet)*cos(phi) ,posy+R*cos(tet+dtet)*sin(phi) ,posz+R*sin(tet+dtet));
glEnd();
}}
}
void DrawCylinder(double R, double Nphi, double Z, double posx, double posy, double posz)
{
double dphi = 6.283185307179586476925286766559/Nphi;
for(double phi=0; phi<=6.2831;phi+=dphi){
glBegin (GL_QUADS);
glVertex3d (posx+R*cos(phi) ,posy+R*sin(phi) ,posz+Z/2);
glVertex3d (posx+R*cos(phi+dphi) ,posy+R*sin(phi+dphi) ,posz+Z/2);
glVertex3d (posx+R*cos(phi+dphi) ,posy+R*sin(phi+dphi) ,posz-Z/2);
glVertex3d (posx+R*cos(phi) ,posy+R*sin(phi) ,posz-Z/2);
glEnd();
}
}
void DrawSquare(double R, double posx, double posy, double posz)
{
glBegin (GL_QUADS);
glVertex3d (posx+R/2,posy+R/2 ,posz+R/2); //+++
glVertex3d (posx-R/2,posy+R/2 ,posz+R/2); //-++
glVertex3d (posx-R/2,posy-R/2 ,posz+R/2); //--+
glVertex3d (posx+R/2,posy-R/2 ,posz+R/2); //+-+
glVertex3d (posx+R/2,posy+R/2 ,posz-R/2); //++-
glVertex3d (posx-R/2,posy+R/2 ,posz-R/2); //-+-
glVertex3d (posx-R/2,posy-R/2 ,posz-R/2); //---
glVertex3d (posx+R/2,posy-R/2 ,posz-R/2); //+--
glVertex3d (posx+R/2,posy+R/2 ,posz+R/2); //+++
glVertex3d (posx-R/2,posy+R/2 ,posz+R/2); //-++
glVertex3d (posx-R/2,posy+R/2 ,posz-R/2); //-+-
glVertex3d (posx+R/2,posy+R/2 ,posz-R/2); //++-;
glVertex3d (posx+R/2,posy-R/2 ,posz+R/2); //+-+
glVertex3d (posx-R/2,posy-R/2 ,posz+R/2); //--+
glVertex3d (posx-R/2,posy-R/2 ,posz-R/2); //---
glVertex3d (posx+R/2,posy-R/2 ,posz-R/2); //+--
glVertex3d (posx+R/2,posy+R/2 ,posz+R/2); //+++
glVertex3d (posx+R/2,posy+R/2 ,posz-R/2); //++-
glVertex3d (posx+R/2,posy-R/2 ,posz-R/2); //+--
glVertex3d (posx+R/2,posy-R/2 ,posz+R/2); //+-+
glVertex3d (posx-R/2,posy+R/2 ,posz+R/2); //-++
glVertex3d (posx-R/2,posy+R/2 ,posz-R/2); //-+-
glVertex3d (posx-R/2,posy-R/2 ,posz-R/2); //---
glVertex3d (posx-R/2,posy-R/2 ,posz+R/2); //--+
glEnd();
}
void DrawSquare(double px, double py, double pz,
double wx, double wy, double wz,
double lx, double ly, double lz,
double tx, double ty, double tz,
double TP)
{
glBegin (GL_QUADS);
glVertex3d (px+wx*TP +lx+tx,py+wy*TP+ly+ty,pz+wz*TP+lz+tz); //+++
glVertex3d (px-wx*TP +lx+tx,py-wy*TP+ly+ty,pz-wz*TP+lz+tz); //-++
glVertex3d (px-wx -lx+tx,py-wy -ly+ty,pz-wz -lz+tz); //--+
glVertex3d (px+wx -lx+tx,py+wy -ly+ty,pz+wz -lz+tz); //+-+
glVertex3d (px+wx*TP +lx-tx,py+wy*TP+ly-ty,pz+wz*TP+lz-tz); //++-
glVertex3d (px-wx*TP +lx-tx,py-wy*TP+ly-ty,pz-wz*TP+lz-tz); //-+-
glVertex3d (px-wx -lx-tx,py-wy -ly-ty,pz-wz -lz-tz); //---
glVertex3d (px+wx -lx-tx,py+wy -ly-ty,pz+wz -lz-tz); //+--
glVertex3d (px+wx*TP +lx+tx,py+wy*TP+ly+ty,pz+wz*TP+lz+tz); //+++
glVertex3d (px-wx*TP +lx+tx,py-wy*TP+ly+ty,pz-wz*TP+lz+tz); //-++
glVertex3d (px-wx*TP +lx-tx,py-wy*TP+ly-ty,pz-wz*TP+lz-tz); //-+-
glVertex3d (px+wx*TP +lx-tx,py+wy*TP+ly-ty,pz+wz*TP+lz-tz); //++-;
glVertex3d (px+wx -lx+tx,py+wy -ly+ty,pz+wz -lz+tz); //+-+
glVertex3d (px-wx -lx+tx,py-wy -ly+ty,pz-wz -lz+tz); //--+
glVertex3d (px-wx -lx+tx,py-wy -ly+ty,pz-wz -lz+tz); //---
glVertex3d (px+wx -lx-tx,py+wy -ly-ty,pz+wz -lz-tz); //+--
glVertex3d (px+wx*TP +lx+tx,py+wy*TP+ly+ty,pz+wz*TP+lz+tz); //+++
glVertex3d (px+wx*TP +lx-tx,py+wy*TP+ly-ty,pz+wz*TP+lz-tz); //++-
glVertex3d (px+wx -lx-tx,py+wy -ly-ty,pz+wz -lz-tz); //+--
glVertex3d (px+wx -lx+tx,py+wy -ly+ty,pz+wz -lz+tz); //+-+
glVertex3d (px-wx*TP +lx+tx,py-wy*TP+ly+ty,pz-wz*TP+lz+tz); //-++
glVertex3d (px-wx*TP +lx-tx,py-wy*TP+ly-ty,pz-wz*TP+lz-tz); //-+-
glVertex3d (px-wx -lx-tx,py-wy -ly-ty,pz-wz -lz-tz); //---
glVertex3d (px-wx -lx+tx,py-wy -ly+ty,pz-wz -lz+tz); //--+
glEnd();
}
void DrawDet(CaloDet* D)
{
/*
double R = 1;
double posx = D->PosX;
double posy = D->PosY;
double posz = D->PosZ;
*/
glBegin (GL_QUADS);
glVertex3d (D->C1X,D->C1Y,D->C1Z); //+++
glVertex3d (D->C2X,D->C2Y,D->C2Z); //-++
glVertex3d (D->C3X,D->C3Y,D->C3Z); //--+
glVertex3d (D->C4X,D->C4Y,D->C4Z); //+-+
glVertex3d (D->C5X,D->C5Y,D->C5Z); //++-
glVertex3d (D->C6X,D->C6Y,D->C6Z); //-+-
glVertex3d (D->C7X,D->C7Y,D->C7Z); //---
glVertex3d (D->C8X,D->C8Y,D->C8Z); //+--
glVertex3d (D->C1X,D->C1Y,D->C1Z); //+++
glVertex3d (D->C2X,D->C2Y,D->C2Z); //-++
glVertex3d (D->C6X,D->C6Y,D->C6Z); //-+-
glVertex3d (D->C5X,D->C5Y,D->C5Z); //++-;
glVertex3d (D->C4X,D->C4Y,D->C4Z); //+-+
glVertex3d (D->C3X,D->C3Y,D->C3Z); //--+
glVertex3d (D->C7X,D->C7Y,D->C7Z); //---
glVertex3d (D->C8X,D->C8Y,D->C8Z); //+--
glVertex3d (D->C1X,D->C1Y,D->C1Z); //+++
glVertex3d (D->C5X,D->C5Y,D->C5Z); //++-
glVertex3d (D->C8X,D->C8Y,D->C8Z); //+--
glVertex3d (D->C4X,D->C4Y,D->C4Z); //+-+
glVertex3d (D->C2X,D->C2Y,D->C2Z); //-++
glVertex3d (D->C6X,D->C6Y,D->C6Z); //-+-
glVertex3d (D->C7X,D->C7Y,D->C7Z); //---
glVertex3d (D->C3X,D->C3Y,D->C3Z); //--+
glEnd();
}

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 12:23 PM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4022754
Default Alt Text
DrawPrimitive.h (5 KB)

Event Timeline