Thread: Area of a polygon

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    8

    Area of a polygon

    I have some x and y coordinates that make a convex polygon. I need to connect 2 of these coordinates such that they cut the polygon into 2 new polygons and the respective areas of these 2 polygons formed have the smallest difference possible ...

    I have managed to write an algorithm that calculates the whole area of the original polygon (without using the triangulation method) but I don't know if that helps and moreover I don't know how to proceed.

    Does anyone have any idea what's the next step or what's the algorithm I should use?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Well if you can already calculate the area of one polygon, how hard can it be just to call the same function twice (with the two sub-polygons) and compare the answers.

    My idea is you draw say a 5-sided polygon on paper, and figure out how you incrementally start at point 1, then pick points 2,3,4,5 as potential target points for the split, and see what shapes you come up with.

    The rest is rinse and repeat.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Area of a Polygon with Arcs
    By johnggold in forum C Programming
    Replies: 6
    Last Post: 10-20-2010, 12:54 AM
  2. polygon area
    By totalfreeloader in forum C++ Programming
    Replies: 4
    Last Post: 11-25-2003, 09:38 AM
  3. Polygon Area and Centroid :(
    By Moni in forum C++ Programming
    Replies: 7
    Last Post: 06-01-2003, 12:39 PM
  4. Polygon
    By Mr Ed in forum C++ Programming
    Replies: 3
    Last Post: 09-06-2001, 01:35 PM
  5. Polygon
    By cheeckyMeecky in forum C++ Programming
    Replies: 3
    Last Post: 09-06-2001, 04:07 AM