# class Angle

Library: Geo
Package: Geo

## Description

This class represents a geometric angle.

Based on code from the Angle (gov.nasa.worldwind.geom.Angle) class from the NASA World Wind Java source code released under the NOSA license.

Note: when comparing Angles for equality, the usual issues when comparing floating-point numbers should be considered.

## Constructors

### Angle

Angle();

Creates a zero Angle.

### Angle

Angle(
const Angle & angle
);

Creates an Angle by copying another one.

### Angle Angle(
double deg,
);

Creates an Angle.

## Destructor

### ~Angle

~Angle();

Destroys the Angle.

## Member Functions

### angularDistanceTo

Angle angularDistanceTo(
const Angle & angle
) const;

Returns the shortest distance between this and the given Angle.

### compassDirection

const std::string & compassDirection() const;

Returns the corresponding compass direction (N, NNW, NW, etc.) for the Angle.

### compassDirectionFromDegrees static const std::string & compassDirectionFromDegrees(
double degrees
);

Returns the corresponding compass direction (N, NNW, NW, etc.) for the given angle.

### cos

double cos() const;

Returns the cosine of this Angle.

### degrees double degrees() const;

Returns the Angle expressed in degrees.

### fromDegrees  static Angle fromDegrees(
double deg
);

Creates an Angle from a number of degrees.

### fromDegreesLatitude static Angle fromDegreesLatitude(
double degrees
);

Creates an Angle from a latitude in degrees.

The latitude must be in the interval [-90, 90].

### fromDegreesLongitude static Angle fromDegreesLongitude(
double degrees
);

Creates an Angle from a longitude in degrees.

The latitude must be in the interval [-180, 180].

### fromRadians  );

Creates an Angle from a number of radians.

### fromRadiansLatitude );

Creates an Angle from a latitude in radians.

The latitude must be in the interval [-PI/2, PI/2].

### fromRadiansLongitude );

Creates an Angle from a longitude in radians.

The latitude must be in the interval [-PI, PI].

### fromXY static Angle fromXY(
double x,
double y
);

Creates an Angle from rectangular coordinates.

• x is the abscissa coordinate
• y is the ordinate coordinate

### normalized

Angle normalized() const;

Returns a normalized Angle.

### normalizedDegrees static double normalizedDegrees(
double degrees
);

Normalizes the given angle in degrees to the interval [0, 360) and returns the result.

### normalizedDegreesLatitude static double normalizedDegreesLatitude(
double degrees
);

Normalizes the given angle in degrees to a latitude in the interval [-90, 90] and returns the result.

### normalizedDegreesLongitude static double normalizedDegreesLongitude(
double degrees
);

Normalizes the given angle in degrees to a longitude in the interval [-180, 180] and returns the result.

### normalizedLatitude

Angle normalizedLatitude() const;

Returns a normalized latitudinal Angle.

### normalizedLongitude

Angle normalizedLongitude() const;

Returns a normalized longitudinal Angle.

### operator != bool operator != (
const Angle & angle
) const;

### operator * Angle operator * (
double multiplier
) const;

Multiplies the Angle by the given multiplier and returns the result.

### operator + Angle operator + (
const Angle & angle
) const;

Adds another Angle and returns the result.

### operator - Angle operator - (
const Angle & angle
) const;

Subtracts another Angle and returns the result.

### operator / Angle operator / (
double divisor
) const;

Divides the Angle by the given divisor and returns the result.

### operator /

double operator / (
const Angle & angle
) const;

Divices the Angle by the given angle and returns the result.

### operator < bool operator < (
const Angle & angle
) const;

### operator <= bool operator <= (
const Angle & angle
) const;

### operator =

Angle & operator = (
const Angle & angle
);

Assignment operator.

### operator == bool operator == (
const Angle & angle
) const;

### operator > bool operator > (
const Angle & angle
) const;

### operator >= bool operator >= (
const Angle & angle
) const;

### radians Returns the Angle expressed in radians.

### sin

double sin() const;

Returns the sine of this Angle.

### swap

void swap(
Angle & other
);

Swaps the Angle with another one.

## Variables

### COMPASS_E static const std::string COMPASS_E;

### COMPASS_ENE static const std::string COMPASS_ENE;

### COMPASS_ESE static const std::string COMPASS_ESE;

### COMPASS_N static const std::string COMPASS_N;

### COMPASS_NE static const std::string COMPASS_NE;

### COMPASS_NNE static const std::string COMPASS_NNE;

### COMPASS_NNW static const std::string COMPASS_NNW;

### COMPASS_NW static const std::string COMPASS_NW;

### COMPASS_S static const std::string COMPASS_S;

### COMPASS_SE static const std::string COMPASS_SE;

### COMPASS_SSE static const std::string COMPASS_SSE;

### COMPASS_SSW static const std::string COMPASS_SSW;

### COMPASS_SW static const std::string COMPASS_SW;

### COMPASS_W static const std::string COMPASS_W;

### COMPASS_WNW static const std::string COMPASS_WNW;

### COMPASS_WSW static const std::string COMPASS_WSW;

### NEG180 static const Angle NEG180;

An Angle of negative 180 degrees.

### NEG90 static const Angle NEG90;

An Angle of negative 90 degrees.

### PI static const double PI;

### PI_OVER_2 static const double PI_OVER_2;

### POS180 static const Angle POS180;

An Angle of positive 180 degrees.

### POS360 static const Angle POS360;

An Angle of positive 360 degrees.

### POS90 static const Angle POS90;

An Angle of positive 90 degrees.