473,657 Members | 2,422 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Circle code

Can anyone give me an idea for drawing a circle without making use of
any floating point computations?
Thanks
Prasad

Jan 19 '06 #1
20 8118
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.programmin g 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.
Jan 19 '06 #2
"ch*******@yaho o.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.c om, 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/>

Jan 19 '06 #3
<ch*******@yaho o.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. ]
Jan 19 '06 #4
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.
Jan 19 '06 #5

<ch*******@yaho o.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.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
Jan 19 '06 #6
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");
}

Jan 19 '06 #7
Ico
ch*******@yahoo .com <ch*******@yaho o.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,s tdout),_<=c;++_ );
return((puts("" )&&c>y)?main(++ i,v):i^i);
}

--
:wq
^X^Cy^K^X^C^C^C ^C
Jan 19 '06 #8
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.
Jan 19 '06 #9

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

Jan 19 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2163
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 varying negative extents (different colors, goes all the way around. Represents a microbial genome). So now that my arcs are drawn, I would would like to draw a line, 25 pixels long that starts on the circle at the endpoint of each of the arcs,...
8
3373
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
7032
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 calculation needed, and the radius of the circle. The program should continue to ask the user for values until the user enters 'Q' as the calculation type. The program should echo print the input data and prompt appropriately. Label the output and format...
14
3591
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 me there's a better way to do this. import numpy def circle(field=None,radius,center=(0,0),value=255,): '''Returns a list of points within 'radius' distance from point 'center'.'''
38
5899
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. Someone please help! I am extremely new at this, as you can probably tell. What am I missing with the code below? #include "stdafx.h"
0
3788
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 the shapes evenly around a circle. As I add more shapes, I just increase the radius of the circle. I'm calculating the radius as follows: Dim m As Single = 20.39285714 Dim x As Single = Me.Flowchart1.Shapes.Count
9
5510
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 should then output the circle’s radius, diameter, circumference, and area. Your program must have at least the following functions: a. distance: This function takes as its parameters four numbers that represent two points in the plane and returns...
7
3228
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 points (x,y) which belong to this cirlce. and these points must be taken evenly form the circle because i need them for planning a trajectory in CNC.
10
6147
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, but I can't seem to figure out a way to make a circle. How do I make a circle on a form for this purpose, or can somebody give me an approach to accomplish my LED light attempt.
26
9426
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) def eyes(row, columns): win = GraphWin()
0
8323
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8739
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8613
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5638
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.