graphics - What is the best approach to compute efficiently the first intersection between a viewing ray and a set of objects? -
For example:
To calculate the first crossroads efficiently between a visible ray and a set One approach for three objects: one spherical, one cone and one cylinder (other 3D Primitives).
What you are doing is a spatial division plan. There are so many options to deal with this, and a lot of research has been done in this area. A good read would have been Crister Eriksson.
An easy way involved in that book will be to define a grid, all the objects must be assigned to all the cells that pierce that line, and the line with the grid cells moves from each other. The back, the intersector with each object connected to that grid cell. Keep in mind that an object can be associated with more grid cells, so the calculated intersection point is not actually in the current cell, but actually later.
The next question will be how do you define that trap. Unfortunately, there is no good answer, and you need to think about what position your scenario can be fit.
Other split plans of interest are various tree structures, such as, and you can also consider joining a grid using trees.
Edit
As stated, if your set is actually these three objects, then you are actually better at piercing each other, And just pick one soon as soon as you are looking for the ray area, ray cylinders, intersection tests, these are not really tough and a quick Google should probably supply all the maths you need. :)
Comments
Post a Comment