Example of a floating point error bug from today that fixed point wouldn’t have helped: I’m calculating the bisector of two vectors a and b. |a|b + b|a| is numerically unstable if vectors are nearly opposite (and fails entirely if vectors are exactly opposite).
-
Show this thread
-
(Correct solution is to invert one vector, rotate them 90 degrees, and then calculate the bisector. This is numerically stable with both floating point and fixed point.)
3 replies 0 retweets 15 likesShow this thread -
Replying to @pcwalton
I'm curious - how do you decide which one of two possible resulting vectors to use? The procedure above gives stability only to tangent of bisector, but does not give stability to direction of the vector. How could swapping of vectors a and b affect the result?
1 reply 0 retweets 0 likes
Yeah, so this is part of a dilation algorithm that expands outlines to make them thicker, so there’s a prepass that determines the appropriate winding order (CW or CCW) and that winding order determines which one we negate.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.