23 – Using the geometry in a ray-tracing application
暂无分享,去创建一个
Publisher Summary
This chapter puts the algebra to work by using it to implement a ray tracer in the C++ programming language. A ray tracer is a program that takes as input the description of a scene (including light sources, models, and camera) and produces an image of that scene as seen from the camera. The chapter shows how the conformal model of Euclidean geometry is very useful for the specification and computation of the basic operations. All geometrical elements occurring in this problem have a natural representation in that model. When really trying to optimize the speed of the ray tracer, it is argued that one may want to deviate from the natural all-purpose representation to a more dedicated choice, which anticipates the typical ray tracing operations that are going to be performed on the data. That is, some of the elegance of the conformal model is traded off for added efficiency. Even then, each of these choices can be described and compared within the conformal model, which moreover always supplies the necessary transformations in its versor representation. The resulting compromise between algebraic elegance and practical performance is probably typical of many applications. In the process, a graphical user interface is written to manipulate objects in a viewport, as well as the camera that produces the view. This is another application in which the conformal model shows its power by giving directly executable expressions connecting mouse coordinates to the simulated motions. Here, practical performance and algebraic elegance coincide in a satisfying manner.