Jason (jcreed) wrote,

Made some dutch baby that turned out real good. K tried some of the caramel sauce on it.

Puttered around with base64 encodings of small images for the purpose of some nebulously as-yet-not-very-completely-designed language game, and separately trying to figure out a plausible way to achieve the "to ensure these functions are perfectly and mathematically derivable/smooth one would need to window the distance decaying function with a smoothstep or something" from http://iquilezles.org/www/articles/smoothvoronoi/smoothvoronoi.htm.

I tried, among other things, copy-pasting the code
THRESH = 0.5;

pts = [{x:0.1, y:0.9}, {x:0.5,y:-0.5}, {x:-0.3,y:-0.8}];
function foo(x, y) {
  var ds = pts.map(function(pt, ix) {
    var v = {x: pt.x - x, y:pt.y - y};
    return Math.sqrt( v.x * v.x + v.y * v.y);
  ds.sort(function(a, b) { return a-b });
  var weights = [];
  var total_weight = 0;
  for (var i = 0; i < ds.length; i++) {
    var t = (ds[i] - ds[0]) / THRESH;
    if (t > 1) 
    else {
      var weight = 1 - 3 * t * t + 2 * t * t * t;
      total_weight += weight;
  var rv = 0;
  weights.forEach(function(w, ix) {
    rv += w * Math.exp(-ds[ix]);

  return -Math.log(rv);

into the browser dev console while at https://developer.cdn.mozilla.net/media/uploads/demos/g/u/guska076/fa5058c56d868f08311aedaae32536cf/3d-grapher-with-full_1354293417_demo_package/index.html and graphing foo(x, y) but it has awful, awful creases around the voronoi cell boundaries so I know I'm doing something wrong.
Tags: math

  • (no subject)

    Poking around the library again today. Found out Martin Schongauer had already developed the amazing German Renaissance cross-hatching style I had…

  • (no subject)

    Ah, some delightful broken english in my inbox. Italicized is the one part I believe sincerely. How there.? How are you? You single? And I'm single…

  • (no subject)

    Someone please call up Germany for me and tell them to stop sending me email about the 1945 bombing of Dresden. It was a horrible thing to have done,…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded