Results 1 to 3 of 3

Thread: Calculate normal of a triangle

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2000
    Location
    France
    Posts
    6

    Calculate normal of a triangle

    A simple question:
    I draw a triangle under OpenGL:
    glBegin(GL_TRIANGLES);
    glVertex3f( 4.0f,2.0f,0.0f);
    glVertex3f( 2.0f,4.0f,-2.0f);
    glVertex3f(0.0f,3.0f,-1.0f);
    glEnd();
    How to make to calculate the normal of this triangle?

  2. #2
    Junior Member Newbie
    Join Date
    Apr 2000
    Location
    Toronto, Ontario, Canada
    Posts
    2

    Re: Calculate normal of a triangle

    Cross Product.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2000
    Location
    Sweden
    Posts
    15

    Re: Calculate normal of a triangle

    Yup, crossproduct is the way to go. Take (v2-v1) x (v2-v3) to get the normal (you might have to switch order of the vectors to end up with a normal pointing in the correct direction, based on the system you use, left or right-handed)

    Of course, you must normalize the vector you get out of the cross product.
    / LC

Similar Threads

  1. How to calculate Normal for 3D Triangle
    By vinothrajendran4 in forum OpenGL: General
    Replies: 5
    Last Post: 11-21-2016, 07:28 AM
  2. How to Calculate normal?
    By yjc33 in forum OpenGL: General
    Replies: 2
    Last Post: 06-30-2005, 01:52 AM
  3. How to Calculate Polygon Normal?
    By Jedah in forum OpenGL: General
    Replies: 4
    Last Post: 05-22-2005, 06:42 PM
  4. Calculate Vertex Normal
    By in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 04-03-2005, 11:37 PM
  5. Calculate polygon normal
    By Crunch in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 04-12-2001, 09:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean