Skip to content

Commit

Permalink
separate examples
Browse files Browse the repository at this point in the history
  • Loading branch information
enkimute committed Aug 13, 2017
1 parent bafdb40 commit 7c8cae4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions examples/example_mandelbrot2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<HEAD>
<SCRIPT SRC="../ganja.js"></SCRIPT>
</HEAD>
<BODY>
<SCRIPT>
/** In quaternion space H, we calculate the mandelbrot set and use the
* iteration count for colorisation.
*/

document.body.appendChild(Algebra({p:3,basis:['1','e12','e13','e23']}).graph(function(x,y){
// Calculate iteration count for mandelbrot.
var n=40, z=0e12, c=x*1.75-1+y*1e12;
while (z < 2 && n--) z=z**2+c;
// Use the iteration count to rotate the color red in the hue plane
var red=1e12, rot=Math.cos(n/20) + Math.sin(n/20)*(0.578e12+0.578e13+0.578e23);
return (rot*red*~rot).slice(1);
}));


</SCRIPT>
</BODY>

0 comments on commit 7c8cae4

Please sign in to comment.