Gate name: ntuu.kpi@ukr.net
Requirements
Construct and render wire-frame model representing a Palm and 15 phalanges of your hand using 16 parallelepipeds with OpenGL API. Each finger has to be individually bent according to the parameters controlled by keyboard combinations (e.g. a/z, s/x, d/f, etc).
Input
Outline your hand on a sheet of graph paper. Make sure the start of the coordinate system corresponds to your wrist.* find the coordinates of every joint: P0i, P1i, P2i , i = 0..4;
* find the length of every phalanx: L0i, L1i, L2i , i = 0..4;
* find the axes of rotation of every phalanx: r0i, i = 0..4.
Implementation aspects
1) Implement a function that draws a wireframe parallelepiped using OpenGL API:
Implementation aspects
1) Implement a function that draws a wireframe parallelepiped using OpenGL API:
void DrawWireFrameParallelepiped(Vec3 start, float width, float height, float length); { Draw Twelve Lines } |
2) Using combinations of translations and rotations implement bending of every finger. Call glTranslate*() to establish the pivot point and glRotate*() to pivot the phalanx:
glTranslatef (P00); glRotatef (AngleBetween(r00, XAxisVector), ZAxisVector); glRotatef (angle0, XAxisVector); DrawWireFrameParallelepiped(...); |
To build a second segment, you need to move the local coordinate system to the next pivot point. Since the coordinate system has previously been rotated, the y-axis is already oriented along the length of the rotated phalanx. Therefore, translating along the y-axis moves the local coordinate system to the next pivot point. Once it's at that pivot point, you can use the same code to draw the second segment as used for the first one. This can be continued for an indefinite number of segments.
glTranslatef (0, L00, 0); glRotatef (angle0, XAxisVector); DrawWireFrameParallelepiped(...); |
Hint
Start with a simple case with one finger consisting of two phalanges.
Comments
Post a Comment