0% found this document useful (0 votes)
1 views

Window to Viewport Transformation Presentation

Window to viewport transformation in computer graphics maps a selected portion of the world coordinate system (window) to a specific area on the display device (viewport). This process involves translating and scaling coordinates to ensure the relative positions and proportions of objects are maintained. Clipping and zooming techniques can also be applied to enhance the display of the scene.

Uploaded by

shakyalish2059
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Window to Viewport Transformation Presentation

Window to viewport transformation in computer graphics maps a selected portion of the world coordinate system (window) to a specific area on the display device (viewport). This process involves translating and scaling coordinates to ensure the relative positions and proportions of objects are maintained. Clipping and zooming techniques can also be applied to enhance the display of the scene.

Uploaded by

shakyalish2059
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Window to Viewport

Transformation
• Subject: Computer Graphics and Animation

• (Image: Screen with transformation arrows.)


Introduction
• In computer graphics, to display a part of a
scene on the screen, we use window to
viewport transformation.

• The window selects a portion of the world


coordinate system (logical coordinates).
• The viewport is the area on the display device
(screen) where the window content is
mapped.
What is a Window?
• A window is a rectangular area in the world
coordinate system.

• It defines the part of the scene we want to


view.
• Coordinates of the window are defined by:
• - Lower-left corner
• - Upper-right corner
What is a Viewport?
• A viewport is a rectangular area on the display
device (screen).

• It defines where and how the window content


will be displayed on the screen.
• Coordinates of the viewport are:
• - Lower-left corner
• - Upper-right corner
Why is Transformation Needed?
• The window uses world coordinates, but the
screen uses device coordinates (pixels).

• To display the selected window content on the


viewport, coordinates must be transformed.

• This transformation maintains the relative


position and proportions of objects.
Transformation Steps
• 1. Translate the window coordinates so that
the window's lower-left corner moves to the
origin.
• 2. Scale the translated coordinates to match
the size of the viewport.
• 3. Translate the scaled coordinates to the
viewport's position on the screen.
• 4. (Optional) Apply clipping to remove parts
outside the window.
Mathematical Formula
• For a point (Xw, Yw) in window coordinates,
the corresponding viewport coordinates (Xv,
Yv) are:

• Xv = Xvmin + (Xw - Xwmin) * (Xvmax - Xvmin) /


(Xwmax - Xwmin)
• Yv = Yvmin + (Yw - Ywmin) * (Yvmax - Yvmin) /
(Ywmax - Ywmin)
Clipping and Zooming
• Clipping: Parts of objects outside the window
are not displayed.

• Zooming: Achieved by changing the window


size while keeping the viewport fixed.
• - Smaller window → zoom in (objects appear
larger)
• - Larger window → zoom out (objects appear
smaller)
Example with Diagram
• Suppose:
• Window: (1,1) to (3,3)
• Viewport: (0,0) to (6,6)
• Point in window: (2,2)

• Calculate viewport point:


• (2,2) maps to (3,3)

• Diagram shows window and viewport


Summary
• Window to viewport transformation maps
world coordinates to device coordinates.

• Involves translation and scaling to fit the


selected window into the viewport.

• Maintains relative positions and proportions


of objects.

You might also like