Naum
2009-01-19 11:58:59
Im trying to make this script work out an angle by using values inputted (0 is unknown) and finding a length or angle (depending upon the boolean) for a triangle. Doesn't work?? I've tried lots of things, could someone help. Thanks!
Function FindAngle_SineRule(FindLength : Boolean; SinA, Lengtha, SinB, Lengthb : Extended) : Extended;
Var
Lz : Array [0..1] Of Variant;
Begin
If Not FindLength Then
Begin
If Lengtha > 0 Then
Begin
Lz[0] := Lengtha;
Lz[1] := Lengthb;
End Else
Begin
Lz[0] := Lengthb;
Lz[1] := Lengtha;
end;
If SinB > 0 Then
Result := (Lz[0] * (Sin(SinB)/Lz[1]))
Else
Result := (Lz[1] * (Sin(SinA)/Lz[0]));
End Else
If FindLength Then
Begin
If SinA > 0 Then
Begin
Lz[0] := SinA;
Lz[1] := SinB;
End Else
Lz[0] := SinB;
Lz[1] := SinA;
If Lengtha > 0 Then
Result := (Lz[0] * Lengtha/Sin(Lz[1]))
Else
Result := (Lz[1] * Lengthb/Sin(Lz[0]))
end;
Result := ArcSin(Result);
end;