All Packages Class Hierarchy This Package Previous Next Index
Interface figPac.invertibleV2V
- public interface invertibleV2V
- extends V2V
The interface invertibleV2V, which stand for "invertible vector to vector" is used to allow the
programmer to refer to an invertible function (from R^n to R^n) by its name. To do so
the programmer creates a class that implements the interface invertibleV2V and programs
the desired function as the method map of that class and the inverse of the function as
the method invmap of that class. The resulting class can be used as any argument of type
invertibleV2V of any method. Here is an example.
class Rotate implements invertibleV2V {
double angle ;
public Rotate(double angle) {
this.angle = angle ;
}
public double[] map(double[] in) {
double[] out = new double[2] ;
double cos = Math.cos(angle) ;
double sin = Math.sin(angle) ;
out[0] = cos*in[0] + sin*in[1] ;
out[1] = -sin*in[0] + cos*in[1];
return out ;
public double[] invmap(double[] in) {
double[] out = new double[2] ;
double cos = Math.cos(-angle) ;
double sin = Math.sin(-angle) ;
out[0] = cos*in[0] + sin*in[1] ;
out[1] = -sin*in[0] + cos*in[1];
return out ;
}
}
-
invmap(double[])
-
-
map(double[])
-
map
public abstract double[] map(double in[])
invmap
public abstract double[] invmap(double in[])
All Packages Class Hierarchy This Package Previous Next Index