简体   繁体   中英

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. I am writing the code in c++.

While going through 3Ds max documentation I found function "MapViewToScreen", Will this function be enough? 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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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