generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: 3D distance formula vs (v1-v2).magnitude

Previous Thread :: Next Thread 
CHONGUS is not online. 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 is not online. 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 is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
16 Oct 2015 08:16 PM
are* 64-bit floats
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
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 is not online. CHONGUS
Joined: 30 Jan 2015
Total Posts: 6153
16 Oct 2015 08:19 PM
Alright, thanks for the quick reply
Report Abuse
Everesty is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image