[MDX] zoom to selected rectangle
How do I let user to select a rectangle on the screen and zoom-in my 3D model to fit that rectangle?
What I can think of is to unproject the center point of that 2D selection rectangle to a view plane, then translate the model to the negative value of that intersection point on the plane, then scale the model to the appropriate scale (screen to selection rectangle ratio).
Is this a correct approach? If it is, I need to know how to obtain the view plane in the first place. The view plane is a plane that crosses the rotation center of the model and always parallel to the screen no matter how you rotate the model.
Look for algorithms to extract the frustum planes from the transformation matrices. The view plane is the near plane in the view frustum.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement