For math gurus or 3d programmers only...

Argo

Lifer
Apr 8, 2000
10,045
0
0
Here is the problem I'm facing in the 3d program I'm writing. Let's say I have a triangle with 3 verteces (x1, y1) (x2, y2) (x3, y3). Now, I have to find the normal to that triangle. The way I'm seeing this, is that the normal has to be at right angle to all 3 vectors. This means the scalar product of each vector and normal should be 0. This will give us 3 equations with 3 unknowns. I was wondering if you guys know any easier way of solving this problem?
 

The third vector is unnecessary since a triangle is in one plane. The normal will be perp. to any two of the legs, so 2 equations/2 unknowns. Solvable.



edit: sorry, I didn't look into it and just thought you were trying to use all 3 legs of the triangle.
 

Duckers

Platinum Member
Mar 30, 2000
2,089
1
0
Wouldn't the normal be perpendicular to the legs only if the triangle was equilateral?

isn't the normal the line bisecting each angle?
 

You're stuck on the dot product being = 0. That's all well and good, but the cross product of the vector given by any two legs of the triangle is a perpendicular normal.

a x b = Determinant given by i,j,k and two vectors =

(a2b3-a3b2)i-(a1b3-a3b1)j+(a1b2-a2b1)k

Double-check my determinant, but I think that's it.
 

Argo

Lifer
Apr 8, 2000
10,045
0
0
Thanks bobtist. The second you said cross product it rang a bell in my head. I have to figure the correct order to get the direction right, though.
 

Pretender

Banned
Mar 14, 2000
7,192
0
0
Aaargh, where/when do they teach this stuff? I can program, but I need to learn about 3d geometry so right now I basically can't do any games or anything cool.
 

Pretender

Banned
Mar 14, 2000
7,192
0
0
The math, 3d vectors, dot product, etc.

The programming is the easy part, it's just the math/physics I haven't been taught yet.
 

GL

Diamond Member
Oct 9, 1999
4,547
0
0
Pretender, that's standard senior level high school Algebra.

-GL
 

Argo

Lifer
Apr 8, 2000
10,045
0
0
I think this is more like linear algebra. I'm not sure a lot of high schools teach that. However, you might check with your college to see if they are offering a course.
 

Pretender

Banned
Mar 14, 2000
7,192
0
0
I'm already to precalc and haven't learned about this stuff. We've learned about vectors (2d) in physics, but that's it.
 

Mday

Lifer
Oct 14, 1999
18,647
1
81
those three points define a plane, in this case, the xy plane... the normal to the plane is what you want which is NOT on the plane, but perpendicular to it...

remember, 3 points define a plane

i mean, if you have any point, (xy), on the xy plane, any line parallel to the z axis through said point would be normal to the xy plane...

the problem is more interesting if the triangle is NOT parallel to any of the xy, yz, xz planes... 3 vertices (x1,y1,z2), (x2,y2,z2), (x3,y3,z3)... if you find the determinant of the following matrix (the cross product):

| i j k |
| x1 y1 z1 |
| x2 y2 z2 |

where i,j,k are unit vectors in the x, y, and z directions respectively

you will find a normal to that triangle, of course what points you choose are arbitrary as long as those points are on the plane defined by that "triangle"

if you only consider a "triangle" that's on the xy plane, notice that z1 and z2 are 0, which means that there are no, i or j components, which means only a vector parallel to the z axis...

the said normal vector also defines a plane. where the tail of the vector is on the plane, and the plane is perpendicular to normal vector...