Class Quadratic

java.lang.Object
  |
  +--Quadratic

class Quadratic
extends java.lang.Object
implements Function

Represents a simplified quadratic curve. The function will have a repeated root (on the origin by default).


Field Summary
protected  double coeff
           
static double DEFAULT_COEFF
           
static double DEFAULT_SHIFT
           
protected  double shift
           
 
Constructor Summary
Quadratic()
          Creates a new quadratic curve, with a single root on the origin, and passing through (-1,1) and (1,1).
Quadratic(double coeff)
          Creates a new quadratic curve, with a single root on the origin.
Quadratic(double coeff, double shift)
          Creates a new quadratic curve.
 
Method Summary
 double evaluate(double x)
           
 double getCoeff()
           
 double getShift()
           
 void setCoeff(double d)
           
 void setShift(double d)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

coeff

protected double coeff

shift

protected double shift

DEFAULT_COEFF

public static final double DEFAULT_COEFF

DEFAULT_SHIFT

public static final double DEFAULT_SHIFT
Constructor Detail

Quadratic

public Quadratic(double coeff,
                 double shift)
Creates a new quadratic curve.
Parameters:
coeff - The x-squared coefficient
shift - The x-coordinate of the root

Quadratic

public Quadratic(double coeff)
Creates a new quadratic curve, with a single root on the origin.
Parameters:
coeff - The x-squared coefficient

Quadratic

public Quadratic()
Creates a new quadratic curve, with a single root on the origin, and passing through (-1,1) and (1,1).
Method Detail

evaluate

public double evaluate(double x)
Specified by:
evaluate in interface Function
Returns:
coeff*(x-shift)*(x-shift)

getShift

public double getShift()

getCoeff

public double getCoeff()

setShift

public void setShift(double d)

setCoeff

public void setCoeff(double d)