[Scilab-users] Fwd: avoid auto-zoom when rotating a 3D graphic

Stéphane Mottelet stephane.mottelet at utc.fr
Wed Jul 7 10:18:52 CEST 2021


Philipp, you should at least add

gc(a().isoview = "on"


Le 07/07/2021 à 08:49, P M a écrit :
>
> Dear,
>
> is it possible to avoid the effect of auto-zoom / streching  when 
> rotating a graph in 3D-view?...see result of attached code.
>
> My best guess is that one would have to set the a.margins according to 
> the actual a.rotation_angles for each frame....but is there a easier way?
>
> Thank you,
> Philipp
> R=23;
> N=1000;
> nmax=1.1*6*N/%pi;
> // Random points in cube 2R*2R*2R
> x=grand(nmax,1,'unf',-R,R);
> y=grand(nmax,1,'unf',-R,R);
> z=grand(nmax,1,'unf',-R,R);
> R2=R*R;
> // Exclude points outside of sphere with radius R
> T=(x^2+y^2+z^2)>R2;
> M=[x  y  z];
> M(T,:)=[];
> [r  c]=size(M);
> M(((N+1):r),  :)=[];
> x=M(:,1);  y=M(:,2);  z=M(:,3);  
> f  =  figure();
> f.background  =  8;
> f.axes_size  =  [300,300]
>
> s  =  linspace(5,  1,  N);
> scatter3d(x,y,z,msizes=1,s);
> a  =  gca();
> a.box  =  "off";
> a.axes_visible  =  ["off","off","off"];
> a.x_label.visible  =  "off"
> a.y_label.visible  =  "off"
> a.z_label.visible  =  "off"
>
> outgif  =  "Sphere03.gif";
> idGif  =  animaGIF(gcf(),  outgif,  1,2);
> for  i  =  0:360;
>      a.rotation_angles  =  [45,  i];
>      idGif  =  animaGIF(gcf(),  idGif);  // Adds the current figure to the GIF stream
> end;
> animaGIF(idGif);     // Closes the GIF stream
>
>
>
>
>
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20210707/12342783/attachment.htm>


More information about the users mailing list