Package com.google.zxing.common.detector
Class MathUtils
java.lang.Object
com.google.zxing.common.detector.MathUtils
General math-related and numeric utility functions.
- 
Method SummaryModifier and TypeMethodDescriptionstatic floatdistance(float aX, float aY, float bX, float bY) static floatdistance(int aX, int aY, int bX, int bY) static intround(float d) Ends up being a bit faster thanMath.round(float).static intsum(int[] array) 
- 
Method Details- 
roundpublic static int round(float d) Ends up being a bit faster thanMath.round(float). This merely rounds its argument to the nearest int, where x.5 rounds up to x+1. Semantics of this shortcut differ slightly fromMath.round(float)in that half rounds down for negative values. -2.5 rounds to -3, not -2. For purposes here it makes no difference.- Parameters:
- d- real value to round
- Returns:
- nearest int
 
- 
distancepublic static float distance(float aX, float aY, float bX, float bY) - Parameters:
- aX- point A x coordinate
- aY- point A y coordinate
- bX- point B x coordinate
- bY- point B y coordinate
- Returns:
- Euclidean distance between points A and B
 
- 
distancepublic static float distance(int aX, int aY, int bX, int bY) - Parameters:
- aX- point A x coordinate
- aY- point A y coordinate
- bX- point B x coordinate
- bY- point B y coordinate
- Returns:
- Euclidean distance between points A and B
 
- 
sumpublic static int sum(int[] array) - Parameters:
- array- values to sum
- Returns:
- sum of values in array
 
 
-