Tyler Altenhofen / MVC

Point.cpp

Committer:
tyleralt
Date:
2015-05-12
Revision:
4:f1e33a234a74
Parent:
1:bb1507f0bb64
Child:
5:d7d16cb9c974

File content as of revision 4:f1e33a234a74:


#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] = -6;
    offAngles[1] = 174;
    offAngles[2] = 44;
    offAngles[3] = 228;
    offAngles[4] = 90;
    offAngles[5] = 270;
    offAngles[6] = 135;
    offAngles[7] = 323;
}

Point :: Point (int posRadian, int posHeight, int posDistance){
    positionRadian = posRadian;
    positionHeight = posHeight;
    positionDistance = posDistance;
    offAngles[0] = -6;
    offAngles[1] = 174;
    offAngles[2] = 44;
    offAngles[3] = 228;
    offAngles[4] = 90;
    offAngles[5] = 270;
    offAngles[6] = 135;
    offAngles[7] = 323;
}     
int Point :: getArraySlice (void){
    return (int) (positionRadian + (offAngles[positionHeight]))%360;
}
char Point :: getIdentifyingChar(void){
    return 0x01 << positionHeight;
}
int Point :: getPositionDistance(void){
    return positionDistance;
}
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 ++;
    }
}