The new NodeBox forum is live! Everything from support.nodebox.net moved here: sign in with the same email to pick up your old posts. Something not working? Write to forum-support@nodebox.net.
Attached is a simple but handy new node: divide_safe.
Divide_safe allows you to perform divisions without having to check for division by zero errors. Just feed in a numerator and denominator. If the denominator is OK it will just perform a normal division. But if the denominator is zero or negative zero it will instead return a specified replacement value. All the checking is done for you.
The demo shows a graph of y = 1/x. Using a normal divide node would trigger an error when x = 0. Using divide_safe instead allows you to draw the graph with no extra fussing.
In this case I used 0 as the replacement value, If you increase or decrease that value you will see the red dot move up and down. The value you select in other scenarios will depend on your situation.
This node is not rocket science, but it's a real time-saver. Enjoy!
Great node John. I get the can't divide by 0 a lot when using the mask node. Is this node also a solution for that?
JO
JOjohn
Floris,
You mean you get divide by 0 errors when you render the latest 3.1 version of my mask node? That shouldn't ever happen.
Could you please send me a Nodebox file which triggers this error so I can track it down? If I can find the offending divide node I will replace it with my divide_true node and update the mask node.
Thanks!
John
FL
FLflorisdejonge
Thanks for the quick response. Maybe I opened a file with an old mask node, or I've integrated an old version in one of my own subnetworks that I use a lot. I will post it as soon as I encounter the error.
Know something that helps?
Sign in with your email address to reply. No password needed.