【发布时间】:2015-03-21 23:40:37
【问题描述】:
考虑到视口的宽度和高度,我正在尝试将平面对象中点的 3D 坐标转换为 2D 坐标。 我正在用 C++ 编写代码。
在浏览 3Ds max 文档时,我发现了函数“MapViewToScreen”, 这个功能够用吗?如果是这样如何实现它。 如果还有其他方法也请建议。
【问题讨论】:
考虑到视口的宽度和高度,我正在尝试将平面对象中点的 3D 坐标转换为 2D 坐标。 我正在用 C++ 编写代码。
在浏览 3Ds max 文档时,我发现了函数“MapViewToScreen”, 这个功能够用吗?如果是这样如何实现它。 如果还有其他方法也请建议。
【问题讨论】:
查看链接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);
【讨论】: