foretold-app / widedomain

An experiment to create mathematical models with clean interfaces
MIT License
8 stars 2 forks source link

Convolution should never break the browser #59

Open OAGr opened 4 years ago

OAGr commented 4 years ago

When I enter, normal(5,2) * normal(5,2)

And have "Downsample To" as blank, it crashes. This shouldn't happen.

image
skosch commented 4 years ago

Leaving that field blank currently sets the sampleCount to 10000 (see this line in DistBuilder.re):

~recommendedLength=options.downsampleTo |> E.O.default(10000),

This seems to be the downfall of convolution, and ultimately also sampling. I think we really have to come up with a reasonable strategy for how many sample points to use depending on the situation.

One thing I think would be REALLY impressive, some day in the future, would be a sample count that increases progressively (both for rendering and sampling) until some sort of equilibrium is reached. Ideally offloaded to webworkers. Sort of like what the Cycles engine does in Blender (video). (That would probably also require switching to non-SVG rendering, but apparently d3+canvas is an option nowadays, and https://d3fc.io even supports WebGL.)