Triangulation

Hi Friends,
I hav problem while Triangulation of Face.
I am reading the file of the type "*.STEP" I get the
face using the following method.

TopoDS_Face face;
face=TopoDS::Face(child);
Handle_Geom_Surface surface;
TopLoc_Location loc;
surface=BRepTool->Surface(face,loc);

traingulate(face,loc);

//
then method traingulate(face,loc)
{
Handle_Poly_Triangulation traingles;
cout traingles=BRep_Tool::Triangulation(face,loc);
if(traingles==NULL){
cout cout }
else{
cout Standard_Integer numOfTri=traingles->NbTriangles();
//Poly_Array1OfTriangle list(1,traingles->NbTriangles());
//list=traingles->Triangles();
//cout }

}

It gives me error when I come to the method triangles->NbTriangle()
it is null

Thanking you

B.J.Avadhani

Stephane Routelous's picture

Hi,

you cannot test :
triangles == NULL
because the Handle mecanism ( smart pointer ) of OpenCASCADE doesn't work like that.
You have to use :
if ( triangles.IsNull() )
to make your tests.

HTH