generate new coordinates (starting from initial coordinates) that are arranged outwards (by a distance H) and on the same plane
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Alberto Acri
il 26 Set 2023
Commentato: Walter Roberson
il 1 Ott 2023
HI! Is there a way to generate new coordinates, starting from the 'trace' matrix, which are arranged outwards (by a distance H) and always on the highlighted plane?
M = [0.138500000000000 0.0645000000000000 0.988300000000000 82.9848687500000];
figure
plot3(trace(:,1),trace(:,2),trace(:,3),'k.','Markersize',10);
hold on
fimplicit3(@(x1,y1,z1) M(1)*x1+M(2)*y1+z1*M(3)-M(4));
hold off
axis equal
zlim([80 84])
0 Commenti
Risposta accettata
Bruno Luong
il 27 Set 2023
Modificato: Bruno Luong
il 27 Set 2023
load('trace.mat')
mt = mean(trace);
dt = trace-mt;
[~,~,V]=svd(dt);
Q=V(:,[1:2]);
t2D = dt*Q;
[~,is]=sort(atan2(t2D(:,2),t2D(:,1)));
P=polyshape(t2D(is,:));
H = 1;
Pbigger=polybuffer(P,H);
Pbigger3D=mt+Pbigger.Vertices*Q';
figure
plot3(trace(:,1),trace(:,2),trace(:,3),'.')
hold on
plot3(Pbigger3D(:,1),Pbigger3D(:,2),Pbigger3D(:,3),'Linewidth', 2)
axis equal
3 Commenti
Bruno Luong
il 1 Ott 2023
Modificato: Bruno Luong
il 1 Ott 2023
Not sure what is "other end nodes"? If you want to densify just interpolate the expalnd nodes using interp1 for example. Each task a specific function, don't mix them.
Walter Roberson
il 1 Ott 2023
Più risposte (2)
Matt J
il 26 Set 2023
Modificato: Matt J
il 26 Set 2023
Project the points into a 2D coordinate system on the plane. Then use polyshape. Then project back to 3D.
load trace
H=0.5;
[~,V]=freeBoundary( delaunayTriangulation(trace(:,1:2)) );
p=polyshape(V);
q=polybuffer(p,H);
scatter(p.Vertices(:,1), p.Vertices(:,2)); hold on
plot([p,q])
scatter(q.Vertices(:,1), q.Vertices(:,2)); hold off
axis equal
3 Commenti
Walter Roberson
il 26 Set 2023
Modificato: Walter Roberson
il 27 Set 2023
which are arranged outwards (by a distance H)
I doubt that you want to arrange the points by distance H, but here it goes.
load trace
axes2 = axes('Parent',figure);
patch(axes2, trace(:,1), trace(:,2), trace(:,3), 'facecolor', 'r', 'facealpha', 0.5, 'edgecolor', 'k');
view(axes2,[31.7625655339418 23.9174311926605]);
axis(axes2, 'equal');
axes3 = axes('Parent', figure);
tc = mean(trace,1);
c = trace - tc;
[th, H, z] = cart2pol(c(:,1), c(:,2), c(:,3)); %center around centroid
[~, order] = sort(H);
patch(axes3, trace(order,1), trace(order,2), trace(order,3), 'facecolor', 'r', 'facealpha', 0.5, 'edgecolor', 'k');
view(axes3,[31.7625655339418 23.9174311926605]);
axis(axes3, 'equal')
axes4 = axes('Parent', figure)
[~, order] = sort(th);
patch(axes4, trace(order,1), trace(order,2), trace(order,3), 'facecolor', 'r', 'facealpha', 0.5, 'edgecolor', 'k');
view(axes4,[31.7625655339418 23.9174311926605]);
axis(axes4, 'equal')
As you can see, the plot is a lot more sensible if you sort by angle than by distance.
2 Commenti
Walter Roberson
il 27 Set 2023
format long g
M = [0.138500000000000 0.0645000000000000 0.988300000000000 82.9848687500000];
tolerance = 1e-3;
load trace
d = M(1)*trace(:,1) + M(2)*trace(:,2) + M(3) * trace(:,3) - M(4);
mask = abs(d) < tolerance;
in = trace(mask,:);
out = trace(~mask,:);
scatter3(in(:,1), in(:,2), in(:,3), 'g');
hold on
scatter3(out(:,1), out(:,2), out(:,3), 'r');
hold off
axis equal
[min(d), max(d)]
The interpretation of this is that all of the points in trace are already on that particular plane to within a fairly small tolerance. You cannot expect the distance-from-plane, d, to be exactly 0 due to round-off error.
With all of the points already being on the plane, then the task becomes to sort by H. But what is H ? Distance between some outer ring (the red one) and the inner ring (the black one) ? But is there an equation for either the inner or outer ring with the coordinates inside trace providing the other of the two rings? Your fimplicit() is linear and defining a plane, not a ring of some kind.
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!