27
Coordinate Systems Lecture 1 Fri, Sep 2, 2005

Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Embed Size (px)

DESCRIPTION

Changing Coordinate Systems In most cases, we change from one coordinate system to another by using a linear transformation. A linear transformation is a function that can be described by matrix multiplication. X' = AX.

Citation preview

Page 1: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Coordinate Systems

Lecture 1Fri, Sep 2, 2005

Page 2: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

The Coordinate Systems

The points we create are transformed through a series of coordinate systems before being drawn on the screen. Model coordinates World coordinates Eye coordinates Clip coordinates Normalized device coordinates Viewport coordinates Screen coordinates

Page 3: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Changing Coordinate Systems

In most cases, we change from one coordinate system to another by using a linear transformation.A linear transformation is a function that can be described by matrix multiplication.

X' = AX.

Page 4: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Affine and Projective Transformations

A linear transformation always maps lines to lines, i.e., collinear points to collinear points.An affine linear transformation always maps Parallel lines to parallel lines. Intersecting lines to intersecting lines.A projective linear transformation may map Parallel lines to intersecting lines. Intersecting lines to parallel lines.

Page 5: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Model Coordinates

An object is first drawn in model coordinates.This is a coordinate system that is local to the object.The origin and the axes are selected for convenience relative to that object.

Page 6: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

ExamplesSphere Place the origin at the center of the

sphere.Cube Place the origin at one corner. Place the adjacent corners on the

positive x-, y-, and z-axes.Cone?Cylinder?

Page 7: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Model Coordinates for a Cube

Read

Run

Page 8: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

World Coordinates

The world coordinate system is the system of coordinates used for building the 3-D scene in a single unified model.The origin and axes are chosen for convenience.

Page 9: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Example

Imagine a scene with five cubes spaced out in a row.Each cube has its own model coordinate system.There is only one world coordinate system.

Page 10: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Five Cubes in a Row

Read

Run

Page 11: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

World Coordinates

Linear transformations are used to move the objects from their local coordinate systems to the world coordinate system. Translations Rotations Reflections Scalings

Page 12: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Eye Coordinates

In the eye coordinate system, the viewpoint, or “eye,” or “camera” is Located at the origin. Looking down the negative z-axis.

Page 13: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

The Eye Coordinate System

x

y

zEye

Directionof view

Page 14: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Eye CoordinatesLinear transformations are used to move the eye from the origin to the desired viewing position in world coordinates. Translations RotationsActually, it is the inverse of this transformation that is applied to transform the objects from world coordinates to eye coordinates.

Page 15: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

The View Frustum

The view frustum is a truncated rectangular pyramid with vertex at the eye and bases parallel to the line of sight.It is bounded by six planes. The left and right planes. The top and bottom planes. The near and far planes.

Page 16: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

The View Frustum

Read

Run

Page 17: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

The View Frustum

The view frustum represents that part of the scene that will be visible on the computer screen.For technical reasons, the near and far planes eliminate objects that are either too near or too far away.

Page 18: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

The View Frustum Transformed

Read

Run

Page 19: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Clip CoordinatesEye coordinates are transformed to clip coordinates by another linear transformation.It transforms the view frustum into sort of a cube.This transformation distorts angles and distances.In clip space, the GPU “clips” all objects, removing objects or parts of objects that are outside of the view frustum.

Page 20: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Normalized Device Coordinates

The view frustum is like a distorted cube.The transformation to clip coordinates followed by the perspective division, transforms the view frustum into a perfect cube.This coordinate system is called normalized device coordinates.This transformation is less intuitive; we will learn the details later.

Page 21: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Normalized Device Coordinates

The cube is centered at the origin.Each dimension ranges from -1 to 1. -1 x 1 -1 y 1 -1 z 1

Page 22: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Normalized Coordinates

x

y

z

Page 23: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Viewport Coordinates

The coordinate system of the drawing region on the 2-D screen is the viewport coordinate system. The origin (0, 0) is the lower left

corner. Increasing x is to the right. Increasing y is up.

Page 24: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Viewport Coordinates

(0, 0)x

y

(x, y)

Page 25: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Window Coordinates

The window coordinate system is like the screen coordinate system, except that The origin is in the upper left corner. Increasing y is down.

Page 26: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Window Coordinates(0, 0)

x

y

Theviewportwithinthe window

(x, y)

Page 27: Coordinate Systems Lecture 1 Fri, Sep 2, 2005. The Coordinate Systems The points we create are transformed through a series of coordinate systems before

Window Coordinates

Normally, the viewport will fill the window. Thus, the x-coordinates will be the same.

xview = xwindow

The y-coordinates will run in opposite directions.

yview = screen height – ywindow