Package boofcv.struct

Class PackedSetsPoint2D_I32


public class PackedSetsPoint2D_I32 extends Object
Compact storage for a set of points. Designed to minimize memory usage. New points can only be added to a set when the set is the tail/last one in the list.

Internally, the value of each point is stored in one or more int[] arrays. The maximum size of each array is specified in the constructor. These arrays are known as blocks. A set of points specifies which block the first element belongs in, the index and how many points are in the set.

  • Constructor Details

    • PackedSetsPoint2D_I32

      public PackedSetsPoint2D_I32(int blockLength)
      Configures the storage
      blockLength - Number of elements in the block's array. Try 2000
    • PackedSetsPoint2D_I32

      public PackedSetsPoint2D_I32()
  • Method Details

    • reset

      public void reset()
      Discards all previously detected points but does not free its memory. This allows it to be recycled
    • grow

      public void grow()
      Adds a new point set to the end.
    • removeTail

      public void removeTail()
      Removes the current point set from the end
    • addPointToTail

      public void addPointToTail(int x, int y)
      Adds a point to the tail point set
      x - coordinate
      y - coordinate
    • totalPoints

      public int totalPoints()
      Total number of points
    • size

      public int size()
      Number of point sets
      number of point sets
    • sizeOfSet

      public int sizeOfSet(int which)
      Returns the size/length of a point set
      which - index of point set
      the size
    • getSet

      public void getSet(int which, DogArray<Point2D_I32> list)
      Copies all the points in the set into the specified list
      which - (Input) which point set
      list - (Output) Storage for points
    • getSet

      public List<Point2D_I32> getSet(int which)
    • createIterator

      public PackedSetsPoint2D_I32.SetIterator createIterator()
    • sizeOfTail

      public int sizeOfTail()
      Returns the size of the set at the tail. If there is no tail an exception will be thrown.
    • writeOverSet

      public void writeOverSet(int which, List<Point2D_I32> points)
      Overwrites the points in the set with the list of points.
      points - Points which are to be written into the set. Must be the same size as the set.