dyna3/engine-proto/ganja-test/ganja-test.html
Aaron Fenyes 3b10c95d5f Clean up examples
Declare JavaScript variables. Revise Julia comments to match new code.
2024-06-25 02:58:39 -07:00

48 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: #ffe0f0;
}
/* needed to keep Ganja canvas from blowing up */
canvas {
min-width: 600px;
max-width: 600px;
min-height: 600px;
max-height: 600px;
}
</style>
<script src="https://unpkg.com/ganja.js"></script>
</head>
<body>
<script>
// in the default view, e4 + e5 is the point at infinity
let CGA3 = Algebra(4, 1);
let v1 = CGA3.inline(() => 1e1 + 1e5)();
let v2 = CGA3.inline(() => 1e2 + 1e5)();
let v3 = CGA3.inline(() => 1e3 + 1e5)();
let w1 = CGA3.inline(() => 1e1 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)();
let w2 = CGA3.inline(() => 1e2 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)();
let w3 = CGA3.inline(() => 1e3 - Math.sqrt(0.2)*1e4 + Math.sqrt(1.2)*1e5)();
let s = CGA3.inline(() => -Math.sqrt(1.2)*1e4 + Math.sqrt(0.2)*1e5);
document.body.appendChild(CGA3.graph(
[
0xff00b0, v1,
0x00ffb0, v2,
0x00b0ff, v3,
0x800040, w1,
0x008040, w2,
0x004080, w3,
0xd0e0f0, s
],
{
conformal: true, gl: true, grid: true
}
));
</script>
</body>
</html>