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 intelementCountNumber of valid points in this polygon.double[]xDataInternal storage.double[]yDataInternal 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 KmgDoublePolygonadd(double x, double y)Adds a point ( x, y ) to this polygon.intcapacity()Returns the current capacity.voidclear()Removes all points.intsize()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.
-
-