From 2f39b77e3c7b0df6bae43fbb3b7001f9dd1e9f5b Mon Sep 17 00:00:00 2001 From: David Mikos Date: Tue, 29 Jan 2008 11:29:54 +1030 Subject: Replace PI, etc. with constants from math.h. --- rubik-internal.h | 60 ++++++++++++++++++++++++++------------------------------ rubik.c | 2 +- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/rubik-internal.h b/rubik-internal.h index 6a0769d..e012ace 100644 --- a/rubik-internal.h +++ b/rubik-internal.h @@ -1,16 +1,6 @@ #ifndef _RUBIK_INTERNAL_H #define _RUBIK_INTERNAL_H -#define RAD 57.296 -#define RRAD 0.01745 - -/* some constants */ -#define PI 3.14159265358979323846 -#define PIdiv2 1.57079632679489661923 -#define toDegrees 57.2957795130823208768 -#define toRadians 0.01745329251994329577 - - #define LRAND() ((long) (random() & 0x7fffffff)) #define NRAND(n) ((int) (LRAND() % (n))) #define MAXRAND (2147483648.0) /* unsigned 1<<31 as a float */ @@ -19,6 +9,12 @@ #include #include +/* some constants */ +#define PI M_PI +#define PIdiv2 M_PI_2 +#define toDegrees (180.0f * M_1_PI) +#define toRadians (M_PI / 180.0f) + //return random number in range [0,x) #define randf(x) ((float) (rand()/(((double)RAND_MAX + 1)/(x)))) @@ -79,19 +75,19 @@ RubikDisplay; typedef struct _squareRec { - int side; - int x; - int y; - int psi; + int side; + int x; + int y; + int psi; } squareRec; typedef struct _faceRec { - float color[4]; + float color[4]; - squareRec *square; + squareRec *square; } faceRec; @@ -101,7 +97,7 @@ typedef struct _RubikScreen { int windowPrivateIndex; - DonePaintScreenProc donePaintScreen; + DonePaintScreenProc donePaintScreen; PreparePaintScreenProc preparePaintScreen; CubeClearTargetOutputProc clearTargetOutput; @@ -119,34 +115,34 @@ typedef struct _RubikScreen DisableOutputClippingProc disableOutputClipping; AddWindowGeometryProc addWindowGeometry; - - CubeGetRotationProc getRotation; - + CubeGetRotationProc getRotation; + + Bool initiated; - + Bool damage; - + CompTransform * tempTransform; - - float *th; - float *oldTh; - float *psi; - float *oldPsi; + float *th; + float *oldTh; + + float *psi; + float *oldPsi; + + CompWindow ** w; - CompWindow ** w; - Box * oldClip; faceRec *faces; - + int hsize; float distance; //perpendicular distance to wall from centre float radius; //radius on which the hSize points lie - + float speedFactor; // multiply rotation speed by this value - + } RubikScreen; diff --git a/rubik.c b/rubik.c index e925008..6ada54e 100644 --- a/rubik.c +++ b/rubik.c @@ -22,7 +22,7 @@ /* * Loosely based on freewins, atlantis, and anaglyph. - * Some texture code from cubedbus. + * Some texture code from cubedbus. */ #include -- cgit v1.1