3D angle Measurement
Afficher commentaires plus anciens
Hello, I have an one 3D dataset of a metal object that i want to measure some data from it. I am able to measure the length etc but calculating the angles giving me hard time since it can be positioned in different angles itself. I was wondering what would be the best and simple thing to calculate the angles. How can i move the data to the certain xyz plane ? or is it possible to create another xyz plane with the reference points in the object thanks
3 commentaires
Julie
le 20 Août 2018
What is in the 3D dataset? Are you working with a truss (Node positions and connectivity), or something else. What are you trying to calculate the angle between, is it 2 parts of the metal object or some global vector?
Emre Erdogan
le 20 Août 2018
Modifié(e) : Emre Erdogan
le 20 Août 2018
ADragon
le 20 Août 2018
Hi Emre, you could use vector math. Using the equation cos(theta) = (u dot v)/(mag u * mag v)
p1 = rand(1,3); % Point 1
p2 = rand(1,3); % Point 2
p3 = rand(1,3); % Point 3
% Vector u from p2 to p1
% Vector v from p2 to p3
u = p1 - p2;
v = p3 - p2;
o = zeros(1,3);
udotv = sum(u.*v); % dot product of u and v
umag = norm(u); % vector magnitude of u
vmag = norm(v); % vector magnitude of v
theta = acos(udotv/(umag*vmag))*180/pi;
figure
p = [u; o; v];
plot3(p(:,1),p(:,2),p(:,3))
title(['Vector Angle = ' num2str(theta,4) ' deg'])
axis equal
grid on
Réponses (0)
Catégories
En savoir plus sur Operating Points dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!