Content deleted Content added
Win32Coder (talk | contribs) mNo edit summary |
Fix bug in CH clipper. |
||
Line 46:
begin
code := [];
if y > ymax then code := [TOP]
else if y < ymin then code := [BOTTOM];
if x > xmax then code := code +[RIGHT]▼
end;
Line 70 ⟶ 71:
{Now find intersection point;
use formulas y=y0+slope*(x-x0),x=x0+(1/slope)*(y-y0).}
if TOP in outcodeOut then
begin {Divide line at top of clip rectangle}
Line 75 ⟶ 77:
y := ymax
end
else if BOTTOM in outcodeOut then
begin {Divide line at bottom of clip rectangle}
x := x0 + (x1 - x0) * (ymin - y0) / (y1 - y0);
y := ymin
end
begin {Divide line at right edge of clip rectangle}
y := y0 + (y1 - y0) * (xmax - x0) / (x1 - x0);
Line 90 ⟶ 93:
x := xmin
end;
{Now we move outside point to intersection point to clip,
and get ready for next pass.}
|