Wed, 03/20/2024 - 18:29
Hello Community,
I am trying to get a precise Oriented Bounding Box of a model I imported. The model i am working with has a rectangular base.
The problem i am facing is that the OBB seems to be slightly rotated, making it a little larger than it should be and the Directions off by a few degrees in consequence.
This also happens on other models.
Here is the code i am using to import the model, convert it and build the OBB:
STEPControl_Reader reader;
reader.ReadFile(path);
reader.TransferRoots();
TopoDS_Shape shape = reader.OneShape();
// Shape Healing
Handle(ShapeFix_Shape) aFixShape = new ShapeFix_Shape();
aFixShape->Init(shape);
aFixShape->Perform();
shape = aFixShape->Shape();
Handle(ShapeFix_Wireframe) aFixWire = new ShapeFix_Wireframe(shape);
FixWire->ModeDropSmallEdges() = true;
aFixWire->FixSmallEdges();
aFixWire->FixWireGaps();
shape = aFixWire->Shape();
// Create OBB
Bnd_OBB obb;
BRepBndLib::AddOBB(shape, obb, true, true, false);
If i make a simple box (1x1x1 with origin (0,0,0)) and build its OBB, it's perfectly precise.
So I am wondering if the problem I am having is due to the complexity of the model? Or because of the conversion from the STEP format?
Any help will be appreciated!
Thu, 03/21/2024 - 09:12
Could you share a sample model?
Thu, 03/21/2024 - 14:30
I have created a one-time download link link for you, since I unfortunately am not allowed to fully publicly post the model here, I hope that is OK.
Thu, 03/21/2024 - 14:22
If model is not public, please don't publish it there. There are a lot of people who will download it faster then developers. Please create a new ticket in bug tracker and Mark that as private.
Best regards, Dmitrii.
Thu, 03/21/2024 - 14:36
Thanks for the advice, I will do that. I assume by bug tracker you mean tracker.dev.opencascade.org?
Thu, 03/21/2024 - 15:32
Yes, that's correct.
Thu, 03/21/2024 - 15:58
I have opened an issue, but there is no way for me to mark it as private, nor edit it in any other way. How do I make it private?
Thu, 03/21/2024 - 15:34
Or you can use "contact us from" in the current site.
Best regards, Dmitrii