The Knights of Ni 2024
CenterStage Off-season Documentation
Loading...
Searching...
No Matches
org.firstinspires.ftc.teamcode.Util.MathUtil Class Reference

Static Public Member Functions

static double lerp (double x, double fromLo, double fromHi, double toLo, double toHi)
 
static int binarySearch (List< Double > li, double query)
 Precondition: The list is sorted Searches the list for the element using a binary search algorithm.
 
static double lerpLookup (List< Double > source, List< Double > target, double query)
 precondition: source and target are sorted and share the same length
 
static List< Double > lerpLookupMap (List< Double > source, List< Double > target, List< Double > queries)
 
static double normalizeAngle (double angle)
 

Member Function Documentation

◆ binarySearch()

static int org.firstinspires.ftc.teamcode.Util.MathUtil.binarySearch ( List< Double > li,
double query )
static

Precondition: The list is sorted Searches the list for the element using a binary search algorithm.

If the element is not found, the inverted insertion point is returned.

Parameters
liThe sorted list to search
Returns
Return the index of the element, if it is contained in the list within the specified range; otherwise, the inverted insertion point (-insertion point - 1). The insertion point is defined as the index at which the element should be inserted, so that the list (or the specified subrange of list) still remains sorted.

The documentation for this class was generated from the following file: