Avoid introduction like I am.glad
Avoid introduction like I am.glad
Key Concepts
● World Coordinates: This is the initial coordinate system where 3D objects are defined. It's
independent of the display device.
● Window: A rectangular subset of the world coordinate system that specifies the portion you
want to view on the screen.
● Viewport: The designated rectangular area on the display screen where the transformed
objects will be displayed.
Transformation Process
1. Normalization: Objects in the world coordinates are often scaled and translated to a
normalized device coordinate (NDC) space that typically ranges from -1 to 1 in both the X
and Y directions.
2. Window Definition: You define the window coordinates (usually (xw_min, xw_max,
yw_min, yw_max)) that specify the rectangular portion of the NDC space you want to
display.
3. Viewport Definition: You define the viewport coordinates (usually (xv_min, xv_max,
yv_min, yv_max)) that specify the rectangular area on the screen where the window will be
mapped.
4. Scaling and Translation: A scaling and translation transformation is applied to map the
window coordinates onto the viewport coordinates. This ensures that the objects fit
proportionally within the viewport.
Mathematical Representation
| Sx 0 Tx |
| 0 Sy Ty |
where:
Benefits
● Flexibility: The window to viewport transformation allows you to control which portion of the
world is displayed and how it's scaled and positioned on the screen.
● Adaptability: This transformation enables you to adapt the view to different screen sizes and
resolutions while maintaining the relative positions of objects within the world.
Additional Considerations
● In some cases, you might need to perform clipping before the window to viewport
transformation to remove objects that are outside the viewing frustum (the portion of the
world that is visible to the camera).
● The specific implementation details of the window to viewport transformation can vary
depending on the graphics API or library you're using.