程序代写代做代考 Discussion Session 5

Discussion Session 5
Xin Wang

Requirements
¡ñ Implement your own graphics library:
¡ð Object drawing in black & white
¡ð Animation
¡ð Viewpoint change (optional)
¡ð No color/Lighting/shading/texture/shadow
¡ð CAN¡¯T use OpenGL or any other graphics libraries
¡ð Save each frame as an image file (ex. JPG, PPM)
¡ñ What you should turn in
¡ð All your code
¡ð Makefile, which can generate a series of image files for all frames
¡ð A video sequence or gif showing the final display result
¡ö you can use any softwares or free-use website to concatenate those frames

Rendering Pipeline
Graphics Primitives
Modeling Transform
View Transform
Projection (Normalization)
Bitmap / Color Buffer
Depth Test
Clipping

Rendering Pipeline
Graphics Primitives
Modeling Transform
View Transform
Projection (Normalization)
Bitmap / Color Buffer
Depth Test
Clipping

Rendering Pipeline
Graphics Primitives
Modeling Transform
View Transform
Projection (Normalization)
Bitmap / Color Buffer
Depth Test
Clipping

Rendering Pipeline
Graphics Primitives
Modeling Transform
View Transform
Projection (Normalization)
Bitmap / Color Buffer
Depth Test
Clipping

Rendering Pipeline
Available and can get concatenated into ONE before drawing any primitives
Graphics Primitives
Modeling Transform
View Transform
Projection (Normalization)
Bitmap / Color Buffer
Depth Test
Clipping

Rendering Pipeline
Graphics Primitives
Modeling Transform
View Transform
Projection (Normalization)
Bitmap / Color Buffer
Depth Test
Clipping

Rendering Pipeline
Graphics Primitives
Modeling Transform
View Transform
Projection (Normalization)
Bitmap / Color Buffer
Depth Test
Clipping
( Lines Drawing, Polygon Filling etc.)

Two missing technical details
1. Polygon Clipping (Sutherland Hodgman)
2. Obtain the plane equation from polygon vertices

Sutherland Hodgman Polygon Clipping
¡ñ Four types of Edges
1. Edges that are totally inside the clip window. – save the second inside vertex
2. Edges that are leaving the clip window. – save the intersection point as a vertex
3. Edges that are entirely outside the clip window. – save nothing
4. Edges that are entering the clip window. – save the intersection and inside points as vertices
2
31
4
Clip Window

Sutherland Hodgman Polygon Clipping ¡ñ What will happen here?

Sutherland Hodgman Polygon Clipping
¡ñ It is incorrect to consider a vertex as inside/outside of the clipping area
¡ñ Instead, for each vertex, tell whether it is in the inner or outer side of each edge of the clipping area

Sutherland Hodgman Polygon Clipping
¡ñ It is incorrect to consider a vertex as inside/outside of the clipping area
¡ñ Instead, for each vertex, tell whether it is in the inner or outer side of each edge of the clipping area
¡ñ It also works in 3D world, where the clipping area consists of 6 surfaces, instead of 4 edges.

Obtain the Plain Equation from Polygon Vertices
A
B
D
C

matrix.c
¡ñ Has all the matrix operations you need:
¡ð Inverse
¡ð Transpose
¡ð Addition/subtraction/multiplication
¡ð Inner/cross product
¡ð Determinant ¡ð…

Q& A