Jump to content
Developer Wiki and Function Reference Links ×

Screen move to model move?


JBenghiat

Recommended Posts

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.

Link to comment

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

Link to comment

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. 

Link to comment
  • 2 weeks later...

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;
}

 

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...