#### Archived

This topic is now archived and is closed to further replies.

# Orientated bounding cube-> triangle collision checking

This topic is 6000 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I am thinking my way to programming an orientated bounding cubewith scenery geomery (triangles)... My initial thinking lead me to think that triangle-edges -> box planes was the correct route to take...but what about if the bounding cube intersects the middle of the triangle? My thinking at present is to make the bounding cube 12 polys and do triangle->triangle checking... Can anyone tell me I am being stupid and the correct thinking to the sollution? Thanks in advance ** Ste ~Having read a lil more i c that 'Voorhies triangle-cube intersection' solves this problem by: 1. If any edge intersects the cube, return true. 2. If the polygon interior intersects the cube, return true. 3. Return false So, is accepted as faster than 12 triangle->triangle tests? Edited by - Jedaye on August 15, 2001 11:03:42 AM

##### Share on other sites
no one even implements face to face collition , lets count face to face , shell we :
( i might have some slight mistakes about the clock-ticks )
we will start with point to face and then multiply by 3 :
int classifypoint(point v,plane p){
float f=dotproduct(v,p.n)+p.d;
if(f>0) return 2;
if(f<0) return 1;
return 0;
}

first we have dotproduct(v,u)=v[0]*u[0]+v[1]*u[1]+v[2]*u[2];
i count 3 mults and 2 sums which equals 3*3+2*3=15ct
now the sum after the dotproduct is 3ct , so we have 18ct by now
lets ignore the "if" part in the function for the time being.

so 18ct per vertex ==> 54ct per polygon
==>648ct per box

I really dont think so !!!

try treating the box as a point and then you have to use plane shifting , and i have absolutly no idea about how to do that !!!

the rubber-hound