Normal components given by surfnorm function do not seem to be the correct ones
12 views (last 30 days)
Show older comments
Hi,
I am trying to get the normal components of a surface using the surfnorm function ([U, V, W] = surfnorm(X,Y,Z)) but when I try to plot them using quiver3 (quiver3(X,Y,Z,U,V,W)), I realize that they are not the correct values.
I compare my plot to the one using surfnorm directly to plot (surfnorm(X,Y,Z)).
The full and simple code to show the issue is this:
[X,Y] = meshgrid(-2:0.2:2,-1:0.2:1);
Z = X.* exp(-X.^2 - Y.^2);
figure;
[U,V,W] = surfnorm(X,Y,Z);
surf(X,Y,Z);
hold on
quiver3(X,Y,Z,U,V,W);
figure;
surfnorm(X,Y,Z);
If I zoom in to the surface I can see that in the first plot, the vector coming from the surface are not actually normal to it. The second looks correct, but from this I cannot extract the normal components.
Thanks.
4 Comments
David Goodmanson
on 12 Dec 2019
Hi Jose,
it's easier to see in 2d because when you rotate a 3d object, things can get foreshortened, which is the basic reason that angles appear to change. In 2d, when you stretch one of the axes in a plot, angles look different although the data is the same.
figure(1)
quiver([0 0],[0 0],[1 1],[-1 1],0)
axis equal % angles look like they should
grid minor
figure(2)
% same data
quiver([0 0],[0 0],[1 1],[-1 1],0)
xlim([-.75 1.75])
ylim([-2 2])
grid minor
Answers (0)
See Also
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!