surface data representation (triangulation...?)

3 views (last 30 days)
martin
martin on 22 Oct 2014
Commented: martin on 23 Oct 2014
Dear all, after searching by myself for a couple of days I allow myself to post a question. How do i plot a colored surface in 3d space, given the data points as (x,y,z, property)? The points clearly lie on a surface, but the shape is non-trivial and non-convex.
the best i got is using scatter3, but this is clearly not what I am looking for:
clc
clear all
close all
load('datafile.mat');
n=1; %only load every nth point for better performance
x= data(1:n:end,1);
y= data(1:n:end,2);
z= data(1:n:end,3);
prop= data(1:n:end,4);
%plot all data
figure(1)
scatter3(x,y,z,2,prop)
%plot only one quadrant for better visibility
xx=x(and(x>0,y>0))
yy=y(and(x>0,y>0))
zz=z(and(x>0,y>0))
pp=prop(and(x>0,y>0))
figure(2)
scatter3(xx,yy,zz,2,pp)
giving
What i tried before is delaunay triangulation, freesurface and convexhull. I could not find something that would return a list of triangles rather than tetraeders. i thought about deviding this surface into fractions that can be seen as function z=f(x,y) and apply the 2d-triagnulation. but this is tideous and not straight forward.
thanks for any suggestions! best, martin

Answers (1)

Mike Garrity
Mike Garrity on 22 Oct 2014
The new alphashape command does a pretty good job with this. Here's what I get with the defaults:
shp=alphaShape(x,y,z);
plot(shp,'EdgeColor','none');
camlight
axis normal
You might be able to do better by adjusting some of the parameters.
  1 Comment
martin
martin on 23 Oct 2014
ill have to upgrade to 2014b first, currently running 2014a. but thanks anyway for this! ill com back to it soon

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!