[SOLVED] Computer Graphics -A13 – Smooth objects

30.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (1 vote)

The goal of the application contained in index.html, is to create 4 objects: a cube, a functional surface, a cylinder, and a sphere. As for assignment 10, the surface defined by equation y = sin(x) * cos(z) with -3 <= x <= 3 and -3 <= z <= 3. A fifth model, a pyramid, is already included in the application, just as an example to code the other primitives. Models are created in file models.js. In particular, the procedure addMesh()receives as parameters the vertex buffer (an array of six elements with the coordinates of the vertices and the direction of the associated normal vectors), the index buffer (an array of indices in the vertex buffer), and an RGB color (a three-elements array, with the value of the red, green and blue components of the color, each one in the 0-1 range). Primitives are encoded as indexed triangle lists.

 

All meshes, except the cube, should be generated by an algorithm (which requires at least two nested loops are required). Below you can see a picture of the expected result. The cube might instead be manually defined. Below you can see a picture of the 4 objects. For what concerns the surface, this tutorial:

 

https://www.khanacademy.org/math/multivariable-calculus/integrating-multivariablefunctions/flux-in-3d-articles/a/unit-normal-vector-of-a-surface

 

might help in finding the correct normal vector direction.

 

In the application, the mouse turns the view, and the slider at the bottom of the page can be used to change the objects being displayed. To help you in the creation of objects, it is possible to toggle a wireframe view pressing the space bar key. Space key also provides a view where the normal vector directions are visually represented by changing the colors of the surface.

 

 

 

 

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.