Find centre point of coordinates in three dimensional space and then calculate euler angles relative to the centre point.

32 views (last 30 days)
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
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.
Jack Turner
Jack Turner on 15 Feb 2019
The array is three columns with each column representing an x, y and z cordinate and each row representing a different point.
The calculate centre equation is just taking the sum of the x, y and z coordinates and then dividing each one by the total number of points to give the average x, y and z coordinate. To explain further the points I have that define the surface are equally spaced across the surface of the volume thus this method works well as it take the average centre of points spread evenly across the surface.
The three euler angles need to be around (0,0,1),(0,1,0),(0,0,1) (i guess for ease to begin with I can just make the initail euler 0 and then simply calculate the 'tilt' followed by a rotation around the z axis) for the program I will then use them with. The euler angle would be calulated not just between an axis and a point but between the line/vector that can be drawn between the centre point and each and every surface value.

Sign in to comment.

Answers (1)

KSSV
KSSV on 15 Feb 2019
Let A be your 2000X3 data points. YOu can get your center using mean
C = mean(A) ;

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!