Clip (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.proj
Class Clip

    java.lang.Object
      com.bbn.openmap.proj.Clip

    public class Clip

extends java.lang.Object

Clipping functions.

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### liang_get_buflen

    public static final int liang_get_buflen(int nverts)

  Calculate the float[] x,y buffer length for nverts.

  Parameters:
    `nverts` - number of verts
  Returns:
    int length required

### liang_clip

    public static final 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.

  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?

  Parameters:
    `xleft` - left side of viewport
    `xright` - right side of viewport
    `ytop` - top of viewport
    `ybottom` - bottom of viewport
    `x` - float[] x coords
    `y` - float[] y coords
    `n` - numcoords
    `ret_val` - float[] clipped polygon
  See Also:
    `liang_get_buflen(int)`

### quickCheckLineClip

    public static final 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.

  Parameters:
    `x1` - pt1.x
    `y1` - pt1.y
    `x2` - pt2.x
    `y2` - pt2.y
    `xleft` - left
    `xright` - right
    `ytop` - ytop < ybottom
    `ybottom` - ybottom < ytop
  Returns:
    int -1=outside, 1=inside, 0=undetermined

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details