Computer Graphics for Java Programmers

ISBN 0-471-98142-7
Leen Ammeraal
Chichester: John Wiley

You can download the file grjava.zip, containing the programs of this book, by clicking here.

Contents

Preface ix

1 Elementary Concepts 1
1.1 Lines, Coordinates and Pixels 1
1.2 The Boundaries of Filled Regions 5
1.3 Logical Coordinates 6
1.4 Anisotropic and Isotropic Mapping Modes 12
1.5 Defining a Polygon by Using the Mouse 18
Exercises 21
Try the demo applets for this chapter.

2 Applied Geometry 25
2.1 Vectors 25
2.2 Inner Product 27
2.3 Determinants 28
2.4 Vector Product 31
2.5 The Orientation of Three Points 32
2.6 Polygons 35
2.7 The Area of a Polygon 36
2.8 Point-in-Triangle Test 38
2.9 Point-in-Polygon Test 39
2.10 Point-on-Line Test 41
2.11 Distance Between a Point and a Line 43
2.12 Projection of a Point on a Line 44
2.13 Triangulation of Polygons 46
Exercises 50
Try the demo applets for this chapter.

3 Rotations and Other Transformations 53
3.1 Matrix Multiplication 53
3.2 Linear Transformations 54
3.3 Combining Linear Transformations 59
3.4 Inverse Transformations and Matrix Inversion 61
3.5 Translations and Homogeneous Coordinates 62
3.6 Rotation About an Arbitrary Point 63
3.7 Rotations About 3D Coordinate Axes 67
3.8 Changing the Coordinate System 68
3.9 Rotation About an Arbitrary Axis 69
Exercises 76
Try the demo applet for this chapter.

4 Some Classic Algorithms 79
4.1 Bézier Curves 79
4.2 B-spline Curve Fitting 88
4.3 Cohen-Sutherland Line Clipping 93
4.4 Sutherland-Hodgman Polygon Clipping 98
4.5 Bresenham's Algorithm for Line Drawing 103
4.6 Circles 107
Exercises 111
Try the demo applets for this chapter.

5 Perspective 113
5.1 Introduction 113
5.2 The Viewing Transformation 115
5.3 The Perspective Transformation 119
5.4 A Cube in Perspective 122
Exercises 125
Try the demo applets for this chapter.

6 Hidden-face Elimination 127
6.1 Back-face Culling 127
6.2 Specification and Representation of 3D Objects 132
6.3 Some Useful 3D Classes 135
6.4 Painter's Algorithm 145
6.5 Z-buffer Algorithm 150
Exercises 160
Try the demo applets for this chapter.

7 Hidden-line Elimination 163
7.1 Line Segments and Triangles 163
7.2 Tests for Visibility 164
7.3 Individual Line Segments 173
7.4 Storing Line Segments 175
7.5 Holes and Invisible Line Segments 176
7.6 Individual Faces 178
7.7 Graphical Output in HP-GL 179
7.8 Implementation 180
Exercises 181
Try the demo applets for this chapter.

8 Some Applications 183
8.1 A (Possibly Hollow) Cylinder 183
8.2 Platonic Solids 190
8.3 Sphere Representations 199
8.4 A Torus 205
8.5 Beams in a Spiral 208
8.6 Functions of Two Variables 211
Exercises 219
Try the demo applets for this chapter.

Appendix A: Linear Interpolation of 1/z 223
Appendix B: A Note on Event Handling 227
Appendix C: File Obj3D.java 231
Appendix D: Program HLines.java 237
Appendix E: Hints and Solutions to Exercises 247
Bibliography 267
Index 269

Back to list of recent books by the same author
Publisher's web page