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:
- 4:759a5c34e239
- Parent:
- 3:2e31dfcb712a
- Child:
- 6:75031d14fc0d
--- a/Rasturizer/Rasturizer.cpp Fri Feb 22 14:01:20 2019 +0000
+++ b/Rasturizer/Rasturizer.cpp Fri Feb 22 19:05:28 2019 +0000
@@ -1,13 +1,20 @@
#include "mbed.h"
#include "Rasturizer.h"
-
+N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
-Rasturizer::Rasturizer(Face face, N5110 lcd){
+Rasturizer::Rasturizer(){
lcd.init();
- float points[4][2] = {{rand()%20,rand()%20},{20+rand()%20, rand()%20}, {20+rand()%20,20+rand()%20}, {rand()%20,20+rand()%20}};
+}
+void Rasturizer::drawFace(Face face){
+ float points[4][3];
+ for(int vertex = 0; vertex < 4; vertex++){
+ for(int axis = 0; axis < 3; axis++){
+ points[vertex][axis] = face.getVertexValue(vertex, axis);
+ }
+ }
int diffX1 = points[0][0]-points[1][0];
int diffY1 = points[0][1]-points[1][1];
int diffX2 = points[2][0]-points[3][0];
@@ -23,7 +30,6 @@
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);
}
- lcd.printString("a",10,0);
}
else{
lcd.printString("bottom",0,0);
@@ -48,5 +54,11 @@
points[3][0],
points[3][1],
1);
-
+}
+void Rasturizer::clear(){
+ lcd.clear();
+}
+
+void Rasturizer::refresh(){
+ lcd.refresh();
}
\ No newline at end of file