## EDU.gatech.cc.is.learning Class Bilinear2D

```java.lang.Object
|
+--EDU.gatech.cc.is.learning.FunctionApproximator
|
+--EDU.gatech.cc.is.learning.Bilinear2D
```

public class Bilinear2D
extends FunctionApproximator
implements java.lang.Cloneable, java.io.Serializable

Transform points from a two-dimensional space to another two dimensional space.

Introduction
The Bilinear2D is a vectorial function that transforms points from a two-dimensional space to another two-dimensional space. The transformation is specified using a grid at the domain space and associating the points at the target space that correspond to each node of the grid.

Computation
The evaluation of query points is performed using a bilinear interpolation of the target points associated with the four neighboring points to the query point.

The domain space is specified by a rectangle and a grid of points. The rectangle is defined using four numbers: `min_x_limit`, `max_x_limit`, `min_y_limit`, and `max_y_limit`. The grid of points is defined using the number of points along the x and y axes: `npoints_x` and `npoints_y`, and a bidimensional array of 2D doubles (i.e., the points in the range space).

File format
A text file can be used to define a Bilinear2D function. The format is as follows:

``` min_x_limit:   [value]
max_x_limit:   [value]
min_y_limit:   [value]
max_y_limit:   [value]
npoints_x:     [r]
npoints_y:     [s]
[x_00],[y_00]  [x_01],[y_01] ... [x_0r],[y_0r]
[x_10],[y_10]  [x_11],[y_11] ... [x_1r],[y_1r]
.              .                 .
.              .                 .
.              .                 .
[x_s0],[y_s0]  [x_s1],[y_s1] ... [x_sr],[y_sr]
```
Example:
``` min_x_limit:   0
max_x_limit:   50
min_y_limit:   0
max_y_limit:   50
npoints_x:     5
npoints_y:     5
10,20  7.5,20    5,20  2.5,20   0,20
10,15  7.5,15    5,15  2.5,15   0,15
10,10  7.5,10    5,10  2.5,10   0,10
10, 5  7.5, 5    5, 5  2.5, 5   0, 5
10, 0  7.5, 0    5, 0  2.5, 0   0, 0
```

Copyright (c)1997 Georgia Tech Research Corporation

`FunctionApproximator`, Serialized Form

 Field Summary ` double` `max_x_limit`           Maximum value for the x variable in the domain space. ` double` `max_y_limit`           Maximum value for the y variable in the domain space. ` double` `min_x_limit`           Minimum value for the x variable in the domain space. ` double` `min_y_limit`           Minimum value for the y variable in the domain space. ` int` `npoints_x`           Number of grid points in the x axis. ` int` `npoints_y`           Number of grid points in the y axis. ` double` `range_x`           Range of the x variable in the domain space: (max_limit - min_limit). ` double` `range_y`           Range of the y variable in the domain space: (max_limit - min_limit). ` double` `resolution_x`           Resolution of the x axis: (max_limit - min_limit) / (npoints - 1) ` double` `resolution_y`           Resolution of the y axis: (max_limit - min_limit) / (npoints - 1) `protected  double[][][]` `table`           Grid of points.

 Fields inherited from class EDU.gatech.cc.is.learning.FunctionApproximator ```domain_dim, range_dim```

 Constructor Summary ```Bilinear2D(double min_x_limit, double max_x_limit, int npoints_x, double min_y_limit, double max_y_limit, int npoints_y, double[][][] table)```           Create an instance of a Bilinear function approximator that maps points from a two-dimensional space (x,y) to another two-dimensional space (u,v). `Bilinear2D(java.lang.String filename)`           Loads the definition of a Bilinear2D function approximator from a file.

 Method Summary ` double[]` `query(double[] point)`           Computes and returns the bilinear interpolation associated with the point. ` double[]` ```query(int x, int y)```           Computes and returns the bilinear interpolation associated with the point. ` void` `saveDefinition(java.lang.String filename)`           Save a definition of this instance in a file. ` void` ```update(double[] q, double[] p)```           Not implemented.

 Methods inherited from class java.lang.Object ```clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait```

 Field Detail

### max_x_limit

`public final double max_x_limit`
Maximum value for the x variable in the domain space.

### min_x_limit

`public final double min_x_limit`
Minimum value for the x variable in the domain space.

### range_x

`public final double range_x`
Range of the x variable in the domain space: (max_limit - min_limit).

### npoints_x

`public final int npoints_x`
Number of grid points in the x axis.

### resolution_x

`public final double resolution_x`
Resolution of the x axis: (max_limit - min_limit) / (npoints - 1)

### max_y_limit

`public final double max_y_limit`
Maximum value for the y variable in the domain space.

### min_y_limit

`public final double min_y_limit`
Minimum value for the y variable in the domain space.

### range_y

`public final double range_y`
Range of the y variable in the domain space: (max_limit - min_limit).

### npoints_y

`public final int npoints_y`
Number of grid points in the y axis.

### resolution_y

`public final double resolution_y`
Resolution of the y axis: (max_limit - min_limit) / (npoints - 1)

### table

`protected double[][][] table`
Grid of points.
 Constructor Detail

### Bilinear2D

```public Bilinear2D(double min_x_limit,
double max_x_limit,
int npoints_x,
double min_y_limit,
double max_y_limit,
int npoints_y,
double[][][] table)```
Create an instance of a Bilinear function approximator that maps points from a two-dimensional space (x,y) to another two-dimensional space (u,v).

### Bilinear2D

```public Bilinear2D(java.lang.String filename)
throws FunctionApproximatorException,
java.io.IOException```
Loads the definition of a Bilinear2D function approximator from a file.
Parameters:
`filename` - the file name.
Throws:
java.io.IOException - if an I/O error occurs.
FunctionApproximatorException - if a parse error occurs.
`FunctionApproximator`
 Method Detail

### saveDefinition

```public void saveDefinition(java.lang.String filename)
throws FunctionApproximatorException,
java.io.IOException```
Save a definition of this instance in a file.
Overrides:
saveDefinition in class FunctionApproximator
Parameters:
`filename` - the file name.
Throws:
java.io.IOException - if an I/O error occurs.
FunctionApproximatorException - if something wrong occurs.

### query

`public double[] query(double[] point)`
Computes and returns the bilinear interpolation associated with the point. The point is clipped to the domain rectangle.
Overrides:
query in class FunctionApproximator
Parameters:
`point` - the input point (two-dimensional array of doubles).
Returns:
the output point (two-dimensional array of doubles).

### query

```public double[] query(int x,
int y)```
Computes and returns the bilinear interpolation associated with the point. The point is clipped to the domain rectangle.
Parameters:
`x` - the x ordinate of the input point.
`y` - the y ordinate of the input point.
Returns:
the output point (two-dimensional array of doubles).

### update

```public void update(double[] q,
double[] p)
throws FunctionApproximatorException```
Not implemented.
Overrides:
update in class FunctionApproximator
Throws:
FunctionApproximatorException - always.