Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Thread: Programming Challenge 12 : Computational Geometry

  1. #1
    Join Date
    May 2008
    Location
    France
    Beans
    120
    Distro
    Kubuntu 8.04 Hardy Heron

    Programming Challenge 12 : Computational Geometry

    In a nutshell
    Find convex hulls of sets of points, areas and intersections.

    Complete description
    You are given two sets of points (in 2D). Let's call them the red and the blue points. You need to:
    • find the convex hull of each set (red hull, blue hull) and the hull of all the points (let's call it the green hull).
    • compute their areas
    • find the points contained in both the blue and the red hull
    • compute the area of their convex hull (the yellow hull)
    • compute the area of the intersection of the blue and the red hull


    See the attachments to have a better idea of what you're asked to do.

    Of course, you cannot use external tools to do the work for you.

    Input
    The sets (up to 5000 points) will be read from a file (input.dat). It's better if your code accepts a filename as a command line argument. The points are given as a list of (x, y) coordinates. The two sets (red then blue) are separated by a blank line. Here is an example :

    Code:
    0.3 5.5
    8.7 4.3
    6.0 7.4
    3.6 3.9
    2.8 0.7
    7.3 1.3
    
    8.5 5.6
    3.2 6.1
    10.6 0.6
    8.4 2.5
    2.3 2.3
    6.1 -2.5
    Output
    Output the areas directly on the screen or in a file 'output.dat', specifying which is which (red, blue, green, yellow, intersection).

    Example output (corresponds to the example input) :
    Code:
    Red: 36.39
    Blue: 45.95
    Green: 59.02
    Yellow: 19.46
    Intersection: 25.37648
    Judging
    The entries will be judged on several criteria:
    • accuracy of the areas
    • beauty and understandability of the code
    • aptitude to react correctly to strange input
    • efficiency of the algorithms


    Bonus points
    Bonus points will be awarded to people who provide graphical output of the hulls (you are allowed to use an external graphical library). Other suggestions : extend the concept in 3D (graphical output definitely needed. for slightly mad coders), turn your code into a quine (for totally insane programmers )

    Deadline
    Submit your code before May 29, 16:00 (GMT).
    If you submit a new version of a previously posted entry, please indicate in your first post that a new version is available.
    Attached Images Attached Images
    Last edited by Bichromat; May 23rd, 2008 at 08:03 PM. Reason: added some precisions
    À la chasse au boson intermédiaire

  2. #2
    Join Date
    Apr 2007
    Location
    Toronto
    Beans
    104
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: Programming Challenge 12 : Computational Geometry

    This is interesting and looks fun. I'm going to attempt this one using either C or C++ without the visual aspect. There is a standard algorithm, The Graham Scan Ronald Graham's 1972 paper proposed a convex hull construction algorithm that ran in O(n·lgn) time.

  3. #3
    Join Date
    Feb 2007
    Beans
    281

    Re: Programming Challenge 12 : Computational Geometry

    I have half a mind to do this... my project is going to force me to write most of the code required anyways... including the graphical portion.

  4. #4
    Join Date
    Jun 2006
    Beans
    943

    Re: Programming Challenge 12 : Computational Geometry

    I'll be entering this one as I now have the time. Woohoo!

  5. #5
    Join Date
    Apr 2007
    Location
    (X,Y,Z) = (0,0,0)
    Beans
    3,715

    Re: Programming Challenge 12 : Computational Geometry

    Hell: Geometry...!

    I'm absolutely lost in this.

  6. #6
    Join Date
    Apr 2008
    Location
    TX, USA
    Beans
    165
    Distro
    Ubuntu Development Release

    Re: Programming Challenge 12 : Computational Geometry

    Ugh.
    FireHOL: An amazing, powerful, linux server firewall that is easy to understand, configure, and use!

    Check it out if you want a secure Ubuntu Server: sudo apt-get install firehol

  7. #7
    Join Date
    Nov 2006
    Location
    Mumbai, India
    Beans
    186
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Programming Challenge 12 : Computational Geometry

    Quote Originally Posted by nvteighen View Post
    Hell: Geometry...!

    I'm absolutely lost in this.
    Me too. I have no clue what hulls are. :-\
    http://verminox.wordpress.com - Answers to Life, the Universe and Everything

  8. #8
    Join Date
    Jun 2006
    Beans
    943

    Re: Programming Challenge 12 : Computational Geometry


  9. #9
    Join Date
    May 2008
    Location
    France
    Beans
    120
    Distro
    Kubuntu 8.04 Hardy Heron

    Re: Programming Challenge 12 : Computational Geometry

    Wikipedia should give you all you need to know to find the convex hulls. You will also need to find how to compute areas, and a few other things. Don't worry too much about efficiency, I think all algorithms are able to deal with 5000 points in a reasonable time.

    If you're stuck somewhere, don't hesitate to ask for clues
    À la chasse au boson intermédiaire

  10. #10
    Join Date
    Jun 2006
    Beans
    943

    Re: Programming Challenge 12 : Computational Geometry

    I'm enjoying this one immensely - good challenge!

    I've still got to implement multiple sets, set merging and intersection area (of hulls).

    Here's a development snapshot:
    Last edited by Lster; August 28th, 2008 at 09:37 PM.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •