
Tue, 07/05/2005 - 20:11
Forums:
I must be missing something simple here. How do I test a TopoDS_Shape for a specific shape (like a sphere)?
TopoDS_Shape aShape;
// test if shape is a sphere
if (????aShape.isSphere()????) // What goes here?
{
//perform operations on sphere
}
Thanks,
David
Tue, 07/05/2005 - 22:32
You can try this(retrieve the underlying geometry and test if it describes a sphere) :
TopoDS_Shape shape;
TopoDS_Face face = TopoDS::Face (shape);
if (not face.IsNull ())
{
Handle_Geom_Surface surface = BRep_Tool::Surface (face);
if (surface->IsKind (STANDARD_TYPE (Geom_SphericalSurface)))
// You have a sphere.
}
It may not work it most of the cases.