1 package sample;
2
3
4 import fi.jyu.mit.graphics.*;
5 import static java.lang.Math.*;
6
7
8
14 public class FunctionR2ASample {
15
16
19 public static class SinCos implements FunctionR2R {
20
23 public static final FunctionR2R sincos = new SinCos();
25
31 @Override
32 public double f(double x, double y) { return sin(x)*cos(y);
34 }
35 }
36
37
42 public static SpacePanel initPanel(SpacePanel panel) {
43 panel.scale(-9,-9,9,9);
44 panel.add(new Axis(15, 15, 15));
45 panel.add(new FunctionMapR2R(SinCos.sincos,-2*PI,-2*PI,2*PI,2*PI));
46 panel.rotate(Axis.X, 50);
47 panel.rotate(Axis.Y, 20);
48 return panel;
49 }
50
51
55 public static void main(String[] args) {
56 Window window = new Window();
57 initPanel(window.getPanel());
58 window.showWindow();
59 window.setTouchPad(true, true);
61 window.setControlButtons(true);
62
63 }
64
65
70 public static class Applet extends EasyApplet {
71 private static final long serialVersionUID = 8729837737198762878L;
72
73
78 @Override
79 public void init() {
80 this.setTouchPad(true, true);
81 this.setControlButtons(true);
82 initPanel(getPanel());
83 }
84 }
85
86 }
87