HP 32SII: area of a polygon by coordinates - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: HP 32SII: area of a polygon by coordinates (/thread-2750.html) HP 32SII: area of a polygon by coordinates - Carlos CM (Mexico) - 12-29-2014 09:19 PM Program to calculate the area of a polygon by coordinates Code: ```[LBL] [A] [CLVARS] [INPUT] [N] [1] [E] [3] [+/-] [*] [1] [+] [STO] [I] [LBL] [B] [INPUT] [X] [INPUT] [Y] [Rv] [+] [Rv] [-] [X<>Y] [Rv] [*] [2] [/] [STO][-][A] [RCL][Y] [RCL][X] [ISG][I] [GTO][B] [VIEW][A] [RTN]``` REGISTERS USED: A: area of the polygon N: total of points to enter X: xi Y: yi LABELS USED: A (20 bytes), B (28.5 bytes) NOTES: X<>Y is SWAP Rv is ROLL DOWN INSTRUCTIONS: 1. The polygon must be in the 1st Cuadrant of Cartesian System 2. Must begin/end with P1(0,0) coordinate 3. The order to enter the coordinates is clockwise to normal figures and counter clockwise if the figure has a HOLE. 4. Enter in order the coordinates, P1, P2...Pn-1,P1 in this way: [X coordinate] [R/S] [Y coordinate] [R/S] 6. At the end of the last point, P1(0,0) the program display the desired area. EXAMPLE 1. For example, in a square (3x3=9 squared units): [XEQ] [A] N? ***Total of points to enter [5] [R/S] *** In this case 5 points [0] [R/S] [0] [R/S] *** P1(0,0) [0] [R/S] [3] [R/S] *** P2(0,3) [3] [R/S] [3] [R/S] *** P3(3,3) [3] [R/S] [0] [R/S] *** P4(3,0) [0] [R/S] [0] [R/S] *** P1(0,0) A=9 ***AREA OF THE POLYGON EXAMPLE 2. Example with a hole at center of the last square: [XEQ][A] N? ***Total of points to enter [1][1] [R/S] *** In this case 11 points [0] [R/S] [0] [R/S] *** P1 (0,0) (Begin with 0,0) [0] [R/S] [3] [R/S] *** P2 (0,3) [3] [R/S] [3] [R/S] *** P3 (3,3) [3] [R/S] [0] [R/S] *** P4 (3,0) [0] [R/S] [0] [R/S] *** P5 (0,0) (Close the polygon) [1] [R/S] [1] [R/S] *** P6 (1,1) (here the order of the points in counter clockwise) [2] [R/S] [1] [R/S] *** P7 (2,1) [2] [R/S] [2] [R/S] *** P8 (2,2) [1] [R/S] [2] [R/S] *** P9 (1,2) [1] [R/S] [1] [R/S] *** P10(1,1) (close the polygon that generate the hole) [0] [R/S] []0 [R/S] *** P11(0,0) (end with 0,0) A=8 ***AREA OF THE POLYGON RESULT=8 squared units Thanks for your aditional comments.