## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

## Book Description

A great many varied and interesting visual effects can be achieved with computer graphics, for which a fundamental understanding of the underlying mathematical concepts - and a knowledge of how they can be implemented in a particular programming language - is essential.

Computer Graphics for Java Programmers, 2nd edition covers elementary concepts in creating and manipulating 2D and 3D graphical objects, covering topics from classic graphics algorithms to perspective drawings and hidden-line elimination.

Completely revised and updated throughout, the second edition of this highly popular textbook contains a host of ready-to-run-programs and worked examples, illuminating general principles and geometric techniques. Ideal for classroom use or self-study, it provides a perfect foundation for programming computer graphics using Java.

2. Preface
3. 1. Elementary Concepts
1. 1.1. LINES, COORDINATES AND PIXELS
2. 1.2. THE BOUNDARIES OF FILLED REGIONS
3. 1.3. LOGICAL COORDINATES
4. 1.4. ANISOTROPIC AND ISOTROPIC MAPPING MODES
5. 1.5. DEFINING A POLYGON BY USING THE MOUSE
4. 2. Applied Geometry
1. 2.1. VECTORS
2. 2.2. INNER PRODUCT
3. 2.3. DETERMINANTS
4. 2.4. VECTOR PRODUCT
5. 2.5. THE ORIENTATION OF THREE POINTS
6. 2.6. POLYGONS
7. 2.7. THE AREA OF A POLYGON
8. 2.8. POINT-IN-TRIANGLE TEST
9. 2.9. POINT-IN-POLYGON TEST
10. 2.10. POINT-ON-LINE TEST
11. 2.11. DISTANCE BETWEEN A POINT AND A LINE
12. 2.12. PROJECTION OF A POINT ON A LINE
13. 2.13. TRIANGULATION OF POLYGONS
5. 3. Geometrical Transformations
1. 3.1. MATRIX MULTIPLICATION
2. 3.2. LINEAR TRANSFORMATIONS
3. 3.3. TRANSLATIONS
4. 3.4. HOMOGENEOUS COORDINATES
5. 3.5. INVERSE TRANSFORMATIONS AND MATRIX INVERSION
6. 3.6. ROTATION ABOUT AN ARBITRARY POINT
7. 3.7. CHANGING THE COORDINATE SYSTEM
8. 3.8. ROTATIONS ABOUT 3D COORDINATE AXES
9. 3.9. ROTATION ABOUT AN ARBITRARY AXIS
6. 4. Some Classic Algorithms
1. 4.1. BRESENHAM'S ALGORITHM FOR LINE DRAWING
2. 4.2. DOUBLING THE LINE-DRAWING SPEED
3. 4.3. CIRCLES
4. 4.4. COHEN – SUTHERLAND LINE CLIPPING
5. 4.5. SUTHERLAND – HODGMAN POLYGON CLIPPING
6. 4.6. BÉZIER CURVES
7. 4.7. B-SPLINE CURVE FITTING
7. 5. Perspective
1. 5.1. INTRODUCTION
2. 5.2. THE VIEWING TRANSFORMATION
3. 5.3. THE PERSPECTIVE TRANSFORMATION
4. 5.4. A CUBE IN PERSPECTIVE
5. 5.5. SOME USEFUL CLASSES
6. 5.6. A GENERAL PROGRAM FOR WIRE-FRAME MODELS
8. 6. Hidden-Line Elimination
1. 6.1. LINE SEGMENTS AND TRIANGLES
2. 6.2. TESTS FOR VISIBILITY
3. 6.3. SPECIFICATION AND REPRESENTATION OF 3D OBJECTS
4. 6.4. HOLES AND INVISIBLE LINE SEGMENTS
5. 6.5. INDIVIDUAL FACES AND LINE SEGMENTS
6. 6.6. AUTOMATIC GENERATION OF OBJECT SPECIFICATION
7. 6.7. HIDDEN-LINE ELIMINATION WITH HP-GL OUTPUT
8. 6.8. IMPLEMENTATION
9. 7. Hidden-Face Elimination
10. 8. Fractals
1. 8.1. INTRODUCTION
2. 8.2. KOCH CURVES
3. 8.3. STRING GRAMMARS
4. 8.4. MANDELBROT AND JULIA SETS
11. A. Linear Interpolation of 1/z
12. B. A Note on Event Handling
13. C. File Obj3D.java
14. D. Class CvHLines.java
15. E. Some Applications
1. E.1. PLATONIC SOLIDS
2. E.2. SPHERE REPRESENTATIONS
3. E.3. A TORUS
4. E.4. BEAMS IN A SPIRAL
5. E.5. FUNCTIONS OF TWO VARIABLES
16. F. Hints and Solutions to Exercises
17. Bibliography