Coordinate Transforms, World -> Screen Coord Systems
For complex visualizations transforms between screen and model/world coordinates are often needed. This examples creates a simple surface plot and adds 3 rectangles to it:
- A red rectangle is embedded into the same group as the surface. It is able to get hidden by the surface in the common way.
- A blue rectangle uses the same coordinates as the red rectangle. But this time, the blue rectangle was added to an ILScreenGroup. Therefore, it gets always rendered on top of the world3d nodes (i.e. on top of the surface). This can be seen from the output: the blue rectangle is always completely visible. Even those parts, which are actually hidden by the surface.
- A fat yellow rectangle is used to mark the screen area of the hull of both other rectangles. Note that the yellow rectangle will always be rendered i) on top of the surface and ii) screen axis aligned – regardless of the orientation of the objects in the world coordinate system.
The example demonstrates how to transform from model view coordinate space into screen coordinate space in order to place objects in screen coordinates, with positions relating to objects in world coordinates. Since the transformation happens in the context of mouse event handlers, no rendering pipeline is available here. Hence, the collection and accumulation of the transformations from all relevant screen graph nodes must get implemented explicitly.
Last modified: July 20 2020 14:52