net.aerith.misao.util
Class Cubics

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

public class Cubics
extends java.lang.Object

The Cubics represents a cubic function of x and y. It consists of 10 coefficients from A to J which represent:

     z = A + Bx + Cy + Dxx + Exy + Fyy + Gxxx + Hxxy + Ixyy + Jyyy
 


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  double G
          The coefficient of x^3.
private  double H
          The coefficient of x^2 y.
private  double I
          The coefficient of x y^2.
private  double J
          The coefficient of y^3.
private  SimultaneousEquation se
          The simultaneous equation to solve this cubic function.
 
Constructor Summary
Cubics()
          Constructs an empty Cubics.
 
Method Summary
static Cubics create(java.lang.String string)
          Creates a Cubics object from the String object which represents the cubic function.
 java.lang.String getOutputString()
          Returns a string representation of the state of this object.
 double getValue(double x, double y)
          Gets z value of the specified (x,y).
 Cubics negative()
          Creates a negative cubic 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 cubic 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.

G

private double G
The coefficient of x^3.

H

private double H
The coefficient of x^2 y.

I

private double I
The coefficient of x y^2.

J

private double J
The coefficient of y^3.

se

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

data_count

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

Cubics

public Cubics()
Constructs an empty Cubics.
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 cubic function in the least square method.

negative

public Cubics negative()
Creates a negative cubic function of this one.
Returns:
a negative cubic function of this one.

create

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

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.