answersLogoWhite

0

The C language does not provide any support for graphics as standard. C is designed to be as generic as possible, but graphics are a system-specific feature. To use graphics in C you need a third-party graphics library that supports your operating system and hardware, however generic libraries such as OpenGL are available. Nevertheless, it is not possible to draw curves, you can only approximate a curve using a series of short lines. The shorter the lines and the higher the resolution, the smoother the curve will appear.

Assuming you have access to an OpenGL library, you can draw an ellipse as follows:

void DrawEllipse(float cx, float cy, float rx, float ry, int num_segments)

{

const float pi = atan (1) * 4;

float theta = 2 * pi / float (num_segments);

float c = cosf (theta);

float s = sinf (theta);

float x = 1;

float y = 0;

float t;

glBegin (GL_LINE_LOOP);

for (int i = 0; i < num_segments; ++i)

{

glVertex2 f (x * rx + cx, y * ry + cy);

t = x;

x = c * x - s * y;

y = s * t + c * y;

}

glEnd();

}

User Avatar

Wiki User

9y ago

What else can I help you with?

Continue Learning about Math & Arithmetic

What does elipticall mean?

isn't it an arty word, like when you draw an ellipse-- so when you see/draw something with an ellipse you call it an elliptical drawing


How can one draw a perfect ellipse?

One can create a perfect ellipse using two pins on a piece of string and a pencil. Place the pins at opposite sides and then loop the string around them. Finally place the pencil in the loops and pull it around the pins to draw the ellipse.


Does a ellipse have a parallel lines?

An ellipse does not have parallel lines in the traditional sense, as it is a smooth, closed curve defined by its geometric properties. However, one can draw tangents to the ellipse at various points, and some of these tangents can be parallel to each other. In a broader mathematical context, while the ellipse itself does not possess parallel lines, the concept of parallelism can apply to lines related to the ellipse, such as its axes or tangents.


Does an ellipse have 4 straight lines?

An ellipse does not have four straight lines; it is a smooth, continuous curve defined as the set of points where the sum of the distances to two fixed points (the foci) is constant. While you can draw tangents that touch the ellipse at various points, the shape itself is not composed of straight lines. However, one can inscribe a rectangle within an ellipse that has four straight sides, but that is separate from the ellipse itself.


How can you draw an ellipse by arc of circle method when major axis 120mm and minor axis 80mm?

Circular segment

Related Questions

What is the independent variable for the ellipse you will draw?

It depends what ellipse you will draw :P


Two points a and b are 100 mm part a point c is 75mm from a and 60 mm from b draw an ellipse passing through a b and c?

To draw an ellipse passing through points A, B, and C, you can use the property that the sum of the distances from any point on the ellipse to the two foci (A and B) is constant. Since points A and B are 100 mm apart, they will be the foci of the ellipse. Point C being 75 mm from A and 60 mm from B means it lies on the ellipse. Using this information, you can construct the ellipse by finding points that satisfy the distance property.


What is the purpose of ellipse tool in Photoshop?

To draw ellipse or circle shapes and paths.


How do you draw Logic Gates in C language?

The C language is not a graphics language and you cannot draw logic gates using it. C is a programming language, and it is possible to use a graphics library to do so, but you did not specify which library you were using. Please restate the question.


What does elipticall mean?

isn't it an arty word, like when you draw an ellipse-- so when you see/draw something with an ellipse you call it an elliptical drawing


Write a java code to draw a circle inside in an ellipse?

write a program draw circle and ellipse by using oval methods in java


How can one draw a perfect ellipse?

One can create a perfect ellipse using two pins on a piece of string and a pencil. Place the pins at opposite sides and then loop the string around them. Finally place the pencil in the loops and pull it around the pins to draw the ellipse.


How to write a Program in C language to draw a house?

here you go nah...


How can you tell if the graph of an equation in the form ax2 plus by2 equals c is a circle or an ellipse?

If a = b then it is a circle; otherwise it is an ellipse.


How do you find the major axis in an ellipse?

The major axis is the line that joins the two foci (focuses) of the ellipse. If all you have is a picture of an ellipse and you don't know where the foci are, you can still find the major axis in a few seconds: It's the longest possible line that you can draw completely inside the ellipse, and it's the line straight across the ellipse between the two opposite "points of the egg".


Does a ellipse have a parallel lines?

An ellipse does not have parallel lines in the traditional sense, as it is a smooth, closed curve defined by its geometric properties. However, one can draw tangents to the ellipse at various points, and some of these tangents can be parallel to each other. In a broader mathematical context, while the ellipse itself does not possess parallel lines, the concept of parallelism can apply to lines related to the ellipse, such as its axes or tangents.


What is the standard equation for an ellipse centred at the origin?

Ax2 + By2 = C