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 ();}

Friday, March 16, 2007

Tank Purge Dip System Advantages



Matrix Transformation

The order is first rotation (zax) and then travel by-d, because moving the camera is as moving the world in the opposite direction.
Another method for generating the matrix transformation and rotation is to calculate the unit vectors UVN and form the rotation matrix composed directly. Given the vectors N and V, these unit vectors are computed as
n = N / NC C = (n1, n2, n3)
u = VXN / VXN ç ç = (u1, u2, u3) v = nxu
= ( v1, v2, v3)
This method also automatically adjusts the direction of V so that v is perpendicular to n.
The rotation matrix composite processing view is



that transforms u into the global axis xw, v and w on the axis of the shaft n zw. This matrix takes place automatically reflection necessary to transform a left side view of a global system right.
The complete transformation of world coordinates to view coordinates is obtained as the matrix product
MVC
¬ WC = R · T-1


glViewport (0, 0, width, height);

This function defines portion of the window where you can draw ogl. The parameters are y, upper-left corner of the "box" where you can draw (with reference
the window), and width and height. In this case picks up the width and height, which are the parameters of reshape (), ie, the data just received
because the resizing of the window.

Tuesday, March 13, 2007

Rosy Cheeks On A Baby

Previous

Vector space

A vector space (or linear space) is the basic object of study in the branch of mathematical called linear algebra. The operations we can make between them are the vector sum and scalar multiplication, dot product, vector product and scalar triple preduce with some natural constraints such as closure of these operations, the association of these and the combination of these operations, following, we arrive at the description of a mathematical structure called space vector.


Given a formal definition
body commutative scalar K (as the body of real numbers or body of complex numbers ), which call for:
0 (zero) to the null element.
1 (a) the unit element.
A set V equipped with an internal composition law (+) (vector sum), and a law External composition (·) (a scalar product) to the body K, is a vector space if and only if:
V has the structure of commutative group
, regarding the internal composition law (+ ), (vector sum).
Regarding its external composition law (·), (scalar product), is fulfilled

Vector field In mathematics a vector field is a construction of calculation vector which associates a vector each point the Euclidean space .
Vector fields are often used in physical
, for example, model the speed and direction of a moving fluid throughout space, or the intensity and direction of a certain strength , as the electromagnetic force or gravitational , they change point to point.
The rigorous mathematical treatment, the vector fields defined in
distinguishable varieties as sections the tangent bundle variety.







Ring Given a nonempty set A and two internal laws of composition, the ordered triple (A,,) has the structure of ring if and only if

a) is associative. Ie,: a, b, c A

b) has a neutral element in A. Ie / if

c) Every element of A is invertible in A for.
is, /

d) is commutative. Ie: a, b A

These 4 properties show that (A,) is an abelian group.

e) is associative. Ie,: a, b, c A (ab) c = a (bc)

This property shows that (A,) is a semigroup.

f) distributes twice over. Ie,,: a, b, c A
a (bc) = (ab) (ac) (bc) a = (ba) (ca)

short we can say that

(A,,) is a ring iff (A,) is an abelian group, (A,) is a semigroup and the second operation distributes over the first.




DEMONSTRATION OF ROTATION MATRIX AXLE







Monday, March 12, 2007

Buy Element Tech Decks



Previous Practice No.2
This is the archive of humanoid that moves according to the parameter is muevete function.

# include # include # include


# include # include void

pint (xAxis float, float ejey, ejez float, float r, char c) void
muevete (abd float, float abi, apd float, float api);

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


void display (void) {

glClear (GL_COLOR_BUFFER_BIT);
glColor3f (0.1, 0.1, 0.1);
glLoadIdentity ();
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);

glEnable (GL_DEPTH_TEST);
glPushMatrix ();
glLoadIdentity ();
muevete ( 8, -8.8, -8);
glPopMatrix ();
Sleep (1000);
surface (0,0,1, -15, 'r');
glutPostRedisplay ();
Sleep (1000);
glDisable (GL_DEPTH_TEST);
glPushMatrix ();
Sleep (1000);
muevete(8,-8,8,-8);
glPopMatrix();
glLoadIdentity();
pinta(0,0,1,-15,'r');
glutSwapBuffers();
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;
}
}

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

return 0;
}


