Computer Graphics for Java Programmers, Second Edition

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.

Table of contents

  1. Copyright
  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
      1. 1.3.1. 1.3.1 The Direction of the Y-axis
      2. 1.3.2. 1.3.2 Continuous vs. Discrete Coordinates
    4. 1.4. ANISOTROPIC AND ISOTROPIC MAPPING MODES
      1. 1.4.1. 1.4.1 Mapping a Continuous Interval to a Sequence of Integers
      2. 1.4.2. 1.4.2 Anisotropic Mapping Mode
      3. 1.4.3. 1.4.3 Isotropic Mapping Mode
    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
      1. 2.5.1. 2.5.1 An Alternative, Two-dimensional Solution
      2. 2.5.2. 2.5.2 A Useful Java Method
    6. 2.6. POLYGONS
    7. 2.7. THE AREA OF A POLYGON
      1. 2.7.1. 2.7.1 Java Code
    8. 2.8. POINT-IN-TRIANGLE TEST
      1. 2.8.1. 2.8.1 An Alternative Method insideTriangle
    9. 2.9. POINT-IN-POLYGON TEST
      1. 2.9.1. 2.9.1 The contains Method of the Java Class Polygon
    10. 2.10. POINT-ON-LINE TEST
      1. 2.10.1. 2.10.1 Testing Whether a Point Lies on a Line Segment
    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
      1. 3.2.1. 3.2.1 Rotation
      2. 3.2.2. 3.2.2 A Programming Example
      3. 3.2.3. 3.2.3 Scaling
      4. 3.2.4. 3.2.4 Shearing
    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
      1. 3.6.1. 3.6.1 An Application
    7. 3.7. CHANGING THE COORDINATE SYSTEM
    8. 3.8. ROTATIONS ABOUT 3D COORDINATE AXES
    9. 3.9. ROTATION ABOUT AN ARBITRARY AXIS
      1. 3.9.1. 3.9.1 Implementation
  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
      1. 4.6.1. 4.6.1 Building Smooth Curves from Curve Segments
      2. 4.6.2. 4.6.2 Matrix Notation
      3. 4.6.3. 4.6.3 3D 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
      1. 5.5.1. 5.5.1 Input: A Class for File Input Operations
      2. 5.5.2. 5.5.2 Obj3D: A Class to Store 3D Objects
      3. 5.5.3. 5.5.3 Tria: A Class to Store Triangles by Their Vertex Numbers
      4. 5.5.4. 5.5.4 Polygon3D: A Class to Store 3D Polygons
      5. 5.5.5. 5.5.5 Canvas3D: An Abstract Class to Adapt the Java Class Canvas
      6. 5.5.6. 5.5.6 Fr3D: A Frame Class for 3D Programs
    6. 5.6. A GENERAL PROGRAM FOR WIRE-FRAME MODELS
      1. 5.6.1. 5.6.1 A Demonstration
  8. 6. Hidden-Line Elimination
    1. 6.1. LINE SEGMENTS AND TRIANGLES
    2. 6.2. TESTS FOR VISIBILITY
      1. 6.2.1. 6.2.1 Test 1 (2D; Figure 6.4)
      2. 6.2.2. 6.2.2 Test 2 (3D; Figure 6.5)
      3. 6.2.3. 6.2.3 Test 3 (3D; Figure 6.6)
      4. 6.2.4. 6.2.4 Test 4 (2D; Figure 6.7)
      5. 6.2.5. 6.2.5 Test 5 (2D; Figure 6.8)
      6. 6.2.6. 6.2.6 Test 6 (3D; Figure 6.9)
      7. 6.2.7. 6.2.7 Test 7 (2D; Figure 6.10)
      8. 6.2.8. 6.2.8 Test 8 (3D; Figure 6.11)
      9. 6.2.9. 6.2.9 Test 9 (3D; Figure 6.12)
      10. 6.2.10. 6.2.10 Recursive Calls
      11. 6.2.11. 6.2.11 The Arguments of the lineSegment Method
    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
    1. 7.1. BACK-FACE CULLING
    2. 7.2. COLORING INDIVIDUAL FACES
    3. 7.3. PAINTER'S ALGORITHM
    4. 7.4. Z-BUFFER ALGORITHM
  10. 8. Fractals
    1. 8.1. INTRODUCTION
    2. 8.2. KOCH CURVES
    3. 8.3. STRING GRAMMARS
      1. 8.3.1. 8.3.1 Moving without drawing and f-strings
      2. 8.3.2. 8.3.2 Branching
    4. 8.4. MANDELBROT AND JULIA SETS
      1. 8.4.1. 8.4.1 Implementation in Java
      2. 8.4.2. 8.4.2 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
      1. E.1.1. E.1.1 Tetrahedron
      2. E.1.2. E.1.2 Cube or hexahedron
      3. E.1.3. E.1.3 Octahedron
      4. E.1.4. E.1.4 Icosahedron and dodecahedron
      5. E.1.5. E.1.5 Dodecahedron
    2. E.2. SPHERE REPRESENTATIONS
      1. E.2.1. E.2.1 Spheres based on an icosahedron
    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

Product information

  • Title: Computer Graphics for Java Programmers, Second Edition
  • Author(s): Leen Ammeraal, Kang Zhang
  • Release date: March 2007
  • Publisher(s): Wiley
  • ISBN: 9780470031605