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
|
| acos2(alpha, beta)
|
function signedcos = acos2(alpha, beta)
%ACOS2 4-quadrant arccosine function, in radians.
%
% ACOS2(alpha, beta) computes the four-quadrant arccosine of the amgle
% [alpha]. For arguments |alpha| > 1, the result is NaN. The resulting
% angle is not uniquely determined by alpha, nor by the lengths or
% order of the sides of the triangle (as in ATAN2), so an additional
% argument [beta] is required. If [beta] < pi/2, the small angle
% (0 <= alpha <= pi/2) is returned. If [beta] > pi/2, the large angle
% (pi/2 < alpha < pi) is returned.
%
% See also acos2d.
% Rody P.S. Oldenhuis
% Delft University of Technology
% Last edited: 23/Feb/2009
% compute the hemisphere function
H = 2*( mod(beta, 2*pi) < pi ) - 1;
H(~isreal(phi)) = NaN;
% compute signed arc-cosine
signedcos = H .* acos(alpha);
% set complex results to NaN & take the modulus
signedcos(~isreal(signedcos)) = NaN;
signedcos = mod(signedcos, 2*pi);
% determine alphaues for zero-alphaued acos
ind1 = (signedcos == 0);
ind2 = (H < 0); ind3 = (H > 0);
indices1 = ((ind1 + ind2) == 2); indices2 = ((ind1 + ind3) == 2);
signedcos(indices1) = pi; signedcos(indices2) = 0;
end
|
|
Contact us at files@mathworks.com