Scilab 中的点云

Cloud of dots in Scilab

我想使用 Scilab 在 3d 中绘制点云。我得到了一些东西,但它看起来很糟糕。这是代码

// Mesures de références :
x1=[0   ; 0.5 ; 0  ];
x2=[0.5 ; 2   ; 1.5];
x3=[0.5 ; 2   ; 0  ];
x4=[0.5 ; 1   ; 0  ];
x5=[0   ; 1.5 ; 1.5];
x6=[0   ; 1.8 ; 2.7];
x7={0   ; 2   ; 2  };
X=[x1,x2,x3,x4,x5,x6,x7];
[n,m]=size(X);

// Transformations :

Angles=[%pi/4, %pi/2, -%pi/6];
C=cos(Angles);
S=sin(Angles);

Q1=[C(3) , S(3) , 0 ;
-S(3), C(3) , 0 ;
0    ,  0   , 1 ];

Q2=[C(2) , 0    , S(2) ;
  0  , 1    ,  0   ;
-S(2), 0    , C(2) ];

Q3=[  1  , 0    ,  0   ;
  0  , C(1) ,  S(1);
  0  , -S(1), C(1) ];

Q=Q1*Q2*Q3;

t=[3 ; -1 ; 0];

bruit=X-(0.11)*eye(n,m); //Simulation d'une impression de mesure

// Mesures 

E=Q*X(:,1)+t+bruit(:,1);
for k=2:m
    e=Q*X(:,k)+t+bruit(:,k);
    E=[E , e];
end


// Graphique

param3d1(X(1,:),X(2,:),X(3,:))

a = get("current_axes");

h = a.children;
h.line_mode = "off";
h.mark_mode = "on";
h.mark_size = 5;
h.mark_foreground = 3;

给出

我没有成功地在与 X 矩阵相同的 window 上绘制 E 矩阵中的点,但具有颜色或形状。另外,我想对其进行改进,使其看起来更像这样:

任何帮助将不胜感激。

类似以下代码的东西可以完成这项工作;

// Mesures de références :
x1=[0   ; 0.5 ; 0  ];
x2=[0.5 ; 2   ; 1.5];
x3=[0.5 ; 2   ; 0  ];
x4=[0.5 ; 1   ; 0  ];
x5=[0   ; 1.5 ; 1.5];
x6=[0   ; 1.8 ; 2.7];
x7=[0   ; 2   ; 2  ];
X=[x1,x2,x3,x4,x5,x6,x7];
[n,m]=size(X);

//triedre
Tox=[0 0 0;2.5 0 0]';
Toy=[0 0 0;0 2.5 0]';
Toz=[0 0 0;0 0 2.5]';
Txy=[2.5 0 0;0 2.5 0]';
Txz=[2.5 0 0;0 0 2.5]';
Tyz=[0 2.5 0;0 0 2.5]';
T=list(Tox,Toy,Toz,Txy,Txz,Tyz);

// Transformations :

Angles=[%pi/4, %pi/2, -%pi/6];
C=cos(Angles);
S=sin(Angles);

Q1=[C(3) , S(3) , 0 ;
-S(3), C(3) , 0 ;
0    ,  0   , 1 ];

Q2=[C(2) , 0    , S(2) ;
  0  , 1    ,  0   ;
-S(2), 0    , C(2) ];

Q3=[  1  , 0    ,  0   ;
  0  , C(1) ,  S(1);
  0  , -S(1), C(1) ];

Q=Q1*Q2*Q3;

t=[3 ; -1 ; 0];

bruit=X-(0.11)*eye(n,m); //Simulation d'une impression de mesure

// Mesures 

E=Q*X(:,1)+t+bruit(:,1);
for k=2:m
    e=Q*X(:,k)+t+bruit(:,k);
    E=[E , e];
end


// Graphique
drawlater()
clf;
//points de mesure
param3d1(X(1,:),X(2,:),X(3,:))
e=gce();
e.line_mode = "off";
e.mark_mode = "on";e.mark_style=1;e.mark_foreground = 3;
e.clip_state="off";

//Triedre
for k=1:6
  Tk=T(k);
  param3d1(Tk(1,:),Tk(2,:),Tk(3,:));e=gce();
  e.line_style=2;e.foreground=2;
  e.mark_mode="on";e.mark_style=11;e.mark_foreground=2;
  e.clip_state="off";
end

//élements déplacés
param3d1(E(1,:),E(2,:),E(3,:));e=gce();
e.line_mode = "off";
e.mark_mode = "on";e.mark_style=9;
e.mark_foreground = 5;e.clip_state="off";

//Triedre déplacé
for k=1:6
  Tk=Q*T(k);
  param3d1(Tk(1,:),Tk(2,:),Tk(3,:));e=gce();
  e.line_style=7;e.foreground=2;
  e.mark_mode="on";e.mark_style=11;e.mark_foreground=2;
  e.clip_state="off";
end




a=gca();
a.data_bounds=[0 -1 -1;3   3   3  ];
a.box="off";
a.rotation_angles=[80 -145];
drawnow()