Faces with the same single geometry

Suppose I have a TopTools_IndexedMapOfShape m_FaceMap, and I want to divide them into a set of groups. Each group contains all the faces in m_FaceMap with the same geometry (both in geometric type and geometric equation). How could I do it? Many thanks in advance.

Roman Lygin's picture

Hi Ming,

Frankly speaking, don’t see an issue here – just iterate and classify.
You might want to distribute into the map like:
to enable faster classification per surface type. Then compare a definition of a current surface with First()’s of every list. If it matches – append to that list, if not – init a new list and add it into the top list. To compare definitions of surfaces you might use:

Handle(Geom_Surface) aHS1 = …, aHS2 = …;
const Geom_Surface& aS1 = *(aHS1.operator->());
const Geom_Surface& aS2 = *(aHS2.operator->());

if (aS1 == aS2) {


Be aware that you will compare doubles, so this can be prone to accuracy problems in general case.

Good luck.

Ming's picture

Hi, Roman,
Thank you very much for your reply. What I am worried is that whetherif (aS1 == aS2) would work well. When I try it, I get the following error. Do you know the reason?

error: no match for 'operator==' in 'aS1 == aS2'
/opt/OpenCASCADE/include/Handle/Standard/Transient.hxx:115: error: candidates
are: int operator==(const Standard_Transient*, const

Thanks again.