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