- /* XXX This is not very efficient. Should transform the ray to
- local coordinate system. */
- Vector node_pos = get_node_position(c);
- Vector v = node_pos-ray.get_start();
- float dist = (v-ray.get_direction()*dot(ray.get_direction(), v)).norm();
+ Vector node_pos((x+i%2)*ts, (y+i/2)*ts, get_node_elevation(c));
+ Vector v = node_pos-local_ray.get_start();
+ float dist = (v-local_ray.get_direction()*dot(local_ray.get_direction(), v)).norm();