Wednesday, August 8, 2018

HP 35S: Intersection Point of a Quadrilateral


HP 35S: Intersection Point of a Quadrilateral

Introduction

Let A, B, C, and D be four vertices of a quadrilateral, with two lines:

Line AC connects points A and C.
Line BC connects points B and D.



Designate the following points as:

A:  (ax, ay)
B:  (bx, by)
C:  (cx, cy)
D:  (dx, dy)

The center point (px, py) can be found by the following formulas:

px = (IBD – IAC)/(SAC – SBD)
py = SAC * px + IAC

Where:

Slope:
SAC = (cy – ay) / (cx – ax)
SBD = (dy – by) / (dx – bx)

Intercept:
IAC = ay – SAC * ax
IBD = by – SBD * bx

You can see the derivation of these formulas here:  https://edspi31415.blogspot.com/2017/08/geometry-intersection-point-of.html

Program  (Pedro Daniel Leiva)

The following program calculates the point – developed by Pedro Daniel Leiva. I used the recall arithmetic available on the HP 35S to shorten the program.  Program listed here with permission. 

Variables Used:

R_A = ax
R_B = ay
R_C = bx
R_D = by
R_E = cx
R_F = cy
R_G = dx
R_H = dy
R_I = SAC
R_J = SBD
R_K = IAC
R_L = IBD
R_P = px
R_Y = py

Program:

I001 LBL I
I002 SF 10
I003 ENTER XA^YA  \\ EQN
I004 STO B
I005 x<>y
I006 STO A
I007 ENTER XB^YB  \\ EQN
I008 STO D
I009 x<>y
I010 STO C
I011 ENTER XC^YC \\ EQN
I012 STO F
I013 x<>y
I014 STO E
I015 ENTER XD^YD  \\ EQN
I016 STO H
I017 x<>y
I018 STO G
I019 CF 10
I020 RCL F
I021 RCL - B     \\ [RCL] [ - ] ( B )
I022 RCL E
I023 RCL - A  \\ [RCL] [ - ]  ( A ) 
I024 ÷
I025 STO I
I026 STO P  \\ advanced storage to calculate px to save steps
I027 RCL× A
I028 +/-
I029 RCL+ B
I030 STO K
I031 RCL H
I032 RCL - D
I033 RCL G
I034 RCL – C
I035 ÷
I036 STO J
I037 STO – P
I038 RCL × C
I039 +/-
I040 RCL + D
I041 STO L
I042 RCL – K
I043 RCL ÷ P
I044 STO P
I045 ENTER
I046 RCL × I
I047 RCL + K
I048 STO Y
I049 x<>y
I050 RTN

50 steps

Instructions:

At each prompt, enter the x point, press [ENTER], enter the y point, press [ R/S ].  The result shows py on the Y stack, and px on the X stack.

Example:

A:  (0, 8)
B:  (11, 12)
C:  (10, 4)
D:  (3, 5)

Results:

py = 6.2353
px = 4.4118

Eddie


 All original content copyright, © 2011-2018.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.  Please contact the author if you have questions.