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.
Dependencies: mbed
Diff: Rasturizer/Rasturizer.cpp
- Revision:
- 8:a667bc5050c1
- Parent:
- 7:15543cb10a14
- Child:
- 9:5915fc800824
diff -r 15543cb10a14 -r a667bc5050c1 Rasturizer/Rasturizer.cpp
--- a/Rasturizer/Rasturizer.cpp Sat Feb 23 17:45:43 2019 +0000
+++ b/Rasturizer/Rasturizer.cpp Tue Feb 26 09:35:03 2019 +0000
@@ -21,8 +21,8 @@
int diffX1 = points[0][0]-points[1][0];
int diffY1 = points[0][1]-points[1][1];
int diffX2 = points[2][0]-points[3][0];
- int diffY2 = points[2][1]-points[3][1];
- /*
+ int diffY2 = points[2][1]-points[3][1];/*
+
if (abs(diffX1) > abs(diffX2)){
double step = (double)diffY1/(double)diffX1;
@@ -30,8 +30,8 @@
double stepSmall2 = (double)diffY2/(double)diffX1;
lcd.printString("top",0,0);
for(int s = 0; s<= abs(diffX1)-1; s++){
- lcd.drawLine((rint(points[0][0]+s)/points[0][2])+42, rint((points[0][1]+step*s)/points[0][2]), rint((points[3][0]-stepSmall1*s)/points[3][2])+42, rint((points[3][1]-stepSmall2*s)/points[3][2])+21, 0);
- lcd.drawLine((rint(points[0][0]+s+1)/points[0][2])+42, rint((points[0][1]+step*s)/points[0][2]), rint((points[3][0]-stepSmall1*s-1)/points[3][2])+42, rint((points[3][1]-stepSmall2*s)/points[3][2])+21, 0);
+ lcd.drawLine((rint(points[0][0]+s)/points[0][2])+42, rint((points[0][1]+step*s)/points[0][2]), rint((points[3][0]-stepSmall1*s)/points[3][2])+42, rint((points[3][1]-stepSmall2*s)/points[3][2])+21, 1);
+ lcd.drawLine((rint(points[0][0]+s+1)/points[0][2])+42, rint((points[0][1]+step*s)/points[0][2]), rint((points[3][0]-stepSmall1*s-1)/points[3][2])+42, rint((points[3][1]-stepSmall2*s)/points[3][2])+21, 1);
//lcd.drawLine(points[0][0]+s, rint(points[0][1]+step*s), rint(points[3][0]-stepSmall1*s), rint(points[3][1]-stepSmall2*s), 0);
//lcd.drawLine(points[0][0]+s+1, rint(points[0][1]+step*s), rint(points[3][0]-stepSmall1*s-1), rint(points[3][1]-stepSmall2*s), 0);
@@ -45,8 +45,8 @@
double stepSmall2 = (double)diffY1/(double)diffX2;
for(int s = 0; s<= abs(diffX2)-1; s++){
- lcd.drawLine(rint((points[0][0]-stepSmall1*s)*(40/points[0][2]))+42, rint((points[0][1]-stepSmall2*s)*(40/points[0][2]))+21,rint((points[3][0]+s)*(40/points[3][2]))+42, rint((points[3][1]+step*s)*(40/points[3][2]))+21, 0);
- lcd.drawLine(rint((points[0][0]-stepSmall1*s-1)*(40/points[0][2])+42), rint((points[0][1]-stepSmall2*s)*(40/points[0][2])+21),rint((points[3][0]+s+1)*(40/points[3][2]))+42, rint((points[3][1]+step*s)*(40/points[3][2]))+21, 0);
+ lcd.drawLine(rint((points[0][0]-stepSmall1*s)*(40/points[0][2]))+42, rint((points[0][1]-stepSmall2*s)*(40/points[0][2]))+21,rint((points[3][0]+s)*(40/points[3][2]))+42, rint((points[3][1]+step*s)*(40/points[3][2]))+21, 1);
+ lcd.drawLine(rint((points[0][0]-stepSmall1*s-1)*(40/points[0][2])+42), rint((points[0][1]-stepSmall2*s)*(40/points[0][2])+21),rint((points[3][0]+s+1)*(40/points[3][2]))+42, rint((points[3][1]+step*s)*(40/points[3][2]))+21, 1);
}
}*/