2.5.1 Brute Force
cf. [FvDFH90, 3.12.2]
To clip a point against a rectangle
means to draw the point exactly if the following condition is satisfied:
and
Clipping a line against a rectangle can lead to one of the following cases:
- Both endpoints lie inside. Hence the whole segment is inside and is to be drawn completely.
- Exactly one endpoint lies inside. Hence the line hits boundary exactly once and we have to determine
the corresponding intersection point and clip the line there.
- Both endpoints lie outside. Then it is not clear whether the line hits the rectangle or not.
So we intersect this line with each of the 4 sides (i.e. the infinite lines) and check
whether some intersection points lies on the boundary of the rectangle. This is
best done in parametric form
But this is still an inefficient method.
Andreas Kriegl 2003-07-23