Package gov.nih.mipav.model.structures
Class PointStack
java.lang.Object
gov.nih.mipav.model.structures.PointStack
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
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPoint(int x, int y) Adds a point to the arrays.Repackages arrays into a java polygon returns points in polygon form.voidgetPoint(int index, int[] x, int[] y) Get a point and stores it in the two input arrays.intgetPointX(int index) Gets the x coordinate of a point.intgetPointY(int index) Gets the y coordinate of a point.voidreset()Removes all elements in array by setting data pointer to zero.intsetIndex(int index) Sets the pointer to specific location return -1 if index exceeds location of valid data.intsize()Returns the number of points.
-
Field Details
-
xBuffer
protected int[] xBufferDOCUMENT ME! -
yBuffer
protected int[] yBufferDOCUMENT ME! -
chunk
private int chunkDOCUMENT ME! -
ptr
private int ptrDOCUMENT ME!
-
-
Constructor Details
-
PointStack
public PointStack(int capacity) PointStack.- Parameters:
capacity- initial size of the arrays
-
-
Method Details
-
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
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)
-