public void calc2DCoords() {
// Point(X|Y|X) a{x,y,z} The point in 3D space that is to be projected.
// Cube.Camera(X|Y|X) c{x,y,z} The location of the camera.
// Cube.Theta(X|Y|X) 0{x,y,z} The rotation of the camera. When c{x,y,z}=<0,0,0>, and 0{x,y,z}=<0,0,0>, the 3D vector <1,2,0> is projected to the 2D vector <1,2>.
// Cube.Viewer(X|Y|X) e{x,y,z} The viewer's position relative to the display surface.
// Bsub(X|Y) b{x,y} The 2D projection of a.
double PointX = X3;
double PointY = Y3;
double PointZ = Z3;
double DsubX, DsubY, DsubZ;
double BsubX, BsubY;
distanceFromViewer = Math.Sqrt(Math.Pow((PointX - Cube.ViewerX), 2) + Math.Pow((PointY - Cube.ViewerY), 2) + Math.Pow((PointZ - Cube.ViewerZ), 2));
DsubX = Math.Cos(Cube.ThetaY) * (Math.Sin(Cube.ThetaZ) * (PointY - Cube.CameraY) + Math.Cos(Cube.ThetaZ) * (PointX - Cube.CameraX)) - Math.Sin(Cube.ThetaY) * (PointZ - Cube.CameraZ);
DsubY = Math.Sin(Cube.ThetaX) * (Math.Cos(Cube.ThetaY) * (PointZ - Cube.CameraZ) + Math.Sin(Cube.ThetaY) * (Math.Sin(Cube.ThetaZ) * (PointY - Cube.CameraY) + Math.Cos(Cube.ThetaZ) * (PointX - Cube.CameraX))) + Math.Cos(Cube.ThetaX) * (Math.Cos(Cube.ThetaZ) * (PointY - Cube.CameraY) - Math.Sin(Cube.ThetaZ) * (PointX - Cube.CameraX));
DsubZ = Math.Cos(Cube.ThetaX) * (Math.Cos(Cube.ThetaY) * (PointZ - Cube.CameraZ) + Math.Sin(Cube.ThetaY) * (Math.Sin(Cube.ThetaZ) * (PointY - Cube.CameraY) + Math.Cos(Cube.ThetaZ) * (PointX - Cube.CameraX))) - Math.Sin(Cube.ThetaX) * (Math.Cos(Cube.ThetaZ) * (PointY - Cube.CameraY) - Math.Sin(Cube.ThetaZ) * (PointX - Cube.CameraX));
BsubX = (DsubX - Cube.ViewerX) / (Cube.ViewerZ / DsubZ);
BsubY = (DsubY - Cube.ViewerY) / (Cube.ViewerZ / DsubZ);
X2 = (int)((BsubX * 50) + 250);
Y2 = (int)((BsubY * 50) + 250);
/*
Console.WriteLine("-----------------------------------------------------------------------------------------------");
Console.WriteLine("DsubX = " + DsubX + " = cos(" + Cube.ThetaY + ")*(sin(" + Cube.ThetaZ + ")*(" + PointY + "-" + Cube.CameraY + ")+cos(" + Cube.ThetaZ + ")*(" + PointX + "-" + Cube.CameraX + "))-sin(" + Cube.ThetaY + ")*(" + PointZ + "-" + Cube.CameraZ + ")");
Console.WriteLine("DsubY = " + DsubY + " = sin(" + Cube.ThetaX + ")*(cos(" + Cube.ThetaY + ")*(" + PointZ + "-" + Cube.CameraZ + ")+sin(" + Cube.ThetaY + ")*(sin(" + Cube.ThetaZ + ")*(" + PointY + "-" + Cube.CameraY + ")+cos(" + Cube.ThetaZ + ")*(" + PointX + "-" + Cube.CameraY + ")))+cos(" + Cube.ThetaX + ")*(cos(" + Cube.ThetaZ + ")*(" + PointY + "-" + Cube.CameraY + ")-sin(" + Cube.ThetaZ + ")*(" + PointX + "-" + Cube.CameraX + "))");
Console.WriteLine("DsubZ = " + DsubZ + " = cos(" + Cube.ThetaX + ")*(cos(" + Cube.ThetaY + ")*(" + PointZ + "-" + Cube.CameraZ + ")+sin(" + Cube.ThetaY + ")*(sin(" + Cube.ThetaZ + ")*(" + PointY + "-" + Cube.CameraY + ")+cos(" + Cube.ThetaZ + ")*(" + PointX + "-" + Cube.CameraY + ")))-sin(" + Cube.ThetaX + ")*(cos(" + Cube.ThetaZ + ")*(" + PointY + "-" + Cube.CameraY + ")-sin(" + Cube.ThetaZ + ")*(" + PointX + "-" + Cube.CameraX + "))");
Console.WriteLine("BsubX = (" + DsubX + " - " + Cube.ViewerX + ") / (" + Cube.ViewerZ + " / " + DsubZ + ")");
Console.WriteLine("BsubY = (" + DsubY + " - " + Cube.ViewerY + ") / (" + Cube.ViewerZ + " / " + DsubZ + ")");
Console.WriteLine("X2 = " + X2 + " Y2 = " + Y2);
*/
}