Package boofcv.struct
Class PackedSetsPoint2D_I32
java.lang.Object
boofcv.struct.PackedSetsPoint2D_I32
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassUsed to access all the points in a set without making a copy. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPointToTail(int x, int y) Adds a point to the tail point setgetSet(int which) voidgetSet(int which, DogArray<Point2D_I32> list) Copies all the points in the set into the specified listvoidgrow()Adds a new point set to the end.voidRemoves the current point set from the endvoidreset()Discards all previously detected points but does not free its memory.intsize()Number of point setsintsizeOfSet(int which) Returns the size/length of a point setintReturns the size of the set at the tail.intTotal number of pointsvoidwriteOverSet(int which, List<Point2D_I32> points) Overwrites the points in the set with the list of points.
-
Constructor Details
-
PackedSetsPoint2D_I32
public PackedSetsPoint2D_I32(int blockLength) Configures the storage- Parameters:
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- Parameters:
x- coordinatey- coordinate
-
totalPoints
public int totalPoints()Total number of points -
size
public int size()Number of point sets- Returns:
- number of point sets
-
sizeOfSet
public int sizeOfSet(int which) Returns the size/length of a point set- Parameters:
which- index of point set- Returns:
- the size
-
getSet
Copies all the points in the set into the specified list- Parameters:
which- (Input) which point setlist- (Output) Storage for points
-
getSet
-
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
Overwrites the points in the set with the list of points.- Parameters:
points- Points which are to be written into the set. Must be the same size as the set.
-