[Plugin] [REL] PointToPoint Plugin
#21

Quote:
Originally Posted by Trooper[Y
]
Tested ?
Yes, works fine.
Reply
#22

Quote:
Originally Posted by bpeterson
Посмотреть сообщение
Could somebody re-upload this somewhere?
Reply
#23

very nice! I needed just such a thing!
Reply
#24

Download Linkґs down.
Reply
#25

PointToPoint windows version here. Linux version not work's for me, and currently no have this.

If you use for calculate distance, use this:

pawn Код:
#define GetDistance(%1,%2,%3,%4,%5,%6) floatadd(floatadd(floatsqroot(floatpower(floatsub(%1, %4), 2)), floatsqroot(floatpower(floatsub(%2, %5), 2))), floatsqroot(floatpower(floatsub(%3, %6), 2)))
Reply
#26

Nice work.
Reply
#27

Thanks alot for this <3
Reply
#28

link dead
Reply
#29

Pictures??
Reply
#30

Quote:
Originally Posted by Elviss
Посмотреть сообщение
Pictures??
What pictures could you possibly want/need?

EDIT: oh you mean the pictures on the main post, my bad :/
Reply
#31

Whoa don't know how this one slipped under my radar for so long....just happened to be going through my IRC logs the other day and found a conversation from Blacklight talking about this.

For those not using this plugin here is a better example of the speed difference over pawns floatsqroot.

Using this benchmark script (Yom posted this on my random plugin...)
pawn Код:
#include <a_samp>
#include <pointtopoint>

#define BENCH_INIT(%1); new BT1=GetTickCount(),BT2,BI1,BI2=%1;

#define BENCH(%1(%2)); \
{\
  for(BI1=0;BI1<BI2;BI1++)\
    %1(%2);\
\
  BT2=GetTickCount();\
  BT1=BT2-BT1;\
\
  printf("\n"#%1"\n -> Average time per call : %8.f ns\n -> Total execution time : %8d ms\n -> Calls per second   : %8.f calls",\
  (float(BT1)/BI2)*1000000,BT1,(float(BI2)/BT1)*1000);\
\
  BT1=BT2;\
}

main()
{
  BENCH_INIT(500000);
  BENCH(floatsqroot((2579.6860 - 708.1278) * (2579.6860 - 708.1278) + (-1220.7325 - -1634.9844) * (-1220.7325 - -1634.9844) + (54.7770 - 4.1586) * (54.7770 - 4.1586)));
  BENCH(floatsqroot((2579.6860 - 708.1278) * (2579.6860 - 708.1278) + (-1220.7325 - -1634.9844) * (-1220.7325 - -1634.9844) + (54.7770 - 4.1586) * (54.7770 - 4.1586)));
  BENCH(PointToPoint3D(2579.6860, -1220.7325, 54.7770, 708.1278, -1634.9844, 4.1586));
  BENCH(PointToPoint3D(2579.6860, -1220.7325, 54.7770, 708.1278, -1634.9844, 4.1586));
  BENCH(floatsqroot((2579.6860 - 708.1278) * (2579.6860 - 708.1278) + (-1220.7325 - -1634.9844) * (-1220.7325 - -1634.9844) + (54.7770 - 4.1586) * (54.7770 - 4.1586)));
  BENCH(floatsqroot((2579.6860 - 708.1278) * (2579.6860 - 708.1278) + (-1220.7325 - -1634.9844) * (-1220.7325 - -1634.9844) + (54.7770 - 4.1586) * (54.7770 - 4.1586)));
  BENCH(PointToPoint3D(2579.6860, -1220.7325, 54.7770, 708.1278, -1634.9844, 4.1586));
  BENCH(PointToPoint3D(2579.6860, -1220.7325, 54.7770, 708.1278, -1634.9844, 4.1586));
  printf("Result of floatsqroot: %.4f", floatsqroot((2579.6860 - 708.1278) * (2579.6860 - 708.1278) + (-1220.7325 - -1634.9844) * (-1220.7325 - -1634.9844) + (54.7770 - 4.1586) * (54.7770 - 4.1586)));
  printf("Result of PointToPoint3D: %.4f", PointToPoint3D(2579.6860, -1220.7325, 54.7770, 708.1278, -1634.9844, 4.1586));

Here are the results....

Код:
[18:39:13]
floatsqroot
 -> Average time per call :      668 ns
 -> Total execution time :      334 ms
 -> Calls per second   :  1497006 calls
[18:39:13]
floatsqroot
 -> Average time per call :      654 ns
 -> Total execution time :      327 ms
 -> Calls per second   :  1529052 calls
[18:39:14]
PointToPoint3D
 -> Average time per call :      144 ns
 -> Total execution time :       72 ms
 -> Calls per second   :  6944444 calls
[18:39:14]
PointToPoint3D
 -> Average time per call :      144 ns
 -> Total execution time :       72 ms
 -> Calls per second   :  6944444 calls
[18:39:14]
floatsqroot
 -> Average time per call :      668 ns
 -> Total execution time :      334 ms
 -> Calls per second   :  1497006 calls
[18:39:14]
floatsqroot
 -> Average time per call :      666 ns
 -> Total execution time :      333 ms
 -> Calls per second   :  1501501 calls
[18:39:14]
PointToPoint3D
 -> Average time per call :      144 ns
 -> Total execution time :       72 ms
 -> Calls per second   :  6944444 calls
[18:39:14]
PointToPoint3D
 -> Average time per call :      146 ns
 -> Total execution time :       73 ms
 -> Calls per second   :  6849315 calls
[18:39:14] Result of floatsqroot: 1917.5236
[18:39:14] Result of PointToPoint3D: 1917.5236
Reply
#32

Quote:
Originally Posted by Tupac
Посмотреть сообщение
pawn Код:
stock Float:PointToPoint(Float:x, Float:y, Float:z, Float:xx, Float:yy, Float:zz)
{
    return floatsqroot( (x - xx) * (x - xx) + (y - yy) * (y - yy) + (z - zz) * (z - zz) );
}
4char
This plugin is because this function is alot slower then this plugin.
Reply
#33

What is it?
what it gives?
Reply
#34

Quote:
Originally Posted by Elviss
Посмотреть сообщение
What is it?
what it gives?
It gives you bacon..
Reply
#35

I can't download the source code.
I'd like to take a look at it...
Could someone please reupload it?
Reply
#36

Quote:
Originally Posted by Double-O-Seven
Посмотреть сообщение
I can't download the source code.
I'd like to take a look at it...
Could someone please reupload it?
Sure: http://solidfiles.com/d/1a8a1/

Downloaded it probably a few days before expiration date ^^.
Reply
#37

I had a function which did same in 3 lines
Reply
#38

Quote:
Originally Posted by [Ask]Terminator
Посмотреть сообщение
I had a function which did same in 3 lines
Yes, everyone does, it has been posted like 50 times in this topic. The reason this plugin was made is not the functionality - it's the performance.
Reply
#39

that plugin is the same that:
Код:
stock DistanceToPoint(playerid, Float:PointX, Float:PointY, Float:PointZ)
{
	new Float:PosX, Float:PosY, Float:PosZ;
	GetPlayerPos(playerid, PosX, PosY, PosZ);
	return floatsqroot((PosX-PointX)*(PosX-PointX)+(PosY-PointY)*(PosY-PointY)+(PosZ-PointZ)*(PosZ-PointZ)))
}
Reply
#40

Similar, but the plugin written by C++ and faster.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)