Class 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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int chunk
      DOCUMENT ME!
      private int ptr
      DOCUMENT ME!
      protected int[] xBuffer
      DOCUMENT ME!
      protected int[] yBuffer
      DOCUMENT ME!
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • xBuffer

        protected int[] xBuffer
        DOCUMENT ME!
      • yBuffer

        protected int[] yBuffer
        DOCUMENT ME!
      • chunk

        private int chunk
        DOCUMENT ME!
      • ptr

        private int ptr
        DOCUMENT ME!
    • Constructor Detail

      • PointStack

        public PointStack​(int capacity)
        PointStack.
        Parameters:
        capacity - initial size of the arrays
    • Method Detail

      • addPoint

        public void addPoint​(int x,
                             int y)
        Adds a point to the arrays. Allocates more memory if necessary.
        Parameters:
        x - x coordinate
        y - 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 array
        x - x coordinate
        y - 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)