Monday, July 30, 2012

Applications and Programming: Area of a Polygon Given the Coordinates of Vertices

Today's blog entry is how to find the area of an enclosed polygon, when you just know the vertices (corner points) of the polygon.

The area, with n vertices, is:

A ≈ 1/2 * | (x1 y0 - x0 y1) + (x2 y1 - x1 y2) + (x3 y2 - x2 y3) + ... + (x0 yn - xn y0) |

With | | representing the absolute value.

The sum ends with the last vertex of the set and the initial vertex. The calculation is a fairly simple one.

The following TI-84+ program handles this formula.

TI-84+ Program AREAVERT

: Input "X0:",X
: Input "Y0:",Y
: {X} → L1
: {Y} → L2
: 0 → T
: 1 → K
: Lbl Y
: 1+K→ K
: Input "NEXT X:", A
: Input "NEXT Y:", B
: augment(L1,{A})→ L1
: augment(L2,{B})→ L2
: T+A*L2(K-1)-B*L1(K-1)→ T
: Menu("MORE?","YES",Y,"NO",N)
: Lbl N
: T+X*L2(K)-Y*L1(K)→ T
: abs(T)/2→ T
: Disp "AREA=", T
: Pause

* L1 is accessed by pressing [2nd], [ 1 ]
* L2 is accessed by pressing [2nd], [ 2 ]
* The program works best if you start with one vertex and cycle either clockwise or counterclockwise, and stay in one direction all the way through.
* The program will ask you if there are more vertices. You do not have to repeat the initial vertex in is program.

Example 1:

Find the area of a square with the vertices (0,0), (0,5), (5,5), and (5,0). This is a square with a side length of 5 units.

Area: 25.

Example 2:

Find the area of a polygon with vertices (-3,0), (3,0), (4,11), (2,15), and (-4,12).

Area: 95.5

Until next time,

This blog is property of Edward Shore. © 2012

1 comment:

  1. Hi, I am trying to use the code, but in the INPUT X0, Y0 and Next X and Next Y I dont know the information to write. Help Me please


Review: Canon F-605 Scientific Calculator

Review:   Canon F-605 Scientific Calculator Company:   Canon Type:   Scientific Memory:   7 registers Battery:   LR54 x 1 Yea...