Skip to Content
Computer Graphics for Java Programmers, Second Edition
book

Computer Graphics for Java Programmers, Second Edition

by Leen Ammeraal, Kang Zhang
March 2007
Intermediate to advanced
386 pages
7h 59m
English
Wiley
Content preview from Computer Graphics for Java Programmers, Second Edition

Chapter 2. Applied Geometry

Before we proceed with specific computer-graphics subjects, we will discuss some mathematics, which we will often use in this book. You can skip the first four sections of this chapter if you are very familiar with vectors and determinants. After this general part, we will deal with some useful algorithms needed for the exercises at the end of this chapter and for the topics in the remaining chapters. For example, in Chapters 6 and 7 we will deal with polygons that are faces of 3D solid objects. Since polygons in general are difficult to handle, we will divide them into triangles, as we will discuss in the last section of this chapter.

VECTORS

We begin with the mathematical notion of a vector, which should not be confused with the standard class Vector, available in Java to store an arbitrary number of objects. Recall that we have used this Vector class in Section 1.5 to store polygon vertices.

A vector is a directed line segment, characterized by its length and its direction only. Figure 2.1 shows two representations of the same vector a = PQ = b = RS. Thus a vector is not altered by a translation.

Two equal vectors

Figure 2.1. Two equal vectors

The sum c of the vectors a and b, written

c = a + b

can be obtained as the diagonal of a parallelogram, with a, b and c starting at the same point, as shown in Figure 2.2.

Figure 2.2. Vector addition

The length of a vector a is denoted by ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

OpenGL Programming for Windows 95 and Windows NT

OpenGL Programming for Windows 95 and Windows NT

Ron Fosner
Java 2D Graphics

Java 2D Graphics

Jonathan Knudsen

Publisher Resources

ISBN: 9780470031605Purchase book