Class LineClipper

java.lang.Object
org.oscim.utils.geom.LineClipper

public class LineClipper extends Object
from http://en.wikipedia.org/wiki/Cohen%E2%80%93 Sutherland_algorithm
  • Field Details

  • Constructor Details

    • LineClipper

      public LineClipper(float minx, float miny, float maxx, float maxy)
  • Method Details

    • setRect

      public void setRect(float minx, float miny, float maxx, float maxy)
    • clipStart

      public boolean clipStart(float x0, float y0)
    • outcode

      public int outcode(float x, float y)
    • clipNext

      public int clipNext(float x1, float y1)
      Returns:
      OUTSIDE (= 1111) if not intersection, INSIDE (= 0) if fully within, INTERSECTION (= -1) if clipped (and 'out' set to new points)
    • clipSegment

      public int clipSegment(float x1, float y1, float x2, float y2)
    • getLine

      public float[] getLine(float[] out, int offset)
    • getPrevOutcode

      public int getPrevOutcode()
    • clipLine

      public int clipLine(GeometryBuffer in, GeometryBuffer out)