void pinta(float ejex, float ejey, float ejez,float r,char c)
{
float x1,y1,z1,r1;
char c1;
x1=ejex;
y1=ejey;
z1=ejez;
r1=r;
c1=c;
glPushMatrix();
if (c1 == 'r')
glRotatef (r1, x1, Y1, z1);
else if (c1 == 't')
glTranslatef (x1, Y1, z1);

/ / glTranslatef cabeza
(0.0f, 2.5f, 0.0f);
glutWireCube (0.5);
glScalef (2.5,2.5,2.0);
glTranslatef (0.0f,-0.45f, 0.0f);
glutWireCube (0.5);
/ / tronco
glPushMatrix ();
glTranslatef (-0.1f,-0.55f, 0.0f);
glScalef (-. 3,1.2,1.0);
glutWireCube (0.5);
glPopMatrix ();
/ / glPushMatrix piernas
();
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);
glPopMatrix ();


glTranslatef (0.7f,-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 ();

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

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


glPopMatrix ();
/ / right arm
glPushMatrix ();
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.8f, 0.0f, 0.0f);
glutWireCube (0.5);
/ / left arm
glPopMatrix ();
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.8f, 0.0f, 0.0f);
glutWireCube (0.5);
glPopMatrix ();}



void muevete (brader float, float braizq, belongs to float, float pieizq)
{float
brazod, brazoi, pied , piei;

brazod = brader;
brazoi = braizq;
pied = owned;
piei = pieizq;

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

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

glPushMatrix ();
glPushMatrix ();
/ / left leg
glRotatef (PIEI, 0,0,1 )
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
glPushMatrix ();
glTranslatef (.3 f,-1.0f, 0.0f);
glScalef (1.6, .2,1.0)
glutWireCube (0.5);
glPopMatrix ();
glPopMatrix ();

/ / right leg
glRotatef (pied, 0,0,1);
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, 0,0,1);
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.8f, 0.0f, 0.0f);
glutWireCube (0.5);
/ / left arm
glPopMatrix ();
glRotatef (brazoi, 0,0,1);
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.8f, 0.0f, 0.0f);
glutWireCube (0.5);
glPopMatrix ();}


Tuesday, March 6, 2007

Leaf Green Cheats For Vba



Aide
Computer Graphics Laboratory

Questionnaire previous # 2
- Geometric Modeling -

1. What is a transformation geometric? What are the basic transformations and matrices?

transformations: a transformation T is a function to change a point or a vector v Q at another point P or another vector u: P = T (Q), u = T (v), any transformation should be applied point to point to all points of a scene.
transformations help us:
Manipulating objects in 3D space
Help to display and examine objects

affine Types:
- Translating
-
Rotation - Scaling
- Shearing
- Reflection

Translation: We move the origin and axes parallel. In two and three dimensions, where dx, dy, dz travel distances:





Rotation: In two dimensions, if we rotate the axes an angle (positive if it rotates counter-clockwise)

In three dimensions: we now have three different rotations on each of the coordinate axes (also considered positive if rotates anti-clockwise) rotation of Z is almost the same as before, but now we have to use a matrix (3x3)

For rotation about X, it is also practically the same as before, only the X axis was previously will now And, and that antesera Y, Z (also considered positive if rotates anti-clockwise)

If we rotate about Y, which in Rz was X will now be Z, and where we had And, now it to Z. So there queintercambiar also rows and columns in the matrix of rotation ...

rotation matrices are orthonormal. We can invert by transposition.
The rotation about any axis will need, in general, be performed as a composition of several transformations:
1. Spindle travel (and the objects to rotate) so that the axis passing through the origin
2. Decomposition of the rotation rotation simple compared to the three coordinate axes X, Y and Z
3. Reverse translation, making the reverse was done in (1)
uniform and nonuniform scaling: We vary the scale on the coordinate axes with the same or different scale factor for each axis (scale factors if the same or different)
Shearing
:
• Do not keep the corners, although the straight and parallel
• Less used in graphics
• In three dimensions is similar, although additional factors appear to us new

2. Type the commands that allow you to apply geometric transformations OpenGL, variants of these commands and describe its parameters.

Translation: void glTranslate (x, y, z) will allow us to move an object in space
Rotation: void glRotate (angle, x, y, z) will allow us to rotate an object
Scale: void glScale (x, y, z) will allow us to scale an object

