Hi, I am looking for a method or algorithm to divide a 3D surface into equal patches. The detail is explained below
Background:
the initial plate has grids as in picture (1). initial position of A1 (a1,b1,c1) …. A121 (a121, b121, c121). All of this position is known. A1 is the origin A1(0,0,0)
After deformation, the plate becomes 3D curve and grids has new position A’1(u1,v1,w1) …A’100(u100, v100,w100).
Currently, I used 3D scanner to get the point cloud data of deformed plate and successfully get the equation of 3D surface.
My question is: How to divide the 3D surface into 100 patches with equal area to find the grid A’2 …A’100 position. (A’1 is the origin A1(0,0,0) and coincide with A1) I already tried matlab built-in function and other software but the result gives me the mesh with different in area. (example: area of S1 ≠ S2 ≠ S100)
Attachment is the point cloud data after processed
Thanks for your support.

 Akzeptierte Antwort

darova
darova am 29 Mai 2021

0 Stimmen

Try arc length interpolation. Original link: LINK
function main
clc,clear
% generate some data
[x,y] = meshgrid(-1:0.4:1);
z = x.^2+y.^2;
surf(x,y,z,'facecolor','none')
% interpolation
[x1,y1,z1] = myinterp1(x,y,z);
[x2,y2,z2] = myinterp1(x1',y1',z1');
hold on
plot3(x2,y2,z2,'.r')
hold off
axis equal
function [x1,y1,z1] = myinterp1(x,y,z)
x1 = x*0;
y1 = y*0;
z1 = z*0;
for i = 1:size(x,1)
dx = diff(x(i,:)).^2;
dy = diff(y(i,:)).^2;
dz = diff(z(i,:)).^2;
t = [0 cumsum(sqrt(dx+dy+dz))]; % parameter
t1 = linspace(0,t(end),size(x,2)); % new parameter
x1(i,:) = interp1(t,x(i,:),t1);
y1(i,:) = interp1(t,y(i,:),t1);
z1(i,:) = interp1(t,z(i,:),t1);
end
end
end

4 Kommentare

Trinh Nam
Trinh Nam am 28 Mai 2021
Verschoben: John D'Errico am 29 Jun. 2023
Hi Darova, thanks for your support. I don't understand some points, could you please explain ?
1. Why the 3D surface is translated along the X axis after running the code ?
2. Why we cannot calculate the "Red point" in the Top and Bottom edge of the 3D surface while it can find the "Red point" along Left edge and Right edge.
3. Why we need to translate the X +15 unit and Z for -100 unit ? , According to the code
plot3(x+15,y,z-100) and [t,r] = cart2pol(x+15,z-100)
Thanks for your explaination
darova
darova am 28 Mai 2021
Verschoben: John D'Errico am 29 Jun. 2023
  • 1. Why the 3D surface is translated along the X axis after running the code ?
I don't understand the question. What translation?
  • 2. Why we cannot calculate the "Red point" in the Top and Bottom edge of the 3D surface while it can find the "Red point" along Left edge and Right edge.
We can. Try griddedInterpolant instead. It has extrapolation property
  • 3. Why we need to translate the X +15 unit and Z for -100 unit ? , According to the code
It's needed to place your data on the circle (to interpolate it in polar syste)
Trinh Nam
Trinh Nam am 29 Mai 2021
Verschoben: John D'Errico am 29 Jun. 2023
Hi Darova
thanks for your explain. But i think this solution is not general. We cannot apply for the saddle shape or the pillow shape.
Saddle shape General shape Pillow shape
I am looking for the general way to do this job, I am appreciate if you have any algorithm
Akhila
Akhila am 29 Jun. 2023
Verschoben: John D'Errico am 29 Jun. 2023
Hi Trinh
Did you get the solution to your problem?
I also need this from my work, if you have the solution could you share it with me?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

darova
darova am 26 Mai 2021

0 Stimmen

Try griddata to interpolate

1 Kommentar

Trinh Nam
Trinh Nam am 27 Mai 2021
I already tried, although it can generate the rectangle patch, but the area of these patch are not equal

Melden Sie sich an, um zu kommentieren.

darova
darova am 27 Mai 2021
Try to interpolate in polar system. Find center of a circle
clc,clear
data = load('curve.txt');
x = data(:,1);
y = data(:,2);
z = data(:,3);
t = linspace(0,2*pi,20);
[x1,y1] = pol2cart(t,100);
plot3(x+15,y,z-100)
%line(x1,y1)
[t,r] = cart2pol(x+15,z-100);
t0 = linspace(max(t(:)),min(t(:)),10);
y0 = linspace(min(y(:)),max(y(:)),10);
[T,Y] = meshgrid(t0,y0);
R = griddata(t,y,r,T,Y);
[X,Z] = pol2cart(T,R);
hold on
plot3(X,Y,Z,'.r')
hold off
view(45,45)

Community Treasure Hunt

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

Start Hunting!

Translated by