Viewing in 2D & 3D¶
2D Viewing¶
- world is infinite but screen is finite.
- 通过appropriate transformation可以得到通过screen看到的window
Window¶
- rectangular region, specified by a center
(xCenter, yCenter)
and sizewindowSize
- Screen referred to as Viewport is a discrete matrix of pixels specified by size
screenSize (in pixels)
-
Mapping the 2D world seen in the window onto the viewport is 2D viewing transformation, also called window-to-viewport transformation.
- 注意对image,x轴正向朝右,y轴正向朝下,而2D world中y轴正向朝上,因此在缩放时要加一个负号




- Aspect Ratio: 保高/保宽

-
OpenGL Commands
-
gluOrtho2D( left, right, bottom, top )
: Creates a matrix for projecting 2D coordinates onto the screen -
glViewport(x, y, width, height)
: Define a rectangle of pixels onto which the final image is mapped.- `(x, y)` specifies the lower-left corner of the viewport. - `(width, height)` specifies the size of the viewport rectangle.
-
-
Modeling v.s. Viewing
- Modeling变换改变了world中放置的物体,会改变场景
- Viewing变换仅仅移动了相机,不改变场景
3D Viewing¶
To display a 3D world onto a 2D screen
Specification becomes complicated because there are many parameters to control
Additional task of reducing dimensions from 3D to 2D (projection)
3D viewing is analogous(类似) to taking a picture with a camera
- PRP: Projection Reference Point = Eye Position

-
Persepective Projection: Foreshortening depends on distance from viewer 不能用来测量
-
Engineering Viewing, Parallel Projection: DOP, Direction of Projection = Eye position at infinity

-
Oblique Projection(斜平行)
- Projectors make an arbitrary angle with the projection plane
- Angles in planes parallel to the projection plane are preserved

- View Specification

- 通过一个绝对的upVector进行正交化得到一个和viewDirection垂直的向量

- world-to-view transformation or view orientation matrix: 将世界坐标系变换到相机坐标系

- Perspective Projection
- prp: projection reference point or cop: center of projection

- View Window

- Perspective Viewing

- Parallel Viewing

-
View Volume: 在此以外的内容看不到,不用考虑
- Perspective projection
- Parallel projection
Complete View Specification¶
-
Specification in world coordinates
- position of viewing (vrp), direction of viewing(-n),
- up direction for viewing (upVector)
-
Specification in view coordinates
- view window : center (cx, cy), width and height,
- prp : distance from the view plane,
- front clipping plane : distance from view plane
- back clipping plane : distance from view plane
