i'm facing some problems with the normals of my shape.
I have a cube with a cylindric hole on one side. I'm using the following code to get the normal of the surface
of a face:
Standard_Real uMin, uMax, vMin, vMax;
BRepTools::UVBounds (face, uMin, uMax, vMin, vMax);
Handle(Geom_Surface) surface = BRep_Tool::Surface(face);
GeomLProp_SLProps props (surface, uMin, vMin, 1, 0.001);
gp_Dir normal = props.Normal();
if (face.Orientation() == TopAbs_REVERSED)
Every face has the orientation \"TopAbs_FORWARD\". But some of the normals are outward directed and some are
inward directed (see attached graphic). The highlighted faces all belong to the mantle of the cylindric hole, so all normals should be inward directed towards the axis of the cylinder.
I\'ve read this tutorial http://opencascade.blogspot.de/2009/02/continued.html but i don\'t really know what to do
to solve my problem. Should i use a different way to get the normal of a face of the mantle or is something
wrong with my shape?
For my written algorithm it\'s important that every normal of the mantle of the cylindric hole is inward directed towards the axis of the cylinder.
I have all the correct normals in a stl file which i can access with the following code (shortened):
Standard_Real Xn, Yn, Zn;
StlMesh_MeshExplorer meshExplorer (stlMesh);
meshExplorer.TriangleOrientation(Xn, Yn, Zn);
Is there a way to set the normal of a surface or face? Or create a new face/surface with a specific normal (the one from the file)?
Thank you very much