p5.js-website
                                
                                
                                
                                    p5.js-website copied to clipboard
                            
                            
                            
                        Incorrect equation on get() reference page
Most appropriate sections of the p5.js website?
Reference
What is your operating system?
No response
Web browser and version
No response
Actual Behavior
This page provides an equivalent statement to get(), using the pixels array: https://p5js.org/reference/#/p5/get
I think the line "let off = (y * width + x) * d * 4;" should be replaced with: "let off = (y * d * width + x) * d * 4;" (This works for me at least, with d = 2).
Here's an example with both equations: https://editor.p5js.org/SnoopethDuckDuck/sketches/_0RDGo_zK
Example with code on website: (path colors don't match grid underneath)

Example with new code: (path colors do match grid underneath)

It should only be noticeable if d > 1, sorry if I'm wrong and I hope I've posted this correct-ish (wasn't sure if it's a bug or a discussion).
Expected Behavior
e
Steps to reproduce
e
Would you like to work on the issue?
nope
Does your corrected equation work for all values of d or only for d=2?
I've just updated the sketch, it seems to work on all the values I've tried (1 up to 10 at least)
For a possibly clearer equation maybe this one: 4 * ((y * d) * (width * d) + (x * d)) adapted from the pixels reference would help?