Results 1 to 6 of 6

Thread: Finding the normals of points

  1. #1
    Member Newbie
    Join Date
    Dec 2000
    Location
    Canada
    Posts
    34

    Finding the normals of points

    Could some please provide some sample code for finding the normals of vertices (as opposed to surfaces)? I generally use triangles, but code for quads would be appreciated too!

    thanks for your time, guys,
    Andrew

  2. #2
    Senior Member Regular Contributor
    Join Date
    Dec 1969
    Location
    Munich,Germany
    Posts
    227

    Re: Finding the normals of points

    If P1 is your first point, P2 your second, and P3 your third, and if they are counter-clockwise, treating them as vectors you can write:
    Edge1 = P1 - P2
    and
    Edge2 = P3 - P2
    and then compute the normal using the crossprodukt:
    Normal = Edge1 X Edge2
    last step is to normalie it
    Normal=Normal/|Normal|

    hope that helps
    Chris

    [This message has been edited by DaViper (edited 03-02-2001).]

    [This message has been edited by DaViper (edited 03-02-2001).]
    yes

  3. #3
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Dunblane, Scotland
    Posts
    333

    Re: Finding the normals of points

    To calculate vertex normals simply take the average of all the face normals that are connected by that vertex. The only dificulty is finding which faces are connected, this depends on your data and structure.
    Reality is for idiots only the best over come it!

  4. #4
    Member Newbie
    Join Date
    Dec 2000
    Location
    Canada
    Posts
    34

    Re: Finding the normals of points

    Chris, that was exactly what I needed. Thank you very much!

    cheers,
    Andrew

  5. #5
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Dunblane, Scotland
    Posts
    333

    Re: Finding the normals of points

    Chris's method would only give you the face normal, if this is what you want then fine but i think you wanted vertex normals in which case you will also have to do what I said and calculate the average normal of the faces attached to that vertex.
    Reality is for idiots only the best over come it!

  6. #6
    Senior Member Regular Contributor
    Join Date
    Dec 1969
    Location
    Munich,Germany
    Posts
    227

    Re: Finding the normals of points

    Andrew, Tim is right my calculations only give you the face normals, if you want the average of all normals you have to do what Tim said
    yes

Similar Threads

  1. Finding the convex hull of a set of points
    By jenny_wui in forum OpenGL: General
    Replies: 4
    Last Post: 05-20-2013, 01:36 PM
  2. Finding curvature between two points
    By jenny_wui in forum OpenGL: General
    Replies: 1
    Last Post: 12-16-2012, 01:02 AM
  3. Finding a point (x,y) between two other points.
    By cutting_crew in forum OpenGL: General
    Replies: 7
    Last Post: 08-25-2008, 02:22 PM
  4. Finding a polygon out of several points
    By Azdo in forum OpenGL: General
    Replies: 2
    Last Post: 06-21-2005, 05:37 AM
  5. finding surface of distribution of points
    By donald in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-06-2001, 08:50 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