# Class: Angle

## jsts.algorithm.Angle

#### new Angle()

Utility functions for working with angles. Unless otherwise noted, methods in this class express angles in radians.
Source:
##### Requires:
• module:jsts/algorithm/CGAlgorithms.js

### Requires

• module:jsts/algorithm/CGAlgorithms.js

### Members

#### (static) CLOCKWISE

Constant representing clockwise orientation
Source:

#### (static) COUNTERCLOCKWISE

Constant representing counterclockwise orientation
Source:

#### (static) NONE

Constant representing no orientation
Source:

Pi/2
Source:

Pi/4
Source:

Pi*2
Source:

### Methods

#### (static) angle() → {Number}

Returns the angle Calls correct angle* depending on argument
Source:
Type
Number

#### (static) angleBetween(tip1, tail, tip2) → {Number}

Returns the unoriented smallest angle between two vectors. The computed angle will be in the range [0, Pi).
##### Parameters:
Name Type Description
`tip1` jsts.geom.Coordinate the tip of one vector.
`tail` jsts.geom.Coordinate the tail of each vector.
`tip2` jsts.geom.Coordinate the tip of the other vector.
Source:
##### Returns:
the angle between tail-tip1 and tail-tip2.
Type
Number

#### (static) angleBetweenCoords(p0, p1) → {Number}

Returns the angle of the vector from p0 to p1, relative to the positive X-axis. The angle is normalized to be in the range [ -Pi, Pi ].
##### Parameters:
Name Type Description
`p0` jsts.geom.Coordinate a coordinate.
`p1` jsts.geom.Coordinate a coordinate.
Source:
##### Returns:
the normalized angle (in radians) that p0-p1 makes with the positive x-axis.
Type
Number

#### (static) angleBetweenOriented(tip1, tail, tip2) → {Number}

Returns the oriented smallest angle between two vectors. The computed angle will be in the range (-Pi, Pi]. A positive result corresponds to a counterclockwise rotation from v1 to v2; a negative result corresponds to a clockwise rotation.
##### Parameters:
Name Type Description
`tip1` jsts.geom.Coordinate the tip of v1.
`tail` jsts.geom.Coordinate the tail of each vector.
`tip2` jsts.geom.Coordinate the tip of v2.
Source:
##### Returns:
the angle between v1 and v2, relative to v1.
Type
Number

#### (static) angleFromOrigo(p) → {Number}

Returns the angle that the vector from (0,0) to p, relative to the positive X-axis. The angle is normalized to be in the range ( -Pi, Pi ].
##### Parameters:
Name Type Description
`p` jsts.geom.Coordinate a coordinate.
Source:
##### Returns:
the normalized angle (in radians) that p makes with the positive x-axis.
Type
Number

#### (static) diff(ang1, ang2) → {Number}

Computes the unoriented smallest difference between two angles. The angles are assumed to be normalized to the range [-Pi, Pi]. The result will be in the range [0, Pi].
##### Parameters:
Name Type Description
`ang1` Number the angle of one vector (in [-Pi, Pi] ).
`ang2` Number the angle of the other vector (in range [-Pi, Pi] ).
Source:
##### Returns:
the angle (in radians) between the two vectors (in range [0, Pi] ).
Type
Number

#### (static) getTurn(ang1, ang2) → {Number}

Returns whether an angle must turn clockwise or counterclockwise to overlap another angle.
##### Parameters:
Name Type Description
`ang1` Number an angle (in radians).
`ang2` Number an angle (in radians).
Source:
##### Returns:
whether a1 must turn CLOCKWISE, COUNTERCLOCKWISE or NONE to overlap a2.
Type
Number

#### (static) interiorAngle(p0, p1, p2) → {Number}

Computes the interior angle between two segments of a ring. The ring is assumed to be oriented in a clockwise direction. The computed angle will be in the range [0, 2Pi]
##### Parameters:
Name Type Description
`p0` jsts.geom.Coordinate a point of the ring.
`p1` jsts.geom.Coordinate the next point of the ring.
`p2` jsts.geom.Coordinate the next point of the ring.
Source:
##### Returns:
the interior angle based at `p1.`
Type
Number

#### (static) isAcute(p0, p1, p2) → {Boolean}

Tests whether the angle between p0-p1-p2 is acute. An angle is acute if it is less than 90 degrees.

Note: this implementation is not precise (determistic) for angles very close to 90 degrees.

##### Parameters:
Name Type Description
`p0` jsts.geom.Coordinate an endpoint of the angle.
`p1` jsts.geom.Coordinate the base of the angle.
`p2` jsts.geom.Coordinate the other endpoint of the angle.
Source:
##### Returns:
true if the angle is acute.
Type
Boolean

#### (static) isObtuse(p0, p1, p2) → {Boolean}

Tests whether the angle between p0-p1-p2 is obtuse. An angle is obtuse if it is greater than 90 degrees.

Note: this implementation is not precise (determistic) for angles very close to 90 degrees.

##### Parameters:
Name Type Description
`p0` jsts.geom.Coordinate an endpoint of the angle.
`p1` jsts.geom.Coordinate the base of the angle.
`p2` jsts.geom.Coordinate the other endpoint of the angle.
Source:
##### Returns:
true if the angle is obtuse.
Type
Boolean

#### (static) normalize(angle) → {Number}

Computes the normalized value of an angle, which is the equivalent angle in the range ( -Pi, Pi ].
##### Parameters:
Name Type Description
`angle` Number the angle to normalize.
Source:
##### Returns:
an equivalent angle in the range (-Pi, Pi].
Type
Number

#### (static) normalizePositive(angle) → {Number}

Computes the normalized positive value of an angle, which is the equivalent angle in the range [ 0, 2*Pi ). E.g.:
• normalizePositive(0.0) = 0.0
• normalizePositive(-PI) = PI
• normalizePositive(-2PI) = 0.0
• normalizePositive(-3PI) = PI
• normalizePositive(-4PI) = 0
• normalizePositive(PI) = PI
• normalizePositive(2PI) = 0.0
• normalizePositive(3PI) = PI
• normalizePositive(4PI) = 0.0
##### Parameters:
Name Type Description
`angle` Number the angle to normalize, in radians.
Source:
##### Returns:
an equivalent positive angle.
Type
Number

##### Parameters:
Name Type Description
`radians` Number an angle in radians.
Source:
##### Returns:
the angle in degrees.
Type
Number

`angleDegrees` Number an angle in degrees.