HP 12C: area of a polygon by coordinates
|
12-29-2014, 08:38 PM
(This post was last modified: 12-29-2014 09:40 PM by Carlos CM (Mexico).)
Post: #1
|
|||
|
|||
HP 12C: area of a polygon by coordinates
Program to calculate the area of a polygon by coordinates
[f] [PRGM] [f] [P/R] [f] [PRGM] Code: [STO] [2] [f] [P/R] REGISTERS USED: R0: area of the polygon R1: xi R2: yi 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. Before to enter the coordinates, you must be press [f][PRGM] and [f] [REGS] to begin in the 1st line of the program and clean all registers, including the STACK (X,Y,Z,T) 5. Enter in order the coordinates, P1, P2...Pn-1,P1 in this way: [X coordinate] [ENTER] [Y coordinate] [R/S] 6. At the end of the last point, P1(0,0) Press [RCL] [0] to obtain the desired area. EXAMPLE 1. For example, in a square (3x3=9 squared units): [f][PRGM] [f] [REGS] [0] [ENTER] [0] [R/S] *** P1(0,0) [0] [ENTER] [3] [R/S] *** P2(0,3) [3] [ENTER] [3] [R/S] *** P3(3,3) [3] [ENTER] [0] [R/S] *** P4(3,0) [0] [ENTER] [0] [R/S] *** P1(0,0) [RCL] [0] RESULT = 9 EXAMPLE 2. Example with a hole at center of the last square: [f][PRGM] [f] [REGS] [0] [ENTER] [0] [R/S] *** P1 (0,0) (Begin with 0,0) [0] [ENTER] [3] [R/S] *** P2 (0,3) [3] [ENTER] [3] [R/S] *** P3 (3,3) [3] [ENTER] [0] [R/S] *** P4 (3,0) [0] [ENTER] [0] [R/S] *** P5 (0,0) (Close the polygon) [1] [ENTER] [1] [R/S] *** P6 (1,1) (here the order of the points in counter clockwise) [2] [ENTER] [1] [R/S] *** P7 (2,1) [2] [ENTER] [2] [R/S] *** P8 (2,2) [1] [ENTER] [2] [R/S] *** P9 (1,2) [1] [ENTER] [1] [R/S] *** P10(1,1) (close the polygon that generate the hole) [0] [ENTER] []0 [R/S] *** P11(0,0) (end with 0,0) [RCL] [0] RESULT=8 squared units *ADITIONAL COMMENT: You can enter the first point (0,0) press only [R/S], only at the begin Thanks for your aditional comments. Best Regards |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)