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: Face/Face.cpp
- Revision:
- 24:4e8bdcb74266
- Parent:
- 22:236319885874
- Child:
- 32:9c250eda7f3f
--- a/Face/Face.cpp Wed Apr 03 16:00:50 2019 +0000
+++ b/Face/Face.cpp Wed Apr 03 16:19:05 2019 +0000
@@ -4,34 +4,34 @@
#include "Face.h"
#endif
-Face::Face(){
- visible = false;
+Face::Face() {
+ visible = false; //Each instantiated face is not visible by default
}
-bool Face::getVisible(){
+bool Face::getVisible() { //Accessor returns whether the face is visible
return visible;
}
-void Face::setVisible(bool v){
+void Face::setVisible(bool v) { //Mutator sets whether the face is visible or not
visible = v;
}
-void Face::setVerticies(float (&PointArray)[4][3]){
+void Face::setVerticies(float (&PointArray)[4][3]) { //Sets the verticies of the face to their xyz coordinate
float z = 0;
- for(int vertex = 0; vertex < 4; vertex++){
- for(int axis = 0; axis < 3; axis++){
- verticies[vertex][axis] = PointArray[vertex][axis];
+ for(int vertex = 0; vertex < 4; vertex++) {
+ for(int axis = 0; axis < 3; axis++) {
+ verticies[vertex][axis] = PointArray[vertex][axis]; //copies the parameter to the private array
}
z += verticies[vertex][2];
}
- avgZ = z/4;
+ avgZ = z/4; //store an average z axis value for each face
}
-float Face::getVertexValue(int vertex, int axis){
+float Face::getVertexValue(int vertex, int axis){ //Accessor to return the value of a vertex depending on the index and axis
return verticies[vertex][axis];
}
-float Face::getAvgZ(){
+float Face::getAvgZ(){ //Accessor to return the average z value of the face
return avgZ;
}
\ No newline at end of file