Package technology.tabula
Class CohenSutherlandClipping
java.lang.Object
technology.tabula.CohenSutherlandClipping
Implements the well known Cohen Sutherland line
clipping algorithm (line against clip rectangle).
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a Cohen Sutherland clipper with clip window (0, 0, 0, 0).CohenSutherlandClipping(Rectangle2D clipWindow) Creates a Cohen Sutherland clipper with the given clip window. -
Method Summary
Modifier and TypeMethodDescriptionbooleanclip(Line2D.Float line) Clips a given line against the clip window.voidsetClip(Rectangle2D clipWindow) Sets the clip rectangle.
-
Constructor Details
-
CohenSutherlandClipping
public CohenSutherlandClipping()Creates a Cohen Sutherland clipper with clip window (0, 0, 0, 0). -
CohenSutherlandClipping
Creates a Cohen Sutherland clipper with the given clip window.- Parameters:
clipWindow- the clip window to use.
-
-
Method Details
-
setClip
Sets the clip rectangle.- Parameters:
clipWindow- the clip window.
-
clip
Clips a given line against the clip window. The modification (if needed) is done in place.- Parameters:
line- the line to clip.- Returns:
- true if line is clipped, false if line is totally outside the clip window.
-