Modifier and Type | Method and Description |
---|---|
Point2D[] |
Polygon2D.asPointsArray()
This polygon as an array of points.
|
static Point2D[] |
TestPolygonGenerator.collinear1()
Makes a 10 point polygon that contains some collinear points (pattern 1)
|
static Point2D[] |
TestPolygonGenerator.collinear2()
Makes a 10 point polygon that contains some collinear points (pattern 2)
|
Point2D |
ShapeMap.destinationPoint()
Get the destination point (path ending point) of this map.
|
Point2D |
Polygon2D.get(int indx)
Get a specific vertex of the polygon.
|
Point2D |
Point2D.midPoint(Point2D p)
Get mid-point of this point and another point p.
|
static Point2D[] |
TestPolygonGenerator.randomPolyGaussian(int size)
Make a random set of points normally-distributed and centered on point (0.5,0.5).
|
static Point2D[] |
TestPolygonGenerator.randomPolyUniform(int size)
Make a random set of points uniformly distributed within the unit square from (0,0) to (1,1).
|
Point2D |
ShapeMap.sourcePoint()
Get the source point (path starting point) of this map.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<Point2D> |
ShapeMap.getAllPoints()
Get all points of all polygons in this shape map - does not include the source and destination points.
|
java.util.Iterator<Point2D> |
Polygon2D.iterator()
Iterator supporting for-each style iteration over all points in this polygon.
|
Modifier and Type | Method and Description |
---|---|
void |
Polygon2D.addPoint(Point2D p)
Add a point to this polygon.
|
static int |
Point2D.collinearMid(Point2D[] pts,
int i,
int j,
int k)
If the three points at the specified indices in pts are collinear,
return index of 'middle' point, otherwise return -1 |
static int |
Point2D.collinearMid(Point2D[] pts,
int i,
int j,
int k,
double delta)
If the three points at the specified indices in pts are collinear (within a given precision error),
return index of 'middle' point, otherwise return -1 |
boolean |
Polygon2D.contains(Point2D p)
Test if a specified point is contained inside this polygon.
Uses JTS method: boolean Geometry.contains(Geometry g) |
boolean |
Polygon2D.contains(Point2D p1,
Point2D p2)
Test if a specified line segment is entirely contained inside this polygon.
Uses JTS method: boolean Geometry.contains(Geometry g) |
boolean |
Polygon2D.disjoint(Point2D p1,
Point2D p2)
Test if the specified line segment points are disjoint from this polygon.
Returns true if none of the line segment points lie on the perimeter or the interior of this polygon. Uses JTS method: boolean Geometry.disjoint(Geometry g) |
double |
Point2D.distanceTo(Point2D p)
Distance from this point to another point p.
|
void |
Point2D.drawTo(Point2D p)
Draw a line from this point to anther point p using the current StdDraw color and pen width.
|
void |
Point2D.drawTo(Point2D p,
java.awt.Color clr)
Draw a line from this point to anther point p using a specified color.
|
void |
Point2D.drawTo(Point2D p,
java.awt.Color clr,
double penWidth)
Draw a line from this point to anther point p using a specified color and pen width.
|
boolean |
Polygon2D.intersects(Point2D p1,
Point2D p2)
Test if a specified line segment intersects this polygon.
Returns true if this polygon and the specified line segment have at least one point in common. Uses JTS method: boolean Geometry.intersects(Geometry g) |
boolean |
Point2D.isEqual(Point2D p)
Test if this point is coincident with another point p.
|
Point2D |
Point2D.midPoint(Point2D p)
Get mid-point of this point and another point p.
|
boolean |
Polygon2D.touches(Point2D p)
Test if a specified point touches this polygon.
Uses JTS method: boolean Geometry.touches(Geometry g) |
boolean |
Polygon2D.touches(Point2D p1,
Point2D p2)
Test if a specified line segment touches this polygon.
Returns true if this polygon and the line segment have at least one point in common, but none of the line segment points lie in the interior of the polygon perimeter. Uses JTS method: boolean Geometry.touches(Geometry g) |
Constructor and Description |
---|
Point2D(Point2D p)
Copy constructor - makes a copy of the specified point.
|
Polygon2D(Point2D[] points)
Construct a polygon from an array of points.
|
ShapeMap(java.util.ArrayList<Polygon2D> polys,
Point2D src,
Point2D dest)
Construct a ShapeMap with a specified set of polygons and a specified source and destination point.
|
ShapeMap(Point2D src,
Point2D dest)
Construct a ShapeMap with a specified source and destination point.
|
Constructor and Description |
---|
Polygon2D(java.util.List<Point2D> points)
Construct a polygon from a List of Point2D.
|