REVIEW - Computer graphics for Java programmers


Title:

Computer graphics for Java programmers

Author:

Leendert Ammeraal

ISBN:

Publisher:

John Wiley & Son Ltd (1998)

Pages:

271pp

Reviewer:

Peter Pilgrim

Reviewed:

February 1999

Rating:

★★★☆☆


If you like Java and want to learn how to program 3D graphics from first principles then this is the book for you.

This book has appeared before but for older computer languages such as C. It has been completely revised for Java developers who have better- than GCSE Mathematics and desire to understand what computer graphics is all about. The book has two main requirements: a good understanding of the Java programming language and grasp of mathematics. In particular you will need to have studied scalars, vector, matrices, products&trigonometry. Whilst introductions to former themes are given in the book, you may find it frugal to have another dedicated book on mathematics to hand. (I personally have K.A. Stroud's Engineering Mathematics). The quality of the book is such that you do not have to be a wizard with figures, especially in the first five chapters, because you will quickly realise that a lot computer graphics is simply adding and multiplying. Learning why and how you must do this, in order to produce pleasing results, is the real point.

The book carefully explains the fundamentals of computer graphics beginning with lines, coordinates and pixels. Moving on to boundaries and fill regions, the difference between logical and physical coordinates , and anisotropic and isotropic mapping modes. The first chapter finishes with a simple example how to draw a polygon using the mouse in Java. There is a set of exercises at the end of the chapter. You are encouraged to try them, between downloading the source code (and thus the solution).

The second chapter of the book teaches you geometry and how it is applied to computer graphics. Here you will use your understanding of vectors and matrices. The inner product of two vectors is the first topic explained, followed by matrix determinants and then the vector product. These are tools of the trade make it possible to calculate if a point lines are on line, or if it lies inside a polygon, the distance between the point and a line or plane, the area of polygon, or perhaps the orientation of vertices in a polygon. Grasping the ideas of the second chapter will go a long way to understanding three dimensional (3D) graphics, and for you wanna-be games programmers this is great goal.

With all geometry in the world, Midway's Space Invaders or the latest Lockheed flight simulator would be nothing without any transformation and rotation. Chapter three is a study of the former where you apply your matrix multiplication and trigonometry abilities. The book explains shearing, translation and rotation in both 2D and 3D space, and how all of these can be combined together. There are plenty of source code examples to demonstrate these ideas. You are warned, however, that there is no Matrix class. I liked Mr. Ammeraal's direct approach to code the functions in Java,where it is better to see what's going on: how mathematics can be expressed in computer languages. If you want pure object oriented programming and all encapsulated to a mind-numbing degree do not look for it here.

Chapter four is a delight if you always wanted to learn what Bezier curves are. The author shows hot to recursively and analytical arrive at the same classic curve-fitting algorithm. To understand the analytical side you need derivation. This chapter also explains other classic algorithms such as B- splines, Cohen-Sutherland's line clipping algorithm, Bresenhem's line drawing, optimised circle drawing, and Sutherland-Hodgman;s polygon clipping. The later is fundamental ingredient in 3D applications.

Chapter five is strictly three-dimensional graphics: it deals with simulating perspective. The concepts of the three coordinates systems (world, eye, and screen) are explained. The general viewing transformation is explained. Although the spherical 3D coordinates may be unfamiliar, it is demonstrated as being very useful in deriving this important transformation. Once the task of viewing any world object from any angle and direction in space has been explained, you need to transform the eye (or camera's) view on a 2D plane (a screen). The perspective transformation is thus described. Source code for drawing a wire frames illustrate the ideas of the chapter.

Having learnt viewing and perspective transformation you need to able to optimise how to draw 3D world objects. At the most three faces of any cube are going to be hidden from view, chapter 7 introduces hidden face elimination starting with back-face culling. The fast efficient but by no means perfect painters algorithm, as used in several computer games, is discussed after a thorough section about the representation of 3D world objects. The Z buffer algorithm is fully explained, but the mathematics is advanced, requiring knowledge of partial differentiation. However there is full source code example of the Zbuffer implementation.

Hidden line elimination is more difficult than hidden face elimination as so has the whole of chapter 7 devoted to it. The topic is quite important when one wants to draw graphics on a plotter or printer. The mathematics and idea are again advanced.

The last chapter demonstrates some of the applications that use computer graphics. The chapter is introduces several programs to generate complex world objects from platonic solids such as cubes, hexahedra, icosahedra and dodecahedra to solids of revolution like spheres, and hollowed cylinders with scores of polygons to a complex surface representing the functions of two variables.

The book has appendices on linear interpolation, Java's 1.1 event handling mechanism, and source code to the fundamental classes. The book is finished with a section on hints and answers to the set exercises. I found that the book neat and complete, and reaches the goal it set out to do. It is very good for an introduction and is a lot lighter than the standard text Foley and Van Dam's Computer Graphics - Principles and Practices. The source code can be downloaded from one of several web sites. The code compiles flawlessly and it is nice to see Java 3D applications. If you like Java and want to learn how to program 3D graphics from first principles then this is the book for you.


Book cover image courtesy of Open Library.





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.