Tuesday, March 20, 2007

The Vsepr Theory Molecular Structure Of H2se



PRACTICE 3

Humaniod hands



# include # include # include


# include # include void

hand (float ang, float rpy, RPZ float, float rpyf123, rpyf23 float, float rpyf3, rixf123 float, float rixf23, rixf3 float, float rmxf123, rmxf23 float, float rmxf3, raxf123 float, float raxf23, raxf3 float, float rmexf123, rmexf23 float, float rmexf3, rmaz float, float rmax, float rmay) void

mueveExtremidades (abd float, float abi, apd float, float api, float x1, float y1, float z1);

void init (void)
{
glClearColor (0.0, 0.0, 1.0, 0.0);
glShadeModel (GL_FLAT);
}

void display(void)
{

glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glLoadIdentity (); /* clear the matrix */
/* viewing transformation */
gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
glScalef (1.0, 1.0, 1.0); /* modeling transformation */


glPushMatrix();
glScalef(0.1,.6,1.0);
glTranslatef(-21,2.75f,0.0f);
glRotatef(90,0,0,1);
mano(0,1,45,0,0, 45,0,0, 45,0,0, 45,0,0, -20,0,0, -15, 0,1,0 );
glPopMatrix();

glPushMatrix();
glScalef(0.1,.6,1.0);
glTranslatef(21,2.75f,0.0f);
glRotatef(-90,0,0,1);
mano(0,1,45,0,0, 45,0,0, 45,0,0, 45,0,0, -20,0,0, -15, 0,1,0 ,);
glPopMatrix();

mueveExtremidades(8,-8,8,-8,0,0,0);

glFlush ();
}

void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
glMatrixMode (GL_MODELVIEW);
}

/* ARGSUSED1 */
void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(0);
break;
}
}

nt main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE GLUT_RGB);
glutInitWindowSize (500, 500);
glutInitWindowPosition (300,230);
glutCreateWindow (argv[0]);
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutMainLoop();

return 0;
}



void mueveExtremidades(float abd, float abi, float apd,float api,float x1,float y1,float z1)
{
float x,y,z,brazod, brazoi, pied, piei;
x=x1;
y=y1;
z=z1;
brazod=abd;
brazoi=abi;
pied=apd;
piei=api;

glPushMatrix();
//cabeza
glTranslatef(0.0f,2.5f,0.0f);
glutWireCube (0.5);

//tronco
glScalef(2.5,2.5,2.0);
glTranslatef(0.0f,-0.45f,0.0f);
glutWireCube (0.5);
//piernas

glPushMatrix();
glPushMatrix();
//pierna izquierda
glRotatef(piei,x,y,z);
glTranslatef (-0.1f,-0.55f, 0.0f);
glScalef (-. 3,1.2,1.0)
glutWireCube (0.5);
glPushMatrix ();

glTranslatef (0.0f,-0.7f, 0.0 f)
glutWireCube (0.5);

glPushMatrix ();
glTranslatef (0.0f, .35 f, 0.0f);
glScalef (1.1, .4,1.0)
glutWireCube (0.5);
glPopMatrix ();
glPopMatrix ();
/ / feet
glPushMatrix ();
glTranslatef (.3 f,-1.0f, 0.0f);
glScalef (1.6, .2,1.0)
glutWireCube (0.5);
glPopMatrix ();
glPopMatrix ();

/ / right leg
glRotatef (pied, x, y, z);
glTranslatef (0.1f,-0.55f, 0.0f);
glScalef (-. 3,1.2,1.0)
glutWireCube (0.5), glPushMatrix
();

glTranslatef (0.0f,-0.7f, 0.0f);
glutWireCube (0.5);
glPushMatrix
();
glTranslatef (0.0f, .35 f, 0.0f);
glScalef (1.1, .4,1.0)
glutWireCube (0.5);
glPopMatrix ();
glPopMatrix ();

/ / feet
glTranslatef (-. 3f,-1.0f, 0.0f);
glScalef (1.6, .2,1.0)
glutWireCube (0.5);


glPopMatrix ();
/ / right arm
glPushMatrix ();
glRotatef (brazod, x , y, z);
glTranslatef (0.35f, 0.1f, 0.0f);
glScalef (0.5,0.4, .5);
glutWireCube (0.5);

glPushMatrix ();

glTranslatef (0.4f, 0.0f, 0.0f);
glScalef (0.5,1.2,1.0);
glutWireCube (0.5);

glPopMatrix ();
glTranslatef (0.7f, 0.0f, 0.0f);
glScalef (.7,1,1.0)
glutWireCube (0.5);
/ / left arm
glPopMatrix ();
glRotatef (brazoi, x, y, z);
glTranslatef (-0.35f, 0.1f, 0.0f);
glScalef (0.5,0.4, .5);
glutWireCube (0.5);

glPushMatrix ();
glTranslatef (-0.4f, 0.0f, 0.0f) ;
glScalef (0.5,1.2,1.0);
glutWireCube (0.5);

glPopMatrix ();
glTranslatef (-0.7f, 0.0f, 0.0f);
glScalef (.7,1,1.0);
glutWireCube (0.5);
glPopMatrix ();}




