Plane Normals?
My question is:
How do I calculate a plane''s normal. I found a site on vectors, and I am going to start on collision detection.
If thispost = 0 Then
GoBack()
Else
Read()
End If
Theory:
With 3 points that lies on the plane you can construct 2 vectors, with 2 vectors you just need to do cross product and that''s all.
Practice:
With points a, b, c you build 2 vectors:
vector1 = a - b
vector2 = c - b
normal.x = vector1.y * vector2.z - vector1.z * vector2.y;
normal.y = vector1.z * vector2.x - vector1.x * vector2.z;
normal.z = vector1.x * vector2.y - vector1.y * vector2.x;
and that''s all.
Bye
With 3 points that lies on the plane you can construct 2 vectors, with 2 vectors you just need to do cross product and that''s all.
Practice:
With points a, b, c you build 2 vectors:
vector1 = a - b
vector2 = c - b
normal.x = vector1.y * vector2.z - vector1.z * vector2.y;
normal.y = vector1.z * vector2.x - vector1.x * vector2.z;
normal.z = vector1.x * vector2.y - vector1.y * vector2.x;
and that''s all.
Bye
To clarify what Rambo said, by "points" he means "vectors"; to get the normal of a triangle, you''d use the three vertices of the triangle. Technically you could use any 3 points that lie along the plane of the triangle, but of course it''s simplest to use its vertices. Also note that the direction of the normal is relative to the order of the points - if they''re clockwise, the normal will point in the opposite direction than it would if they''re counterclockwise.
~CGameProgrammer( );
~CGameProgrammer( );
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement