Hey guys, my stlwrite function is not working and i would like to know how to fix it. In the code C is random points

2 次查看(过去 30 天)
seeds=C;
Unrecognized function or variable 'C'.
[Ver,Cel,C_tst]=voronoi3d_cuboid(seeds,Vcub);
FK = zeros(100,3,312);
figure
hold on
axis('equal')
view([-36 27])
scatter3(seeds(:,1),seeds(:,2),seeds(:,3),25, ...
'Marker','o','MarkerFaceColor',[1 0 0], 'MarkerEdgeColor','k');
scatter3(Ver(:,1),Ver(:,2),Ver(:,3),25, ...
'Marker','o','MarkerFaceColor',[0 1 0], 'MarkerEdgeColor','r');
for k = 1:length(Cel)
if ~isempty(Cel{k})
col=rand(1,3);
Vk = Ver(Cel{k},:); Fk = convhull(Vk);
if exist('mergeCoplanarFaces.m','file')==2
[Vk, Fk] = mergeCoplanarFaces(Vk, Fk);
for i=1:length(Fk)
patch('Vertices',Vk,'Faces',Fk{i},'FaceColor',col,'FaceAlpha',0.3)
end
else
trisurf(Fk,Vk(:,1),Vk(:,2),Vk(:,3),'FaceColor',col, ...
'FaceAlpha', 1,'EdgeAlpha',1,'EdgeColor','k');
%
FK(1:size(Fk,1),1:3,k) = Fk(:,1:3);
VK(1:size(Vk,1),1:3,k) = Vk(:,1:3);
end
end
end
grid on
xlabel('X');ylabel('Y');zlabel('Z');
P = struct('faces',FK,'vertices',VK);
stlwrite('mytriangulation.stl',P);

回答(1 个)

VINAYAK LUHA
VINAYAK LUHA 2023-10-6
Hi Akhshay,
It is my understanding that you are facing issues while using the “stlwrite” function. The issue is caused by the incorrect placement of the passed parameters in the calling syntax for the "stlwrite" function.
Refer to the examples listed in the following documentation of “stlwrite” function to learn how to use “stlwrite” function correctly- https://in.mathworks.com/help/matlab/ref/stlwrite.html
Hope this helps in fixing the “stlwrite” error.
Regards,
Vinayak Luha

类别

Help CenterFile Exchange 中查找有关 Voronoi Diagram 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by