"Unfurl" 3D surface to 2D plane (not projection)
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hugo Calisto
el 16 de Mayo de 2023
Comentada: Mathieu NOE
el 17 de Mayo de 2023
I have a cloud of points with (x,y,z) coordinates with a scalar value (velocity) at each point, defining a 3D surface.
This surface consists of a straight rectangular section with constant y-values, followed by a curved section (with vertical sides) and then another straight rectangular section, but this time with constant x-values. The surface thus looks like a bent rectangular ribbon, with straight vertical and horizontal edges.
In Matlab, how do I "unfurl" (not project) the ribbon onto a (x,z) plane, i.e. have on the same (x,z) plane the first straight section, then the curved one and finally the second straight one, in adjacent sections? This of course means the obtained (x,z) area needs to have the same surface as the original (x,y,z) 3D surface.
Thank you in advance
4 comentarios
Respuesta aceptada
Mathieu NOE
el 16 de Mayo de 2023
hello
after a few trials , this is it !

try this :
data = readmatrix('Test1.xlsx',"NumHeaderLines",1); % x y z v
x = data(:,1);
x = x - min(x); % so it starts at x = 0
y = data(:,2);
y = y - min(y); % so it starts at y = 0
z = data(:,3);
z = z - min(z); % so it starts at z = 0
v = data(:,4);
figure(1)
scatter3(x,y,z,5,v,'filled');
colorbar;
% master curve between distance to origin d and arc length s
d = sqrt( x.^2 + y.^2 );
[val,ix] = sort(d);
xs = x(ix);
ys = y(ix);
% arc length s computed from sorted x,y values
s = 0.0;
for i = 1:numel(xs)-1
s(i+1) = s(i) + sqrt( (xs(i+1)-xs(i))^2 + (ys(i+1)-ys(i))^2 );
end
% convert back s with correct indices to match initial x,y data (indexes)
% reverse sort as explained here : https://blogs.mathworks.com/loren/2007/08/21/reversal-of-a-sort/
unsorted = 1:length(s);
newInd(ix) = unsorted;
s = s(newInd);
figure(2)
scatter(s,z,5,v,'filled');
colorbar;
3 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
