NetTopologySuite
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
NetTopologySuite.Mathematics.MathUtil Class Reference

Various utility functions for mathematical and numerical operations. More...

Static Public Member Functions

static double Clamp (double x, double min, double max)
 Clamps a double value to a given range. More...
 
static int Clamp (int x, int min, int max)
 Clamps a int value to a given range. More...
 
static double Log10 (double x)
 Computes the base-10 logarithm of a double value. More...
 
static int Wrap (int index, int max)
 Computes an index which wraps around a given maximum value. For values &ge 0, this is equals to val % max. For values < 0, this is equal to max - (-val) % max More...
 
static double Average (double x1, double x2)
 Computes the average of two numbers. More...
 
static double Max (double v1, double v2, double v3)
 Computes the maximum fo three values More...
 
static double Max (double v1, double v2, double v3, double v4)
 Computes the maximum of four values More...
 
static double Min (double v1, double v2, double v3)
 Computes the minimum of four values More...
 
static double Min (double v1, double v2, double v3, double v4)
 Computes the minimum of four values More...
 

Detailed Description

Various utility functions for mathematical and numerical operations.

Member Function Documentation

static double NetTopologySuite.Mathematics.MathUtil.Average ( double  x1,
double  x2 
)
static

Computes the average of two numbers.

Parameters
x1A number
x2A number
Returns
The average of the inputs
static double NetTopologySuite.Mathematics.MathUtil.Clamp ( double  x,
double  min,
double  max 
)
static

Clamps a double value to a given range.

Parameters
xThe value to clamp
minThe minimum value of the range
maxThe maximum value of the range
Returns
The clamped value
static int NetTopologySuite.Mathematics.MathUtil.Clamp ( int  x,
int  min,
int  max 
)
static

Clamps a int value to a given range.

Parameters
xThe value to clamp
minThe minimum value of the range
maxThe maximum value of the range
Returns
The clamped value
static double NetTopologySuite.Mathematics.MathUtil.Log10 ( double  x)
static

Computes the base-10 logarithm of a double value.

  • If the argument is NaN or less than zero, then the result is NaN.
  • If the argument is positive infinity, then the result is positive infinity.
  • If the argument is positive zero or negative zero, then the result is negative infinity.
Parameters
xA positive number
Returns
The value log a, the base-10 logarithm of the input value
static double NetTopologySuite.Mathematics.MathUtil.Max ( double  v1,
double  v2,
double  v3 
)
static

Computes the maximum fo three values

Parameters
v1A number
v2A number
v3A number
Returns
The maximum value of v1 , v2 and v3
static double NetTopologySuite.Mathematics.MathUtil.Max ( double  v1,
double  v2,
double  v3,
double  v4 
)
static

Computes the maximum of four values

Parameters
v1A number
v2A number
v3A number
v4A number
Returns
The maximum value of v1 , v2 , v3 and v4
static double NetTopologySuite.Mathematics.MathUtil.Min ( double  v1,
double  v2,
double  v3 
)
static

Computes the minimum of four values

Parameters
v1A number
v2A number
v3A number
Returns
The minimum value of v1 , v2 and v3
static double NetTopologySuite.Mathematics.MathUtil.Min ( double  v1,
double  v2,
double  v3,
double  v4 
)
static

Computes the minimum of four values

Parameters
v1A number
v2A number
v3A number
v4A number
Returns
The minimum value of v1 , v2 , v3 and v4
static int NetTopologySuite.Mathematics.MathUtil.Wrap ( int  index,
int  max 
)
static

Computes an index which wraps around a given maximum value. For values &ge 0, this is equals to val % max. For values < 0, this is equal to max - (-val) % max

Parameters
indexThe index to wrap
maxThe maximum value (or modulus)
Returns
The wrapped index

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