Compute each of the vertices against window edges. The inside vertices are saved for clipping against next boundary; outside vertices are discarded. There are four possible cases as we process line segments.
Let S = previous point and P = new point
Look at three examplesof solid polygon clipping
So have procedure:
procedure SOLID_POLY (N: integer; X, Y: Points; FILL_COLOR: integer);
var I : integer X_OUT, Y_OUT : Points; array [1..2] of real X_PDC, Y_PDC : PDC_Points; array [1..2] of integer M : integer;
begin POLYGON_CLIP (N, X, Y, M, X_OUT, Y_OUT); for I := 1 to M do PointViewingTransform(X_OUT[I], Y_OUT[I], X_PDC[I], Y_PDC[I]); FILL_AREA_SOLID (N, FILL_COLOR, X_PDC, Y_PDC); end;
Main Clipping Page
HyperGraph Table of Contents.
HyperGraph Home page.