    Next: B.1 Setup of the Up: Dissertation Otmar Ertl Previous: A. Line-Triangle Intersection

# B. Ray-Isosurface Intersection

It is assumed that the surface is represented as the zero LS of function and a ray with direction passes through point  (B.1)

In order to find the intersection with the surface, the following equation must be solved (B.2)

It is essential for ray tracing, that this equation can be solved with as few numerical operations as possible. Optimized algorithms are presented in the following, which are superior to those reported in the literature [69,74,88,119].

The LS function is usually multi-linearly interpolated within a grid cell. The index vector of a grid cell is defined to be equal to the lower bound indices of all its corner grid points. For an arbitrary number of dimensions , the multi-linear interpolation formula within the grid cell with index vector can be expressed as (B.3)

This expression can be expanded to a multi-variate polynomial (B.4)

where are its coefficients. They can be obtained by rewriting (B.3) as (B.5)

and further as (B.6)

Hence, the coefficients can be calculated as (B.7)

If the coefficients are calculated in a straightforward manner, additions or subtractions are needed [69,119]. However, the number of numerical operations can be reduced to subtractions as demonstrated in Algorithm B.1. The algorithm is realized using template metaprogramming  which allows for the elimination of all recursive function calls at compile time. An array of size , which contains the LS values of all corner grid points in lexicographical order (with reversed significance), is passed to the static member function. After the function call the same array holds the coefficients in lexicographical order (again with reversed significance) with respect to . Subsections    Next: B.1 Setup of the Up: Dissertation Otmar Ertl Previous: A. Line-Triangle Intersection

Otmar Ertl: Numerical Methods for Topography Simulation