Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

How to Draw N-sided Regular Polygons [2/11]

2. Drawing a Regular Triangle

The provided program draws the simplest regular polygon: a triangle.
[Run the program by clicking the 'Run' button]

Most parts of the provided source code are not necessary for just drawing a triangle. Those parts were added as a visual assistance for this tutorial.

The Top Vertice

In this section of the program, a point named p1 is created. This point is the top vertice od the drawn triangle. The position of the point p1 is calculated in the program by expression center + v, which adds the green vector v to the center point. The point p1 is then visualized in the olive color.
[Run the program by clicking the 'Run' button]

[Click on the 'Next' button (on the page top) to read the next page, or press the F4 key]

Loading...