|
![](/i/fill.gif) |
Hello,
In one of my macros, I'm finding the slope of a 2D line, and sometimes I
get that warning about dividing by zero. Since it seems that diving any
number by zero results in an infinite number, would something like this
be a good fix?
#if(A.x-B.x != 0)
#local m1 = (A.y-B.y)/(A.x-B.x);
#else
#local m1 = 1e10;
#end
It seems to get rid of the warnings, but I wonder if there's a better way.
This poor hack was (understandably) giving me artifacts:
(A.x-B.x+0.000001)
I guess the other option is to jitter my points slightly, but that would
introduce problems into the whole setup, and total infallibility would
still not be ensured.
Sam
Post a reply to this message
|
![](/i/fill.gif) |