toxi.geom
Class SutherlandHodgemanClipper
java.lang.Object
toxi.geom.SutherlandHodgemanClipper
- All Implemented Interfaces:
- PolygonClipper2D
public class SutherlandHodgemanClipper
- extends java.lang.Object
- implements PolygonClipper2D
A simplified, rectangle-only version of the Sutherland-Hodgeman polygon
clipping algorithm to clip 2D polygons.
More information: http://en.wikipedia.org/wiki/Sutherland-Hodgman_algorithm
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SutherlandHodgemanClipper
public SutherlandHodgemanClipper(Rect bounds)
clipPolygon
public Polygon2D clipPolygon(Polygon2D poly)
- Description copied from interface:
PolygonClipper2D
- Creates a clipped version of the polygon to the boundary shape set.
- Specified by:
clipPolygon
in interface PolygonClipper2D
- Parameters:
poly
- polygon to be clipped
- Returns:
- clipped poly
getBounds
public Rect getBounds()
- Returns:
- the bounding rect
setBounds
public void setBounds(Rect bounds)
- Parameters:
bounds
- the bounding rect to set