473,509 Members | 7,333 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

why is the circle not completed !!

106 New Member
i'm writing a c code to implement a circle using Midpoint algorithm ..but when i run the program i just see half the circle ( only one quadrant ) where is the rest ?????????

void MidpointCircle ( int radius, int color )
{
int x, y;
float d;


x = 0;
y = radius;
d = 5.0 / 4 - radius;
CirclePoints ( x, y, color );

while ( y > x ) {
if ( d < 0 ) {
d += x * 2.0 + 3;
x ++;
}
else {
d += (x - y) * 2.0 + 5;
x ++;
y --;
}
CirclePoints ( x, y, color );
}
}


void CirclePoints (float x, float y, int color)
{
putpixel ( x, y, color );
putpixel ( y, x, color );
putpixel ( y, -x, color );
putpixel ( x, -y, color );
putpixel ( -x, -y, color );
putpixel ( -y, -x, color );
putpixel ( -y, x, color );
putpixel ( -x, y, color );
}
Oct 27 '06 #1
2 1204
RADAR
21 New Member
I hope you have declared the functions you have written the following
CirclePoints ( x, y, color );
putpixel ( x, y, color );
don't have any declarations.
Oct 28 '06 #2
jessy
106 New Member
Of cOurse I have ......and of course that's not the problem.......
Oct 28 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2150
by: Talon | last post by:
Hi all, I am new to Tk, so please bear with me. I need someone better at math than me to help me figure this out. I am drawing multiple arcs on the same circle. All arcs start at 90 and have...
8
3367
by: Stub | last post by:
In statement: Circle c1=c2; Is the assignment operator= of Circle called? In statement Circle c1(c2); Is the copy constructor called?
1
7016
by: rdeaton | last post by:
I need to design and code a Java program that calculates and prints the (D) diameter, the (C) circumference, or the (A) area of a circle, given the radius. The program inputs two data items: the...
0
1931
by: Chua Wen Ching | last post by:
Hi.. just wonder i draw a circle in the picturebox1 1) and i want to store the circle in memory (only circle) when i store into bmp... i want to see the circle with transparent...
14
3577
by: Pythor | last post by:
I wrote the following code for a personal project. I need a function that will plot a filled circle in a two dimensional array. I found Bresenham's algorithm, and produced this code. Please tell...
0
3784
by: Carl Gilbert | last post by:
Hi I am trying to plot a series of shapes in a circular fashion. All shapes are evenly spaced with lines going between each shape. At present, all shapes are the same size so I can easily plot...
9
5503
by: saraaana | last post by:
Given the center and a point on the circle, you can use this formula to find the radius of the circle. Write a program that prompts the user to enter the center and a point on the circle. The program...
7
3221
by: heterodon7 | last post by:
hello, can anyone give me a clue or simple code on task: for example we have in 2D an equation fo circle: (x - 3)^2 + (y - 4)^2 = 25. now the program must return for example a 40 pairs of...
14
14488
by: DeadSilent | last post by:
I have this code and for some reason I keep getting an error where it says "exporting non-public type through public api ".. I'm not sure why this keeps happening but it does so for getCircleInfo /...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7416
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7073
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5062
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4732
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3207
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
779
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
443
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.