# ArMath Class Reference

`#include <ariaUtil.h>`

## Detailed Description

This class has static members to do common math operations.

Definition at line 309 of file ariaUtil.h.

## Static Public Member Functions

static double addAngle (double ang1, double ang2)
This adds two angles together and fixes the result to [-180, 180].
static bool angleBetween (double angle, double startAngle, double endAngle)
Finds if one angle is between two other angles.
static double atan2 (double y, double x)
Finds the arctan of the given y/x pair.
static double cos (double angle)
Finds the cos, from angles in degrees.
Converts an angle in degrees to an angle in radians.
static double distanceBetween (double x1, double y1, double x2, double y2)
Finds the distance between two coordinates.
static double fabs (double val)
Finds the absolute value of a double.
static double fixAngle (double angle)
Takes an angle and returns the angle in range (-180,180].
static double log2 (double x)
static void pointRotate (double *x, double *y, double th)
Rotates a point around 0 by degrees given.
Converts an angle in radians to an angle in degrees.
static long random (void)
Returns a long between 0 and some arbitrary huge number.
static int roundInt (double val)
Finds the closest integer to double given.
static short roundShort (double val)
Finds the closest short to double given.
static double sin (double angle)
Finds the sin, from angles in degrees.
static double squaredDistanceBetween (double x1, double y1, double x2, double y2)
Finds the squared distance between two coordinates.
static double subAngle (double ang1, double ang2)
This subtracts one angle from another and fixes the result to [-180,180].
static double tan (double angle)
Finds the tan, from angles in degrees.

## Member Function Documentation

 static double ArMath::addAngle ( double ang1, double ang2 ) ` [inline, static]`

This adds two angles together and fixes the result to [-180, 180].

Parameters:
 ang1 first angle ang2 second angle, added to first
Returns:
sum of the angles, in range [-180,180]
subAngle

Definition at line 320 of file ariaUtil.h.

 static double ArMath::atan2 ( double y, double x ) ` [inline, static]`

Finds the arctan of the given y/x pair.

Parameters:
 y the y distance x the x distance
Returns:
the angle y and x form

Definition at line 399 of file ariaUtil.h.

 static double ArMath::cos ( double angle ) ` [inline, static]`

Finds the cos, from angles in degrees.

Parameters:
 angle angle to find the cos of, in degrees
Returns:
the cos of the angle
sin

Definition at line 376 of file ariaUtil.h.

 static double ArMath::degToRad ( double deg ) ` [inline, static]`

Converts an angle in degrees to an angle in radians.

Parameters:
 deg the angle in degrees
Returns:

Definition at line 360 of file ariaUtil.h.

 static double ArMath::distanceBetween ( double x1, double y1, double x2, double y2 ) ` [inline, static]`

Finds the distance between two coordinates.

Parameters:
 x1 the first coords x position y1 the first coords y position x2 the second coords x position y2 the second coords y position
Returns:
the distance between (x1, y1) and (x2, y2)

Definition at line 492 of file ariaUtil.h.

 static double ArMath::fabs ( double val ) ` [inline, static]`

Finds the absolute value of a double.

Parameters:
 val the number to find the absolute value of
Returns:
the absolute value of the number
Examples:
actsColorFollowingExample.cpp.

Definition at line 420 of file ariaUtil.h.

 static double ArMath::fixAngle ( double angle ) ` [inline, static]`

Takes an angle and returns the angle in range (-180,180].

Parameters:
 angle the angle to fix
Returns:
the angle in range (-180,180]

Definition at line 341 of file ariaUtil.h.

 static double ArMath::log2 ( double x ) ` [inline, static]`

Base-2 logarithm

Definition at line 508 of file ariaUtil.h.

 static double ArMath::radToDeg ( double rad ) ` [inline, static]`

Converts an angle in radians to an angle in degrees.

Parameters:
Returns:
the angle in degrees

Definition at line 368 of file ariaUtil.h.

 static int ArMath::roundInt ( double val ) ` [inline, static]`

Finds the closest integer to double given.

Parameters:
 val the double to find the nearest integer to
Returns:
the integer the value is nearest to (also caps it within int bounds)

Definition at line 434 of file ariaUtil.h.

 static short ArMath::roundShort ( double val ) ` [inline, static]`

Finds the closest short to double given.

Parameters:
 val the double to find the nearest short to
Returns:
the integer the value is nearest to (also caps it within short bounds)

Definition at line 451 of file ariaUtil.h.

 static double ArMath::sin ( double angle ) ` [inline, static]`

Finds the sin, from angles in degrees.

Parameters:
 angle angle to find the sin of, in degrees
Returns:
the sin of the angle
cos

Definition at line 384 of file ariaUtil.h.

 static double ArMath::squaredDistanceBetween ( double x1, double y1, double x2, double y2 ) ` [inline, static]`

Finds the squared distance between two coordinates.

use this only where speed really matters

Parameters:
 x1 the first coords x position y1 the first coords y position x2 the second coords x position y2 the second coords y position
Returns:
the distance between (x1, y1) and (x2, y2)

Definition at line 504 of file ariaUtil.h.

 static double ArMath::subAngle ( double ang1, double ang2 ) ` [inline, static]`

This subtracts one angle from another and fixes the result to [-180,180].

Parameters:
 ang1 first angle ang2 second angle, subtracted from first angle
Returns:
resulting angle, in range [-180,180]

Definition at line 331 of file ariaUtil.h.

 static double ArMath::tan ( double angle ) ` [inline, static]`

Finds the tan, from angles in degrees.

Parameters:
 angle angle to find the tan of, in degrees
Returns:
the tan of the angle

Definition at line 391 of file ariaUtil.h.

The documentation for this class was generated from the following file:
Generated on Fri Dec 1 10:55:17 2006 for Aria by  1.4.7