Distance between points of a 3D centreline
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I have a curve represented by 3D points (please see attached .mat file). I would like to find out the distance between the 1st point and the 2nd point, the 2nd point and the 3rd point, the 3rd point and the 4th point, the 4th point and the 5th point ect until the final point and the values be saved to a text file.
What would be the simplest most accurate way of achieving this? Any suggestions welcome.
1 Commento
Risposte (1)
John D'Errico
il 12 Gen 2020
Modificato: John D'Errico
il 12 Gen 2020
Why not try diff? For example, what does
diff(CL,[],1)
do? TRY IT! What is distance? Does that give you something you might be able to work with? Does it get you closer to the goal that you need to achieve?
What if you then squared the elements of that array? Again, THINK! TRY IT!
diff(CL,[],1).^2
Suppose you now used sum on the result?
sum(diff(CL,[],1).^2,2)
what does that represent? Now, again, what is the distance you are trying to achieve? Would a sqrt help here? TRY IT!
When you have a difficult problem, break it into small pieces. Try to move towards the goal you want. Look for functions that will help you to acheive that goal. While it is often unlikely that you will find one magic function that does exactly what you want, it is also the case that very often, you can find several functions that will get you there when taken in combination.
0 Commenti
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!