1.1-Introductie-Programmeren

Drawing multiple triangles - 1

Difficulty: Filled Filled Outlined

Create a drawTriangle(int x, int y) method that allows you to draw a triangle on a certain given location. The location is entered as a x,y coordinate which refers to the top-left corner of the (virtual) box around the triangle. Make sure that the triangle does not fill the entire screen, as we want to place multiple triangle in the screen.

Fill out the screen with triangles as shown in the example by invoking your newly created method several times.

Example

Example

You can use the image below to figure out how to calculate the triangle coordinates. Triangle draw help