src/ccmath.h File Reference

#include <cmath>
#include <cstdlib>

Include dependency graph for ccmath.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define _CCMATH_H_
#define M_PI   3.14159265358979323846
#define M_PI_2   1.57079632679489661923
#define TWO_PI   (M_PI*2)

Functions

double radiansToDegrees (double radians)
double degreesToRadians (double degrees)
double randBellCurve ()
int randInt (int range)
double rand0to1 ()


Define Documentation

#define _CCMATH_H_

Definition at line 7 of file ccmath.h.

#define M_PI   3.14159265358979323846

Definition at line 14 of file ccmath.h.

Referenced by IEnvironmentObject::calcAngle(), CityManager::CheckCollision(), StateSailing::HandleKeyDown(), Battle::HandleKeyDown(), StateSailing::Timer(), ShipAI::Update(), ShipAI::UpdateFight(), and ShipAI::UpdateFlee().

#define M_PI_2   1.57079632679489661923

Definition at line 18 of file ccmath.h.

Referenced by SkyDome::DrawDome(), Battle::HandleKeyDown(), Ship::Update(), and ShipAI::UpdateFight().

#define TWO_PI   (M_PI*2)

Definition at line 21 of file ccmath.h.

Referenced by degreesToRadians(), SkyDome::DrawDome(), radiansToDegrees(), StateSailing::Timer(), ShipAI::Update(), Ship::Update(), and Ocean::Update().


Function Documentation

double degreesToRadians ( double  degrees  )  [inline]

Definition at line 27 of file ccmath.h.

References TWO_PI.

Referenced by CityManager::CheckCollision(), SkyDome::DrawDome(), Terrain::FindNearestShoreAngle(), and ShipAI::UpdateFight().

00027                                                {
00028   return degrees*(TWO_PI/360.0);
00029 }

double radiansToDegrees ( double  radians  )  [inline]

Definition at line 23 of file ccmath.h.

References TWO_PI.

Referenced by Bullet::Bullet(), Camera::CalcValues(), and Ship::Draw().

00023                                                {
00024   return radians*(360.0/TWO_PI);
00025 }

double rand0to1 (  )  [inline]

Definition at line 39 of file ccmath.h.

Referenced by Battle::Battle().

00039                          {
00040   return ((double) rand()) / RAND_MAX;
00041 }

double randBellCurve (  )  [inline]

Definition at line 31 of file ccmath.h.

Referenced by Cargo::FillRandom(), StateDone::SackPlayer(), StateSailing::SetTicksToNextBattle(), and StateDone::StateDone().

00031                               {
00032   return ((rand()/(double)RAND_MAX)+(rand()/(double)RAND_MAX)+(rand()/(double)RAND_MAX))/ 3.0;
00033 }

int randInt ( int  range  )  [inline]

Definition at line 35 of file ccmath.h.

Referenced by ResourceManager::AcquireRandom(), and Battle::Battle().

00035                               {
00036   return (int) ((float)(range+1)*rand()/(RAND_MAX+1.0));
00037 }


Generated on Mon Jan 8 22:34:13 2007 for CrownandCutlass by  doxygen 1.4.7