Where: x, y, z are the coordinates of a point.

3. Describe what are the OpenGL GL_MODELVIEW and GL_PROJECTION matrices. What is the purpose? How can I switch between the two? What is the active matrix by default? What is the use the command glLoadIdentity ()?

GL_MODELVIEW: the array containing the transformations arising from the
modeling and position changes of the camera.
GL_PROJECTION: the array with the changes that made the projection of the scene
3 to 2 dimensions.

These two matrices are used to make a transformation operation. Is specified with the glMatrixMode (GLenum mode) that has as its subject one of the three constants listed. It behaves like a state, therefore, until you enter a new state all changes are made on the last matrix specified.
In resaphe function code () the previous chapter:
void reshape (int width, int height) {
glViewport (0, 0, width, height);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluPerspective (60.0, (GLfloat) height / (GLfloat) width, 1.0, 128.0);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
gluLookAt (0.0, 1.0, 3.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);}

used is noted glMatrixMode () twice, first with
GL_PROJECTION and the second with GL_MODELVIEW.
After the first call to glMatrixMode (), the matrix on which the transformations take place
is GL_PROJECTION, the first operation is to initialize the function matrix glLoadIdentity () to load the identity matrix and defines a perspective projection with gluPerspective function (). This function explained in the next chapter.
After the second call to glMatrixMode (), the matrix on which the transformations take place is GL_MODELVIEW
, also, the first operation is to initialize the function matrix glLoadIdentity () and then sets the camera position with gluLookAtAl OpenGL behave as a state machine, the following processing operations carried out in the code, which will be out resaphe function (), will be held on the last matrix specified, ie on GL_MODELVIEW.

4. What are the commands glPushMatrix () and glPopMatrix ()? Describe their use through an example in code.

glPushMatrix (); / / The function glPushMatrix () makes a copy of the upper die and puts it on the stack, so that the two above matrices are equal, the function call glPushMatrix () is doubled upper die. The following changes are made apply only to the upper die of the stack, leaving the former with the values \u200b\u200bit had at the time of the function call glPushMatrix ().
glPopMatrix (); The role glPopMatrix () removes the upper die, being in the top of the stack the matrix that was when the function call glPushMatrix ().

glColor4f (1.0,0.0,0.0,1.0);
dibujarCuadro (1.0);
glPushMatrix ();
glTranslatef (0.0, 2.0, 0.0);
dibujarCuadro (0.5);
glPopMatrix ();
glPushMatrix ();
glTranslatef (0.0, -2.0, 0.0);
dibujarCuadro (0.5);
glPopMatrix ();

5. What are the commands glBegin () and glEnd ()? Describe its use, its parameters and exemplify through a piece of code.

To create any geometric shape in OpenGL vertices must be defined between a pair of calls to glBegin () and glEnd (). A glBegin function can be passed an argument that determines what kind of geometric figure will be built. After the corners are defined by function calls glVertex. Here is an example which defines the polygon.
glBegin (GL_POLYGON)
glVertex2f (0.0, 0.0);
glVertex2f (0.0, 3.0);
glVertex2f (3.0, 3.0);
glVertex2f (4.0, 1.5);
glVertex2f (3.0, 0.0);
glEnd () ;
void glBegin (GLenum mode); marks the beginning of a list of vertices describing a geometric primitive. The mode parameter indicates the type of primitive (GL_POINTS individual points. GL_LINES Each pair of vertices form a single segment.
GL_POLYGON simple polygon vertices connected. GL_TRIANGLES Each triplet determines a triangle. GL_QUADS Each quadruple determines a square. GL_LINE_STRIP Series of connected line segments. GL_LINE_LOOP Series of connected line segments and closed. GL_TRIANGLE_STRIP chains connected triangles. GL_TRIANGLE_FAN polystrip chains (the center is the first
corner). Quadrilaterals GL_QUAD_STRIP chains.)
void glEnd (void); marks the end of a list of vertices.

6. What is geometric modeling? Describe the types of geometric modeling in the world.

