|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.starhope.appius.geometry.Polygon
public class Polygon
General polygon consisting of a series of line segments
Field Summary | |
---|---|
protected Circle |
boundingCircle
WRITEME: Document this brpocock@star-hope.org |
protected Rectangle |
boundingRectangle
Bounding rectangle |
protected Coord2D[] |
points
WRITEME: Document this brpocock@star-hope.org |
protected LineSeg2D[] |
segments
WRITEME: Document this brpocock@star-hope.org |
Constructor Summary | |
---|---|
|
Polygon(Coord2D... newPoints)
Constructs a closed polygon using the given set of points as line segments |
private |
Polygon(Coord2D[] newPoints,
LineSeg2D[] newSegments,
Circle newBoundingCircle)
Private constructor used during internal changes to avoid the overhead of recalcuating bounding stuff ASSUMES you know what you're doing! |
|
Polygon(double[] xPoints,
double[] yPoints)
Constructs a polygon from a pair of arrays. |
|
Polygon(List<Coord2D> newPoints)
WRITEME: Document this constructor brpocock@star-hope.org |
Method Summary | |
---|---|
private void |
computeBounds()
Computes a rough bounding circle and rectangle |
private LineSeg2D[] |
computeSegments()
Computes the line segments for the polygon |
boolean |
contains(Coord2D coord2d)
Tests to see if we are inside of the polygon. |
boolean |
contains(double x,
double y)
Determines if the polygon contains that point |
Circle |
getBoundingCircle()
|
Rectangle |
getBoundingRectangle()
WRITEME: Document this method brpocock@star-hope.org |
Coord2D |
getCenter()
|
Coord2D[] |
getPoints()
|
LineSeg2D[] |
getSegments()
|
Coord2D[] |
intersection(LineSeg2D lSeg2d)
Gets all the intersection points between two polygons |
boolean |
intersects(LineSeg2D lSeg2d)
Determines if the polygon intersects the line segment |
boolean |
intersects(PolygonPrimitive<?> polygon)
Determines if this polygon intersects with another one |
boolean |
intersectsCircle(Circle circle)
WRITEME: Document this method brpocock@star-hope.org |
boolean |
intersectsPoly(Polygon polygon)
WRITEME: Document this method brpocock@star-hope.org |
boolean |
intersectsRect(Rectangle rectangle)
WRITEME: Document this method brpocock@star-hope.org |
Polygon |
scale(double sizeScalar)
WRITEME: Document this method brpocock@star-hope.org |
String |
toRoomVar()
|
String |
toString()
format roughly {(x,y),(x,y)…} |
Polygon |
translate(Coord2D coord2d)
WRITEME: Document this method brpocock@star-hope.org |
Polygon |
translate(double x,
double y)
Translates the object |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Circle boundingCircle
protected Rectangle boundingRectangle
protected final Coord2D[] points
protected final LineSeg2D[] segments
Constructor Detail |
---|
public Polygon(Coord2D... newPoints)
newPoints
- The points to use to construct the polygonprivate Polygon(Coord2D[] newPoints, LineSeg2D[] newSegments, Circle newBoundingCircle)
newPoints
- WRITEMEnewSegments
- WRITEMEnewBoundingCircle
- WRITEMEpublic Polygon(double[] xPoints, double[] yPoints) throws ParameterException
xPoints
- Array of x coordinate pointsyPoints
- Array of y coordinate points
ParameterException
- The number of x and y coordinates must
matchpublic Polygon(List<Coord2D> newPoints)
newPoints
- WRITEMEMethod Detail |
---|
private void computeBounds()
private LineSeg2D[] computeSegments()
public boolean contains(Coord2D coord2d)
contains
in interface PolygonPrimitive<Polygon>
coord2d
- WRITEME
PolygonPrimitive.contains(org.starhope.appius.geometry.Coord2D)
public boolean contains(double x, double y)
PolygonPrimitive
contains
in interface PolygonPrimitive<Polygon>
x
- WRITEMEy
- WRITEME
PolygonPrimitive.contains(double,
double)
public Circle getBoundingCircle()
public Rectangle getBoundingRectangle()
public Coord2D getCenter()
getCenter
in interface PolygonPrimitive<Polygon>
PolygonPrimitive.getCenter()
public Coord2D[] getPoints()
public LineSeg2D[] getSegments()
public Coord2D[] intersection(LineSeg2D lSeg2d)
intersection
in interface PolygonPrimitive<Polygon>
lSeg2d
- WRITEME
PolygonPrimitive.intersection(org.starhope.appius.geometry.LineSeg2D)
public boolean intersects(LineSeg2D lSeg2d)
PolygonPrimitive
intersects
in interface PolygonPrimitive<Polygon>
lSeg2d
- WRITEME
PolygonPrimitive.intersects(org.starhope.appius.geometry.LineSeg2D)
public boolean intersects(PolygonPrimitive<?> polygon)
Determines if this polygon intersects with another one
XXX: There has to be a better way than this
intersects
in interface PolygonPrimitive<Polygon>
polygon
- WRITEME
public boolean intersectsCircle(Circle circle)
intersectsCircle
in interface PolygonPrimitive<Polygon>
circle
- WRITEME
public boolean intersectsPoly(Polygon polygon)
intersectsPoly
in interface PolygonPrimitive<Polygon>
polygon
- WRITEME
public boolean intersectsRect(Rectangle rectangle)
intersectsRect
in interface PolygonPrimitive<Polygon>
rectangle
- WRITEME
public Polygon scale(double sizeScalar)
PolygonPrimitive
scale
in interface PolygonPrimitive<Polygon>
sizeScalar
- WRITEME
PolygonPrimitive.scale(double)
public String toRoomVar()
public String toString()
toString
in class Object
Object.toString()
public Polygon translate(Coord2D coord2d)
PolygonPrimitive
translate
in interface PolygonPrimitive<Polygon>
coord2d
- The amount to move
PolygonPrimitive.translate(org.starhope.appius.geometry.Coord2D)
public Polygon translate(double x, double y)
PolygonPrimitive
translate
in interface PolygonPrimitive<Polygon>
x
- The amount to move on the x-axisy
- The amount to move on the y-axis
PolygonPrimitive.translate(double,
double)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |