JTS Topology Suite - v 1.12

com.vividsolutions.jts.math
Class MathUtil

java.lang.Object
  extended by com.vividsolutions.jts.math.MathUtil

public class MathUtil
extends java.lang.Object

Various utility functions for mathematical and numerical operations.

Author:
mbdavis

Constructor Summary
MathUtil()
           
 
Method Summary
static double clamp(double x, double min, double max)
          Clamps a double value to a given range.
static int clamp(int x, int min, int max)
          Clamps an int value to a given range.
static double log10(double x)
          Computes the base-10 logarithm of a double value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MathUtil

public MathUtil()
Method Detail

clamp

public static double clamp(double x,
                           double min,
                           double max)
Clamps a double value to a given range.

Parameters:
x - the value to clamp
min - the minimum value of the range
max - the maximum value of the range
Returns:
the clamped value

clamp

public static int clamp(int x,
                        int min,
                        int max)
Clamps an int value to a given range.

Parameters:
x - the value to clamp
min - the minimum value of the range
max - the maximum value of the range
Returns:
the clamped value

log10

public static double log10(double x)
Computes the base-10 logarithm of a double value.

Parameters:
x - a positive number
Returns:
the value log a, the base-10 logarithm of the input value

JTS Topology Suite - v 1.12