#### Archived

This topic is now archived and is closed to further replies.

# Getting a normal from points

This topic is 5474 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I asked this over in the Graphics forum but didn''t get a reply, so I thought I''d ask in this one since its more math oriented. I have a set of 3-d points that form an object. So given a center point Pc and its n nearest neighbors P1 ... Pn . How can I estimate the normal for it? I heard there is a way using least-squares minimization to build a plane, but I''ve looked at material on this and can''t draw the connection. I haven''t taken a linear algebra, or for that fact, a math course in years. LinaInverse

##### Share on other sites
One of the easiest ways is to:

a) triangulate several points that are close to the center point using Delaunay triangulation (search the forum archives or google for this---its all over the place)

b) compute the normals for each triangle, making sure they all point roughly in the same direction, e.g., the dot product of each normal with each other normal is positive

c) add the normals together the unitize it.

There are more and less efficient ways to do all that, which I''ll let you figure out on your own.

You could also subdivide the localized triangle mesh before calculating the normals, and use only the interior triangles of the subdivided mesh to calculate the normal---this will better approximate a curved surface:

www.subdivision.org

That said, there are other ways including least squares.

Given a point cloud, with no connectivity or underlying surface definition, you are going to have to make an approximation of the surface at the center point. Computing a least squares surfaces, for example a plane, is one way to do it. Search the forum archives or google and you will probably be able to find an in depth discussion of computing least squares lines or planes from points. If your object has highly variable curvature, or is a closed body, you''d want to compute the plane only from some points in the vicinity of the center point.

Beyond least squares planes, you could fit a higher order surface, for example locally use least squares to find a sphere whose center point and radius minimizes the error from several points that are nearby the center point.

Beyond that you can look into various interpolating spline techniques, or something like minimum norm network (MNN). These are more advanced techniques, though, and unless you have a very specialized purpose won''t amount to much benefit.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

##### Share on other sites
search for a
"Newell method" of normal computation.

##### Share on other sites
you should use the cross product...

the cross product of two vectors will give you a vector that is perpendicular to both of these... so, if you have 3 points on a plane p1, p2, p3... and you make the vectors v1, v2 like so:

v1 = p2 - p1
v2 = p3 - p1

then do the cross product of v1 x v2... you''ll get yourself a vector which is normal to the plane of those 3 points...

Note: if your gonna do this, it will work best if your vectors v1 and v2 are roughly perpendicular to each other...

1. 1
2. 2
3. 3
Rutin
22
4. 4
5. 5

• 13
• 19
• 14
• 9
• 9
• ### Forum Statistics

• Total Topics
632930
• Total Posts
3009290
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!