CHONGUS
|
  |
| Joined: 30 Jan 2015 |
| Total Posts: 6153 |
|
|
| 16 Oct 2015 08:15 PM |
Might not be the right forum but I'm curious
What is the difference between the Pythagorean distance formula in 3d and the magnitude method?
I ran a little test and they seem to be the same to about 6 or 7 decimal places but then diverge. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 16 Oct 2015 08:15 PM |
| Same thing, it is probably just that Vector3s implement 32-bit floats whereas Lua numbers have 64-bit floats (doubles) thus more precise. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 16 Oct 2015 08:17 PM |
@cnt
Are you basically saying that if we program our own default methods we would be able to get a more precise solution? |
|
|
| Report Abuse |
|
|
CHONGUS
|
  |
| Joined: 30 Jan 2015 |
| Total Posts: 6153 |
|
|
| 16 Oct 2015 08:19 PM |
| Alright, thanks for the quick reply |
|
|
| Report Abuse |
|
|
Everesty
|
  |
| Joined: 08 Oct 2009 |
| Total Posts: 6156 |
|
|
| 16 Oct 2015 08:23 PM |
"more precise" If you care about that 1 millionth decimal place, by all means, go ahead. Just know that it'll probably be slower (but I won't guarantee that statement). |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 16 Oct 2015 08:26 PM |
It's barely more precise in this case, usually this type of precision is important when dealing with money or very small/very large numbers.
Also if done correctly, it can actually be faster :) |
|
|
| Report Abuse |
|
|
CHONGUS
|
  |
| Joined: 30 Jan 2015 |
| Total Posts: 6153 |
|
|
| 16 Oct 2015 08:34 PM |
| I don't see how a single line expression like a distance formula would be slower than .magnitude (assuming it's written in lua) |
|
|
| Report Abuse |
|
|