
The programs in this folder create an image that has the same model
repeated five times. In order to have a model appear five times in
an image we must somehow "reuse" the model. These example show several
ways to write code that "reuses" a model.

Example1.java - This program just shows you what he model looks line.
This program draws the model just one time.

Example2.java -  This program renders the same Model into a FrameBuffer
five times. Just before each call to the renderer this program changes
the model's translation Vector so that the Model appears in a different
place. The final image in the FrameBuffer is the accumulation of the
five calls to the renderer (each call to the renderer draws just one
image of the Model). This is sometimes referred to as "multiple
exposures". In this example we are "reusing" both the Model object and
the FrameBuffer object since we render the same Model into the same
FrameBuffer five times.

https://en.wikipedia.org/wiki/Multiple_exposure

Example3.java - This program creates one instance of the Model and then
places that instance in each of five Position objects. This has the effect
of creating a DAG instead of a tree data structure. All the Position objects
point to the same Model object. Each Position object has a different
translation Vector, so the one Model object appears in five different places
in the final image. In this example, we are "reusing" a Model object by
placing it in multiple Position objects (creating a graph data structure).
This is a good way to write this program but it has the slight disadvantage
that the five models must be exact copies of each other (since we are reusing
only one instance of the Model). For example, the five model images must all
have the same color.

Example4.java - This program writes all the code to define five different
Model objects. There ends up being a lot of repeated code. We "reuse" the
code for our Model by repeating that code five times. This is not a good
way to write the program. Its only advantage is that now we can make slight
changes to each of the five models. We could, for example, give each model
a different color.

Example4a.java - In this program we reduce some of the code repetition by
having the five models share their Vertex and LineSegment objects. This is
a bit like Example3.java. We are "reusing" some of our objects by placing
them into multiple objects.

Example5.java - The extreme amount of code repetition in Example4.java is
a real problem. This program shows how Object-Oriented Programming has a
simple way to reduce the repetition from Example4.java. In this program
we define a Model that is a subclass of the Model class. Then we can
instantiate our subclass five times. We only need to write the code for
defining the Model subclass one time (in the subclass constructor) and
then we call that constructor five times. We end up with five different
Model objects but they are five instances of the same class. We are
"reusing" our subclass definition.

Example6.java - This is similar to Example5.java, but the Model subclass
is moved into its own file, DecoratedSquare.java. This makes the
DecoratedSquare class more public. It can be used by other programs,
not just Example6.java.

Example6a.java - This program is similar to Example3.java. It creates a
DAG with one instance of DecoratedSquare placed into five Position objects.

