Find centre point of coordinates in three dimensional space and then calculate euler angles relative to the centre point.
32 views (last 30 days)
Show older comments
Hi all,
I have an array with around 2000 points in. These points sit on a surface in three dimensional space. I want to calculate the centre point in between all of these points and then calculate the euler angles that the vector between the centre point each point sits at treating the z axis as 0,0,0 euler angle.
I am currently going over potential ways to the first problem and currently am going to impliment:
centre = ((x1 + x2 ... + xn)/n),((y1 + y2 ... + yn)/n),((z1 + z2 ... + zn)/n)
However if anyone has a better idea I am all ears.
My second problem I am a bit more confused about how to do. I can find the angle at which the vector sits relative to the z axis by dot product but I don't know how to calculate the three euler angles.
thanks for all your help.
2 Comments
Jan
on 15 Feb 2019
Edited: Jan
on 15 Feb 2019
Please post a tiny example, because "I have an array with around 2000 points in" is not a clear description. "x1 + x2 ... + xn" sounds like you have hidden indices in the names of the variables and this would be a really bad idea. How do you define "center"? The arithmetic or geometric mean? The arithmetic of an array is calculated by the mean command.
You cannot calculate 3 Euler angles (by the way: in which order? There are many different Euler and Euler-Cardan angles according on the order of rotations) between an axis and a point. You can determine 3 euler angles only bewteen two coordinate systems with 3 axes. Between a reference system and one point you can only determine azimut and elevation: 2 angles. But there is no rotational angle around the vector from the origin to the point.
Answers (1)
KSSV
on 15 Feb 2019
Let A be your 2000X3 data points. YOu can get your center using mean
C = mean(A) ;
To get angle refer: https://in.mathworks.com/matlabcentral/answers/16243-angle-between-two-vectors-in-3d
0 Comments
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!