For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

axis aligned bouding box

jelle's picture
Forums: 

hi,

Is there an API call in OCC to generate a axis aligned bouding box from a TopoDS_Shape?

thanks,

-jelle

Mauro Mariotti's picture

BRepBndLib.

Regards.

Mauro

jelle's picture

hi Mauro,

This is a little embarrassing, I got the terminology wrong -- I'm interested in a OOBB rather than AABB...

Cauchy Ding's picture

Hi Jelle,

 My method is to get all tessellated points from the shape, and use GProp_PGProps to get the principal component. (GProp_PrincipalProps p= principal.PrincipalProperties();)

 And finally, using the points to measure with the initial bounding box.

Ding

Robert W.'s picture

Hi. Could you be more specific? What do you mean by "using the points to measure with the initial bounding box". What do you need the principal component for? Sadly, i can not understand the idea behind your method.

Benjamin Bihler's picture

Hi,

I am interested in the same topic. Object-oriented bounding boxes or k-DOPs for arbitrary shapes in OCCT would be great. Are there already some approaches? Cauchy's method? Or would we need to develop it from scratch?

Benjamin
 

Cauchy Ding's picture

Hi Guys,

I've attached a source file. Please take it as reference. To get raw points from face, you can do it as followings:

    TopLoc_Location loc;
    Handle_Poly_Triangulation pTess = BRep_Tool::Triangulation(face, loc);
    if(pTess.IsNull())
        return false;

    std::vector<gp_Pnt> nodes;
    std::vector<gp_Pnt> norms;
    std::vector<LS_INTEGER> face3Vers;
    LS_INTEGER i, N1, N2, N3;

    const TColgp_Array1OfPnt& meshVers = pTess->Nodes();

Ding

Attachments: 
Benjamin Bihler's picture

Hi Cauchy,

thank you very much. I will have a close look at it.

Benjamin

Benjamin Bihler's picture

Hi Cauchy,

thank you again for the code snippet. It has served well as a starting point for studying oriented bounding boxes. Still I have the feeling that there are some flaws in the implementation. For example the swapping if id==0 in lines 151 and 152 should be x <-> y and y <-> z in my opinion.

I have wondered whether we should propose to integrate oriented bounding boxes into OCCT. But then my impression was that a good implementation really demands a lot of effort. For example the standard separation axis test reports two oriented bounding boxes always as intersecting, if they are flat and within the same plane and extra checks have to be written to get correct results in that special case. Therefore it might be better to use already existing implementations that care for all of that (right now I am not aware of such an implementation) instead of re-implementing everything within OCCT. What do you and the others think? Has anyone found a high-quality OBB implementation and used it with OCCT?

Benjamin

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.