AnyLogic
Expand
Font size
All Implemented Interfaces:
Serializable

@AnyLogicInternalAPI
public class Polygon2D
extends Object
implements Serializable
See Also:
Serialized Form

Constructor Summary

ConstructorDescription
Polygon2D(MarkupShape owner) 

Method Summary

Modifier and TypeMethodDescription
voidaddVertex(double x, double y) 
booleancontains(double px, double py) 
doublegetArea() 
PointgetCenter(Point out) 
doublegetNearestPoint(Point output, double rx, double ry) 
intgetNPoints()
Returns the number of points in the markup element.
Path2D.DoublegetPath() 
doublegetPointDx(int i)
Returns the x coordinate of a particular point of the markup element relative to the start point.
doublegetPointDy(int i)
Returns the y coordinate of a particular point of the markup element relative to the start point.
doublegetXMax()
Returns the x coordinate of the bottom-right corner of bounding rectangle for this markup element.
doublegetXMin()
Returns the x coordinate of the top-left corner of bounding rectangle for this markup element.
doublegetYMax()
Returns the y coordinate of the bottom-right corner of bounding rectangle for this markup element.
doublegetYMin()
Returns the y coordinate of the top-left corner of bounding rectangle for this markup element.
voidinitialize() 
PointrandomPointInside(Random rng, Point out) 
voidsetPoints(double[] dx, double[] dy) 

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

Polygon2D

public Polygon2D(MarkupShape owner)

Method Details

setPoints

public void setPoints(double[] dx,
 double[] dy)

addVertex

public void addVertex(double x,
 double y)

initialize

public void initialize()

getXMin

public double getXMin()
Returns the x coordinate of the top-left corner of bounding rectangle for this markup element. (#getX() is included)
Returns:
the minimum x coordinate of the markup element

getXMax

public double getXMax()
Returns the x coordinate of the bottom-right corner of bounding rectangle for this markup element. (#getX() is included)
Returns:
the maximum x coordinate of the markup element

getYMin

public double getYMin()
Returns the y coordinate of the top-left corner of bounding rectangle for this markup element. (#getY() is included)
Returns:
the minimum y coordinate of the markup element

getYMax

public double getYMax()
Returns the y coordinate of the bottom-right corner of bounding rectangle for this markup element. (#getY() is included)
Returns:
the maximum y coordinate of the markup element

getNPoints

public int getNPoints()
Returns the number of points in the markup element.
Returns:
the number of points in the markup element

getPointDx

public double getPointDx(int i)
Returns the x coordinate of a particular point of the markup element relative to the start point.
Parameters:
i - the index of the point (starting from 0)
Returns:
the x coordinate of the point relative to the start point (#getX(), #getY())

getPointDy

public double getPointDy(int i)
Returns the y coordinate of a particular point of the markup element relative to the start point.
Parameters:
i - the index of the point (starting from 0)
Returns:
the y coordinate of the point relative to the start point (#getX(), #getY())

getArea

public double getArea()

getPath

public Path2D.Double getPath()

getCenter

public Point getCenter(Point out)

randomPointInside

public Point randomPointInside(Random rng,
 Point out)

contains

public boolean contains(double px,
 double py)

getNearestPoint

public double getNearestPoint(Point output,
 double rx,
 double ry)