public class GeoConvexPolygon extends GeoBasePolygon
Modifier and Type | Field and Description |
---|---|
protected GeoPoint[] |
edgePoints
A point which is on the boundary of the polygon
|
protected SidedPlane[] |
edges
A list of edges
|
protected double |
fullDistance
Tracking the maximum distance we go at any one time, so to be sure it's legal
|
protected boolean |
isDone
Set to true when the polygon is complete
|
protected BitSet |
isInternalEdges
A bitset describing, for each edge, whether it is internal or not
|
protected GeoPoint[][] |
notableEdgePoints
The set of notable points for each edge
|
protected List<GeoPoint> |
points
The list of polygon points
|
planetModel
Constructor and Description |
---|
GeoConvexPolygon(PlanetModel planetModel,
double startLatitude,
double startLongitude)
Create a convex polygon, with a starting latitude and longitude.
|
GeoConvexPolygon(PlanetModel planetModel,
List<GeoPoint> pointList)
Create a convex polygon from a list of points.
|
GeoConvexPolygon(PlanetModel planetModel,
List<GeoPoint> pointList,
BitSet internalEdgeFlags,
boolean returnEdgeInternal)
Create a convex polygon from a list of points, keeping track of which boundaries
are internal.
|
Modifier and Type | Method and Description |
---|---|
void |
addPoint(double latitude,
double longitude,
boolean isInternalEdge)
Add a point to the polygon.
|
protected void |
createCenterPoint()
Compute a reasonable center point.
|
void |
done(boolean isInternalReturnEdge)
Finish the polygon, by connecting the last added point with the starting point.
|
boolean |
equals(Object o) |
void |
getBounds(Bounds bounds)
Compute bounds for the shape.
|
GeoPoint[] |
getEdgePoints()
Return a sample point that is on the outside edge/boundary of the shape.
|
int |
hashCode() |
boolean |
intersects(Plane p,
GeoPoint[] notablePoints,
Membership... bounds)
Assess whether a plane, within the provided bounds, intersects
with the shape.
|
boolean |
isWithin(double x,
double y,
double z)
Check if a point is within this shape.
|
protected int |
legalIndex(int index)
Compute a legal point index from a possibly illegal one, that may have wrapped.
|
protected double |
outsideDistance(DistanceStyle distanceStyle,
double x,
double y,
double z)
Called by a
computeOutsideDistance method if X/Y/Z is not within this shape. |
String |
toString() |
computeOutsideDistance, computeOutsideDistance, isWithin
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
computeOutsideDistance, computeOutsideDistance
isWithin
protected final BitSet isInternalEdges
protected SidedPlane[] edges
protected GeoPoint[][] notableEdgePoints
protected GeoPoint[] edgePoints
protected double fullDistance
protected boolean isDone
public GeoConvexPolygon(PlanetModel planetModel, List<GeoPoint> pointList)
planetModel
- is the planet model.pointList
- is the list of points to create the polygon from.public GeoConvexPolygon(PlanetModel planetModel, List<GeoPoint> pointList, BitSet internalEdgeFlags, boolean returnEdgeInternal)
planetModel
- is the planet model.pointList
- is the set of points to create the polygon from.internalEdgeFlags
- is a bitset describing whether each edge is internal or not.returnEdgeInternal
- is true when the final return edge is an internal one.public GeoConvexPolygon(PlanetModel planetModel, double startLatitude, double startLongitude)
-PI/2 -> PI/2
, lon: -PI -> PI
planetModel
- is the planet model.startLatitude
- is the latitude of the first point.startLongitude
- is the longitude of the first point.public void addPoint(double latitude, double longitude, boolean isInternalEdge)
-PI/2 -> PI/2
, lon: -PI -> PI
latitude
- is the latitude of the next point.longitude
- is the longitude of the next point.isInternalEdge
- is true if the edge just added with this point should be considered "internal", and not
intersected as part of the intersects() operation.public void done(boolean isInternalReturnEdge)
isInternalReturnEdge
- is true if the return edge (back to start) is an internal one.protected void createCenterPoint()
protected int legalIndex(int index)
index
- is the index.public boolean isWithin(double x, double y, double z)
Membership
x
- is x coordinate of point to check.y
- is y coordinate of point to check.z
- is z coordinate of point to check.public GeoPoint[] getEdgePoints()
GeoShape
public boolean intersects(Plane p, GeoPoint[] notablePoints, Membership... bounds)
GeoShape
p
- is the plane to assess for intersection with the shape's edges or
bounding curves.notablePoints
- represents the intersections of the plane with the supplied
bounds. These are used to disambiguate when two planes are identical and it needs
to be determined whether any points exist that fulfill all the bounds.bounds
- are a set of bounds that define an area that an
intersection must be within in order to qualify (provided by a GeoArea).public void getBounds(Bounds bounds)
GeoShape
getBounds
in interface GeoShape
getBounds
in class GeoBaseShape
bounds
- is the input bounds object.
The input object will be modified.protected double outsideDistance(DistanceStyle distanceStyle, double x, double y, double z)
GeoBaseMembershipShape
computeOutsideDistance
method if X/Y/Z is not within this shape.outsideDistance
in class GeoBaseMembershipShape
public boolean equals(Object o)
equals
in class BasePlanetObject
public int hashCode()
hashCode
in class BasePlanetObject
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.