boofcv.misc
Class CircularIndex
- java.lang.Object
-
- boofcv.misc.CircularIndex
-
public class CircularIndex extends java.lang.ObjectFunction for use when referencing the index in a circular list
-
-
Constructor Summary
Constructors Constructor and Description CircularIndex()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static intaddOffset(int index, int offset, int size)Adds offset (positive or negative) to index in a circular buffer.static intdistance(int index0, int index1, int size)Returns the smallest distance you would need to travel (positive or negative) to go from index0 to index1.static intdistanceP(int index0, int index1, int size)Returns how many elements away in the positive direction you need to travel to get from index0 to index1.static intminusPOffset(int index, int offset, int size)Subtracts a positive offset to index in a circular buffer.static intplusPOffset(int index, int offset, int size)Adds a positive offset to index in a circular buffer.static intsubtract(int index0, int index1, int size)Subtracts index1 from index0.
-
-
-
Method Detail
-
plusPOffset
public static int plusPOffset(int index, int offset, int size)Adds a positive offset to index in a circular buffer.- Parameters:
index- element in circular bufferoffset- integer which is positive and less than sizesize- size of the circular buffer- Returns:
- new index
-
minusPOffset
public static int minusPOffset(int index, int offset, int size)Subtracts a positive offset to index in a circular buffer.- Parameters:
index- element in circular bufferoffset- integer which is positive and less than sizesize- size of the circular buffer- Returns:
- new index
-
addOffset
public static int addOffset(int index, int offset, int size)Adds offset (positive or negative) to index in a circular buffer.- Parameters:
index- element in circular bufferoffset- offset. |offset| < sizesize- size of the circular buffer- Returns:
- new index
-
distanceP
public static int distanceP(int index0, int index1, int size)Returns how many elements away in the positive direction you need to travel to get from index0 to index1.- Parameters:
index0- element in circular bufferindex1- element in circular buffersize- size of the circular buffer- Returns:
- positive distance
-
distance
public static int distance(int index0, int index1, int size)Returns the smallest distance you would need to travel (positive or negative) to go from index0 to index1.- Parameters:
index0- element in circular bufferindex1- element in circular buffersize- size of the circular buffer- Returns:
- smallest distance
-
subtract
public static int subtract(int index0, int index1, int size)Subtracts index1 from index0. positive number if its closer in the positive direction or negative if closer in the negative direction. if equal distance then it will return a negative number.- Parameters:
index0- element in circular bufferindex1- element in circular buffersize- size of the circular buffer- Returns:
- new index
-
-
DataMelt 3.0 © DataMelt by jWork.ORG