Conical curves are very known geometric spaces based on section of cones. There are four conical curves:

All of them are very used in computer graphics and, in this post, I wish to present how to plot a circle.

The analytic equation of circles is:

We know

Comparing original equation with obtained equation, it's possible to verify that:

So, we have now the values for

Now, let's write some code in Scilab.

By first, a circle of radius

The result of this code is the following picture.

Take attention the limits of the circle are

And for finishing, a harder example, four circles with different centers and radius.

And the result is:

Take attention the parameters of center and radius of each circle and the obtained picture.

- circle;
- ellipse;
- hyperbole;
- parabola.

All of them are very used in computer graphics and, in this post, I wish to present how to plot a circle.

The analytic equation of circles is:

*where***(x - xc)² + (y - yc)² = r²****means the center of the circle and***(xc, yc)**is it radius.***r**We know

*, for any angle***cos²(a) + sin²(a) = 1***, thus multiplying both sides of equation by***a****we obtain***r²**.***(r cos(a))² + (r sin(a))² = r²**Comparing original equation with obtained equation, it's possible to verify that:

*x - xc = r cos (a)**x = r cos(a) + xc***y - yc = r sin(a)****y = r sin(a) + yc**So, we have now the values for

*and***x****depending only of the center of the circle, it radius and an angle***y**.***a***and***(xc, yc)****are given by the circle and***r**is an angle that means a dummy variable in range***a****.***[0, 2*%pi]*Now, let's write some code in Scilab.

By first, a circle of radius

*and center***r = 2****.***(xc, yc) = (0, 0)*//center of the circle xc = 0; yc = 0; //radius of the circle r = 2; //dummy variable for angle in range [0, 2*%pi] a = linspace(0, 2*%pi, 100); //x axis x = xc + r*cos(a); //y axis y = yc + r*sin(a); //plot the circle plot(x, y);

The result of this code is the following picture.

Take attention the limits of the circle are

*both for***(-2, 2)****and***x**axis, what means this circle is centered in***y***with radius***(0,0)****.***2*And for finishing, a harder example, four circles with different centers and radius.

///////////////////////////////////////// //center of the circle xc = 6; yc = 0; //radius of the circle r = 6; //dummy variable for angle in range [0, 2*%pi] a = linspace(0, 2*%pi, 100); //x axis x = xc + r*cos(a); //y axis y = yc + r*sin(a); //plot the circle plot(x, y); //////////////////////////////////////// //center of the circle xc = 6; yc = 0; //radius of the circle r = 2; //dummy variable for angle in range [0, 2*%pi] a = linspace(0, 2*%pi, 100); //x axis x = xc + r*cos(a); //y axis y = yc + r*sin(a); //plot the circle plot(x, y); //////////////////////////////////////// //center of the circle xc = 2; yc = 0; //radius of the circle r = 2; //dummy variable for angle in range [0, 2*%pi] a = linspace(0, 2*%pi, 100); //x axis x = xc + r*cos(a); //y axis y = yc + r*sin(a); //plot the circle plot(x, y); //////////////////////////////////////// //center of the circle xc = -3; yc = 3; //radius of the circle r = 3; //dummy variable for angle in range [0, 2*%pi] a = linspace(0, 2*%pi, 100); //x axis x = xc + r*cos(a); //y axis y = yc + r*sin(a); //plot the circle plot(x, y);

And the result is:

Take attention the parameters of center and radius of each circle and the obtained picture.