You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In V2, giving a NaN value in a vertex call will create a point at 0,0, and throw a warning.
While the warning is nice (in V1, there was no warning!) I don't think we should draw a point at 0,0. I don't think we can assume a NaN means 0, and in the example code below, it ignores the value of y=height/4 and creates a point at y=0, which is strange behavior.
I don't think we should draw a point with a NaN in the vertex call at all, which is what happened in V1, the point was just ignored. Or, we could throw a runtime error instead of just a warning. If I'm not peeking at the console, I would love to know when my code is accidentally generating a NaN so I can track that problem down.
translate(width/2,height/2);beginShape();vertex(width/4,height/4);vertex(0,height/4);//When vertex recieves a NaN for one of the values, it sets both values to 0 and draws the point and gives a warningvertex(NaN,-height/4);endShape();
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms.
Hi @ksen0 , I can reproduce this on 2.3.4 and 2.4.0-rc.1, in both 2D and WEBGL.
It looks like it comes from the p5.Vector constructor. If any argument is non-finite it sets values = [], and the x/y/z getters fall back to 0, so the whole vertex ends up at (0, 0) and the valid y is lost. On 2.2.3 only the NaN coordinate became 0, and in 1.x (2D) the point was skipped. line() and point() with NaN do the same thing, and with p5.min.js there's no warning at all.
Which behavior would you prefer here: skipping the vertex like 1.x, going back to the 2.2 behavior, or throwing an error like the issue suggests? I'd like to work on it once there's a direction.
Activity
welcome commentedon Oct 22, 2026
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms.
For guidance on contributing, check out our contributing guidelines and other resources for contributors.
💬 If you have questions or need support, feel free to join the Processing Foundation Forum or visit our Community page.
📜 Please also review our Code of Conduct to understand our community standards.
Thank You!
Anshumancanrock commentedon Oct 24, 2026
Hi @ksen0 , I can reproduce this on 2.3.4 and 2.4.0-rc.1, in both 2D and WEBGL.
It looks like it comes from the p5.Vector constructor. If any argument is non-finite it sets
values = [], and thex/y/zgetters fall back to 0, so the whole vertex ends up at (0, 0) and the valid y is lost. On 2.2.3 only the NaN coordinate became 0, and in 1.x (2D) the point was skipped.line()andpoint()with NaN do the same thing, and with p5.min.js there's no warning at all.Which behavior would you prefer here: skipping the vertex like 1.x, going back to the 2.2 behavior, or throwing an error like the issue suggests? I'd like to work on it once there's a direction.