php distance
v1.0.1
تتيح مكتبة مسافة PHP حساب العديد من أنواع المسافة بين النقاط.
يمكن تثبيت مسافة PHP بسهولة باستخدام الملحن. فقط قم بتشغيل الأمر التالي من جذر مشروعك.
composer require divineomega/php-distance
إذا لم تكن قد استخدمت أبدًا مدير الاعتماد على الملحن من قبل ، فتوجه إلى موقع الملحن لمزيد من المعلومات حول كيفية البدء.
راجع مقتطف الكود التالي الذي يضع شيطانًا كيفية استخدام هذه المكتبة.
$ a = new Point ( $ x1 , $ y1 );
$ b = new Point ( $ x2 , $ y2 );
$ c = new Point ( $ x3 , $ y3 , $ z3 ); # Infinite dimensions supported by some distance types
$ distanceType = new Euclidean ();
$ distanceType = new EuclideanSquare ();
$ distanceType = new Haversine (); # For GPS coordinates (latitude and longitude)
$ distance = ( new Distance ())
-> type ( new Euclidean ()) # Type is optional, and defaults to Euclidean distance
-> from ( $ a )
-> to ( $ b )
-> get ();