Exercices Homework 16. Design practice Ján Dugáček April 15, 2019 Ján Dugáček 16. Design practice Exercices Homework Table of Contents 1 Exercices Introduction Exercises 2 Homework Ján Dugáček 16. Design practice Exercices Homework Introduction Exercises Introduction 1 You are strongly advised to use the image.hpp class from study materials for this lesson 2 These exercises build on each other, so skipping some might be impractical Ján Dugáček 16. Design practice Exercices Homework Introduction Exercises Exercises 1 Create a class Canvas that has all the properties of Image, but has an extra draw() method allowing to draw objects inheriting from class Drawable 2 Create a Triangle class inheriting from Drawable that, draws a triangle with given coordinates of points on the image 3 Create a Parallelepiped class inheriting from Drawable that is composed of two triangles and uses them for drawing itself 4 Create a Polygon class in a similar way to the previous exercise 5 Create a Colour class and use it to set colours to objects with less code Somewhere during the process, change the way colours are handled to avoid code duplication. Solutions to the first two exercises can be pasted from: github.com/Dugy/simplest_image_library_possible Ján Dugáček 16. Design practice Exercices Homework Introduction Exercises Exercises #2 1 Create a Polygon3D class that can be projected into a Polygon (or drawn on the Canvas) and rotated in 3 axes 2 Create a Light class with a direction and modify the Polygon3D class appropriately so that the projection into the Polygon class changes the colour according to the illumination 3 Create a PolygonSet class that contains several Polygon objects and draws them in proper order and can be rotated 4 Create a Cube class that is a cube that can be drawn on the Canvas while using illumination somehow Somewhere in the process, create a Vector3D class holding three coordinates and supports dot product and cross product. Also, change the Canvas class to add a method to draw Polygon3D objects with illumination. Ján Dugáček 16. Design practice Exercices Homework Homework Change the class system from these exercises so that they would draw over a picture, but add the changes to the original contents of the picture with chosen opacity You have two weeks to do it Challenge for the Advanced: finish the regular exercises Ján Dugáček 16. Design practice