public class Clip
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static float[] |
liang_clip(int xleft,
int xright,
int ytop,
int ybottom,
float[] x,
float[] y,
int n,
float[] ret_val)
Liang Barsy polygon clipping algorithm.
|
static int |
liang_get_buflen(int nverts)
Calculate the float[] x,y buffer length for nverts.
|
static int |
quickCheckLineClip(int x1,
int y1,
int x2,
int y2,
int xleft,
int xright,
int ytop,
int ybottom)
Check if a line is completely inside or completely outside
viewport.
|
public static final int liang_get_buflen(int nverts)
nverts
- number of vertspublic static final float[] liang_clip(int xleft, int xright, int ytop, int ybottom, float[] x, float[] y, int n, float[] ret_val)
Viewport: xleft < xright, ybottom < ytop
Set up with:
float[] ret_val = new float[n*2*2];
ret_val = liang_clip(,...,ret_val);
Points: xpoints, ypoints, npts HACK: closure on these points?
xleft
- left side of viewportxright
- right side of viewportytop
- top of viewportybottom
- bottom of viewportx
- float[] x coordsy
- float[] y coordsn
- numcoordsret_val
- float[] clipped polygonliang_get_buflen(int)
public static final int quickCheckLineClip(int x1, int y1, int x2, int y2, int xleft, int xright, int ytop, int ybottom)
x1
- pt1.xy1
- pt1.yx2
- pt2.xy2
- pt2.yxleft
- leftxright
- rightytop
- ytop < ybottomybottom
- ybottom < ytopCopyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details