src/engine/eAxis.h

Go to the documentation of this file.
00001 #include "defs.h"
00002 
00003 #include <math.h>
00004 #include <stdio.h>
00005 
00006 #include "eCoord.h"
00007 
00008 /*
00009  * Find the angle described by the vector from (0,0) to POS 
00010  */
00011 // YES its y then x! Why did you think I made a define? :)
00012 #define eCoordToRad(POS) atan2f(POS.y, POS.x)
00013 
00014 class eAxis {
00015     friend class eGrid;
00016 
00017 public:
00018     eAxis(int number=4);
00019     ~eAxis();
00020 
00021     int WindingNumber() const {return numberWinding;}
00022     int NearestWinding (eCoord pos);
00023     eCoord GetDirection (int winding);
00024 
00025     void Turn(int &currentWinding, int direction);
00026     void TurnRight(int &direction);
00027     void TurnLeft(int &direction);
00028 
00029 protected:
00030     void Init(int number);
00031     void Init(int number, eCoord predefinedAxis[], bool normalize=true);
00032 
00033     unsigned int numberWinding; // How many winding are possible
00034     eCoord *windings; // The different axis possible.
00035     float *windingAngles; // The angles (in radiant) associated with the winding axis
00036 
00037     void ComputeWinding();
00038     void ComputeAngles();
00039     void SnapWinding(); 
00040 };
00041 

Generated on Sat Mar 15 22:55:43 2008 for Armagetron Advanced by  doxygen 1.5.4