Giter VIP home page Giter VIP logo

Comments (3)

bryanburgers avatar bryanburgers commented on June 13, 2024

I suppose one solution that I could use, in lieu of this, is to keep dividing in half, so 1/4 of the way there would be

let midpoint = sourcePoint.midpointTo(destinationPoint);

sourcePoint.midpointTo(midpoint); // 1/4 of the way there
midpoint // 1/2 of the way there
midpoint.midpointTo(destinationPoint); // 3/4 of the way there

from geodesy.

chrisveness avatar chrisveness commented on June 13, 2024

Bryan,

I've added the formula for an intermediate point
http://www.movable-type.co.uk/scripts/latlong.html#intermediate-point at
a fraction along the path between two points.

I'm not sure I'll bother adding it to the library, so I'll leave it to you
to code up...

Chris

On 1 September 2015 at 19:31, Bryan Burgers [email protected]
wrote:

I can't find anywhere on the internet that describes the algorithm to do
this. Your midpoint algorithm is the closest I can find:

Similar to .midpointTo, but where it is an arbitrary percentage (or
distance, either one) along the path from one point to another, where
.midpointTo is exactly halfway.

sourcePoint.midpointToN(destinationPoint, 0.5) == sourcePoint.midpointTo(destinationPoint);
sourcePoint.midpointToN(destinationPoint, 0.1); // 1/10th of the way there.
sourcePoint.midpointToN(destinationPoint, 0.9); // 9/10ths of the way there.
sourcePoint.midpointToN(destinationPoint, 1) == destinationPoint

.midpointToN is a bad name, obviously, since it isn't calculating the
midpoint. .percantageDistanceTo?


Reply to this email directly or view it on GitHub
#17.

from geodesy.

chrisveness avatar chrisveness commented on June 13, 2024

LatLon.intermediatePoint() method added.

from geodesy.

Related Issues (20)

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.