Hello,
So I just thought I’d ask for the best ways for rounding numbers. In my pathfinding AI I am trying to make the routes as efficient as possible by cutting waypoints down (that way the animation also looks relatively smooth).
(mr valeska has to follow his path, for reference red = node calculated, green = stored, blue = new node added but thats irrelevant)
As you can see from the poorly constructed diagram the gradients of those lines are constant (in terms of relevance to a real life scenario) however to a computer the accuracy can be off by 0.0001 or in my case:
Gradient 1: 16.214718487099 | Gradient 2: 16.214617857237
Which is highly impractical when your trying to do a == comparison. Currently I’m just subtracting the numbers and testing the accuracy based on that however is their any way to round to the nearest 3dp?