gmath.h

This interface exports several functions for working with graphical geometry along with the constants PI and E.
Constants
PI The mathematical constant pi, which is the ratio of the circumference of a circle to its diameter.
The mathematical constant e, which is the base of natural logarithms.
Functions
sinDegrees(angle) Returns the trigonometric sine of angle, which is expressed in degrees.
cosDegrees(angle) Returns the trigonometric cosine of angle, which is expressed in degrees.
tanDegrees(angle) Returns the trigonometric tangent of angle, which is expressed in degrees.
toDegrees(radians) Converts an angle from radians to degrees.
toRadians(degrees) Converts an angle from degrees to radians.
vectorDistance(x, y) Computes the distance between the origin and the specified point.
vectorAngle(x, y) Returns the angle in degrees from the origin to the specified point.

Function detail


double sinDegrees(double angle);
Returns the trigonometric sine of angle, which is expressed in degrees.

Usage:

sine = sinDegrees(angle);

double cosDegrees(double angle);
Returns the trigonometric cosine of angle, which is expressed in degrees.

Usage:

cosine = cosDegrees(angle);

double tanDegrees(double angle);
Returns the trigonometric tangent of angle, which is expressed in degrees.

Usage:

tangent = tanDegrees(angle);

double toDegrees(double radians);
Converts an angle from radians to degrees.

Usage:

degrees = toDegrees(radians);

double toRadians(double degrees);
Converts an angle from degrees to radians.

Usage:

radians = toRadians(degrees);

double vectorDistance(double x, double y);
Computes the distance between the origin and the specified point.

Usage:

r = vectorDistance(x, y);

double vectorAngle(double x, double y);
Returns the angle in degrees from the origin to the specified point. This function takes account of the fact that the graphics coordinate system is flipped in the y direction from the traditional Cartesian plane.

Usage:

angle = vectorAngle(x, y);