is Near
Checks if the given value matches an expected value within a certain tolerance.
Return
Whether or not the actual value is within the allowed tolerance
Parameters
The expected value
The allowed difference between the actual and the expected value
Checks if the given value matches an expected value within a certain tolerance. Supports continuous input for cases like absolute encoders.
Continuous input means that the min and max value are considered to be the same point, and tolerances can be checked across them. A common example would be for absolute encoders: calling isNear(2, 359, 5, 0, 360) returns true because 359 is 1 away from 360 (which is treated as the same as 0) and 2 is 2 away from 0, adding up to an error of 3 degrees, which is within the given tolerance of 5.
Return
Whether or not the actual value is within the allowed tolerance
Parameters
The expected value
The allowed difference between the actual and the expected value
Smallest value before wrapping around to the largest value
Largest value before wrapping around to the smallest value