Tangent Circle to two straight lines with a given radius
Description
Origin: David Stedman in "HP-67/HP97 Users' Library Solutions - Geometry", pp. 46-51
This problem calculates the x and y coordinates of the center of a circle with a given radius. This circle being tangent to two given straight lines. In the more general case, there are four center solutions to this problem.
Input successively:
- The radius of the circle to be determined: Rf f A
- Each of the straight lines in the following manner:
Define the straight line by point and angle, the indicated position of the circle to be determined by reference to the straight line:
B : circle above the straight lines
C : circle below the straight lines
D : circle to the left of thestraight lines
E : circle to the right of the straight lines
These modifiers allow the shifting of the two initial straightlines, the calculation is then the one of the intersection of the straight lines.
Line 1 = [ X₁, Y₁, Θ₁ ]
Line 2 = [ X₂, Y₂, Θ₂ ]
Formulas used:
(Y₂-Y₁)cosΘ₁cosΘ₂ + X₁sinΘ₁cosΘ₂ - X₂sinΘ₂cosΘ₁
X = ——————————————————————————————————————————————
sin(Θ₁-Θ₂)
Y = Y₁+(x-x₁)tanΘ₁
Y = Y₂+(x-x₂)tanΘ₂

Instructions:
- Input the radius Rf f A
- For each straight line input its elements: Xd ENTER Yd ENTER Θd
- Position the center to be calculated by reference to the straight line: B , C , D or E
- Calculate the abscisse GSB .0
- Calculate the ordinate GSB .1
- For a new case go back to 1
Sample Problem:
Rf = 10
D1 = [ 10, 20, 30° ]
D2 = [ -20, 30, -60° ]
10 f A → 10.0000 (Radius Rf)
10 ENTER 20 ENTER 30 f B → (D1)
20 CHS ENTER 30 ENTER 60 CHS f B → (D2)
GSB .0 → -4.5096 (the abscisse X)
GSB .1 → 23.1699 (the ordiante Y)
The program being executed four times will yield:
| Position of | | |
| the circle | | |
| D1 | D2 | X | Y |
———————————————————————————————————————
Above | B | B | -4.5096 | 23.1699 |
Below | C | C | -11.8901 | -4.1506 |
Left | D | D | -21.8301 | 13.1699 |
Right | E | E | 5.4904 | 5.8494 |
Program Resources
Labels
Name |
Description |
|
Name |
Description |
|
A |
Rf (Radius of the circle) |
|
2 |
# |
|
B |
Circle above the straight lines |
|
3 |
# |
|
C |
Circle below the straight lines |
|
4 |
# |
|
D |
Circle to the left of the straight lines |
|
.0 |
Calculate the abscisse X |
|
E |
Circle to the right of the straight lines |
|
.1 |
Calculate the ordinate Y |
|
1 |
# |
|
|
|
|
Storage Registers
Name |
Description |
|
1 |
X₁ |
|
2 |
Y₁ |
|
3 |
θ₁ |
|
4 |
X₂ |
|
5 |
Y₂ |
|
6 |
θ₂ |
|
7 |
cos θ₁ |
|
8 |
Rf / cos θ₂ |
|
Flags
Number |
Description |
|
1 |
Toggle D₁ & D₂ |
|
Program
Line |
Display |
Key Sequence |
|
Line |
Display |
Key Sequence |
|
Line |
Display |
Key Sequence |
|
000 |
|
|
|
038 |
44 4 |
STO 4 |
|
076 |
45 3 |
RCL 3 |
|
001 |
42,21,11 |
f LBL A |
|
039 |
43, 5, 1 |
g CF 1 |
|
077 |
45 6 |
RCL 6 |
|
002 |
44 8 |
STO 8 |
|
040 |
43 32 |
g RTN |
|
078 |
30 |
− |
|
003 |
43 32 |
g RTN |
|
041 |
42,21,14 |
f LBL D |
|
079 |
23 |
SIN |
|
004 |
42,21,12 |
f LBL B |
|
042 |
43,30, 2 |
g TEST x<0 |
|
080 |
10 |
÷ |
|
005 |
45 8 |
RCL 8 |
|
043 |
22 13 |
GTO C |
|
081 |
44 7 |
STO 7 |
|
006 |
22 1 |
GTO 1 |
|
044 |
22 12 |
GTO B |
|
082 |
43 32 |
g RTN |
|
007 |
42,21,13 |
f LBL C |
|
045 |
42,21,15 |
f LBL E |
|
083 |
42,21, .1 |
f LBL . 1 |
|
008 |
45 8 |
RCL 8 |
|
046 |
43,30, 2 |
g TEST x<0 |
|
084 |
45 3 |
RCL 3 |
|
009 |
16 |
CHS |
|
047 |
22 12 |
GTO B |
|
085 |
43 16 |
g ABS |
|
010 |
42,21, 1 |
f LBL 1 |
|
048 |
22 13 |
GTO C |
|
086 |
9 |
9 |
|
011 |
34 |
x↔y |
|
049 |
43 32 |
g RTN |
|
087 |
0 |
0 |
|
012 |
43, 6, 1 |
g F? 1 |
|
050 |
42,21, .0 |
f LBL . 0 |
|
088 |
43,30, 7 |
g TEST x>y |
|
013 |
22 2 |
GTO 2 |
|
051 |
45 5 |
RCL 5 |
|
089 |
22 3 |
GTO 3 |
|
014 |
44 3 |
STO 3 |
|
052 |
45 2 |
RCL 2 |
|
090 |
45 7 |
RCL 7 |
|
015 |
34 |
x↔y |
|
053 |
30 |
− |
|
091 |
45 1 |
RCL 1 |
|
016 |
42 1 |
f → R |
|
054 |
45 3 |
RCL 3 |
|
092 |
30 |
− |
|
017 |
34 |
x↔y |
|
055 |
24 |
COS |
|
093 |
45 3 |
RCL 3 |
|
018 |
33 |
R⬇ |
|
056 |
44 7 |
STO 7 |
|
094 |
25 |
TAN |
|
019 |
40 |
+ |
|
057 |
20 |
× |
|
095 |
20 |
× |
|
020 |
44 2 |
STO 2 |
|
058 |
45 6 |
RCL 6 |
|
096 |
45 2 |
RCL 2 |
|
021 |
33 |
R⬇ |
|
059 |
24 |
COS |
|
097 |
22 4 |
GTO 4 |
|
022 |
34 |
x↔y |
|
060 |
44 8 |
STO 8 |
|
098 |
42,21, 3 |
f LBL 3 |
|
023 |
30 |
− |
|
061 |
20 |
× |
|
099 |
45 7 |
RCL 7 |
|
024 |
44 1 |
STO 1 |
|
062 |
45 1 |
RCL 1 |
|
100 |
45 4 |
RCL 4 |
|
025 |
43, 4, 1 |
g SF 1 |
|
063 |
45 8 |
RCL 8 |
|
101 |
30 |
− |
|
026 |
43 32 |
g RTN |
|
064 |
20 |
× |
|
102 |
45 6 |
RCL 6 |
|
027 |
42,21, 2 |
f LBL 2 |
|
065 |
45 3 |
RCL 3 |
|
103 |
25 |
TAN |
|
028 |
44 6 |
STO 6 |
|
066 |
23 |
SIN |
|
104 |
20 |
× |
|
029 |
34 |
x↔y |
|
067 |
20 |
× |
|
105 |
45 5 |
RCL 5 |
|
030 |
42 1 |
f → R |
|
068 |
40 |
+ |
|
106 |
42,21, 4 |
f LBL 4 |
|
031 |
34 |
x↔y |
|
069 |
45 4 |
RCL 4 |
|
107 |
40 |
+ |
|
032 |
33 |
R⬇ |
|
070 |
45 7 |
RCL 7 |
|
108 |
44 5 |
STO 5 |
|
033 |
40 |
+ |
|
071 |
20 |
× |
|
109 |
45 7 |
RCL 7 |
|
034 |
44 5 |
STO 5 |
|
072 |
45 6 |
RCL 6 |
|
110 |
44 4 |
STO 4 |
|
035 |
33 |
R⬇ |
|
073 |
23 |
SIN |
|
111 |
33 |
R⬇ |
|
036 |
34 |
x↔y |
|
074 |
20 |
× |
|
112 |
31 |
R/S |
|
037 |
30 |
− |
|
075 |
30 |
− |
|
113 |
43 32 |
g RTN |
|