I'm importing in 3D CAD software some STEP and IGES files thanks of "STEPControl_Reader" or "IGESControl_Reader".
I'm getting all the faces constituting the 3D models with "TopExp_Explorer" and I'm keeping the
faces definition in a "TopTools_IndexedMapOfShape" object (fmap).
I'm tesselating each face :
TopoDS_Face face = TopoDS::Face( fmap(face_i) );
BRepAdaptor_Surface sf(face, Standard_False);
BRepLProp_SLProps prop(sf, 1, 1e-3);
Handle(Poly_Triangulation) triangulation = BRep_Tool::Triangulation (face, loc);
if (triangulation.IsNull()) return;
gp_Pnt2d uv; gp_Pnt vertex; gp_Vec faceNormale;
int ntriangles = triangulation->NbTriangles();
for (int j = 1; j Poly_Triangle triangle = (triangulation -> Triangles())(j);
for (int k = 1; k
uv = (triangulation->UVNodes())(triangle(k));
vertex = (triangulation -> Nodes())(triangle(k)).Transformed(loc);
faceNormale = prop.Normal();
if( face.Orientation() == TopAbs_REVERSED )
faceNormale *= -1;
All the vertex are ok, the triangles ok, direction of the normale ok, but there is a problem with the normals orientations (outside the solid) : it's offen the inverted true normal. Why ?
It is a problem with the STEP / IGES translation, I forget a value control for the normal, an orientation test ?
If you have some idea, thank you.