Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
355 views
in Technique[技术] by (71.8m points)

Distance betwwen two 3D points in python in an array

i'm trying to write a python code to calculate the distance between two 3D points. Those points are listed as follows:

Timestamp, X, Y, Z, Distance

2613, 4.35715, 5.302030, -0.447308
2614, 7.88429, -8.401940, -0.484432
2615, 4.08796, 2.213850, -0.515359
2616, 4.35715, 5.302030, -0.447308
2617, 7.88429, -8.401940, -0.484432

i know the formula but I'm not sure how to list the column to run the formula for 3D point distance!

question from:https://stackoverflow.com/questions/65836062/distance-betwwen-two-3d-points-in-python-in-an-array

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is essentially the same question as How can the Euclidean distance be calculated with NumPy?

you can use numpy/scipy.linalg.norm

E.g.

scipy.lingalg.norm(2613-2614)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...