Created
January 25, 2016 08:57
-
-
Save smcl/e901d989a520bb8b012e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void drawProjectedLine(point3D_type from, point3D_type to) { | |
from.z += CAM_F; | |
to.z += CAM_F; | |
int x1_2D = CAM_X + (int)(((double)from.x / (double)from.z) * CAM_F); | |
int y1_2D = CAM_Y + (int)(((double)from.y / (double)from.z) * CAM_F); | |
int x2_2D = CAM_X + (int)(((double)to.x / (double)to.z) * CAM_F); | |
int y2_2D = CAM_Y + (int)(((double)to.y / (double)to.z) * CAM_F); | |
/* take projected positions and draw on screen */ | |
display.drawLine(x1_2D, y1_2D, x2_2D, y2_2D, WHITE); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment