Normal components given by surfnorm function do not seem to be the correct ones

조회 수: 7 (최근 30일)
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.
Capture1.PNG
Capture2.PNG
Thanks.
  댓글 수: 4
David Goodmanson
David Goodmanson 2019년 12월 12일
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
Jose Enrique Almanza
Jose Enrique Almanza 2019년 12월 13일
Hi David,
Thanks for your response and for clarifying.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by