CS 4722 - Computer Graphics and Multimedia
Module #3, Assignment #1Exercise #1Modify the following MakePoly.html program so that it allows you to create polygons of any size by clicking into the canvas to determine the vertices for the polygon, and then clicking on the "End Polygon" button when you want to draw the shape for the previous button clicks. The color of each vertex of the polygon should be set by the value selected in the list of colors at the time each vertex is clicked upon. The Javascript code is MakePoly.js code. You will need to modify both programs to get this to work. Now modify your MakePoly application so that while you are clicking into the canvas you see the lines of the vertices that will create the polygon in whatever color is selected, and then when you click on the "End Polygon" button the shape of the polygon will be drawn. The color of each vertex of the polygon should be set by the value selected in the list of colors at the time each vertex is clicked upon. Exercise #2Modify your MakePoly application and turn it into a new application called MakeMesh. The MakeMesh application will create a mesh while you are clicking into the canvas instead of a simple polygon. You will see the Mesh lines between your vertice points in whatever color is selected, and then when you click on the "End Mesh" button the mesh shape and colored triangles are drawn. The color of each vertex of the polygon should be set by the value selected in the list of colors at the time each vertex is clicked upon, just as it was done in the previous MakePoly program. The Color of the Mesh lines should always be in Black, so take Black out of the Color picker, and add another color (of your choice) in its place. Brown is the new color in the above example, but you should choose something other than Brown. The following link takes you to a table of standard Web colors to choose from: Color Table Add a Comment block section to the top of your Javascript program in this assignment with the following information filled in using the following format: /*
* Course: CS 4722
* Section: .....
* Name: ......
* Professor: ......
* Assignment #: ......
*/
Be sure your program runs without error. DeliverablesTurn in the files:
Do this by uploading the file as an attachment to this Module's assignment drop box in D2L Brightspace. |