Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Point.cpp
- Committer:
- tyleralt
- Date:
- 2015-05-01
- Revision:
- 0:ded79d89abdf
- Child:
- 1:bb1507f0bb64
File content as of revision 0:ded79d89abdf:
#include "Point.h" //*********************point class************************// Point :: Point (void){ positionRadian = 180; positionHeight = 4; positionDistance = 8; //int offAngles [8] = {-3, 174, 44, 228, 90, 270, 135, 315}; offAngles[0] = -3; offAngles[1] = 174; offAngles[2] = 44; offAngles[3] = 228; offAngles[4] = 90; offAngles[5] = 270; offAngles[6] = 135; offAngles[7] = 315; } Point :: Point (int posRadian, int posHeight, int posDistance){ positionRadian = posRadian; positionHeight = posHeight; positionDistance = posDistance; offAngles[0] = -3; offAngles[1] = 174; offAngles[2] = 44; offAngles[3] = 228; offAngles[4] = 90; offAngles[5] = 270; offAngles[6] = 135; offAngles[7] = 315; } int Point :: getArraySlice (void){ return (int) (positionRadian + (offAngles[positionHeight]))%360; } char Point :: getIdentifyingChar(void){ return 0x01 << positionHeight; } int Point :: getPositionDistance(void){ return positionDistance%16; } void Point :: moveUp(){ if (positionHeight < 7){ positionHeight ++; } } void Point :: moveDown(){ if(positionHeight > 0){ positionHeight --; } } void Point :: rotateRight(){ positionRadian = (positionRadian + 1) % 360; } void Point :: rotateLeft(){ positionRadian = (positionRadian - 1) % 360; } void Point :: moveIn(){ if (positionDistance > 0){ positionDistance --; } } void Point :: moveOut(){ if (positionDistance < 15){ positionDistance ++; } }