假设我有一个如下所示的数据结构:
Camera {
double x, y, z
/** ideally the camera angle is positioned to aim at the 0,0,0 point */
double angleX, angleY, angleZ;
}
SomePointIn3DSpace {
double x, y, z
}
ScreenData {
/** Convert from some point 3d space to 2d space, end up with x, y */
int x_screenPositionOfPt, y_screenPositionOfPt
double zFar = 100;
int width=640, height=480
}
Run Code Online (Sandbox Code Playgroud)
...
没有屏幕剪辑或其他任何东西,我如何在空间中给出一些3d点的情况下计算某个点的屏幕x,y位置.我想将这个3d点投影到2d屏幕上.
Camera.x = 0
Camera.y = 10;
Camera.z = -10;
/** ideally, I want the camera to …Run Code Online (Sandbox Code Playgroud)