Re: [Scilab-users] Sgrayplot/champ for non-regular grids

2019-04-17 Thread Dang Ngoc Chan, Christophe
Hello Philippe,

> Apr 16, 2019; 7:45pm Philippe Roux
>
> but is there an easy
> way to convert meshgrid output to a triangulation?

For this, you might try the Delaunay triangulation.

You can find it in the CGLAB Atoms module

https://www.scilab.org/tutorials/introduction-model-reduction

https://atoms.scilab.org/toolboxes/cglab/2.3.2

HTH,

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer

General
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error), please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Sgrayplot/champ for non-regular grids

2019-04-16 Thread philippe
Le 16/04/2019 à 16:49, Samuel Gougeon a écrit :
> 
> 
> Have you tried fec()? 

It looks promising to replace surf in my problem, but is there an easy
way to convert meshgrid output to a triangulation?



> As with plot3d() (seen from gca().rotation_angles(1)=0), 
> isn't colors interpolation the same as smoothing?

I think yes , at least as final rendering.


Cheers
Philippe

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Sgrayplot/champ for non-regular grids

2019-04-16 Thread philippe
hi to all,

I realized that scilab function "Sgrayplot" (and other 2D plotting
functions like "champ") only accept "regular grids" that is
Sgrayplot(X,Y,Z) requires

size(Z)=length(X)xlength(Y)

while "surf" also accept non-regular ones with

size(Z)=size(X)=size(Y)

this pose substantial problems in some plots, compared to matlab/octave
behaviors, and it would be a nice feature that Sgrayplot and others
accept non-regular grid in the same way as "surf".

My problem started when I needed to plot a vector field "above"  a gray
plot, the usual way to do this is straight and simple :

dt=0.1;t=-1:dt:1;
[X,Y]=meshgrid(t,t);
Z=X.^2-Y.^2;// potential field
Vx=X;Vy=Y;//vector field
clf;
Sgrayplot(t,t,Z')
champ(t,t,Vx',Vy')// simple ... except the ' on Z,Vx,Vy :-)

but I need to do this for Z,Vx,Vy corresponding to a non-regular grid
(It comes from a Joukowski transform for those who want to know) so I
can't use anymore Sgrayplot/champ  and I try to replace them with
surf/xarrows

dt=0.1;t=-1:dt:1;
[X,Y]=meshgrid(t,t);//  <== in real life X,Y are non-regular
Z=X.^2-Y.^2;// potential field
Vx=X;Vy=Y;//vector field
clf;
// let's try to simulate Sgrayplot
surf(X,Y,Z);E=gce();E.thickness=0;E.color_flag=3;
A=gca();A.rotation_angles=[0,90];
// horrible hack to replace "champ"
xarrows([X(:)';X(:)'+dt*Vx(:)'],[Y(:)';Y(:)'+dt*Vy(:)'],[Z(:)';dt+Z(:)'],1)

If you compare both plot the second method isn't satisfying, because
vectors can be hidden by the surface (and code is complex!).

Can someone provide a work-arround to improve the result since changing
the specification of Sgrayplot/champ can't be done quickly.

sincerely yours,
Philippe

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users