public class Polygon2D
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
int |
npoints |
float[] |
xpoints |
float[] |
ypoints |
Constructor and Description |
---|
Polygon2D() |
Polygon2D(float[] xpts,
float[] ypts) |
Polygon2D(float[] xpts,
float[] ypts,
int npts) |
Polygon2D(Point2D[] pts) |
Polygon2D(Point2D[] pts,
int offset) |
Polygon2D(Point2D[] pts,
int offset,
int npts) |
Modifier and Type | Method and Description |
---|---|
void |
addPoint(float x,
float y) |
float |
area() |
Point2D |
centroid() |
boolean |
contains_down(float x,
float y)
Return true if thinks the given point is inside the polygon checking down.
|
boolean |
contains_downUp(float x,
float y,
boolean fromDown)
Return true if thinks the given point is inside the polygon checking down.
|
boolean |
contains_left(float x,
float y) |
boolean |
contains_right(float x,
float y)
Return true if thinks the given point is inside the polygon checking right.
|
boolean |
contains_rightLeft(float x,
float y,
boolean fromRight)
Return true if thinks the given point is inside the polygon when checking right.
|
boolean |
contains_up(float x,
float y) |
boolean |
contains(double x,
double y) |
boolean |
contains(float x,
float y)
4/23/11 when checking right or up still had problems when > saddle point,
so adding check left and up. |
boolean |
contains(int x,
int y) |
boolean |
contains(Polygon2D testpoly) |
boolean[][] |
getMask(int width,
int height) |
void |
getTestImg() |
float |
greatestDiameter() |
void |
test() |
java.lang.String |
toString() |
public int npoints
public float[] xpoints
public float[] ypoints
public Polygon2D()
public Polygon2D(float[] xpts, float[] ypts)
public Polygon2D(float[] xpts, float[] ypts, int npts)
public Polygon2D(Point2D[] pts)
public Polygon2D(Point2D[] pts, int offset)
public Polygon2D(Point2D[] pts, int offset, int npts)
public void test()
public void getTestImg()
public boolean[][] getMask(int width, int height)
public boolean contains(int x, int y)
public boolean contains(double x, double y)
public boolean contains(float x, float y)
WO 3/7/2013 discovered an error when have ribbon polygon (snake indentation) that overlaps itself, then the overlapped region which is inside both ribbons is considered to be outside the polygon.
public boolean contains_rightLeft(float x, float y, boolean fromRight)
public boolean contains_right(float x, float y)
public boolean contains_left(float x, float y)
public boolean contains_downUp(float x, float y, boolean fromDown)
public boolean contains_down(float x, float y)
public boolean contains_up(float x, float y)
public boolean contains(Polygon2D testpoly)
public void addPoint(float x, float y)
public Point2D centroid()
public float area()
public float greatestDiameter()
public java.lang.String toString()
toString
in class java.lang.Object