[HN Gopher] Graph Toy, an interactive graph visualizer using mat...
       ___________________________________________________________________
        
       Graph Toy, an interactive graph visualizer using mathematical
       functions
        
       Author : netule
       Score  : 48 points
       Date   : 2020-12-29 20:40 UTC (2 hours ago)
        
 (HTM) web link (memorystomp.com)
 (TXT) w3m dump (memorystomp.com)
        
       | netule wrote:
       | This is based on the original work by Inigo Quilez [1], but adds
       | support for time and custom constants.
       | 
       | [1] http://www.iquilezles.org/apps/graphtoy/
        
         | wetmore wrote:
         | Do you know if the technique for rendering the graphs is
         | similar to the one he outlines at the end of this article?
         | https://www.iquilezles.org/www/articles/distance/distance.ht...
        
           | dahart wrote:
           | It's not the same technique. That article is describing how
           | to plot functions when drawing them using fragment shaders,
           | via the vertical y-axis distance to the function. So to get a
           | constant width line you have to compensate for the slope of
           | the line. Graph Toy is using line drawing to render the
           | function plots, and samples the function once for every pixel
           | horizontally, so the line width issue it taken care of. It's
           | very easy to pop open your dev tools panel and read the
           | source code, BTW, it's not minified or obfuscated. The
           | drawing routine is called draw().
        
       | dahart wrote:
       | If the author is here -- the extra features compared to IQ's
       | version are nice! I might make this my bookmarked default
       | version.
       | 
       | If interested, here are a few thoughts:
       | 
       | - It might be good to link directly to IQ's version of GraphToy,
       | rather than his homepage.
       | 
       | - I dig the white background option!
       | 
       | - The create link feature is a bit smoother than the original.
       | 
       | - The download image button is a great idea, though I just
       | realized with both versions you can right click to save the
       | image, without needing a new tab. One thing that occurred to me
       | -- it would be _killer_ if the download image version popped up
       | an SVG render with a higher sampling rate, instead of pixels! A
       | little text or UI could clarify how to save a pixel version vs a
       | vector rendering.
       | 
       | - I like the escalator function used to demo the time variable!
       | I've used that very function on ShaderToy.
       | 
       | - It would be super nice if the plot window used a flexbox or
       | grid layout to stretch to fill the window. It's current a bit
       | smaller than IQ's and doesn't resize.
       | 
       | - Might also be nice to have the help box be a popup you can
       | click (the way it works in ShaderToy), and maybe put the
       | variables underneath the plot, to allow the plot to expand to
       | basically full screen?
        
       | zw123456 wrote:
       | It would be fun if it could play the wave form as audio.
        
       | TeMPOraL wrote:
       | This reminds me of my favourite Windows application ever:
       | EvalDraw.
       | 
       | It's like this, except that beyond drawing single-argument f(x)
       | -> y functions, it also draws f(x, y) -> z heatmaps, f(x, y) ->
       | (R, G, B) colored heatmaps, f(x, y, z) -> (R, G, B) volumetric 3D
       | graphics, and all these have also a f(..., t) -> ... variant for
       | animations. And then you dig in and discover it somehow also has
       | keyboard & mouse input handling, can play sounds (and can be used
       | for live procedural music), simulate a piano keyboard, and
       | probably a bunch of other stuff I'm forgetting. It was my go-to
       | tool for visualizing any kind of math back during the university
       | years.
       | 
       | In fact, I just took a look at it again (after not using it for
       | years) and I discovered it has networking capability, IDE
       | features, and - I kid you not - it seems to compile the scripts
       | down to native code, offering a helpful x86 ASM output in the
       | built-in debugger. It can dump executables, has network
       | capabilities, bindings to OpenGL and support for old-school VR
       | (colored stereoscopic, NVidia 3DVision).
       | 
       |  _All in an executable that weighs 746 KB._
       | 
       | It's hands-down one of the most impressive pieces of software I
       | have ever seen.
       | 
       | http://advsys.net/ken/download.htm#evaldraw
       | 
       | EDIT: And if you give it a try, be sure to check some of the
       | ridiculous amount of examples it comes bundled with, which
       | include games, explorable explanations, infinite calendars,
       | optical systems simulations, and a whole host of other stuff.
        
       | petrocrat wrote:
       | Is this a custom <Canvas/> widget or is it using a library to
       | create the canvas? If so, which library?
        
         | Impossible wrote:
         | It likely uses piLibJS
         | https://www.iquilezles.org/code/piLibsJS/piLibsJS.htm, a small
         | framework created by Inigo Quilez and used by Shadertoy
        
       | symplee wrote:
       | This is awesome!
       | 
       | Anyone discover any cool graphs to share?
       | 
       | For example, the simplest one producing something interesting
       | I've found so far is:                 t%x
       | 
       | Which creates a growing jagged triangular graph when you press
       | "play" for the "t" constant.
       | 
       | Naturally, this can be built upon to make weirder and weirder
       | graphs, ex:                 sin(t%x)
        
         | zw123456 wrote:
         | I kind of like this one sin(8 _x) /2_x
        
           | tartoran wrote:
           | try sin(8 * x)/2 * x/sin(t)
           | 
           | or even
           | 
           | sin(b * x * t/clamp(b/10,x/t,t)) * x * clamp(b/40 * t,x/10,t)
           | 
           | or sin(b * x * t/clamp(b/10,x / t,t)) * x *
           | clamp(b/40,x/10,t)
           | 
           | or sin( b * x * t/clamp(b/10,x/t,t)) * x * (x-x * x) *
           | clamp(b/4,sin (x * t) * x/10,t)
        
         | ggoo wrote:
         | inversesqrt(t%x)
        
       | danpalmer wrote:
       | This reminds me of Grapher on macOS, which I had expected would
       | have been removed by now, but no, it's still there on Big Sur!
        
       ___________________________________________________________________
       (page generated 2020-12-29 23:00 UTC)