Results 1 to 11 of 11

Thread: Area of Polygon... accurately

  1. #1

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Area of Polygon... accurately

    How do you calculate the area of an irregular polygon? The algorithm should work for any concievable 2D polygon, irregular or not.

    I can't find any code on google.

    Thanks.
    I don't live here any more.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104
    I was just looking at planimeters and how they work on the web. I don't know an equation for finding the area of any polygon, and wasn't really thinking of doing such a thing, but one possibility would be to look at how planimeters work, and create your own function. Another would be to come up with a technique to chop your polygon into triangles. Once you have that, you can add the areas of the triangles.

  3. #3

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    Hmm, Planimeters were a real mind-f*** when I first saw one.
    How the hell does a wheel on a stick find the area of anything?

    Anyway, I have though of using a monte-carlo method but that would take too long to generate enough random numbers.

    The triangles plan would cause stack problems with very complex polygons. I'm looking at more than 10000 sides here




    Any more ideas anyone?
    I don't live here any more.

  4. #4
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    Not if you just put it in a loop instead of in a function. I'd bet the triangle would actually be the best option.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  5. #5

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    OK. but what triangles would I try to calculate?

    Where for example would they be on this polygon...



    ?
    I don't live here any more.

  6. #6

  7. #7

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    OK, that's pretty neat.

    But what about self-intersecting polygons? Do you reckon that algorithm could be adapted to work on them too?
    I don't live here any more.

  8. #8
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    what do you mean by self-intersecting? the lines crossing each other?

  9. #9
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573
    Originally posted by wossname
    OK, that's pretty neat.

    But what about self-intersecting polygons? Do you reckon that algorithm could be adapted to work on them too?
    A self-intersected polygon can be just regarded as a number of non-intersected polygons.

  10. #10
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573
    I haven't used this for polygons with thousands of sides so I don't know if it might be too slow for you. Maybe it's worth a try.

    http://www.vbforums.com/showthread.p...hreadid=233516

  11. #11

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    Thanks, I'll try it on Monday.
    I don't live here any more.

Posting Permissions

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



Click Here to Expand Forum to Full Width