You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use the function intersectBox(AABB b) in order to calculate the
intersection between two different boxes that I previously created.
The problem was that, to orient the boxes on the face of the other box, I was
rotating the extent vector of the box of multiples of PI/2, in order to swap x
and y.
But this would cause the intersectBox function not to work (I believe because
the extent vector components would become negative). I've wrote an intersect
function myself in Processing, and this one seems to work fine:
boolean intersectsBox2(AABB other){
boolean intersecting = false;
Vec3D diff = other.sub(boundingBox);
Vec3D extent = boundingBox.getExtent();
Vec3D otherExtent = other.getExtent();
// I wrote the function in 2D, it should work in 3D as well
if(abs(diff.x) <= (abs(extent.x) + abs(otherExtent.x)) && abs(diff.y) <= (abs(extent.y) + abs(otherExtent.y))){
intersecting = true;
}
return intersecting;
}
Hope this helps... Let me know if you think it can work or if there are any
other ways to fix it.
Original issue reported on code.google.com by a.rossi....@gmail.com on 11 Jun 2013 at 10:13
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
a.rossi....@gmail.com
on 11 Jun 2013 at 10:13The text was updated successfully, but these errors were encountered: