Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Vector Arithmetic and Vector Drawings [4/10]

This program draws three half-lines, employing slightly different computations in each one.

In all the loops, line points are drawn by the function discp. The vector mv represents the difference between two line points.

In the first loop, the member function .mul from type vector2D calculates the position of a point on a line, by multiplying the vector mv.

In the second loop, the arithmetic operator * is used instead of the member function .mul to multiply the vector mv.

The third line is decorative. It is drawn with a blue-red color gradient.

Loading...