[scilab-Users] Re: Drawing a pierced rectangle facet

Samuel GOUGEON Samuel.Gougeon at univ-lemans.fr
Thu Nov 4 10:59:18 CET 2010


  Hello Jens,

----- Message d'origine -----
De : JensSimon
Date : 03/11/2010 16:59:
> Hello Samuel,
> I think it is due to the different approaches of xfpoly and plot3d2.
The bug is about plot3d() -- not plot3d2() -- that was able to draw any
set of 3D polygones until Scilab 4.1.2, whatever was the number of
their edges, and that is bugged now (= regression).
Both 4.1.2 and 5.3.0 results are illustrated in the bug report.

By the way, after a xfpoly() instruction, it is straightforward to change
the _3D_ coordinates of the polygone's vertices. You may run the updated
script given below (see its last lines)

> In plot3d2 the input matrices must be designed so that every 2 x 2-submatrix
> represents a quadrangle. If necessary the quadrangles can be recuced to
> triangles or lines by inventing fictive identical values. The latter trick is
> essential to become capable of acting with plot3d2
Quadrangles are not enought to simplify your drawing, and if it is always
possible to mask some vertices either by setting one of their coordinates
to %nan, or by setting adjacent vertices as identical, it would mainly be
required -- but not possible -- to _add_ some vertices to build N-edged
polygones. So, unfortunately, there is no easy work-around to the reported
bug, and maybe i will increase its severity.

Best regards
Samuel
---------
// Flat rectangle into (xOy)
rdX = 5;
rdY = 3;
rXY = [ 0 0 rdX rdX 0 ; 0 rdY rdY 0 0 ]';

// Flat circular hole into (x0y)
n  = 40;   // number of edges
theta = linspace(-%pi,%pi,n+1)';
R = 1;     // radius
cXo = 3.75; // center's position
cYo = 1.2;
tho = atan(cYo,cXo);
cXY = [ [ cXo+R*cos(theta+tho) ; 0 ] [cYo+R*sin(theta+tho) ; 0 ] ];
// Another one
R = 0.3; cXo = 1; cYo = 2; tho = atan(cYo,cXo);
cXY2= [ [ cXo+R*cos(theta+tho); 0] [cYo+R*sin(theta+tho); 0] ];

// Connecting & Plotting the whole
XY = cat(1,[ 0 0 ], cXY, cXY2, rXY);
clf
param3d([0 rdX rdX],[0 0 rdY],[0 0 0]) // setting axes bounds...
xfpoly(XY(:,1),XY(:,2));  // ... because xfpoly() does not do it!
e = gce();
//e.line_mode = "off";
e.background = color("blue");
ca = gca(); ca.isoview="on";
// Animation in Z
e = gce();
for i=0:0.05:2, e.data(:,3)=i; sleep(50); end




More information about the users mailing list