Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculate normal of a single triangle in 3D space

Tags:

geometry

3d

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.

like image 978
user2309865 Avatar asked Oct 13 '13 22:10

user2309865


People also ask

How do you find the normal of a 3D triangle?

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).

What is the normal of a triangle?

The normal of the triangle, or vector C is the cross product of A and B. Note that the order in which the vertices were created determines the direction of the normal (in this example vertices have been created counter-clockwise).

What is normal in 3D space?

The normal is often used in 3D computer graphics (notice the singular, as only one normal will be defined) to determine a surface's orientation toward a light source for flat shading, or the orientation of each of the surface's corners (vertices) to mimic a curved surface with Phong shading.


1 Answers

Quoting from https://www.khronos.org/opengl/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 A = p2 - p1 and the vector B = p3 - p1 then the normal N = A x B and can be calculated by:

Nx = Ay * Bz - Az * By
Ny = Az * Bx - Ax * Bz
Nz = Ax * By - Ay * Bx
like image 106
Kromster Avatar answered Sep 23 '22 09:09

Kromster