Thread: Over lapping circles

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    733
    Quote Originally Posted by C_ntua View Post
    Are you allowed to use common APIs or libraries? For example make a full screen program that draws the circles as red in white background, capture a screenshot (from code), save screenshot in a bitmap and count the red pixels and you are done.
    Isn't it obvious that it's a contest? You are usually limited to standard input/output and pure single-threaded computations.

    There are three approaches:
    1. Analytical - requires advanced math.
    2. Numerical - requires less math, but not as accurate.
    3. Per pixel checking - simple to implement, but extremely inefficient. In this case it would require 100 * 1000 * 100 * 1000 bits (precision to 3 decimal places), which is over one GB of memory.

    The approach 2 would since be preffered, through it requires basic knowledge of constructive solid geometry (limited to 2D in this case). All you need is to divide each circle into a sensible number of segments and implement sum operation. Having that, you need to compute the area of the constructed figures (note: there can be more than one). Both operations can be googled.
    Last edited by kmdv; 05-03-2013 at 07:53 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Circles and Computers
    By G4B3 in forum Tech Board
    Replies: 4
    Last Post: 11-29-2008, 09:23 AM
  2. Circles Anyone?
    By Nightsky in forum C Programming
    Replies: 5
    Last Post: 09-03-2006, 08:27 PM
  3. Firefox circles
    By Salem in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-20-2006, 09:49 AM
  4. Circles
    By Unregistered in forum Game Programming
    Replies: 0
    Last Post: 07-02-2002, 01:00 PM
  5. Drawing circles
    By chomper in forum Windows Programming
    Replies: 3
    Last Post: 05-07-2002, 12:37 PM