简体   繁体   English

在3ds max中将3D坐标转换为2D

[英]Converting 3D coordinates to 2D in 3ds max

I am trying to convert 3D coordinates of a point in plane object to 2D coordinates considering viewport width and height. 我正在尝试考虑视口的宽度和高度将平面对象中点的3D坐标转换为2D坐标。 I am writing the code in c++. 我正在用C ++编写代码。

While going through 3Ds max documentation I found function "MapViewToScreen", Will this function be enough? 在浏览3Ds max文档时,我发现了函数“ MapViewToScreen”,这个函数足够吗? If so how to implement it. 如果是这样,如何执行它。 If there are any other methods too please suggest. 如果还有其他方法,请提出建议。

Check the link map-world-point-to-viewport-coordinates 检查链接地图世界点到视口坐标

Basically what you need to do is 基本上你需要做的是

//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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM