com.pentec.math
Class AMath

java.lang.Object
  extended by com.pentec.math.AMath

public class AMath
extends java.lang.Object

This class is a collection of mathematical functions in the form of static utility methods intended for use with ADAPT.

Author:
Pender Technology

Field Summary
static int EXP
          Linear, logarithmic, or exponential mode indicators
static int LINEAR
          Linear, logarithmic, or exponential mode indicators
static int LOG
          Linear, logarithmic, or exponential mode indicators
static double LOG10SCALE
          Constant used to convert from natural log (ln)
 
Constructor Summary
AMath()
           
 
Method Summary
private static double[] getDeltas(int iMode, int iNumDeltas, double dTotalDelta)
          This method computes an array of deltas for multi-sectioned intervals.
static double[] getDeltas(int iMode, int iNumDeltas, double dScaleMin, double dScaleMax)
          This method computes an array of deltas for multi-sectioned intervals.
static double[] getDeltas(int iMode, int iNumDeltas, int iScaleMin, int iScaleMax)
          This method computes an array of deltas for multi-sectioned intervals.
private static java.awt.image.DataBuffer getRandom2DBuffer()
          Create a constant slope 2D gradient with random slope direction.
static AImage makeImage(java.io.File file, DataFrame dataFrame)
          Load a frame with an image with random slope direction
static int numFracDigits(double d)
          Compute the number of fraction digits required to display a number.
static int numIntDigits(double d)
          Compute the number of integer digits required to display a number.
static int round(int iVal, int iIncrement)
           
static int round(int iVal, int iIncrement, int iOffset)
           
static double roundUp(double d)
          Rounds a number up to the nearest power of ten times 1, 2, or 5.
static int unsignedByteToInt(byte number)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXP

public static final int EXP
Linear, logarithmic, or exponential mode indicators

See Also:
Constant Field Values

LINEAR

public static final int LINEAR
Linear, logarithmic, or exponential mode indicators

See Also:
Constant Field Values

LOG

public static final int LOG
Linear, logarithmic, or exponential mode indicators

See Also:
Constant Field Values

LOG10SCALE

public static final double LOG10SCALE
Constant used to convert from natural log (ln)

Constructor Detail

AMath

public AMath()
Method Detail

getDeltas

private static double[] getDeltas(int iMode,
                                  int iNumDeltas,
                                  double dTotalDelta)
This method computes an array of deltas for multi-sectioned intervals.

Parameters:
iMode - either LINEAR, LOG, or EXP
iNumDeltas - the number of intervals to divide the region into
dTotalDelta - the total range of the interval
Returns:
the array of deltas

getDeltas

public static double[] getDeltas(int iMode,
                                 int iNumDeltas,
                                 double dScaleMin,
                                 double dScaleMax)
This method computes an array of deltas for multi-sectioned intervals.

Parameters:
iMode - either LINEAR, LOG, or EXP
iNumDeltas - the number of intervals to divide the region into
dScaleMin - the interval minimum
dScaleMax - the interval maximum
Returns:
the array of deltas

getDeltas

public static double[] getDeltas(int iMode,
                                 int iNumDeltas,
                                 int iScaleMin,
                                 int iScaleMax)
This method computes an array of deltas for multi-sectioned intervals.

Parameters:
iMode - either LINEAR, LOG, or EXP
iNumDeltas - the number of sections to divide the interval into
iScaleMin - the interval minimum
iScaleMax - the interval maximum
Returns:
the array of deltas

getRandom2DBuffer

private static java.awt.image.DataBuffer getRandom2DBuffer()
Create a constant slope 2D gradient with random slope direction. The width and the height are both 128; the slope is randomly in one of 8 directions; the values are all stored in a single data buffer bank.

Returns:
the data buffer

makeImage

public static AImage makeImage(java.io.File file,
                               DataFrame dataFrame)
Load a frame with an image with random slope direction

Parameters:
file - the file to be loaded with the new data
dataFrame - the frame to place the image in
Returns:
a image containing the fabricated 2D gradient

numFracDigits

public static int numFracDigits(double d)
Compute the number of fraction digits required to display a number.

Parameters:
d - the number to compute fraction digits for
Returns:
the number of fraction digits required for the input number; No number larger than 15 is returned.

numIntDigits

public static int numIntDigits(double d)
Compute the number of integer digits required to display a number.

Parameters:
d - the number to compute integer digits for
Returns:
the number of integer digits required for the input number; No number larger than 15 is returned.

round

public static int round(int iVal,
                        int iIncrement)

round

public static int round(int iVal,
                        int iIncrement,
                        int iOffset)

roundUp

public static double roundUp(double d)
Rounds a number up to the nearest power of ten times 1, 2, or 5.

Parameters:
d - the number to round up
Returns:
the input number rounded up to the nearest 10, 20, 50, 100, etc.

unsignedByteToInt

public static int unsignedByteToInt(byte number)