JBenghiat Posted May 14, 2018 Share Posted May 14, 2018 Does anyone know of a function or have a process of transforming a screen move to a 3D coordinate when not in a top view? For catching moves in Update Support, I handle x and y moves differently than z moves. So, for example, if looking at a front view, I want a y screen move to translate to a z object move. The matrix reported in theData->fTransformOffset follows the screen coordinates. I can easily catch the case I want: if (!theData->fbIs3DMove && gSDK->GetProjection(gSDK->GetActiveLayer()) != projectionPlan ) But I can't seem to find an easy way to transform the screen offset to the model offset. Quote Link to comment
Pat Stanford Posted May 15, 2018 Share Posted May 15, 2018 You have probably already looked at this but in VS, there are functions to change coordinates: ScreenVecToModelVec ScreenPtToModelPt2D ScreenPlanePtToPlanarPt PlanarPtTo3DModelPt Plus some others. I played with them MANY years ago, but don't really remember if I solved your problem or not. HTH Quote Link to comment
JBenghiat Posted May 15, 2018 Author Share Posted May 15, 2018 The SDK has equivalent functions. ScreenVecToModelVec looked promising, but it only works for two dimensional points, which limits its use to translating rotated plan. PlanarPtTo3DModelPt might work, but there would need to be a way to find the ID of the screen-aligned plane. Quote Link to comment
JBenghiat Posted May 25, 2018 Author Share Posted May 25, 2018 OK, got it. I can get the working plane and convert the working plane point to a model pt. TransformMatrix matMove = theData->fTransformOffset; WorldPt3 moveOffset = matMove.P(); bool isPlanarMove = false; // Check if 2D move in 3D view // If so, transform move vector so it acts with respect of the object if (!theData->fbIs3DMove && gSDK->GetProjection(gSDK->GetActiveLayer()) != projectionPlan ) { TPlanarRefID wpRef = gSDK->GetWorkingPlanePlanarRefID(); gSDK->PlanarPtTo3DModelPt(wpRef, WorldPt(matMove.P().x,matMove.P().y), moveOffset); isPlanarMove = true; } Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.