
Sun, 06/08/2025 - 17:56
Forums:
I'd like to write some regression tests for my shape generation code. The idea is to read a gold standard BRep file and compare it to what the test code generates. I know that TopoDS_Shape::IsEqual simply compares the underlying TShape pointers for identity. Is there a method which compares two TopoDS_Shapes for equivalence of the actual topology and geometry?
Thanks,
Allen
Mon, 06/09/2025 - 14:28
There is no such a tool in OCCT itself that would compare for equality two B-Rep shapes created independently.
However, if you would like to check deviations of some algoritm from a reference, you may implement a comparison tool based on OCCT persistence - e.g. write/read shape into/from file using
BinTools::Write()
/BimTools::Read()
and compare binary files / streams for equality.This wouldn't help to recognize what exactly is different in two shapes, but it's very fast and straightforward to implement. If algoritm will involve different versions of OCCT - the shapes in binary format might be different.
Multithreading and order-undefined acceleration structures like
std::unordered_map
might produce shapes, which has different order of sub-shapes, but topologically and geometrically identical.Differences in floating point math and compiler optimizations might also produce deviations.
Thu, 06/12/2025 - 20:04
It occurred to me that BRepAlgoAPI_Cut might work. The result should be an empty shape. There's no guarantee of that, of course.
Thanks,
Allen