WCSLIB 8.2.2
Loading...
Searching...
No Matches
Macros | Functions
wcstrig.h File Reference
#include <math.h>
#include "wcsconfig.h"

Go to the source code of this file.

Macros

#define WCSTRIG_TOL   1e-10
 Domain tolerance for asin() and acos() functions.
 

Functions

double cosd (double angle)
 Cosine of an angle in degrees.
 
double sind (double angle)
 Sine of an angle in degrees.
 
void sincosd (double angle, double *sin, double *cos)
 Sine and cosine of an angle in degrees.
 
double tand (double angle)
 Tangent of an angle in degrees.
 
double acosd (double x)
 Inverse cosine, returning angle in degrees.
 
double asind (double y)
 Inverse sine, returning angle in degrees.
 
double atand (double s)
 Inverse tangent, returning angle in degrees.
 
double atan2d (double y, double x)
 Polar angle of $(x,y)$, in degrees.
 

Detailed Description

When dealing with celestial coordinate systems and spherical projections (some moreso than others) it is often desirable to use an angular measure that provides an exact representation of the latitude of the north or south pole. The WCSLIB routines use the following trigonometric functions that take or return angles in degrees:

These "trigd" routines are expected to handle angles that are a multiple of $90^\circ$ returning an exact result. Some C implementations provide these as part of a system library and in such cases it may (or may not!) be preferable to use them. WCSLIB provides wrappers on the standard trig functions based on radian measure, adding tests for multiples of $90^\circ$.

However, wcstrig.h also provides the choice of using preprocessor macro implementations of the trigd functions that don't test for multiples of $90^\circ$ (compile with -DWCSTRIG_MACRO). These are typically 20% faster but may lead to problems near the poles.

Macro Definition Documentation

◆ WCSTRIG_TOL

#define WCSTRIG_TOL   1e-10

Domain tolerance for asin() and acos() functions.

Domain tolerance for the asin() and acos() functions to allow for floating point rounding errors.

If $v$ lies in the range $1 < |v| < 1 + WCSTRIG\_TOL$ then it will be treated as $|v| == 1$.

Function Documentation

◆ cosd()

double cosd ( double  angle)

Cosine of an angle in degrees.

cosd() returns the cosine of an angle given in degrees.

Parameters
[in]angle[deg].
Returns
Cosine of the angle.

◆ sind()

double sind ( double  angle)

Sine of an angle in degrees.

sind() returns the sine of an angle given in degrees.

Parameters
[in]angle[deg].
Returns
Sine of the angle.

◆ sincosd()

void sincosd ( double  angle,
double *  sin,
double *  cos 
)

Sine and cosine of an angle in degrees.

sincosd() returns the sine and cosine of an angle given in degrees.

Parameters
[in]angle[deg].
[out]sinSine of the angle.
[out]cosCosine of the angle.
Returns

◆ tand()

double tand ( double  angle)

Tangent of an angle in degrees.

tand() returns the tangent of an angle given in degrees.

Parameters
[in]angle[deg].
Returns
Tangent of the angle.

◆ acosd()

double acosd ( double  x)

Inverse cosine, returning angle in degrees.

acosd() returns the inverse cosine in degrees.

Parameters
[in]xin the range [-1,1].
Returns
Inverse cosine of x [deg].

◆ asind()

double asind ( double  y)

Inverse sine, returning angle in degrees.

asind() returns the inverse sine in degrees.

Parameters
[in]yin the range [-1,1].
Returns
Inverse sine of y [deg].

◆ atand()

double atand ( double  s)

Inverse tangent, returning angle in degrees.

atand() returns the inverse tangent in degrees.

Parameters
[in]s
Returns
Inverse tangent of s [deg].

◆ atan2d()

double atan2d ( double  y,
double  x 
)

Polar angle of $(x,y)$, in degrees.

atan2d() returns the polar angle, $\beta$, in degrees, of polar coordinates $(\rho,\beta)$ corresponding to Cartesian coordinates $(x,y)$. It is equivalent to the $\arg(x,y)$ function of WCS Paper II, though with transposed arguments.

Parameters
[in]yCartesian $y$-coordinate.
[in]xCartesian $x$-coordinate.
Returns
Polar angle of $(x,y)$ [deg].