toxi.geom
Class SutherlandHodgemanClipper

java.lang.Object
  extended by 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


Constructor Summary
SutherlandHodgemanClipper(Rect bounds)
           
 
Method Summary
 Polygon2D clipPolygon(Polygon2D poly)
          Creates a clipped version of the polygon to the boundary shape set.
 Rect getBounds()
           
 void setBounds(Rect bounds)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SutherlandHodgemanClipper

public SutherlandHodgemanClipper(Rect bounds)
Method Detail

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