How does the basic “Clipping Algorithm / Cohen-Sutherland Algorithm” work
in case of non trivial:
- P1 and P2 have a bit difference
- calculate intersection with this edge (set Bit to 0)
- check again for line with this new point
-> if still not trivial: repeat process
How does “𝜶-Clipping” work
How does the “Polygon Clipping” algorithm by “Sutherland-Hodgman” work in 2D
For “Convex” clipping regions:
- iterate over all vertices in order (adjacent vertices are connected by line)
- after each edge => closed polygon => pipeline process
- 4 cases:
– both points inside => include both points
– both points outside => exclude both points
– Pi inside, Pi+1 outside => include first P1and then intersection with edge
– Pi outside , Pi+1 inside => include first intersection with edge and then P2
=> decomposition of triangles easy: Q1, Qi, Qi+1 (can be problematic though -> thin triangles)
=> interpolation possible with attributes (colors, normals, texture coordinates)
For “Non-Convex” clipping regions:
- divide in convex areas
How does the “Point-Inside-Polygon” Test work
Problem: What if ray along edge / through vertex
Solution:
- shoot ray in positive x direction: R1 (below), R2 (above, including yP)
- only count if end points of edge lie in different regions
What’s the Problem with “Perspective Projection” and “De-Homogenization” regarding clipping? How can it be solved?
How to transform from “Normalized Device Coordinates” to “Viewport”
How does “Line Rasterization” work? How does “Bresenham’s Line Algorithm” work?
Further Ideas:
- note: only 2 cases: next pixel to EAST or to NORTH-EAST
- find “Condition” to choose what case should be chosen
-> use y-value between two cases (edge of pixel)
-> check implicit representation of line -> F(x, y)
–> above point: NORTH-EAST
–> below point: EAST
=> multiplication still present + floating point precision problem
Bresenham’s Line Algorithm:
1. Incremental Version
- d := F(x0 + 1, y0 + 1/2) -> FTP number
- if d < 0
– NORTH-EAST case: (x0 + 1, y0 + 1)
– next test F(x0 + 2, y0 + 1.5)
–> change of d: (y0 - y1) + (x1 - x0)
–> d = d + (y0 - y1) + (x1 - x0)
- if d ≥ 0:
– EAST case
–> d = d + (y0 - y1)
What is a problem of “Line Rasterization” and how to fix it
How does “Rasterization of Polygons” work via the “Brute Force” approach
How does “Rasterization of Polygons” work via the “Scanline Polygon Rendering” approach? How to interpolate?
How to “Perspectively Interpolate Attributes” correctly
???