导出后损坏的stl对象

时间:2017-07-04 19:58:36

标签: matlab stl

我试图从Matlab导出.stl对象几天。 我正在使用stlwrite(filename, varargin)函数导出对象。这是代码:

clear all, close all

K=0.9;     % try K from 0.7 to 1

c(1,:)=[-K -K -K];
c(2,:)=[-K +K -K];
c(3,:)=[-K -K +K];
c(4,:)=[-K +K +K];
c(5,:)=[+K -K -K];
c(6,:)=[+K +K -K];
c(7,:)=[+K -K +K];
c(8,:)=[+K +K +K];

x(1)=rand();        % random starting point
y(1)=rand(); 
z(1)=rand(); 

for j=1:40000  

    cc=c(ceil(8*rand()),:); 

    x(j+1) = cc(1) + (x(j)-cc(1))/((sqrt((x(j)-cc(1))^2+(y(j)-cc(2))^2+(z(j)-cc(3))^2))^2);
    y(j+1) = cc(2) + (y(j)-cc(2))/((sqrt((x(j)-cc(1))^2+(y(j)-cc(2))^2+(z(j)-cc(3))^2))^2);
    z(j+1) = cc(3) + (z(j)-cc(3))/((sqrt((x(j)-cc(1))^2+(y(j)-cc(2))^2+(z(j)-cc(3))^2))^2);
end


plot3(x,y,z,'.','MarkerSize',4) , hold on
stlwrite('test.stl',x, y, z);

以下是生成的图像:

enter image description here

到目前为止一切顺利。问题来自生成的stl对象。

enter image description here

起初我认为问题是我正在使用的stlwrite函数,所以我尝试了另一个 - sutf2stl但问题仍然是一样的。如果有人能指出我正确的方向,我将不胜感激。

最好的问候。

0 个答案:

没有答案