alecjacobson / computer-graphics-bounding-volume-hierarchy

Computer Graphics Assignment about Bounding Volume Hierarchies
123 stars 45 forks source link

triangle-trianlge box-box intersections #48

Closed s99090 closed 5 years ago

s99090 commented 5 years ago

Just wondering if one vertex of triangle touches the other triangle, does it count as a hit? what about for boxes?

abhimadan commented 5 years ago

I'd say that these (literal) corner cases count as hits, but the chances of this happening between two arbitrary meshes (or two bounding boxes of arbitrary sets of objects) are quite low.

s99090 commented 5 years ago

I had errors when running the following ./intersections ../data/fandisk.obj ../data/fandisk.obj i.e. to intersect the same objects.

And I get a lot of errors if those corner cases count for triangles. and I got only 6 errors when the corner cases don't count for triangles.

I got all other combinations error-free except the above one. And I am kind of stuck on that. Do we need to consider intersecting the same objects?

abhimadan commented 5 years ago

The brute force intersection code (in intersections.cpp) uses the triangle-triangle intersection routine that you use in your AABB intersections, so they should recognize the same intersections if they compare the same relevant triangles. Also, adding additional box-box intersections shouldn't affect correctness, since they only create extra candidate pairs during the broad phase. I would say that the bug is likely in your find_all_intersecting_pairs_using_AABBTrees, not your intersection routines.

abhimadan commented 5 years ago

I should also mention that the bug is not necessarily in any of your intersection code directly, but it could also be in code that it depends on from previous parts of the assignment.

s99090 commented 5 years ago

Thanks, I will try my best to find it........