Class MathUtils
Provides math-related utility functions.
public static class MathUtils
- Inheritance
-
objectMathUtils
Methods
EqualsTolerance(double, double, double)
Compares two floating-point values for equality, allowing for a certain tolerance
.
public static bool EqualsTolerance(this double a, double b, double tolerance = 1E-05)
Parameters
a
doubleb
doubletolerance
double
Returns
- bool
EqualsTolerance(float, float, float)
Compares two floating-point values for equality, allowing for a certain tolerance
.
public static bool EqualsTolerance(this float a, float b, float tolerance = 1E-05)
Parameters
a
floatb
floattolerance
float
Returns
- bool
Modulo(int, int)
Calculates the mathematical modulo of a value.
public static int Modulo(this int value, int modulo)
Parameters
value
intmodulo
int
Returns
- int
Modulo(long, long)
Calculates the mathematical modulo of a value.
public static long Modulo(this long value, long modulo)
Parameters
value
longmodulo
long
Returns
- long
MultiplyAndRound(Size, SizeF)
Multiplies a System.Drawing.Size with a System.Drawing.SizeF and then rounds the components to integer values.
public static Size MultiplyAndRound(this Size size, SizeF factor)
Parameters
size
Sizefactor
SizeF
Returns
- Size
XOr(byte[], byte[])
Combines two byte arrays via Exclusive Or.
public static byte[] XOr(byte[] array1, byte[] array2)
Parameters
array1
byte[]array2
byte[]
Returns
- byte[]