-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
42 lines (35 loc) · 1.67 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script src="lib/twgl/twgl-full.min.js"></script>
<script src="src/sowebplot.js"></script>
<div id="sowebplot-target" style="border: 1px black solid; width:512px; height:512px;">
</div>
<script>
document.addEventListener("DOMContentLoaded", (d, e) =>
{
var plotter = new SoWebPlotter("sowebplot-target");
plotter.camera.setPosition(1,1,1);
plotter.camera.setTarget(0,0,0);
var gl = plotter.webgl;
let plot1 = new R2toRPlot(new RealValuedFunction(["x", "y"], "Math.cos(5*x*x) + Math.sin(5*y*y)"));
let plot2 = new R2toRPlot(new RealValuedFunction(["x", "y"], "(x * x + y * y + x) / (x * x + y * y + x * y) * 1/3"));
let gfx1 = new R2toRGraphicsObject(plot1);
let gfx2 = new R2toRGraphicsObject(plot2);
let axes = new Axes3GraphicsObject();
plotter.renderer.registerGraphicsObject(gfx1);
plotter.renderer.registerGraphicsObject(axes);
//plotter.renderer.registerGraphicsObject(gfx2);
plotter.loop();
function rotate(t) {
plotter.camera.setPosition(Math.cos(1.0/Math.PI / 1000.0 * t), 1, Math.sin(1.0/Math.PI / 1000.0 * t));
plotter.camera.setTarget(0, 0, 0);
requestAnimationFrame(rotate);
}
requestAnimationFrame(rotate);
});
</script>
</body>
</html>