QP  0.7-SNAPSHOT Control software for the ??SRT telescope
Angles Namespace Reference

Encapsulates a few angle conversion and formatting functions. More...

## Functions

double dms2r (int d, int m=0, double s=0.0, bool norm=false)
Convert an angle in d:m:s to radians. More...

double hms2r (int h, int m=0, double s=0)
Convert an angle in h:m:s to radians. More...

double r2d (double r)

double d2r (double d)

char * r2dms_b (char *, size_t, double angle, bool norm=false)
Convert an angle in radians into degrees and minutes. More...

char * r2hms_b (char *, size_t, double angle)
Convert an angle in radians into hours, minutes and seconds. More...

## Detailed Description

Encapsulates a few angle conversion and formatting functions.

## Function Documentation

 double Angles::dms2r ( int d, int m = `0`, double s = `0.0`, bool norm = `false` )

Convert an angle in d:m:s to radians.

Any sign on the degree is translated into an overall sign; thus

dms2r(-d, m, s) = -dms2r(d, m, s)

The minutes and seconds must be positive. The result is normalised into [0, 2pi) if `norm` is true.

 double Angles::hms2r ( int h, int m = `0`, double s = `0` )

Convert an angle in h:m:s to radians.

Any sign on the hour is translated into an overall sign; thus

hms2r(-h, m, s) = -hms2r(h, m, s)

The minutes and seconds must be positive. The result is always normalised into [0, 2pi).

 char * Angles::r2dms_b ( char * buf, size_t buflen, double angle, bool norm = `false` )

Convert an angle in radians into degrees and minutes.

There's no need for the accuracy of seconds, and it just clutters the output. If `norm` is true, then normalise the angle to be in [0,2pi); if not, then it may be negative.

Parameters
 buf a buffer into which the formatted angle is written buflen the size of the buffer, which must be large enough to accommodate a terminating null angle the angle norm true if the angle is to be normalised to [0,2pi)
Returns
the argument `buf`
 char * Angles::r2hms_b ( char * buf, size_t buflen, double angle )

Convert an angle in radians into hours, minutes and seconds.

Parameters
 buf a buffer into which the formatted angle is written buflen the size of the buffer, which must be large enough to accommodate a terminating null angle the angle
Returns
the argument `buf`