Code covered by the BSD License
-
aaa(A, B, C)
AAA gives both solutions to the angle-angle-angle problem, in radians.
-
aaad(A, B, C)
AAAD gives both solutions to the angle-angle-angle problem, in degrees.
-
aas(A, B, a)
AAS gives both solutions to the angle-angle-side problem, in radians.
-
aasd(A, B, a)
AASD gives both solutions to the angle-angle-side problem, in degrees.
-
acos2(alpha, beta)
-
acos2d(alpha, beta)
-
asa(A, B, c)
ASA gives both solutions to the angle-side-angle problem, in radians.
-
asad(A, B, c)
ASAD gives both solutions to the angle-side-angle problem, in degrees.
-
sas(a, C, b)
SAS gives both solutions to the side-angle-side problem, in radians.
-
sasd(a, C, b)
SASD gives both solutions to the side-angle-side problem, in degrees.
-
ssa(a, b, A)
SSA gives both solutions to the side-side-angle problem, in radians.
-
ssad(a, b, A)
SSAD gives both solutions to the side-side-angle problem, in degrees.
-
sss(a, b, c)
SSS gives both solutions to the side-side-side problem, in radians.
-
sssd(a, b, c)
SSS gives both solutions to the side-side-side problem, in degrees.
-
View all files
from
Oblique Spherical Triangle toolbox
by Rody Oldenhuis
solves the general oblique spherical triangle
|
| sss(a, b, c)
|
function [A1, B1, C1, A2, B2, C2] = sss(a, b, c)
%SSS gives both solutions to the side-side-side problem, in radians.
%
% SSS(a, b, c) results in NaNs for those indices where the existence
% condition |pi - a| - |pi - b| <= |pi - c| <= |pi - a| + |pi -b| is not
% met.
%
% See also SSSD.
% Rody P.S. Oldenhuis
% Delft University of Technology
% Last edited: 23/Feb/2009
% first solution
A1 = acos2( (cos(a) - cos(b).*cos(c))./(sin(b).*sin(c)), a);
B1 = acos2( (cos(b) - cos(a).*cos(c))./(sin(a).*sin(c)), b);
C1 = acos2( (cos(c) - cos(a).*cos(b))./(sin(a).*sin(b)), c);
% second solution
A2 = 2*pi - A1;
B2 = 2*pi - B1;
C2 = 2*pi - C1;
% check constraints
indices = ( (abs(pi-a) - abs(pi-b)) <= abs(pi-c) <= (abs(pi-a) + abs(pi-b)) );
A1(indices) = NaN; B1(indices) = NaN; C1(indices) = NaN;
A2(indices) = NaN; B2(indices) = NaN; C2(indices) = NaN;
end
|
|
Contact us at files@mathworks.com