public class Polygonal2DRegion extends AbstractRegion implements FlatRegion
world
Constructor and Description |
---|
Polygonal2DRegion()
Construct the region
|
Polygonal2DRegion(LocalWorld world)
Deprecated.
|
Polygonal2DRegion(LocalWorld world,
java.util.List<BlockVector2D> points,
int minY,
int maxY)
Deprecated.
|
Polygonal2DRegion(Polygonal2DRegion region)
Make a copy of another region.
|
Polygonal2DRegion(World world)
Construct the region.
|
Polygonal2DRegion(World world,
java.util.List<BlockVector2D> points,
int minY,
int maxY)
Construct the region.
|
Modifier and Type | Method and Description |
---|---|
void |
addPoint(BlockVector2D position)
Add a point to the list.
|
void |
addPoint(Vector position)
Add a point to the list.
|
void |
addPoint(Vector2D position)
Add a point to the list.
|
java.lang.Iterable<Vector2D> |
asFlatRegion()
Get this region as an iterable flat region.
|
Polygonal2DRegion |
clone()
Make a clone of the region.
|
static boolean |
contains(java.util.List<BlockVector2D> points,
int minY,
int maxY,
Vector pt)
Checks to see if a point is inside a region.
|
boolean |
contains(Vector position)
Returns true based on whether the region contains the point.
|
void |
contract(Vector... changes)
Contract the region.
|
void |
expand(Vector... changes)
Expand the region.
|
boolean |
expandY(int y)
Expand the height of the polygon to fit the specified Y.
|
int |
getArea()
Get the number of blocks in the region.
|
int |
getHeight()
Get Y-size.
|
int |
getLength()
Get Z-size.
|
Vector |
getMaximumPoint()
Get the upper point of a region.
|
int |
getMaximumY()
Gets the maximum Y value
|
Vector |
getMinimumPoint()
Get the lower point of a region.
|
int |
getMinimumY()
Gets the minimum Y value
|
int |
getMininumY()
Deprecated.
|
java.util.List<BlockVector2D> |
getPoints()
Get the list of points.
|
int |
getWidth()
Get X-size.
|
java.util.Iterator<BlockVector> |
iterator()
Get the iterator.
|
java.util.List<BlockVector2D> |
polygonize(int maxPoints)
Polygonizes a cross-section or a 2D projection of the region orthogonal to the Y axis.
|
protected void |
recalculate()
Recalculate the bounding box of this polygonal region.
|
void |
setMaximumY(int y)
Set the maximum Y.
|
void |
setMinimumY(int y)
Set the minimum Y.
|
void |
shift(Vector change)
Shift the region.
|
int |
size()
Return the number of points.
|
java.lang.String |
toString()
Returns string representation in the format
"(x1, z1) - ...
|
getCenter, getChunkCubes, getChunks, getWorld, setWorld, setWorld
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public Polygonal2DRegion()
@Deprecated public Polygonal2DRegion(LocalWorld world)
public Polygonal2DRegion(World world)
world
- the world@Deprecated public Polygonal2DRegion(LocalWorld world, java.util.List<BlockVector2D> points, int minY, int maxY)
public Polygonal2DRegion(World world, java.util.List<BlockVector2D> points, int minY, int maxY)
world
- the worldpoints
- list of pointsminY
- minimum YmaxY
- maximum Ypublic Polygonal2DRegion(Polygonal2DRegion region)
region
- the other regionpublic java.util.List<BlockVector2D> getPoints()
protected void recalculate()
public void addPoint(Vector2D position)
position
- the positionpublic void addPoint(BlockVector2D position)
position
- the positionpublic void addPoint(Vector position)
position
- the positionpublic int getMinimumY()
FlatRegion
getMinimumY
in interface FlatRegion
@Deprecated public int getMininumY()
public void setMinimumY(int y)
y
- the Ypublic int getMaximumY()
FlatRegion
getMaximumY
in interface FlatRegion
public void setMaximumY(int y)
y
- the Ypublic Vector getMinimumPoint()
Region
getMinimumPoint
in interface Region
public Vector getMaximumPoint()
Region
getMaximumPoint
in interface Region
public int getArea()
AbstractRegion
getArea
in interface Region
getArea
in class AbstractRegion
public int getWidth()
AbstractRegion
getWidth
in interface Region
getWidth
in class AbstractRegion
public int getHeight()
AbstractRegion
getHeight
in interface Region
getHeight
in class AbstractRegion
public int getLength()
AbstractRegion
getLength
in interface Region
getLength
in class AbstractRegion
public void expand(Vector... changes) throws RegionOperationException
Region
expand
in interface Region
changes
- array/arguments with multiple related changesRegionOperationException
public void contract(Vector... changes) throws RegionOperationException
Region
contract
in interface Region
changes
- array/arguments with multiple related changesRegionOperationException
public void shift(Vector change) throws RegionOperationException
Region
shift
in interface Region
shift
in class AbstractRegion
change
- the changeRegionOperationException
public boolean contains(Vector position)
Region
public static boolean contains(java.util.List<BlockVector2D> points, int minY, int maxY, Vector pt)
points
- a list of pointsminY
- the min YmaxY
- the max Ypt
- the position to checkpublic int size()
public boolean expandY(int y)
y
- the amount to expandpublic java.util.Iterator<BlockVector> iterator()
AbstractRegion
iterator
in interface java.lang.Iterable<BlockVector>
iterator
in class AbstractRegion
public java.lang.Iterable<Vector2D> asFlatRegion()
FlatRegion
asFlatRegion
in interface FlatRegion
public java.lang.String toString()
toString
in class java.lang.Object
public Polygonal2DRegion clone()
Region
clone
in interface Region
clone
in class AbstractRegion
public java.util.List<BlockVector2D> polygonize(int maxPoints)
Region
polygonize
in interface Region
polygonize
in class AbstractRegion
maxPoints
- maximum number of points to generate. -1 for no limit.