在3D中绘制法线向量 [英] plotting normal vector in 3d

查看:58
本文介绍了在3D中绘制法线向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个法线向量,该向量是根据两个向量[xn,yn,zn]的叉积计算得出的,并且我有一个点[x0,y0,z0],该如何在3d中绘制法线.我不知道该怎么做.有什么建议吗?

I have a normal vector that I calculated from the cross product of two vectors [xn,yn,zn] and I have a point[x0,y0,z0] how can I plot the normal in 3d. I didn't know how to do it. Any suggestions please?

推荐答案

带箭头:

a = [2 3 5]; % your point [x0,y0,z0]
b = [1 1 0]; % your normal vector 
c = a+b; % end position of normal vector

%quiver3 syntax: quiver3(x,y,z,u,v,w)
quiver3(a(1), a(2), a(3), c(1), c(2), c(3));
axis equal;

这将有望从您的点向法线方向绘制一个矢量...带有箭头.如果要在3D中绘制一条简单的线,则必须使用plot3:

This will hopefully draw a vector from your point into the direction of your normal...with arrow heads. If you want to draw a simple line in 3D you must use plot3:

plot3(X1,Y1,Z1,...)

函数调用应与quiver3相同.:)

The function call should be the same as for quiver3. :)

编辑/添加:我刚刚看到我可能误解了quiver3的功能.实际上看来,您不需要从a中减去或添加b.因为quiver3只是将给定的向量(u,v,w)添加到一个点(x,y,z).如果不进行检查,我认为该呼叫应如下所示:

EDIT/ADD: I just saw that I might have misunderstood what quiver3 does. Actually it seems, that you don't need to substract or add b from a. Because quiver3 just adds a given vector (u, v, w) to a point (x, y, z). Without checking it, I think the call should look like:

a = [2 3 5]; % your point [x0,y0,z0]
b = [1 1 0]; % your normal vector 
quiver3(a(1), a(2), a(3), b(1), b(2), b(3));

这篇关于在3D中绘制法线向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