Skip to content

Instantly share code, notes, and snippets.

@jared-hughes
Last active May 18, 2021 00:23
Show Gist options
  • Save jared-hughes/adac228ecf81a6a455e1181e8e8e87bf to your computer and use it in GitHub Desktop.
Save jared-hughes/adac228ecf81a6a455e1181e8e8e87bf to your computer and use it in GitHub Desktop.
Desmos more accurate implicits
// ==UserScript==
// @name More accurate implicits
// @namespace github.com/jared-hughes
// @match *://www.desmos.com/calculator*
// @description More accurate implicit functions in Desmos! Very slow if you crank it up high. Incompatible with other userscripts that change workers.
// @grant none
// @version 0.1.0
// @run-at document-start
// @author fireflame241 (Jared Hughes)
// ==/UserScript==
/*
To change resolution, change the exponent on Math.pow(2,18).
I'm estimating that higher than 22 would crash most computers when plotting a single implicit graph.
The default value is 14.
*/
window.Worker = new Proxy(Worker, {
construct(target, args) {
if (args[0].startsWith("blob:")) {
const xhr = new XMLHttpRequest
xhr.open("GET", args[0], false)
xhr.send()
const hooked = xhr.responseText
// core/math/implicit-plotter
.replace(/Math.pow\(2,14\)/g, "Math.pow(2,18)")
args[0] = URL.createObjectURL(new Blob([hooked]))
}
return new target(...args)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment