Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Calculating Normal vectors

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2003
    Location
    Ontario, Canada
    Posts
    4

    Calculating Normal vectors

    Hi,
    part of my project involves using opengl. I will like to know how to calculate normal vectors (for glNormal3f) for a large set of scanned object. assumming the data is something like this.....

    glBegin(GL_TRIANGLES);
    glNormal3f ();
    glVertex3f(7.4350, -2.47203, -45.1869);
    glVertex3f(71.6133, 6.12588, -53.2960);
    glVertex3f( 50.12, 10.45, 23.00);
    glNormal3f ();
    glVertex3f(74.4350, -2.47203, -45.1869);
    glVertex3f( 77.6763, -2.29052,-38.1057);
    glVertex3f( 82.0971, -7.86762, -36.3902);
    glNormal3f ();
    glVertex3f( 74.4350, -2.47203, -45.1869);
    glVertex3f( 71.6133, 6.12588, -53.2960);
    glVertex3f( 67.6907, -1.83262, -61.1861);
    glNormal3f ();
    glVertex3f( 74.4350, -2.47203, -45.1869);
    ........etc
    any contribution will be appreciated.
    chuks

  2. #2
    Guest

    Re: Calculating Normal vectors

    you have 3 vertices with a x, y and z coordinate. this vertices are 3-dimensional vectors. Use the Crossproduct and you'll get a normal vec

    (v3-v1)x(v2-v1)

  3. #3
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    Re: Calculating Normal vectors

    Hi !

    Have a look at:
    http://www.ime.usp.br/~massaro/openg.../redbook-E.pdf

    and
    http://www.lp23.com/files/tutorial_03.pdf

    (I found them both at google)

    Mikael


    [This message has been edited by mikael_aronsson (edited 08-05-2003).]

  4. #4
    Junior Member Newbie
    Join Date
    Aug 2003
    Location
    Ontario, Canada
    Posts
    4

    Re: Calculating Normal vectors

    Hi,
    Thanks a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •