Ray casting is a widely used method in interactive graphics and in game development, for example, for measuring distances, detecting visibility of objects and confirming the outcome of shots fired. This method is based on checking the intersection of an imaginary line with objects.
Practical use of this functionality can be seen in this simple yet funny demo. Please pay attention to traces left by mouse clicks - they are implemented with textured planes aka decals.
You can browse through the code listing by clicking the View Code button. The source files for this example are present in both Community Edition and PRO distributions.