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
Modifier and TypeClassDescriptionclass
Used to access all the points in a set without making a copy. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPointToTail
(int x, int y) Adds a point to the tail point setgetSet
(int which) void
getSet
(int which, DogArray<Point2D_I32> list) Copies all the points in the set into the specified listvoid
grow()
Adds a new point set to the end.void
Removes the current point set from the endvoid
reset()
Discards all previously detected points but does not free its memory.int
size()
Number of point setsint
sizeOfSet
(int which) Returns the size/length of a point setint
Returns the size of the set at the tail.int
Total number of pointsvoid
writeOverSet
(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.
-