Welcome to Phrogram Sign in | Join | Help
in Search


CalculateArea

Last post 04-07-2008, 9:35 AM by TomDad. 4 replies.
Sort Posts: Previous Next
  •  04-06-2008, 9:53 AM 6472

    CalculateArea

    Phrogram team,

    Attached (see below) is my entry for the Phrogram contest.  The inspiration was the desire to manage the woods that surrounds our home in Minnesota, USA.  I used GoogleEarth to get a satelite view of our property.  I printed this on a piece of paper.  I then drew crude rectangles and triangles and used GoogleEarth to give me some of the lengths of the sides and heights of these simple polygons. 

    Then, and here is the hard part - I asked my daughter to calculate the area of our woods using the data I had put on paper.  Well, a week later and after a lot of bugging... she finally did it.  All this time I thought to myself, "I could write a program to do this faster than she was taking to calculate the area of the woods!'

    CalculateArea is the result.

    Read the comments at the start of the program for more details.  I have included other sample image files that allow you to calculate the area of other objects, such as a circle (with a radius = 1, try to get as close to pi (3.1415...) as possible!), rooms in a house's floor plan, the state of Minnesota, and, of course, the original satelite map of our property.

    I think the coolest part, honestly, is that the mathmatics to calculate the area of an n-sided polygon is gnarly looking with determinants and summations: see

    http://mathworld.wolfram.com/PolygonArea.html

    But, due to the power of programming and programming languages like Phrogram - it really just boils down to a handful of lines of code in a simple For loop.  So, my math entry is less than five lines of "mathmatics" supported by a few hundred lines of "making it useful for a real-life need!" 

    Best of luck to all the contest entries!

    Regards,


    ChristmasWhistler
    http://www.christmaswhistler.com
    (\ _/)
    (- . -) This is bunneh. Copy and paste him to
    (")-(") your signature, so that he may gain popularity and eventually rule the world
  •  04-06-2008, 11:20 AM 6473 in reply to 6472

    Re: CalculateArea

    It is always fun to see what other people do for contest entries...I ran your program on my machine and got everything to work ok, but somehow the screensize is just a little too big??? I mean the console box that you enter the text in; it was hidden under the tool bars at the bottom of the screen...had a quick look at your code and think your program "auto sizes" for the display? I'm an XP user and have a 4:3 aspect on the monitor, just thought I'd let you know from a tester perspective....


    TomDad. Tom is my son...and I'm his Dad. So we are TomDad Software.
  •  04-06-2008, 3:46 PM 6484 in reply to 6473

    Re: CalculateArea

    I had the same problem as TomDad. I have a 1024 * 768 Screen Resolution 

  •  04-06-2008, 4:15 PM 6486 in reply to 6484

    Re: CalculateArea

    Attachment: CalculateArea.zip

    TomDad and srjek,

    Thank you very much for the quick feedback.  I was indeed creating and running the program on a system with high-resolution.  I have changed it to now simply maximize the screen size based upon the resolution you have set.  I then tested it at 1024x768 at which it seems to work fine.

    I have uploaded an updated version of CalculateArea.

    Regards,


    ChristmasWhistler
    http://www.christmaswhistler.com
    (\ _/)
    (- . -) This is bunneh. Copy and paste him to
    (")-(") your signature, so that he may gain popularity and eventually rule the world
  •  04-07-2008, 9:35 AM 6495 in reply to 6486

    Re: CalculateArea

    Yes...it seems to work perfectly on 1024x768...fills the screen nicely.
    TomDad. Tom is my son...and I'm his Dad. So we are TomDad Software.
View as RSS news feed in XML