Can anyone give me an idea for drawing a circle without making use of
any floating point computations?
Thanks
Prasad 20 8102 ch*******@yahoo.com wrote: Can anyone give me an idea for drawing a circle without making use of any floating point computations? Thanks Prasad
Asking in comp.programming is possibly a better idea.
If you try to implement this in C, and have questions, you can always
come back here.
Cheers
Vladimir
--
My e-mail address is real, and I read it.
"ch*******@yahoo.com" wrote: Can anyone give me an idea for drawing a circle without making use of any floating point computations?
Sure. Take compass, insert pencil in pencil holder, place pointy
end on desired circle center, adjust compass for appropriate
radius, and spin it.
What was your question about the C language?
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
<ch*******@yahoo.com> wrote: Can anyone give me an idea for drawing a circle without making use of any floating point computations?
This is not a C language question.
Try asking in "comp.graphics.algorithms",
and/or search for "Bresenham’s Algorithm"
Roberto Waltman
[ Please reply to the group, ]
[ return address is invalid. ] ch*******@yahoo.com wrote: Can anyone give me an idea for drawing a circle without making use of any floating point computations?
Why? That seems a fairly useless thing to do.
Brian
--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
<ch*******@yahoo.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com... Can anyone give me an idea for drawing a circle without making use of any floating point computations? Thanks Prasad
Use a compass and a pencil.
I used no floating point calculations in
conceiving or presenting this idea.
-Mike
Vladimir S. Oka wrote: ch*******@yahoo.com wrote: Can anyone give me an idea for drawing a circle without making use of any floating point computations?
If you try to implement this in C, and have questions, you can always come back here.
this C program draws one circle without any fp:
#include <stdio.h>
int main(int argc, char **argv) {
printf("o\n");
} ch*******@yahoo.com <ch*******@yahoo.com> wrote: Can anyone give me an idea for drawing a circle without making use of any floating point computations? Thanks Prasad
Solution #1:
------------
#include <stdio.h>
int main(void)
{
putchar('O');
}
Solution #2:
------------
#include <stdio.h>
int main(int i, char **v)
{
int c='\n',_=-c,y;
for(y=i-c;putc((_*_<c*c-y*y)?0x2a:040,stdout),_<=c;++_);
return((puts("")&&c>y)?main(++i,v):i^i);
}
--
:wq
^X^Cy^K^X^C^C^C^C
tedu wrote: Vladimir S. Oka wrote: ch*******@yahoo.com wrote: Can anyone give me an idea for drawing a circle without making use of any floating point computations? If you try to implement this in C, and have questions, you can always come back here.
this C program draws one circle without any fp:
This program is not correct C: #include <stdio.h> int main(int argc, char **argv) { printf("o\n");
return 0;
}
Also I was not the OP.
Cheers
Vladimir
--
My e-mail address is real, and I read it.
Vladimir S. Oka wrote: ch*******@yahoo.com wrote: Can anyone give me an idea for drawing a circle without making use of any floating point computations?
Here's the LOGO / differential geometry solution:
repeat
go forward 1 unit
turn right 1 unit
Googmeister wrote: Vladimir S. Oka wrote: ch*******@yahoo.com wrote: Can anyone give me an idea for drawing a circle without making use of any floating point computations?
Here's the LOGO / differential geometry solution:
repeat go forward 1 unit turn right 1 unit
Apart from the original question not being asked by me at all, this is
now way off topic in comp.lang.c! Please trim your cross-posts to
comp.programing only.
Cheers
Vladimir
--
My e-mail address is real, and I read it.
Vladimir S. Oka wrote: tedu wrote: this C program draws one circle without any fp: This program is not correct C:
#include <stdio.h> int main(int argc, char **argv) { printf("o\n");
return 0;
}
i was hoping the on-topic requirements here were loose enough to
squeeze a little c99 into the group.
Also I was not the OP.
that post isn't visible to me, which is why i quoted the original
author as well.
tedu wrote: Vladimir S. Oka wrote: tedu wrote: this C program draws one circle without any fp: This program is not correct C:
#include <stdio.h> int main(int argc, char **argv) { printf("o\n"); return 0;
}
i was hoping the on-topic requirements here were loose enough to squeeze a little c99 into the group.
You're right about the C99. I guess I'll get used to it when there's
more compilers supporting it. I still think that it's good practice to
have something returned from a function that does have a return value. Also I was not the OP.
that post isn't visible to me, which is why i quoted the original author as well.
Sorry for jumping the gun.
Cheers
Vladimir
--
My e-mail address is real, and I read it.
<ch*******@yahoo.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com... Can anyone give me an idea for drawing a circle without making use of any floating point computations? Thanks Prasad
32 seconds with Google returned this excellent page: http://www.cs.unc.edu/~mcmillan/comp...e7/circle.html
Rod Pemberton
"Default User" <de***********@yahoo.com> writes: ch*******@yahoo.com wrote: Can anyone give me an idea for drawing a circle without making use of any floating point computations?
Why? That seems a fairly useless thing to do.
It could be very useful for a graphics program running on a system
where integer arithmetic is significantly faster than floating-point
arithmetic. (That doesn't make it topical here, of course.)
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
"Rod Pemberton" <do*******@bitbucket.cmm> writes: <ch*******@yahoo.com> wrote in message news:11**********************@g44g2000cwa.googleg roups.com... Can anyone give me an idea for drawing a circle without making use of any floating point computations? Thanks Prasad
32 seconds with Google returned this excellent page: http://www.cs.unc.edu/~mcmillan/comp...e7/circle.html
No wonder the OP couldn't find his homework solution using Google -
that page doesn't even use the word 'float'.
--
Chris.
On 2006-01-19, ch*******@yahoo.com wrote: Can anyone give me an idea for drawing a circle without making use of any floating point computations?
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
long radius = 100, point;
if ( argc > 1 ) radius = strtol(argv[1],NULL,10);
point = radius + 18;
printf( "%!\n%d %d %d 0 360 arc stroke showpage\n", point, point, radius);
return 0;
}
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
On 2006-01-19, Ico <us****@zevv.nl> wrote: ch*******@yahoo.com <ch*******@yahoo.com> wrote: Can anyone give me an idea for drawing a circle without making use of any floating point computations? Thanks Prasad
Solution #1: ------------
#include <stdio.h>
int main(void) { putchar('O'); }
You need to also output a newline, otherwise the output might never
show. In particular, my system's interactive shell prints a carriage
return and overwrites an unterminated last line of output with its
prompt. Other systems may not flush an unterminated last line to the
output device at all.
Jordan Abel <ra*******@gmail.com> wrote: #include <stdio.h>
int main(void) { putchar('O'); }
You need to also output a newline, otherwise the output might never show. In particular, my system's interactive shell prints a carriage return and overwrites an unterminated last line of output with its prompt. Other systems may not flush an unterminated last line to the output device at all.
Yes, you are completely right. I guess my suggesions are just bad
examples for the OP's homework.
--
:wq
^X^Cy^K^X^C^C^C^C
"tedu" <tu@zeitbombe.org> wrote: Vladimir S. Oka wrote: ch*******@yahoo.com wrote: Can anyone give me an idea for drawing a circle without making use of any floating point computations?
If you try to implement this in C, and have questions, you can always come back here.
this C program draws one circle without any fp:
#include <stdio.h> int main(int argc, char **argv) { printf("o\n"); }
Whether that draws a true circle or only an approximation is
implementation-dependent. On non-Western or oddly configured systems it
could even result in a completely different drawing.
Richard
Ico wrote: Jordan Abel <ra*******@gmail.com> wrote: #include <stdio.h>
int main(void) { putchar('O'); }
You need to also output a newline, otherwise the output might never show. In particular, my system's interactive shell prints a carriage return and overwrites an unterminated last line of output with its prompt. Other systems may not flush an unterminated last line to the output device at all.
Yes, you are completely right. I guess my suggesions are just bad examples for the OP's homework.
Well, my DS-6000 draws a perfect circle given the following:
void main(void)
{
int i = i++;
}
Unfortunately, the DS-6000b draws an ellipse. Should I submit a bug
report to the DS-6000b developers?
:-) :-) :-) :-)
--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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?
|
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...
|
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...
|
by: jdcrief |
last post by:
Complier: Visual C++ 2005 Express Edition
The program I wrote will compile and execute, but the output is always
the same, no matter what number is entered in for the radius of the
circle. ...
|
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...
|
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...
|
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...
|
by: Greg (codepug |
last post by:
I would like to simulate an LED light. Actually need a few of them
on my form to serve as indicator lights.
I can easily place rectangle labels to make this happen, and turn the
color On or OFF,...
|
by: OzzyB |
last post by:
This is another problem in the Zelle book.
def drawCircle(win, centre, radius, colour):
circle = Circle(radius)
circle.setFill(colour)
circle.setWidth(2)
circle.draw(win)
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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...
|
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...
| |