Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Vector Arithmetic and Vector Drawings [2/10]

This program draws three circles with three loops, employing slightly different computations in each one.

In all three loops, the member function .rotdg from type vector2D rotates the vector v.

In the first loop, the member function .add from type point2D calculates the position of a point on a circle, by adding the vector vr to the circle's center point.

In the second loop, the arithmetic operator + is used instead of the member function .add to add a vector to a point.

In the last loop, the intermediate variable vr is eliminated by substitution.