Face Type

How can I determine whether a face is a sphere, cylinder or cone face? when I count edge and vertex numbers, they all have same (3 edges & 2 vertices)


Bearloga's picture

Count the number of degenerated edges. Sphere has 2 such edges, cone 1 and cylinder 0.

Stephane Routelous's picture

you can try BRepAdaptor_Surface::GetType()
but it will return you the type of the opencascade entity, not the "shape" of your face. ex : if you have a bspline surface representing a sphere, you will get GeomAbs_BSplineSurface and not GeomAbs_Sphere.


suresh's picture

You can get the surface of the face and compare the type of the face.

Handle_Geom_Surface hSurface = BRep_Tool::Surface(m_face);
if(hSurface->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) //Cylindrical Surface
else if(hSurface->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) //Conical Surface