X,Y Characteristics of a circle

This is a discussion on X,Y Characteristics of a circle within the C++ Programming forums, part of the General Programming Boards category; hey, ok first off heres my prob, i want to plot a circle using a setpixel algorithm (it is important ...

  1. #1
    Registered User MicroFiend's Avatar
    Join Date
    Nov 2002
    Posts
    80

    Question X,Y Characteristics of a circle

    hey, ok first off heres my prob, i want to plot a circle using a setpixel algorithm (it is important that i use setpixel) but at present all i can get it doing is stuff like a diamond or a hexagon, ive got a few ideas of how it might work like by seperating it into 4 quadrants and use a decayed x,y value in each quaderant that is incrementing to the inverse of each other but that only gave me my diamond lol, erm so has any1 got any info maybee a web link or if u can post any code or any hints of how it might work
    You can stop change as easily as u can drink the sea with a fork

  2. #2
    ---
    Join Date
    May 2004
    Posts
    1,379
    This might be a stupid and obvious question to ask, but have you tried writing an algo using
    PI * radius squared?
    or whatever the formula is (its been a while since high school )

  3. #3
    Registered User MicroFiend's Avatar
    Join Date
    Nov 2002
    Posts
    80
    thanx for ur reply, hmm im interested im not sure what u meen, pr2 is the area of a circle, how could i apply this to plot each pixel into a circle.. i keep trying to visualize the movements of a circle and picturing the x,y values at each point but no good, maybee i should draw a circle in paint and note down the x,y data into a table and analyse it... heh
    You can stop change as easily as u can drink the sea with a fork

  4. #4
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,805
    Hmmmm im not good with math but maybe do something with the circumference of the circle and then the distance of the circle then some sort of function to traverse your starting point to 360 degrees (im sure this is wrong but hey made me think a little)
    Woop?

  5. #5
    Registered User MicroFiend's Avatar
    Join Date
    Nov 2002
    Posts
    80
    omg ive actualy found a use for my old maths books, "reading" i think this may hold the answer its saying that each point in a circle will share the idea x2 + y2 = 25
    You can stop change as easily as u can drink the sea with a fork

  6. #6
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,805
    I'd like to know how you did it if you find out keep me posted
    Woop?

  7. #7
    Registered User MicroFiend's Avatar
    Join Date
    Nov 2002
    Posts
    80
    hmm ok this is what i got so far, ive concluded that if radius is say 5 then , at any given point the sum of (x*x) + (y*y) must equal r*r (25) so the way i see it, y must be worked out by this equation:
    x=x+1
    y=25-(x*x)
    then i have to plot the xy characteristics of the................... aha wait i think i figured it
    *thinking as i post* i have to then root the y value before i can try and plot it right?
    il post back if it works
    You can stop change as easily as u can drink the sea with a fork

  8. #8
    Registered User MicroFiend's Avatar
    Join Date
    Nov 2002
    Posts
    80
    it worked like a charm hehe, thanx for ur help
    You can stop change as easily as u can drink the sea with a fork

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. circle problem
    By gunghomiller in forum C++ Programming
    Replies: 10
    Last Post: 07-14-2007, 06:40 PM
  2. Drawing circle into a bitmap file
    By brokensail in forum C++ Programming
    Replies: 2
    Last Post: 10-30-2006, 12:26 AM
  3. Half of the circle
    By hdragon in forum Game Programming
    Replies: 14
    Last Post: 03-10-2006, 09:15 PM
  4. circle filling
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 06-08-2002, 05:37 AM
  5. point lies in circle?
    By cozman in forum Game Programming
    Replies: 3
    Last Post: 12-20-2001, 03:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21