Sunday, June 15, 2014

HP 15C: Area by Verticies With Curve Segments (with Jason Foose)

Introduction

On June 6, 2014, I posted a revised program for the HP 15C to find the area of a polygon by given the coordinates of each vertex. You can see this post here:

http://edspi31415.blogspot.com/2014/06/hp-15c-area-of-polygon-by-vertices.html

Jason Foose, County Surveyor at Mohave County Public Works in Kingman, AZ contributed an addendum to the program:  this allows you to enter curve segments and calculate the total area based on vertices and the curve segments.  Jason Foose can be found on Google+ and on Linkedin. 

General Instructions

The idea is to first enter all the coordinates of the vertices and calculate the area, then enter the curve segments and recalculate the area.  Start at one at one point and work in either the clockwise or the counterclockwise motion.  

Hence:

1.  Enter initial coordinates (x0, y0):  y0 ENTER x0 LBL A
2.  Enter additional coordinates:  y ENTER x LBL B
3.  Calculate area with coordinates:  LBL C
4.  Enter radius and central angle, in HMS format:   radius ENTER angle LBL D
5.  Calculate final area:  LBL E

When entering the radius and central angles, use positive values for radius for "outies", chord lines that add to the area.  Use negative values for "innies", or chords that cut across the area.   The 15C should be in Degrees mode. 

The Expanded Program

Here is the program in full.  Instructions in bold red are contributed by Jason Foose.  


Memory registers used:
R0 = area
R1 = x_i
R2 = y_i
R3 = x_i+1
R4 = y_i+1
R5 = Σ (x_i * y_i+1) // ( i=1...n and cycle back to 1)
R6 = Σ (x_i+1 * y_i)
R7 = x_1
R8 = y_1


Program:


001   42, 21, 11   LBL A  // enter initial vertex
002            0       0
003       44   5   STO 5

004       44   6   STO 6
005           33   R down // R↓
006       44   1   STO 1
007       44   7   STO 7
008           33   R down
009       44   2   STO 2
010       44   8   STO 8
011       43  32   RTN

012   42, 21, 12   LBL B // step 12 - add verticies
013       43   3   STO 3
014   45, 20,  2   RCL× 2
015   44, 40,  6   STO+ 6
016           33   R down
017       44   4   STO 4
018   45, 20,  1   RCL× 1
019   44, 40,  5   STO+ 5

020       45   4   RCL 4
021       44   2   STO 2
022       45   3   RCL 3
023       44   1   STO 1
024       43  32   RTN

025   42, 21, 13   LBL C // step 25 - calculate area with vertices
026       45   7   RCL 7
027   45, 20,  2   RCL× 2
028   44, 40,  6   STO+ 6
029       45   8   RCL 8
030   45, 20,  1   RCL× 1
031   44, 40,  5   STO+ 5
032       45,  5   RCL 5
033   45, 30,  6   RCL- 6
034       43  16   ABS
035            2   2
036           10   ÷
037       44   0  STO 0

038            4   4   // where Jason's steps start
039            3   3
040            5   5
041            6   6
042            0   0
043           10   divide ÷  // convert to acres
044        43 32   RTN
045   42, 21, 14   LBL D  // step 45 - segment routine
046       43   2   >HR  
047           36   ENTER
048       42   3   >RAD
049           34   X<>Y
050           23   SIN
051           30   -
052           48   DECIMAL POINT (.)
053            5   5
054           20   *
055           34   X<>Y
056       43  11   XSQ (x^2)
057           20   *
058   44, 40,  0   STO+0
059       43  32   RTN
060   42, 21, 15   LBL E  // step 60 - convert area to acres
061       45   0   RCL 0
062            4   4
063            3   3
064            5   5
065            6   6
066            0   0
067           10   DIVIDE ÷
068       43  32   RTN
Example (Updated 6/29/2014)
 
See the diagram below.  The steps are included with the diagram.  We are going to start at the point (100,100) and go counterclockwise.  The diagram and example has been provided by Jason Foose.


 
Calculate the area with the segments:

Keystrokes:

Starting at Point (100, 100)

Coordinates:
100 ENTER 100 LBL A
100 ENTER 400 LBL B
200 ENTER 500 LBL B
300 ENTER 500 LBL B
300 ENTER 225 LBL B
425 ENTER 100 LBL B
LBL C   \\ Area:  1.9011 acres

Add segments:
100 ENTER 90 LBL D \\ "outie"  angle = 90
125 ENTER 90 CHS LBL D  \\ "innie" angle = -90
LBL E   \\ Area:  1.8643 acres

Special thanks to Jason Foose for the great addendum to the area by vertices program.  

Eddie


Fun with the HP 30b

Fun with the HP 30 b Introduction The following programs are for the HP 30b Business Professional. Did you know that the 30b...