How can I easily calculate the direction of the normal to a TopoDS_Face or Geom_Surface?

Rob Bachrach Thu, 06/17/2004 - 17:23

Look at GeomLProp_SLProps::Normal. This requires you to set the location at which you require the normal using U,V parameters on the surface. You can use BRep_Tool::Surface to get the surface for a face and BRepTools::UVBounds to get the parametric limits on the surface.

there is an infinity of normals on a brep / nurbs surface, since the set of possible points is endless.
the wiki image is that of a mesh, which is a discrete representation of a surface, hence with finite normals.
so its a little confusing.
as mentioned before, you can lookup the normals of the surface for every u,v position.
really easy...

Thu, 06/17/2004 - 17:23

Look at GeomLProp_SLProps::Normal. This requires you to set the location at which you require the normal using U,V parameters on the surface. You can use BRep_Tool::Surface to get the surface for a face and BRepTools::UVBounds to get the parametric limits on the surface.

Thu, 06/17/2004 - 18:02

Thank you!

Here is the result:

TopoDS_Face aCurrentFace = [..];

Standard_Real umin, umax, vmin, vmax;

BRepTools::UVBounds(aCurrentFace,umin, umax, vmin, vmax);

Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aCurrentFace);

GeomLProp_SLProps props(aSurface, umin, vmin,1, 0.01);

gp_Dir normal = props.Normal();

Sat, 07/09/2011 - 20:17

does one surface have only one vector?

i think planes have only one vector?

am i wrong?

Sun, 07/10/2011 - 00:52

yes a single vector

Sun, 07/10/2011 - 13:20

but a surface can be something like this

http://t3.gstatic.com/images?q=tbn:ANd9GcTZmX6H8E2ZAKCdS2o2HOIZ_rCC8iDiJ...

am i wrong, am i wrong with the concept of "surface"?

a surface like the one at the pic has lots of tangent planes, thus surface should have lots of normals?

Sun, 07/10/2011 - 13:54

http://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Surface_normal....

one surface must have a set of normals, must have one normal for its every point.

Sun, 07/10/2011 - 14:04

there is an infinity of normals on a brep / nurbs surface, since the set of possible points is endless.

the wiki image is that of a mesh, which is a discrete representation of a surface, hence with finite normals.

so its a little confusing.

as mentioned before, you can lookup the normals of the surface for every u,v position.

really easy...

Sun, 07/10/2011 - 14:26

thanks