Geometric Modeling: is a technique that can generate different types of objects.
models can be classified into Alambrito, surfaces (flat or curved) and solids. Curved surface models are divided into parametric (analytical and synthetic) and nonparametric (explicit and implicit). The most important solid models: semi-space, border, CSG, scanning, enumeration space, etc.
Among the unconventional models include: fractals, grammars, systems of particles, the blobs, and those based on physical properties.

7. Build code to draw a cube (check in the theory class), and from this hierarchical model of the humanoid figure and write the program that draws it. The measures are on your own.


#include
#include

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

void cube(void){
GLfloat vertices[][]={{0.55,0.5,0.5},
{-0.5,-0.5,0.5},
{0.5,-0.5,0.5},
{-0.5,0.5,0.5},
{-0.5,-0,5,-0.5},
{-0.5,0.5,-0.5},
{0.5,0.5,-0.5}};
glBegin(GL_QUADS);
glVertex3fv(vertices[0]);
glVertex3fv(vertices[1]);
glVertex3fv(vertices[2]);
glVertex3fv(vertices[3]);
glEnd();
glBegin(GL_QUADS);
glVertex3fv(vertices[4]);
glVertex3fv(vertices[5]);
glVertex3fv(vertices[6]);
glVertex3fv(vertices[7]);
glEnd();
glBegin(GL_QUADS);
glVertex3fv(vertices[1]);
glVertex3fv(vertices[6]);
glVertex3fv(vertices[5]);
glVertex3fv(vertices[2]);
glEnd();
glBegin(GL_QUADS);
glVertex3fv(vertices[0]);
glVertex3fv(vertices[3]);
glVertex3fv(vertices[4]);
glVertex3fv(vertices[7]);
glEnd();
glBegin(GL_QUADS);
glVertex3fv(vertices[0]);
glVertex3fv(vertices[7]);
glVertex3fv(vertices[6]);
glVertex3fv(vertices[1]);
glEnd();
glBegin(GL_QUADS);
glVertex3fv(vertices[2]);
glVertex3fv(vertices[5]);
glVertex3fv(vertices[4]);
glVertex3fv(vertices[3]);
glEnd();
}
void display(void)
{

glPushMatrix();
glTranslatef(0.0,1.25,0.0);
glPushMatrix();
glTranslatef(0.25,1.5,0.0);
glScalef(1.5,0.5,0.5);
cube();
glPopMatrix();

glPushMatrix();
glTranslatef(0.25,2.0,0.0);
glScalef(1.0,2.0,0.5);
cube();
glPopMatrix();

glPushMatrix();
glTranslatef(-4.75,1.75,0.0);
glScalef (0.5,2.0,0.5);
cube ();
glPopMatrix ();
glPushMatrix ();
glTranslatef (1.5,0.0,0.0);
glScalef (2.0,1.5,0.5);
cube ();
glPopMatrix ();

glPushMatrix ();
glTranslatef (2.0,0.0,0.0);
glScalef (2.0,0.5,0.5);
cube ();
glPopMatrix ();
glPushMatrix ();
glTranslatef (- 1.5,0.0,0.0);
cube ();
glPopMatrix ();

glPushMatrix ();
glTranslatef (-2.0,0.0,0.0);
glScalef (2.0,1.5,0.5);
cube ();
glPopMatrix (); glPushMatrix
();
glTranslatef (-2.0,0.75,0.0);
glScalef (2.0,0.5,0.5);
cube ();
glPopMatrix ();
glPushMatrix ();
glTranslatef (0.0, -2.0,0.0);
cube ();
glPopMatrix ();

glPushMatrix ( );
glTranslatef (0.75, -2.5,0.0);
glScalef (2.0,3.0,0.5);
cube ();
glPopMatrix ();
glPushMatrix ();
glScalef (0.5,2.0,0.5);
cube ();
glPopMatrix ();
glPushMatrix ();
glTranslatef (12:25, -2.0,0.0);
glScalef (1.0,2.0,1.0);
cube ();
glPopMatrix ();
glPushMatrix ();
glTranslatef (0.5, -1.5,0.0);
glScalef (1.5,0.5,0.5);
cube();
glPopMatrix();
glPopMatrix();

}
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;
}
}*/
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE GLUT_RGBA)
glutInitWindowSize (500, 300);
glutInitWindowPosition (300.230);
glutCreateWindow (argv [0]);
init ();
glutDisplayFunc (display);
glutReshapeFunc (reshape);
glutKeyboardFunc (keyboard);
glutMainLoop ();
return 0;}


