Vermiculus
Well-known member
I have been over my code several times, but I just cant seem to find the error. It is supposed to be a simple triangle calculator (actually a control for a much bigger project) that solves for any missing parts.
This is the SSS (Side-Side-Side) portion of it that does not work...
This is the SSS (Side-Side-Side) portion of it that does not work...
VB.NET:
Public Function SolveTriangle(ByVal t As Int16)
Dim AA, AB, AC, SA, SB, SC As Double
AA = Double.TryParse(txtAA.Text, True)
AB = Double.TryParse(txtAB.Text, True)
AC = Double.TryParse(txtAC.Text, True)
SA = Double.TryParse(txtSA.Text, True)
SB = Double.TryParse(txtSB.Text, True)
SC = Double.TryParse(txtSC.Text, True)
'Check which scenario is appliccable; t is and identifier (binary: ABCabc)
If t = 7 Then
AA = Acos((SB ^ 2 + SC ^ 2 - SA ^ 2) / (2 * SB * SC) * PI / 180) * 180 / PI
AB = Acos((SA ^ 2 + SC ^ 2 - SB ^ 2) / (2 * SA * SC) * PI / 180) * 180 / PI
AC = Acos((SA ^ 2 + SB ^ 2 - SC ^ 2) / (2 * SA * SB) * PI / 180) * 180 / PI
txtAA.Text = AA
txtAB.Text = AB
txtAC.Text = AC
MsgBox(AC)
MsgBox(AB)
MsgBox(AA)
End If
Return Nothing
End Function