Thread: Mapping Math
View Single Post
Old 04-22-2006, 08:23 AM   #11
blu_da_noob
Nonchalant
 
blu_da_noob's Avatar


Respected User
 
Join Date: Mar 2006
Posts: 1,933

Submissions (2)

blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)

[Quicksilver #2] - 2nd Place[Quicksilver#1] 1st place

Send a message via MSN to blu_da_noob
Default

Quote:
Originally Posted by mmx2000
Just a tip for your pythagorean theorems: As an alternative to doing (x2-x1)*(x2-x1) in case you have huge variable names or whatever, I believe you can use Pow(x2-x1, 2.0) to square it.

That's doing exactly the same thing, and might even be slower depending on how exactly the native Pow function works. The only advantage it would have with large variable names is number of characters?

Another useful thing to avoid having to SquareRoot in cases is when you are checking the distance between points against a certain number (using mathematical comparison, 2 > 1 etc).

Instead of:
Collapse JASS:
if SquareRoot(x*x+y*y) > dist then
Use:
Collapse JASS:
if x*x+y*y > dist*dist then
blu_da_noob is offline   Reply With Quote