manually void (float a, float rpy, rpz float, float rpyf123, rpyf23 float, float rpyf3, rixf123 float, float rixf23, rixf3 float, float rmxf123, rmxf23 float, float rmxf3, raxf123 float, float raxf23, raxf3 float, float rmexf123, rmexf23 float, float rmexf3, float rmaz , float rmax, float rmay)



{glRotatef (this, rmax, rmay, rmaz);
glPushMatrix ();
/ / palm

glScalef (4,3,2);
glutWireCube (0.5);
glPopMatrix ();

glPushMatrix ();
/ / Pulgar
/ / falange1
glRotatef (rpyf123, 0,1,0);
glTranslatef (1.25f,-0.55f, 0.0f);
glScalef (1.25,1,1);
glutWireCube (0.5);

/ / falange2
glRotatef (rpyf23, 0,1,0);
glTranslatef (.5 f, 0.0f, 0.0f);
glScalef (1,1,1);
glutWireCube (0.5);

/ / falange3
glRotatef (rpyf3, 0,1,0);
glTranslatef (0.39f, 0.0f, 0.0f);
glScalef (.5,1,1);
glutWireCube (0.5);

glPopMatrix ();

glPushMatrix ();
/ / Indices
/ / falange1
glRotatef (rixf123, 1,0,0);
glScalef (1,1.5,1);
glTranslatef (0.75f, 0.75f, 0.0f);
glutWireCube (0.5);

/ / falange2
glRotatef (rixf23, 1,0,0);
glScalef (1 , 1.25,1);
glTranslatef (0.0f, 0.45f, 0.0f);
glutWireCube (0.5);

/ / falange3
glRotatef (rixf3, 1,0,0);
glScalef (1, .5, 1);
glTranslatef (0.0f, .75 f, 0.0f);
glutWireCube (0.5);

glPopMatrix ();

glPushMatrix ();
/ / Medio
/ / falange1
glRotatef (rmxf123, 1.0 , 0);
glScalef (1,1.5,1);
glTranslatef (0.25f, 0.75f, 0.0f);
glutWireCube (0.5);

/ / falange2
glRotatef (rmxf23, 1,0,0);
glScalef (1,1.25,1);
glTranslatef (0.0f, 0.45f, 0.0f);
glutWireCube (0.5 );

/ / falange3
glRotatef (rmxf3, 1,0,0);
glScalef (1, .75,1);
glTranslatef (0.0f, .60 f, 0.0f);
glutWireCube (0.5);

glPopMatrix ();

glPushMatrix ();
/ / Anguilla
/ / falange1
glRotatef (raxf123, 1,0,0);
glScalef (1,1.25,1);
glTranslatef (-0.25f, 0.860f , 0.0f);
glutWireCube (0.5);

/ / Falange2
glScalef (1,1.25,1);
glRotatef (raxf23, 1,0,0);
glTranslatef (0.0f, .45 f, 0.0f);
glutWireCube (0.5);

/ / falange3
glRotatef (raxf3, 1,0,0);
glScalef (1,1,1);
glTranslatef (0.0f, .5 f, 0.0f);
glutWireCube (0.5);

glPopMatrix ();

glPushMatrix ( );
/ / meñique
/ / falange1
glRotatef (rmexf123, 1,0,0);
glScalef (1,1.2,1);
glTranslatef (-0.75f, 0.86f, 0.0f);
glutWireCube (0.5 );

/ / falange2
glRotatef (rmexf23, 1,0,0);
glScalef (1,1,1);
glTranslatef (0.0f, 0.5f, 0.0f);
glutWireCube (0.5);

/ / falange3
glRotatef (rmexf3, 1,0,0);
glScalef (1 , 1.1);
glTranslatef (0.0f, .5 f, 0.0f);
glutWireCube (0.5);

glPopMatrix ();}

0 comments:

Post a Comment