ABCDEF is a hexagon and O is an interior point.
Triangle ABO is equilateral with sides of length 4.
Triangle CDO is equilateral with sides of length 3.
Triangle EFO is equilateral with sides of length 7.
Given: BC, DE, and FA are integer lengths. Find them.
Sides bc, de and fa are respectively: 3, 6 and 7.
The angles in degree measure,
48.1896851042214 58.4118644947988 73.3984504009798
add up to the required 180.
The program uses what could be valid triangles between the given triangles and uses the law of cosines to find the total of the angles at O, which should total 180.
Dim crlf$, pi
Private Sub Form_Load()
Form1.Visible = True
crlf = Chr(13) + Chr(10)
Text1.Text = ""
pi = 4 * Atn(1)
For bc = 2 To 6
For de = 5 To 9
For fa = 4 To 10
a1 = angle(bc, 4, 3)
a2 = angle(de, 3, 7)
a3 = angle(fa, 4, 7)
diff = Abs(180 - a1 - a2 - a3)
If diff < 0.001 Then
Text1.Text = Text1.Text & bc & Str(de) & Str(fa) & crlf
Text1.Text = Text1.Text & a1 & Str(a2) & Str(a3) & " " & Str(a1 + a2 + a3) & crlf & crlf
Text1.Text = Text1.Text & crlf & " done"
Function angle(a, b, c)
cosa = (b * b + c * c - a * a) / (2 * b * c)
If cosa = 0 Then angle = 90: Exit Function
sina = Sqr(1 - cosa * cosa)
a1 = Atn(sina / cosa) * 180 / pi
If cosa < 0 Then a1 = a1 + 180
angle = a1
Posted by Charlie
on 2016-03-02 15:41:57