How to calculate even distance by interpolated path (Python2.7)?

I have a (long) list of x, y tuples that collectively describe the path (i.e., mouse activity selected at a constant speed, despite the inconsistent speeds).

My goal is to revive this path at a constant speed. Thus, I have segments that are curved, and the segments are straight, and the delta-d between any two points is not guaranteed to be the same.

Data such as:

[(0,0), (0,2), (4,6).... ], where the length of this list is ~ 1k-2k points, is there any way, except brute force, to count the lengths of line segments between each point and then designate each n-length with a "frame"?

+4
source share
3 answers

Numpy , . , .

+1

, pandas, , . , :

node . , D, . , node D node, x, y ( / ) , D node , .

, , /. , , , .

0

, , , , tuple1 , tuple2 , :

abs(complex(tuple2[0]-tuple1[0], tuple2[1]-tuple1[1]))

gives the length traversed between these two points, the sum of which will be the total length. This division by total time will give the length to go through the unit of time. So there is still brute force, but perhaps a more efficient way to do this, especially if it is used in understanding the list along with the sum function. Like a s sign. notes, if you can increase the resolution of the sample, the approximation will improve.

0
source

All Articles