CS488 - Introduction to Computer Graphics - Lecture 4
Graphics I/O Hardware
Mice & Keyboards (Input)
Types of Input
- Request
- Sample
- Event
Devices
- Text Input
- Pointing Input
Event-based Programming
- Event Loop
- Callbacks
- Toolkit programming
- Java listeners
Callbacks need formal work. Java is trying hard but needs to step
further back from the coal face.
Geometry
The course notes give you the axioms and theorems. In class, I will
concentrate on ideas and algorithms.
Euclid and the Greeks
Of course, it's completely unfair to give the Greeks all the credit.
- Straightedge and compass.
- Congruence: two different triangles share a property called
congruence.
- Similarity: two different triangles share a propety called
similarity.
- Felix Klein's Erlangen program. (circa 1870).
Descartes
Points are pairs (triples, etc)
Points morphed into vectors. What is the difference between two points?
- An arrow that goes from one point to the other
- The arrow does not change when the origin is translated
- Suppose we think only about vectors
- Subtract
- Add
- Unit, inverse
- Scalar multiply
Closed up to here
- Dot product of two vectors: defines length, angle.
- Makes geometry challenging as an interpretation of algebra!
Vector Spaces, aka Linear Algebra.
We have some things that look like Descartes' points, though we don't know
exactly what they are.
We can tell when they are equal
- v1 =1 v2 if and only if x1 = x2 and
y1 = y2.
We can add them together
- v1 +1 v2 means (x1, y1) +1 (x2, y2) =1 (x1 + x2, y1 + y2)
- They are closed under addition.
- There is a zero element 01 =1 (0, 0)
- There is an inverse: If x1 =1 x2
and y1 =1 y2, then (x1, y1 ) +1 (x2, y2 ) =1 01
Where addition is, multiplication cannot be far behind
- a *1 v =1(a * x, a * y ), called scalar
multiplication.
- They are closed under scalar multiplication.
- There is a unit element 1; there is a zero element 0.
- Scalars must be a field.
- Scalar multiplication distributes over addition: a *1 ( v1 +1 v2 ) =1 a *1
v1 +1 a *1 v2.
What are these things? We want the geometrical interpretation.
- Descartes called them points, BUT they are not like points.
How?
- You can move them around, like
- derivatives
- position independent code.
We call them vectors.
Generators
- How few vectors can I use to create all of them?
- The number is the dimension.
- A set having that number, with appropriate weasel words, is a
basis.
Transformations
Vectors can be transformed, by multiplying them by matrices
- Rigid transformations in 2D
- Unit
- Rotation
- Reflection
More complex in 3D
- Non-rigid transformations in 2D
- Scale
- Skew
If you are Felix Klein you show that they are a group, and how they
separate into subgroups. But even though you are not Felix Klein your
response to this formulation is the same.
Affine Spaces
Intuition is that when I add an origin, O, vectors define points.
- Each point, P, can be - but is not - identified with the vector that
joins it to the origin.
- P =2 O +2 v
- This is point/vector addition.
- =2 and +2 are related to =1 as follows,
- First, P1 =2 O +2 v1 =2 P2 =2 O +2 v2 if and only if v1 =1 v2.
- Second, ( O +2 v1 ) +2 v2 =2 O +2 ( v1 +1 v2 )
- Define point subtraction
- v =1 P1 -2 P2 if and only if P1 =2 P2 +2 v
Generators
- A basis for the vectors, (v1, v2, ... ), plus one point, O.
Package them together (v1, v2, ..., O).
Return to: