What we need to be doing is ignore subtraction of slopes of A.stl, which are too steep...

4 visualizaciones (últimos 30 días)
we are subtracting (3D Subtraction) A.stl from B.stl. What we need to be doing is ignore subtraction of slopes of A.stl, which are too steep. PS: we can detect which points have greater than entered slope in A.stl
  1 comentario
DGM
DGM el 5 de Abr. de 2025
Editada: DGM el 5 de Abr. de 2025
It's not clear what A and B are, how they relate geometrically, or what "subtraction" means in this context -- specifically what subtraction can mean if it's a slope-dependent process. It's also unclear how slope is being measured.
I suspect that A and B may be something like simple height maps, in which case I suspect that "ignore subtraction" is probably supposed to actually mean "clamp the minimum result". Otherwise, you're asking for a bunch of step discontinuities.

Iniciar sesión para comentar.

Respuestas (1)

DGM
DGM el 5 de Abr. de 2025
If I'm gonna guess, I might as well invest in it.
unzip saddles.zip
% these two files have directly correlated vertex lists
% this is not typical, so don't expect to meaningfully subtract random
% objects like this.
B = stlread('saddletop.stl');
A = stlread('saddletop90.stl');
isequal(A.Points(:,1:2),B.Points(:,1:2)) % x,y locations match
ans = logical
1
subplot(1,2,1); trisurf(B)
subplot(1,2,2); trisurf(A)
You could ignore cases where some angle criteria is exceeded.
% get some sort of "angle"
fn = vertexNormal(A);
th = acosd(fn(:,3)./vecnorm(fn,2,2)); % elevation angle
ignorethese = th > 45;
V = B.Points;
V(:,3) = V(:,3) - A.Points(:,3);
V(ignorethese,3) = B.Points(ignorethese,3);
T = triangulation(B.ConnectivityList,V);
% display it using patch()
figure
patch('faces',T.ConnectivityList,'vertices',T.Points, ...
'facecolor','w','edgecolor','k');
view(3); camlight; view(10,33)
axis equal; grid on
xlabel('X'); ylabel('Y'); zlabel('Z')
... or you could do something else.
% just do some sort of constrained difference
V = B.Points;
V(:,3) = max(V(:,3) - A.Points(:,3),-0.5); % clamp at some level
T = triangulation(B.ConnectivityList,V);
% display it using patch()
figure
patch('faces',T.ConnectivityList,'vertices',T.Points, ...
'facecolor','w','edgecolor','k');
view(3); camlight; view(10,33)
axis equal; grid on
xlabel('X'); ylabel('Y'); zlabel('Z')
... or something entirely different.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by