Skip to content
Advertisement

Equidistant points between two points?

I am trying to know equidistant points between two points. For example:

JavaScript

The answer that I am expecting is:

JavaScript

In this example, with p1, and p2:

JavaScript

Always will be a straight line. HowManyParts in this case is the whole distance that is divided
something like numpy.linspace() but in two dimensions.

Advertisement

Answer

Thanks to linearity of the line connecting two points, you can simply use numpy.linspace for each dimension independently:

JavaScript

For example:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement