Giter VIP home page Giter VIP logo

Comments (3)

alexpechkarev avatar alexpechkarev commented on September 20, 2024 2

Hi @azureshin,

Have run your example, following will work, please note tolerance is given in meters, in this case 130m will return true.

The location ['lat' => 25.771, 'lng' => -80.186] is considered on path with tolerance 130 meters, return true.
tolerance = 140 - return true
tolerance = 130 - return true
tolerance = 120 - return false
tolerance = 100 - return false
and so on

      $r = \GeometryLibrary\PolyUtil::isLocationOnPath(
              ['lat' => 25.771, 'lng' => -80.186], // point array [lat, lng]
              [ // poligon arrays of [lat, lng]
                ['lat' => 25.774, 'lng' => -80.190], 
                ['lat' => 18.466, 'lng' => -66.118], 
                ['lat' => 32.321, 'lng' => -64.757]
              ],
                130);

from geometry-library.

alexpechkarev avatar alexpechkarev commented on September 20, 2024

Hi @azureshin,

Please can you try to reduce $tolerance from 0.001 to 0.1 ?
According to Floating point precision "numbers have limited precision and non elementary arithmetic operations may give larger errors, and, of course, error propagation must be considered when several operations are compounded."

Looking deeper in the code:
// $toleranceEarth = 0.001;
$tolerance = $toleranceEarth / MathUtil::EARTH_RADIUS; // 6371009
// tolerance at this stage 1.5696100884491E-10
// than following is called
$havTolerance = MathUtil::hav($tolerance);
//$havTolerance = 6.159189574403E-21

from geometry-library.

azureshin avatar azureshin commented on September 20, 2024

Dear @alexpechkarev

I try to $tolerance from 0.001 to 0.1
but it return false

thanks....

from geometry-library.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.