net.aerith.misao.util
Class Quadrics

java.lang.Object
  |
  +--net.aerith.misao.util.Quadrics

public class Quadrics
extends java.lang.Object

The Quadrics represents a quadric function of x and y. It consists of 6 coefficients from A to F which represent:

     z = A + Bx + Cy + Dxx + Exy + Fyy
 


Field Summary
private  double A
          The constant item.
private  double B
          The coefficient of x.
private  double C
          The coefficient of y.
private  double D
          The coefficient of x^2.
private  int data_count
          The number of (x,y,z) data to solve the simultaneous equation.
private  double E
          The coefficient of x y.
private  double F
          The coefficient of y^2.
private  SimultaneousEquation se
          The simultaneous equation to solve this quadric function.
 
Constructor Summary
Quadrics()
          Constructs an empty Quadrics.
 
Method Summary
static Quadrics create(java.lang.String string)
          Creates a Quadrics object from the String object which represents the quadric function.
 java.lang.String getOutputString()
          Returns a string representation of the state of this object.
 Position getPeak()
          Calculates the peak (x,y).
 double getValue(double x, double y)
          Gets z value of the specified (x,y).
 Quadrics negative()
          Creates a negative quadric function of this one.
 void setData(double x, double y, double z)
          Adds a (x,y,z) data to solve the simultaneous equation.
 void solve()
          Solves the simultaneous equation and calculates this quadric function in the least square method.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

A

private double A
The constant item.

B

private double B
The coefficient of x.

C

private double C
The coefficient of y.

D

private double D
The coefficient of x^2.

E

private double E
The coefficient of x y.

F

private double F
The coefficient of y^2.

se

private SimultaneousEquation se
The simultaneous equation to solve this quadric function.

data_count

private int data_count
The number of (x,y,z) data to solve the simultaneous equation.
Constructor Detail

Quadrics

public Quadrics()
Constructs an empty Quadrics.
Method Detail

getValue

public double getValue(double x,
                       double y)
Gets z value of the specified (x,y).
Parameters:
x - the x value.
y - the y value.
Returns:
z value of the specified (x,y).

setData

public void setData(double x,
                    double y,
                    double z)
Adds a (x,y,z) data to solve the simultaneous equation.
Parameters:
x - the x value.
y - the y value.
z - the z value.

solve

public void solve()
Solves the simultaneous equation and calculates this quadric function in the least square method.

negative

public Quadrics negative()
Creates a negative quadric function of this one.
Returns:
a negative quadric function of this one.

create

public static Quadrics create(java.lang.String string)
Creates a Quadrics object from the String object which represents the quadric function.
Parameters:
string - the string which represents the quadric function.
Returns:
a new Quadrics of the specified string.

getPeak

public Position getPeak()
Calculates the peak (x,y).
Returns:
the peak (x,y).

getOutputString

public java.lang.String getOutputString()
Returns a string representation of the state of this object.
Returns:
a string representation of the state of this object.