Thread: Bresenham Circle Algorithm

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    403

    Bresenham Circle Algorithm

    Does anyone have experience with this algo.. i can't seem to get it working right (i converted the code i found on gamedev from pascal to c++)?

    Code:
    PHP Code:
        int d,mx,my;     - (2*radius);     mx 0;     my radius;     while(my != mx)     {         DrawPixel(surface,x+mx,y+my,color);         DrawPixel(surface,x+mx,y-my,color);         DrawPixel(surface,x-mx,y+my,color);         DrawPixel(surface,x-mx,y-my,color);         DrawPixel(surface,x+my,y+mx,color);         DrawPixel(surface,x+my,y-mx,color);         DrawPixel(surface,x-my,y+mx,color);         DrawPixel(surface,x-my,y-mx,color);         if(0)             += (4*mx)+6;             else         {             += 4*(mx-my) + 10;             my--;         }     } 
    edit: It is drawing a + sign rather than an O.. I'm trying to figure this one out but so far no luck.
    Last edited by cozman; 04-30-2002 at 03:50 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Implement of a Fast Time Series Evaluation Algorithm
    By BiGreat in forum C Programming
    Replies: 7
    Last Post: 12-04-2007, 02:30 AM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  4. point lies in circle?
    By cozman in forum Game Programming
    Replies: 3
    Last Post: 12-20-2001, 04:39 PM