floatadd - error
#4

Quote:
Originally Posted by skaTim
Посмотреть сообщение
pawn Код:
floatadd(floatadd(floatsqroot(floatpower(floatsub(x1,x2),2)),floatsqroot(floatpower(floatsub(y1,y2),2))),floatsqroot(floatpower(floatsub(z1,z2),2)));
Everyone keeps copying this, but apparently no-one seems to question why the original author bothered using the functions instead of the normal operators. You can't really get around floatsqroot because there isn't an operator for that, but that line is essentially this:

Код:
floatsqroot((x1 - x2) * (x1 - x2)) + floatsqroot((y1 - y2) * (y1 - y2)) + floatsqroot((z1 - z2) * (z1 - z2))
Which, IMO, makes it much more obvious what is going on. VectorSize is currently the fastest, though.
Reply


Messages In This Thread
floatadd - error - by skaTim - 23.11.2016, 13:52
Re: floatadd - error - by Konstantinos - 23.11.2016, 13:54
Re: floatadd - error - by AbyssMorgan - 23.11.2016, 13:56
Re: floatadd - error - by Vince - 23.11.2016, 14:52

Forum Jump:


Users browsing this thread: 1 Guest(s)