计算三维空间中单个三角形的法线 [英] Calculate normal of a single triangle in 3D space

查看:445
本文介绍了计算三维空间中单个三角形的法线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个图形编程类,我正在做的书面作业,而不是编程,所以我希望这是适合本网站。我有这个问题:
$ b


计算每个
按照顶点集合指定的三角形的单位法线(假设三角形正面临着
的起源):

我在一年前拿了线性代数,然后我的老师说他不会教交叉产品,因为只有班上的计算机科学人员需要它,并且在需要它时会被覆盖(这不是因为他们认为线性代数老师这样做),而且我已经检查了二十个解释这些问题有三个不同的问题,所以如果有人能够引导我通过如何解决一个没有的问题包含大量的变量和希腊字母,我们将不胜感激。

这个问题的A部分有三个坐标作为三角形的点: [1,1,1]; [1,-1,1]; [1,0,-1] 。我尝试过不同的公式和解释,并且我得到法线向量是[4,0,0],但这看起来不正确,因为我知道足够的知道这个三角形不在y-z平面上。我唯一的另一件事是公式:

 (A x B)/ | A x B | 

我知道A和B是用矢量表示的三角形的两个随机边,在A和V3中减去V2和V1,在B中减去V1,但我不明白到底是什么让我去做。

http://www.opengl.org/wiki/Calculating_a_Surface_Normal 引用



三角形的曲面法线可以通过取该三角形两个边的向量叉积来计算。计算中使用的顶点的顺序将影响法线的方向(面内或面外缠绕)。

因此,对于一个三角形<$ c $如果向量 U = p2 - p1 并且向量 V = p3 - p1,那么c> p1,p2,p3 然后是正常的 N = U x V 并且可以通过以下方式计算:

<$ p $ N $ = UyVz - UzVy
Ny = UzVx - UxVz
Nz = UxVy - UyVx


I am in a graphics programming class and I am doing the written homework, not programming, so I hope this is appropriate for this site. I have this problem:

Compute the unit normal for the triangles specified by each of the following vertex sets (assume the triangles are facing away from the origin):

I took linear algebra over a year ago, my teacher then said that he wouldn't teach cross products because only the Computer Science people in the class would need it and it would be covered when they needed it (it wasn't because they assumed the linear algebra teacher did it), and I have checked two dozen explanations and they are all way over my head.

This problem has three different problems within it, so if someone could walk me through how to solve a single one that didn't involve tons of variables and Greek letters it would be greatly appreciated.

Part A of this problem has these three coordinates as the points of the triangle: [1, 1, 1]; [1, -1, 1]; [1, 0, -1]. I tried cobbling together different formulas and explanations and I got that the normal vector is [4, 0, 0], but that doesn't seem right since I know enough to know that this triangle doesn't lie on the y-z plane. The only other thing I have is the formula:

(A x B) / | A x B |

I know that A and B are two random sides of the triangle represented as a vector, and calculated by subtracting V2 and V1 for A and V3 and V1 for B, but I don't understand what exactly it is telling me to do.

解决方案

Quoting from http://www.opengl.org/wiki/Calculating_a_Surface_Normal

A surface normal for a triangle can be calculated by taking the vector cross product of two edges of that triangle. The order of the vertices used in the calculation will affect the direction of the normal (in or out of the face w.r.t. winding).

So for a triangle p1, p2, p3, if the vector U = p2 - p1 and the vector V = p3 - p1 then the normal N = U x V and can be calculated by:

Nx = UyVz - UzVy
Ny = UzVx - UxVz
Nz = UxVy - UyVx

这篇关于计算三维空间中单个三角形的法线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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