Clear Filters
Clear Filters

How to segment 3D point data

1 view (last 30 days)
3mg4
3mg4 on 6 Dec 2016
Edited: 3mg4 on 6 Dec 2016
Hello,
I have a set of data points (xyz) that describes an upside down cone shape (One cone has something around 200.000 points.) I know the center point and shifted the origin of the coordiante system to this point.
Now i would like to slice the cone in pieces, similar to a cake. After that i would like to do some calculations for each silce (e.g.mean of all points in this slice)
I got so far:
  • Import data
  • shift origin to center of cone
  • transform to cylindrical polar coordinates (theta rho z)
  • sort the matrix according to the azimut angle theta
But now im stuck, how should I segment it, e.g. every slice should have an angle of 20 degree (0.3149 rad) or a different approach-> slice the cone in X even segments.
Since my data files are very big .csv files, im not sure if i can upload them here.
English is not my native language, i hope you can understand what im trying to say.
Here is my code: I'm sure there are some comsetical no no's in it, im by far nor Matlab expert, but learning constantly and try to improve myself, so please be gentle;-)
TEST
Importdir = dir('*.csv');
for i = 1:numel(Importdir);
M = Importdir(i).name;
M = csvread(M);
MID{i} = M(:,1);
Mx{i} = M(:,2);
My{i} = M(:,3);
Mz{i} = M(:,4);
end
for a = 1:numel(Importdir);
% Find position of cone center ID 1005
PosOrigin{a} = find(MID{a}==1005);
% Get value according to ID 1005 for x y z
x_center{a} = Mx{a}(PosOrigin{a},1);
y_center{a} = My{a}(PosOrigin{a},1);
z_center{a} = Mz{a}(PosOrigin{a},1);
% Make matrix with center values
center{a} = [x_center{a},y_center{a}, z_center{a}];
% Make Matrix of coordinates for cone
Mxyz{a} = [Mx{a}, My{a}, Mz{a}];
% Shift Cone to new origin
s{a} = Mxyz{a} - center{a};
end
for j = 1:numel(Importdir);
% make matrix to transformation in zylindrical coordinates
v = cell2mat(s(j));
% Transform catesian into cylindrical coordinates
[theta,rho,z] = cart2pol(v(:,1),v(:,2),v(:,3));
% Create Matrix and sort it in respect of theta (angle on xy plane)
l = [theta rho z];
lsort = sortrows(l,1);
%search = lsort(:,1);
% Find Angle to first Interval e.g. 0 to 20 degrees?
end
Thank You!
  2 Comments
KSSV
KSSV on 6 Dec 2016
Note that code is not attached. Along what plane you want to slice it?
3mg4
3mg4 on 6 Dec 2016
Now it should be visible, sorry for that! I would like to slice it vertical, like you would slice a cake.

Sign in to comment.

Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!