Outward pointing normal vector for 3D plane
5 次查看(过去 30 天)
显示 更早的评论
I have the following facet of a cuboid given by the vertices: V = [-1,-1,-1; 1, 1, -1; -1,1,-1;1, -1,-1]. This facet is the bottom facet of the cuboid. So the outward pointing normal to the cuboid with respect to this facet should be [0 0 -1]. However, with the following MATLAB code, I get the normal, which is [0 0 1], which is inward pointing. What is missing here?
V=V-mean(V);
[U,S,W]=svd(V,0);
norm_vec = W(:,end)
I see at some places that the vertices should be arranged in the counterclockwise direction to calculate the outward pointing normal.
0 个评论
回答(1 个)
Rishik Ramena
2020-10-8
There is no way for the svd function to know that the vertices you have provided are of a bottom facet of a cuboid. So there’s no inward/outward facing normal that can be ensured. Also the V generated by svd does not ensure a direction to a plane. It can only ensure that the vector will be normal to the best fit plane covering the provided vertices. You might also have noticed that the orientation of the provided vertices(clockwise/counter-clockwise) does not affect the generated normal. You might want to go through the explanation provided here to better understand how and why this method works this way.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!