Class KmgDoublePolygon
- java.lang.Object
-
- KmgDoublePolygon
-
public class KmgDoublePolygon extends Object
Stores the points ( xi, yi ) of a polygon.
-
-
Field Summary
Fields Modifier and Type Field Description int
elementCount
Number of valid points in this polygon.double[]
xData
Internal storage.double[]
yData
Internal storage.
-
Constructor Summary
Constructors Constructor Description KmgDoublePolygon()
Creates an empty polygon.KmgDoublePolygon(double[] xArray, double[] yArray)
Creates a polygon from two double arrays.KmgDoublePolygon(int initialCapacity)
Creates an empty polygon (with given initial capacity).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KmgDoublePolygon
add(double x, double y)
Adds a point ( x, y ) to this polygon.int
capacity()
Returns the current capacity.void
clear()
Removes all points.int
size()
Returns the number of points of the polygon.
-
-
-
Constructor Detail
-
KmgDoublePolygon
public KmgDoublePolygon()
Creates an empty polygon.
-
KmgDoublePolygon
public KmgDoublePolygon(int initialCapacity)
Creates an empty polygon (with given initial capacity).
-
KmgDoublePolygon
public KmgDoublePolygon(double[] xArray, double[] yArray)
Creates a polygon from two double arrays. Silently ignores surplus elements of the longer array if both arrays do not have equal length.
-
-
Method Detail
-
add
public KmgDoublePolygon add(double x, double y)
Adds a point ( x, y ) to this polygon. The capacity of the internal storage is increased dynamically if needed.
-
size
public int size()
Returns the number of points of the polygon.
-
capacity
public int capacity()
Returns the current capacity.
-
clear
public void clear()
Removes all points.
-
-