Tyler Altenhofen / MVC
Revision:
1:bb1507f0bb64
Parent:
0:ded79d89abdf
Child:
2:891b3618be4f
--- a/View.cpp	Fri May 01 05:33:50 2015 +0000
+++ b/View.cpp	Fri May 01 09:22:50 2015 +0000
@@ -5,6 +5,7 @@
 #include "View.h"
 #include "Point.h"
 #include "EuclidPoint.h"
+#include <math.h>
 
 //write to arm pins
     DigitalOut pushRegister(p24);
@@ -79,17 +80,62 @@
     int arrSlice = pointer.getArraySlice();
     char c = pointer.getIdentifyingChar();
     int distance = pointer.getPositionDistance();
-    slice_data[arrSlice][distance] ^= c;
+    slice_data[arrSlice][distance] |= c;
 }
 
+
 void View :: addEucPoint(EuclidPoint euc){
-    Point start = euc.getStartPoint();
-    Point end = euc.getEndPoint(); 
-    int distance = start.getPositionDistance();
-    char c = start.getIdentifyingChar();
-    for (int i = start.getArraySlice(); i < end.getArraySlice(); i++){
-        slice_data[i][distance] ^= c;
+    int x = euc.x;
+    int y = euc.y;
+    Point pointer = euc.getPoint();
+    int arrSlice = pointer.getArraySlice();
+    char c = pointer.getIdentifyingChar();
+    int distance = pointer.getPositionDistance();
+    
+    
+    slice_data[arrSlice][distance] |= c;
+    
+    int divider = 1 + ((distance)/ 4);
+    int reach = rint((double)3 / divider);
+    for (int i = 0 ; i < reach; i ++){
+        slice_data [(arrSlice + i)%360][distance] |= c;
+        slice_data [(arrSlice - i)%360][distance] |= c;
     }
+    
+    
+    
+    /*
+    int changeDeg = arrSlice;
+    double deg = (double) changeDeg / 57.295;
+  
+    while ( ((sin (deg) * (distance + 1)) - y == 0 && (int) (cos (deg) * (distance + 1)) - x == 0)){
+        slice_data[change][distance] |= c;
+        changeDeg ++;
+        double deg = (double) changeDeg / 57.295;
+    }
+
+    
+    
+    changeDeg = arrSlice;
+    deg = (double) changeDeg / 57.295;
+
+    while ( (int) (sin (deg) * (distance + 1)) - y == 0 && (int) (cos (deg) * (distance + 1)) - x == 0){
+        slice_data[change][distance] |= c;
+        changeDeg --;
+        double deg = (double) changeDeg / 57.295;
+    }
+    while (  tan(arrSlice / 57.295) ==  ((double) y / x) || (int) tan(arrSlice / 57.295) == (int) ((double) -y / x)){ 
+    slice_data[change][distance] |= c;
+    change ++;
+    }
+    change = arrSlice;
+    //while ((int) (sin(change / 57.295) * distance) == x && (int)(cos (change / 57.295) * distance)== y){
+    while ( (int) tan(arrSlice / 57.295) == (int) ((double) y / x) || (int) tan(arrSlice / 57.295) == (int) ((double) -y / x)){ 
+    slice_data[change][distance] |= c;
+    change --;
+    }
+    */
+    
 }
 
 
@@ -97,3 +143,4 @@
 
 
 
+