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