Package toxi.geom

Class SutherlandHodgemanClipper

java.lang.Object
toxi.geom.SutherlandHodgemanClipper
All Implemented Interfaces:
PolygonClipper2D

public class SutherlandHodgemanClipper extends Object implements PolygonClipper2D
A version of the Sutherland-Hodgeman algorithm to clip 2D polygons optimized for rectangular clipping regions. More information: http://en.wikipedia.org/wiki/Sutherland-Hodgman_algorithm
See Also:
  • Constructor Details

    • SutherlandHodgemanClipper

      public SutherlandHodgemanClipper(Rect bounds)
  • Method Details

    • 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