WSCG’97Analysis and construction of worst-case optimal ray shooting algorithms
Introduction
Ray shooting is a geometric problem arisen in the framework of the famous ray tracing[1], and can be formulated as follows: Given a set of objects in three-dimensional space, a data structure must be built that allows the effective determination of the first object that is intersected by an arbitrary ray.
The solution of the ray-shooting problem usually consists of two phases: in the pre-processing phase objects are transformed into an appropriate data structure; in the query phase the object intersected first by a given ray is searched for.
This paper focuses on the effective solution of the query phase. From the theoretical point of view, algorithm efficiency is characterized by complexity measures that express the rate of increase of the required time and memory space as the size of the problem grows. Here the size of the problem is the number of the objects in the scene. In this paper the number of objects, computation time and required storage are denoted by letter n, T(n) and S(n), respectively. The time and space complexities impose constraints on the functions T(n) and S(n). A function g(n) is said to be in O(f(n)) if it grows at most with the speed of f(n), in Ω(f(n)) if it grows at least with the speed of f(n) and in Θ(f(n)) if it grows exactly with the speed of f(n).
The required time is expressed by the number of constant time operations needed to complete the algorithm. Before carrying out such an analysis, we have to define what kind of operations can be used in the algorithm. In the generally accepted algebraic decision tree model[2], the following operation type is allowed: an algebraic function is evaluated and according to its result a decision is made to select the next operation. In this framework, the computation can be visualized by a binary tree that is divided into two branches by every single decision.
In the classical approach, algorithms are optimized for the worst case, thus complexity measures also express the resource requirements of the worst arrangement of input of a given size.
The naive solution of the ray-shooting problem, when each object is tried to be intersected, and then the nearest intersection is retained, obviously requires linear time. However, having pre-processed the object space into a sophisticated data structure, this problem can be solved more effectively. Concerning effective ray-shooting, the following questions need to be answered[3]:
- 1.
What is the lower-bound of the time complexity of ray-shooting, and thus what are the theoretical limits of optimal ray-shooting algorithms?
- 2.
How such an optimal algorithm can be elaborated?
- 3.
What is the minimum price of optimal time complexity in terms of the required memory space and pre-processing time?
- 4.
What is the practical value of worst-case optimal algorithms in ray-shooting?
First, by examining the computation tree, this paper shows that the optimal time complexity of the ray-shooting problem is logarithmic. Then the structure of the space involving the objects and the ray is analysed and the results are used to determine the storage complexity.
Section snippets
Previous work
One of the earliest results on the complexity of ray-shooting have been published by Glassner[1], who stated that his octree based acceleration technique runs in logarithmic time, but his statements have been neither precisely formulated nor proven. For example, he must have meant average-case complexity since the octree algorithm is definitely not a worst-case logarithmic method (it is easy to construct an object space for which the octree-based algorithm would run in linear time), but he did
Lower-bound for the worst case time complexity of ray-shooting
The lower-bounds of the complexity are inherent properties of the problem to be solved, not of the algorithm. We have to prove that no algorithm can be found for the given problem that is able to solve it better than using this lower-bound complexity. In the algebraic decision tree model, this is usually done by determining the size of the tree based on the number of possible outcomes of the algorithm.
The ray-shooting algorithm can result in at least n+1 different outputs, since generally any
Analysis of the space containing the objects and the ray
In ray-shooting five independent real parameters define the ray unambiguously. For different five-tuples, the ray may intersect different objects. The collection of those five-tuples, that represent rays intersecting the same object, forms a cell in the five-dimensional space of ray parameters (Fig. 2). The intersection of these cells—called sub-cells—define those rays that intersect not only a single object but several objects. Since a set of objects may be intersected from two, opposite
Construction of logarithmic-time ray-shooting algorithms
Logarithmic-time ray-shooting algorithms can be constructed by applying the divide-and-conquer approach. This method attacks a problem of size n by subdividing it into smaller problems of the same type and in a single phase of the search it selects that smaller problem which solves the original problem.
Let us assume that the problems generated by the subdivision are of size at most n/r(n), where r(n)>1. If the solution time of a problem of size n is Q(n) and the time of decomposition is d(n),
Ray-shooting using Plücker coordinates
One way of tracing back ray-shooting to an equivalent point location problem is the application of Plücker coordinates as proposed in Ref.[3]. Since Plücker coordinates can be defined for linear varieties, the objects should be assumed to be bounded by lines, thus we restrict the types of objects to triangles.
Let us define a directed line l by two points (a1, a2, a3, a4) and (b1, b2, b3, b4) using homogeneous coordinates. This line can be represented by a point π and a plane π in a
The complementer plane algorithm
This algorithm is based on the observation that the identification of the groups of objects intersected by the line of the ray can be traced back to a point location problem if the direction of the ray is fixed. For fixed direction, different groups will correspond to different areas on a plane which is perpendicular to the direction and onto which all objects are projected (Fig. 5). This plane is called the complementer plane in Ref.[11].
On the complementer plane, the objects of the scene can
Conclusions
This paper reviewed the worst-case analysis of the ray-shooting problem focusing on the theoretical limits. The practical value of this analysis is to point out what can be done and what is not reasonable to do to speed up ray-shooting.
It has been demonstrated that ray-shooting algorithms run at least in logarithmic time in the worst-case and logarithmic algorithms use at least Ω(n4) storage and pre-processing time which makes these algorithms not feasible in practical applications. Making the
Acknowledgements
This work has been supported by the National Scientific Research Fund (OTKA), Ref. No.: F 015884 and the Austrian-Hungarian Action Fund, Ref. No.: 29ö4 and 32öu9.
References (12)
- Glassner, A. S., (editor), An Introduction to Ray Tracing, Academic Press, London,...
On the optimality of some set algorithms
Journal of the ACM
(1972)- de Berg, M., Efficient algorithms for ray shooting and hidden surface removal, Ph.D. thesis, Rijksuniversiteit te...
- Chazelle, B., Edelsbrunner, H., Guibas, L., Pollack, R. and Sharir, M., Lines in space–combinatorics, algorithms and...
- Pellegrini, M., New results on ray shooting and isotopy classes of lines in 3-dimensional space. In Proc. Workshop on...
- McKenna, M. and O'Rourke, J., Arrangements of lines in 3-space: a data structure with applications. In 4th ACM Symp. on...
Cited by (3)
On comparing ray shooting algorithms
2003, Computers and Graphics (Pergamon)Interactive ray tracing with the visibility complex
1999, Computers and Graphics (Pergamon)LCTS: ray shooting using longest common traversal sequences
2000, Computer Graphics Forum