Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The rendered graph is lean #19

Open
asukaminato0721 opened this issue Dec 10, 2022 · 1 comment
Open

The rendered graph is lean #19

asukaminato0721 opened this issue Dec 10, 2022 · 1 comment

Comments

@asukaminato0721
Copy link

Thanks to this library, it cut the render time a lot.

https://editor.p5js.org/AsukaMinato/sketches/ftth2jRtZ

This is the newton fractal set.

By q5

image

by p5

image

Why it's not the same graph…

@LingDong-
Copy link
Owner

Very curious issue, thanks for reporting!

Turns out it's because q5 doesn't support subtracting a scalar from a vector (yet), so change the line from this:

const f =  (x) => vectorPow(x, 4).sub(1);

to this:

const f =  (x) => vectorPow(x, 4).sub(createVector(1,0));

Easy to add the feature. Only concerns are that: more type checking overhead; clarity: should (1,2,3) - 1 be (0,2,3) or (0,1,2)? (1,2,3)*2 is not (2,2,3). But in the spirit of compatibility with p5 we probably should support it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants