Class CoordPolygon
java.lang.Object
org.rspeer.game.coord.shape.CoordPolygon
- All Implemented Interfaces:
CoordShape
-
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines whether the given coordinate lies inside this shape.static CoordPolygonConstructs a polygonal shape from the given vertices.getBoundary(boolean outer) Returns all coordinates on the boundary (perimeter) of the shape.Returns all coordinates contained within this shape.intReturns the set of vertices defining this shape.Allows this polygon to match coordinates on any floor level instead of onlyfloorLevel.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CoordShape
getCenter, getRandomCoord
-
Method Details
-
from
Constructs a polygonal shape from the given vertices.The floor level is taken from the first vertex (or 0 if none are given).
- Parameters:
vertices- the polygon vertices, in order
-
ignoreFloorLevel
Allows this polygon to match coordinates on any floor level instead of onlyfloorLevel.- Returns:
- this polygon (for chaining)
-
contains
Description copied from interface:CoordShapeDetermines whether the given coordinate lies inside this shape.- Specified by:
containsin interfaceCoordShape- Parameters:
node- the node to test- Returns:
trueif the shape contains the coordinate
-
getVertices
Description copied from interface:CoordShapeReturns the set of vertices defining this shape.For a rectangle, this is the 4 corner coordinates. For polygons, this would be all defining polygon points.
- Specified by:
getVerticesin interfaceCoordShape- Returns:
- an immutable set of shape-defining vertices
-
getBoundary
Description copied from interface:CoordShapeReturns all coordinates on the boundary (perimeter) of the shape.- Specified by:
getBoundaryin interfaceCoordShape- Parameters:
outer- iftrue, returns the ring of tiles immediately surrounding the shape;
iffalse, returns only the tiles forming the perimeter on the shape itself.- Returns:
- a set of coordinates representing the boundary
-
getCoords
Description copied from interface:CoordShapeReturns all coordinates contained within this shape.For large shapes, this may be a large collection.
- Specified by:
getCoordsin interfaceCoordShape- Returns:
- a set of all coordinates inside the region
-
getFloorLevel
public int getFloorLevel()- Specified by:
getFloorLevelin interfaceCoordShape
-
getPolygonView
-