How can you represent a submodule in a 3D scene?
I need to modify a WPF application written in C # that displays a complex 3D model with many submodels or parts. When the user selects a piece through an alternate UI mechanism, I would like to rotate, scale, or move the scene so that the submodule appears. No submodule is completely hidden (i.e. the interior of the main model).
What's the best way to do this?
There is no real top or bottom of the model as additional information. This is a 3D representation of a molecule, and the user selects the atom to "scroll".
a source to share
Get the center (or centroid) of the bounding volume of the submodel. Rotate the camera to look at the center. Move or scale the view until the bounding volume of the submodel fills a predefined portion of the screen. This involves solving a simple linear equation linking the viewing volume and the bounding volume. This is pretty easy if your bounding volume is a minimum bounding box.
EDIT
In such a case, you might be better off if you start a search engine first. The particular function you are talking about is usually called 'zoom to match' . If you do some internet search, I'm sure you will find a detailed discussion of implementations much better than I could here. The explanation requires you to understand things like transformations between screen coordinates and world coordinates and how they are related.
a source to share