Tyler Altenhofen / MVC
Revision:
0:ded79d89abdf
Child:
1:bb1507f0bb64
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Point.cpp	Fri May 01 05:33:50 2015 +0000
@@ -0,0 +1,67 @@
+
+#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 ++;
+    }
+}
\ No newline at end of file