Skip to content

Commit

Permalink
added configurable starting point for julia fractal
Browse files Browse the repository at this point in the history
  • Loading branch information
dmackinnon1 committed Jan 31, 2017
1 parent a03b4bf commit 6ecb4e3
Showing 1 changed file with 54 additions and 11 deletions.
65 changes: 54 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,31 @@
}
};

function gatherInput() {
var option = $('input[name=options]:checked').val();
console.log("radio clicked: " + option);
if (option === "mandelbrot") {
selectedMap = cplxfrac.mandelbrotMap;
} else if (option === "dendrite") {
selectedMap = cplxfrac.dendrite;
} else if (option === "rabbit") {
selectedMap = cplxfrac.rabbit;
} else if (option === "siegleDisk") {
selectedMap = cplxfrac.siegleDisk;
} else if (option === "julia1") {
var real = parseFloat($('#real').val());
var imaginary = parseFloat($('#imaginary').val());
var point = new CPoint(real, imaginary);
var map = new Map(mandelbrot, juliaIterator, 2, point);
selectedMap = map;
}
if (selectedMap != currentMap) {
currentMap = selectedMap;
}
}

function resetCanvas() {
gatherInput();
if (currentSize == "sm") {
$(".canvasDiv").html("<canvas id='canvas' width='300' height='300' align='center' style='border:1px solid #000000;'>");
} else if (currentSize == "md") {
Expand Down Expand Up @@ -88,7 +112,11 @@
} else if (option === "siegleDisk") {
selectedMap = cplxfrac.siegleDisk;
} else if (option === "julia1") {
selectedMap = cplxfrac.julia1;
var real = parseFloat($('#real').val());
var imaginary = parseFloat($('#imaginary').val());
var point = new CPoint(real, imaginary);
var map = new Map(mandelbrot, juliaIterator, 2, point);
selectedMap = map;
}
if (selectedMap != currentMap) {
currentMap = selectedMap;
Expand All @@ -115,6 +143,18 @@
});
});

$(document).ready(function(){
$("#real").on('input change',function(e){
resetCanvas();
});
});


$(document).ready(function(){
$("#imaginary").on('input change',function(e){
resetCanvas();
});
});
</script>
<body>

Expand Down Expand Up @@ -152,6 +192,7 @@ <h1>Cplxfrac <small>Some Mandelbrot and Julia Set Fractals</small></h1>
<input type="radio" class="radio-inline" name="size" value="lrg"> large<br>
</label>
</form>

</div>
<br>
<hr>
Expand All @@ -166,6 +207,13 @@ <h1>Cplxfrac <small>Some Mandelbrot and Julia Set Fractals</small></h1>
Iteration depth: <input type="range" id="depth" min="2" max="100" step="2" value="8"></input>
</form>
</div>
<br>
<div class="sliderDiv" width ="300">
<form>
zoom: <input type="range" id="zoom" min="80" max="400" step="10" value="80"></input>
</form>
</div>

<br>
<div class="buttonDiv">
<form>
Expand All @@ -184,19 +232,14 @@ <h1>Cplxfrac <small>Some Mandelbrot and Julia Set Fractals</small></h1>
<label class="radio-inline">
<input type="radio" class="radio-inline" name="options" value="julia1"> another julia<br>
</label>
</form>
</div>

<br>
<div class="sliderDiv" width ="300">
: <em>c</em> = <input type="number" id="real"
min="-1" max="1" step="0.001" value="-0.322"> +
<input type="number" id="imaginary"
min="-1" max="1" step="0.001" value="-0.619"><em>i</em>
<form>
zoom: <input type="range" id="zoom" min="80" max="200" step="10" value="80"></input>
</form>
<hr>
<br>


</div>
<hr>
<br>
</div>
<div class='col-sm-1'>
Expand Down

0 comments on commit 6ecb4e3

Please sign in to comment.