Jump to content

Check if bounds are outside of multiple bounds


jacquesr
 Share

Recommended Posts

Hi,

I need to implement a check that can determine if a bounding box is completely inside a set of bounding boxes. See my attached graphic for a better understanding of the situation.

I am thinking of consuming the A to B paths on each axis of the original bounding box using the axes limits of the containing bounding boxes.

Then, for each axis, I would store those in an array, sort them by starting point, find if there are overlaps, eliminate them, find gaps (could probably happen if outer bounding boxes are not adjacent to each other) and if none are there, look if the total length is the length of the object bounding box.

If this is the truth for every axis, then I can be sure that the item is completely inside the valid area.

 

The only thing I am worried about is that this can become quiet slow.

Since this is usually an edge case, I would first go through all container bounding boxes and see if the object is completely inside one of them. Only if that is not true, I need to do the more complex check.

 

Any ideas on different, maybe faster algorithms?

 

Regards

Jacques

 

 

 

oobcheck.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...