在 3ds max 中将 3D 坐标转换为 2D
Converting 3D coordinates to 2D in 3ds max
考虑到视口的宽度和高度,我正在尝试将平面对象中某个点的 3D 坐标转换为 2D 坐标。
我正在用 C++ 编写代码。
在浏览 3Ds max 文档时我发现了函数 "MapViewToScreen",
这个功能够用吗?如果是如何实现它。
如果还有其他方法也请提出。
勾选 link map-world-point-to-viewport-coordinates
基本上你需要做的是
//get Transfromation matrix of the plane
Matrix3 tmMatrix = inode->GetObjectTM( GetCOREInterface()->GetTime() );
ViewExp& vpt = GetCOREInterface()->GetActiveViewExp();
GraphicsWindow *gwindow= vpt.getGW();
gwindow->setTransform( Matrix3(1) );
//Your required point, consider only the X and Y part
IPoint3 out; // X and Y from the bottom left corner
Point3 in( your_3d_point * tmMatrix );
gwindow->hTransPoint(&in, &out);
考虑到视口的宽度和高度,我正在尝试将平面对象中某个点的 3D 坐标转换为 2D 坐标。 我正在用 C++ 编写代码。
在浏览 3Ds max 文档时我发现了函数 "MapViewToScreen", 这个功能够用吗?如果是如何实现它。 如果还有其他方法也请提出。
勾选 link map-world-point-to-viewport-coordinates
基本上你需要做的是
//get Transfromation matrix of the plane
Matrix3 tmMatrix = inode->GetObjectTM( GetCOREInterface()->GetTime() );
ViewExp& vpt = GetCOREInterface()->GetActiveViewExp();
GraphicsWindow *gwindow= vpt.getGW();
gwindow->setTransform( Matrix3(1) );
//Your required point, consider only the X and Y part
IPoint3 out; // X and Y from the bottom left corner
Point3 in( your_3d_point * tmMatrix );
gwindow->hTransPoint(&in, &out);