arctica1963 |
Hello all, I was wondering if it was possible to compute and visualise the normals to a 3D surface in Scilab? I think Matlab has something called surfnorm;is there something similar for Scilab? I have attached the basic code for the Moebius strip, and it would be useful to showwhat happens to the normals at say z=0, but not sure how one would go about this. Perhaps this has already been solved. Cheers Lester _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users Moebius.sce (738 bytes) Download Attachment |
Hello,
In the Plotlib you have an equivalent function : http://forge.scilab.org/index.php/p/plotlib/source/tree/HEAD/tags/0.46/plotlib/macros/surfnorm.sci S. > Le 17 juin 2018 à 00:40, Lester Anderson <[hidden email]> a écrit : > > Hello all, > > I was wondering if it was possible to compute and visualise the normals to a 3D surface in Scilab? I think Matlab has something called surfnorm;is there something similar for Scilab? > > I have attached the basic code for the Moebius strip, and it would be useful to showwhat happens to the normals at say z=0, but not sure how one would go about this. Perhaps this has already been solved. > > Cheers > Lester > <Moebius.sce> > _______________________________________________ > users mailing list > [hidden email] > https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users |
arctica1963 |
Hi Stéphane, Scilab users Thanks for the information. I retrieved the surfnorm function, and the associated functions that it called internally. I still cannot figure out how it should work with the existing code;had to add the functions into the main sce file to get it doing something (not sure why!). The attached code shows where I am at so far,and a small image of what I would like to get to. [x1,y1,z1] = surfnorm(x,y,z) does generate value,but plot3d does not give a meaningful result.Perhaps I am missing something very obvious, so any pointers are great. Scilab 6.0.1 (64 bit Windows) Thanks in advance Lester On 17 June 2018 at 07:47, Stéphane Mottelet <[hidden email]> wrote: Hello, _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users |
Hello, If you are using scilab 5.5.2 you can install the Plotlib (Atoms package). There is an example of normals plotting in the help page of quiver3. S.
_______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users |
Rafael Guerra |
In reply to this post by arctica1963
Hi Lester,
Try xarrows(). At the end of your code, add: // Compute normals to surface [x1,y1,z1]=surfnorm(x,y,z); sf = 0.2; // arrows scale factor x1 = sf*x1 + x; y1 = sf*y1 + y; z1 = sf*z1 + z; // Plot normal vectors to surface xarrows([x(:)';x1(:)'],[y(:)';y1(:)'],[z(:)';z1(:)'],-1,2) Rafael
_______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users |
arctica1963 |
Hi Rafael,
Xarrows() worked to generate the normals in Scilab 6.0.1. <http://mailinglists.scilab.org/file/t495709/Moebius2_arrows.jpg> Getting closer to the solution, but it gets "confused" at position (x=1.5, y=0, z=0) where the vectors should change to inbound rather than outbound as the surface folds as shown in the illustrative figure before. At this point we actually see a double vector. From x=0 to -1 it should be on the "inner" part if I'm looking at this right? Is it possible to just show the vector arrows along say z=0 only? Hopefully I am explaining this properly. Thanks for the help, very informative. Lester -- Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users |
Le 18/06/2018 à 10:55, arctica1963 a écrit :
> Hi Rafael, > > Xarrows() worked to generate the normals in Scilab 6.0.1. > > <https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/file/t495709/Moebius2_arrows.jpg> > > Getting closer to the solution, but it gets "confused" at position (x=1.5, > y=0, z=0) where the vectors should change to inbound rather than outbound as > the surface folds as shown in the illustrative figure before. At this point > we actually see a double vector. field is not continous : https://en.wikipedia.org/wiki/Orientability S. > From x=0 to -1 it should be on the "inner" > part if I'm looking at this right? > > Is it possible to just show the vector arrows along say z=0 only? Hopefully > I am explaining this properly. > > Thanks for the help, very informative. > > Lester > > > > -- > Sent from: https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html > _______________________________________________ > users mailing list > [hidden email] > https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/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 _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users |
Rafael Guerra |
In reply to this post by arctica1963
Lester,
To just show the vector arrows close to level Z ~ 0, you can define the # of points for each parametric coordinate of the Mobius strip: Nl = 40; // long axis #points Ns = 10; // short axis #points u = linspace(0,2*%pi,Nl); v = linspace(-0.5,0.5,Ns); and then at the end of the code write: // Compute normals to surface [x1,y1,z1]=surfnorm(x,y,z); x0 = x(Ns/2,:); y0 = y(Ns/2,:); z0 = z(Ns/2,:); sf = 0.2; // arrows scale factor x1 = sf*x1(Ns/2,:) + x0; y1 = sf*y1(Ns/2,:) + y0; z1 = sf*z1(Ns/2,:) + z0; // Plot normal vectors to surface along Z~0 xarrows([x0;x1],[y0;y1],[z0;z1],-1,2) You'll then get the less busy picture attached. As pointed out by Stephane, as the Mobius strip is non-orientable it will be impossible to extend the definition of normal to the whole surface. Regards, Rafael -----Original Message----- From: users [mailto:[hidden email]] On Behalf Of arctica1963 Sent: Monday, June 18, 2018 10:55 AM To: [hidden email] Subject: Re: [Scilab-users] Compute normals to 3D surface Hi Rafael, Xarrows() worked to generate the normals in Scilab 6.0.1. <http://mailinglists.scilab.org/file/t495709/Moebius2_arrows.jpg> Getting closer to the solution, but it gets "confused" at position (x=1.5, y=0, z=0) where the vectors should change to inbound rather than outbound as the surface folds as shown in the illustrative figure before. At this point we actually see a double vector. From x=0 to -1 it should be on the "inner" part if I'm looking at this right? Is it possible to just show the vector arrows along say z=0 only? Hopefully I am explaining this properly. Thanks for the help, very informative. Lester _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users Moebius_strip_normal_vector.png (32K) Download Attachment |
arctica1963 |
Thanks Stéphane, Rafael for all your help. All helps with the learning
process. Cheers Lester -- Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users |
Free forum by Nabble | Edit this page |