bounding boxes (graphics programming)

(nikoy) #1

Anyone have an algorithm (pseudo code or in C) that detects when two bounding boxes overlap? I’m writing code to detect neighbouring polygons by traversing line segments of the polygons and looking for collinearity. I’ve got collinearity of lines detected, but now I need to restrict my focus to adjacent segments. I was told that I could detect overlap of bounding boxes to do this, but I can’t think of how to do this (without hacking some really ugly code). Any help?

(S68) #2


If for bounding box you mean
[Xmin1,Ymin1,Zmin1; Xmax1,Ymax1,Zmax1]
[Xmin2,Ymin2,Zmin2; Xmax2,Ymax2,Zmax2]

of two objects and the reference system is THE SAME for both it
is trivial

if NOT ((Xmax1 < Xmin2 OR Xmax2 < Xmin1) AND
(Ymax1 < Ymin2 OR Ymax2 < Ymin1) AND
(Zmax1 < Zmin2 OR Zmax2 < Zmin1)

then the intersects


P.S. Why oh, why there is a Q&A forum?

(nikoy) #3

Thanks, I have figured it out. With regards to your post script, in this particular forum I can “chat about anything related to Computer Graphics or elYsiun”. Since a question certainly falls under the category of “chatting”, this question is not the least bit off topic. It would have been had I gone to the questions forum which is a “place to ask Questions about Blender”.

I will spare you a smart-ass post script

(valarking) #4

you are right, this is about “computer graphics”

(Timothy) #5

perhaps it may be usefull to add some programming forums?
I will have to think about this though,… perhaps a better place for those would be at instead,… or perhaps a general 3d programming forum can be based here,… let me think!!! :slight_smile: