Package org.oscim.utils.geom
Class LineClipper
java.lang.Object
org.oscim.utils.geom.LineClipper
from http://en.wikipedia.org/wiki/Cohen%E2%80%93
Sutherland_algorithm
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintclipLine(GeometryBuffer in, GeometryBuffer out) intclipNext(float x1, float y1) intclipSegment(float x1, float y1, float x2, float y2) booleanclipStart(float x0, float y0) float[]getLine(float[] out, int offset) intintoutcode(float x, float y) voidsetRect(float minx, float miny, float maxx, float maxy)
-
Field Details
-
INSIDE
public static final int INSIDE- See Also:
-
LEFT
public static final int LEFT- See Also:
-
RIGHT
public static final int RIGHT- See Also:
-
BOTTOM
public static final int BOTTOM- See Also:
-
TOP
public static final int TOP- See Also:
-
OUTSIDE
public static final int OUTSIDE- See Also:
-
INTERSECTION
public static final int INTERSECTION- See Also:
-
outX1
public float outX1 -
outY1
public float outY1 -
outX2
public float outX2 -
outY2
public float outY2
-
-
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
-