Package gov.nih.mipav.model.structures
Class PointStack
- java.lang.Object
-
- gov.nih.mipav.model.structures.PointStack
-
public class PointStack extends java.lang.Object
PointStack is a structure used specifically in ViewComponentEditImage for use in the active level set generation and was built for speed. However, I have included it in the model package in the hope that it can be used elsewhere.- Version:
- 0.1 April 7, 1998
- Author:
- Matthew J. McAuliffe
-
-
Constructor Summary
Constructors Constructor Description PointStack(int capacity)
PointStack.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPoint(int x, int y)
Adds a point to the arrays.java.awt.Polygon
exportPolygon()
Repackages arrays into a java polygon returns points in polygon form.void
getPoint(int index, int[] x, int[] y)
Get a point and stores it in the two input arrays.int
getPointX(int index)
Gets the x coordinate of a point.int
getPointY(int index)
Gets the y coordinate of a point.void
reset()
Removes all elements in array by setting data pointer to zero.int
setIndex(int index)
Sets the pointer to specific location return -1 if index exceeds location of valid data.int
size()
Returns the number of points.
-
-
-
Method Detail
-
addPoint
public void addPoint(int x, int y)
Adds a point to the arrays. Allocates more memory if necessary.- Parameters:
x
- x coordinatey
- y coordinate
-
exportPolygon
public java.awt.Polygon exportPolygon()
Repackages arrays into a java polygon returns points in polygon form.- Returns:
- DOCUMENT ME!
-
getPoint
public void getPoint(int index, int[] x, int[] y)
Get a point and stores it in the two input arrays.- Parameters:
index
- pointer into arrayx
- x coordinatey
- y coordinate
-
getPointX
public int getPointX(int index)
Gets the x coordinate of a point.- Parameters:
index
- pointer into array- Returns:
- x coordinate of point
-
getPointY
public int getPointY(int index)
Gets the y coordinate of a point.- Parameters:
index
- pointer into array- Returns:
- y coordinate of point
-
reset
public void reset()
Removes all elements in array by setting data pointer to zero.
-
setIndex
public int setIndex(int index)
Sets the pointer to specific location return -1 if index exceeds location of valid data.- Parameters:
index
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
size
public int size()
Returns the number of points.- Returns:
- the size of the array (i.e., the number of points)
-
-