8. What are the commands glClearColor () and glClear ()? Describe its operation, its parameters and exemplify through a piece of code. Void

glClearColor (GLclampf network GLclampf green, blue GLclampf, GLclampf alpha) Enables
current background color, the model RGB representation. Each argument represents the amount of color indicated that he has the background color, and takes values \u200b\u200bin the interval [0, 1 . The default color is BLACK which is represented by the value: (0, 0, 0, 0).
void display (void) {

glClearColor (0.0,0.0,0.0,0.0);
/ / Background color: black
glClear (GL_COLOR_BUFFER_BIT);
/ / Boramos
screen glMatrixMode (GL_PROJECTION);
/ / Mode
projection glLoadIdentity ();
/ / Load the identity matrix
glOrtho (-1.0,1.0, -1.0,1.0, -1.0,1.0);
/ / orthographic projection, said hub within
glMatrixMode (GL_MODELVIEW);
/ /
Modeling Mode glBegin (GL_TRIANGLES)
/ / Draw a triangle
glColor3f (1.0,0.0,0.0);
/ / first vertex color: red
glVertex3f (0.0,0.8,0.0);
/ / coordinates of first vertex glColor3f
( 0.0,1.0,0.0);
/ / second vertex color: green
glVertex3f (-0.6, -0.2,0.0);
/ / Coordinates of the second vertex
glColor3f (0.0,0.0,1.0);
/ / Color third point: blue
glVertex3f (0.6, -0.2,0.0);
/ / Coordinates of the third vertex
glEnd ();
/ / Finish drawing
glFlush ();
/ / We force the drawn
sleep (10);
/ / Wait 10 seconds
exit (0);
/ / Exit the program}


void glClear (GLbitfield mask);
Clear the buffer specified by the parameter, initialized to the value it had assigned the previous state variable. Possible values \u200b\u200bof argument, that is possible buffers we have are the following:
GL_COLOR_BUFFER_BIT
Color Depth Buffer Buffer Buffer Accumulate GL_DEPTH_BUFFER_BIT
GL_ACCUM_BUFFER_BIT
GL_STENCIL_BUFFER_BIT

Stencil Buffer void display (void) {
glClear (GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT) glPushMatrix
();
glMultMatrixd (mModel)
glColor3f (1.0,1.0,0.0);
drawTurtle ();
glPopMatrix ();
displayTrace ();
glutSwapBuffers ();}

9. Describe the commands glutInit (), glutInitDisplayMode (), glutInitWindowSize (), glutInitWindowPosition (), glutCreateWindow (), glutDisplayFunc (), glutReshapeFunc (), glutKeyboardFunc () and glutMainLoop (). Describe your operation, use and settings. Void

glutInit (& argc, argv); that initializes the GLUT, and negotiates with the system to open windows. The parameters should be the same argc and argv unmodified main (). Glut means a series of parameters that can be passed by command line. Void

glutDisplayFunc ( void (* func) (void)) The function func () is called each time you have to redraw the window. Initializes the buffer of the screen, esn this case is the mode and type of screen colors (RGB / RGBA)


glutReshapeFunc void (void (* func) (int width, int height)) The function func (width , height)
is called each time the window is resized, and receive as parameters the new width and height.

glutInitDisplayMode. Initialize mode. In this case, we are activating the depth buffer (GLUT_DEPTH), double buffering (GLUT_DOUBLE) and rendering RGB (GLUT_RGBA).

glutInitWindowSize (Width, height). Initialize the size of the window.

glutInitWindowPosition (x, y). Initialize the position of the window on the desktop.

glutCreateWindow (char * title). Create the window. This function displays a window of defined size and position and the title you have placed.

glutKeyboardFun Void (void (* func) (unsigned char key, int x, int y)): Responsible for the interaction of events on the keyboard. manages the control of the keyboard, making a transition between ASCII and GLUT

glutMainLoop Void (), is the main loop of the display, is responsible for interacting with events. This function initializes the framework running GLUT, and processes operating system messages

10. What is a Callback Function in GLUT?

The implementation of this function waits for events to occur. Every time I attend an event and executes the registered function, responsible for responding to the event (callback function).