Graphics Reference
In-Depth Information
Line . What constructors should the Line class have? What about a Segment class?
What methods should Segment have that Line lacks? Can you develop a way
to make rays, lines, and segments cooperate with the ProjectiveTransformation
class, or are there insurmountable problems? Think about what happens when a
ray crosses the line on which a projective transformation is undefined.
Exercise 12.2: General position of the points P i ( i = 1,
,4 ) was needed to
invert the matrix B in the construction of the PointsToPoints method for pro-
jective maps. We also assumed that the points Q i ( i = 1,
...
,4 ) were in general
position, but that assumption was stronger than necessary. What is the weakest
geometric condition on the Q i that allows the PointsToPoints transformation to
be built?
Exercise 12.3: Explain why the two characterizations of general position for
four points in the plane—that (a) no point lies on a line passing through another
pair and (b) the first three form a nondegenerate triangle, while the fourth is not
on the extensions of any of the sides of this triangle—are equivalent. Pay partic-
ular attention to the failure cases, that is, show that if four points fail to satisfy
condition (a), they also fail to satisfy condition (b), and vice versa.
Exercise 12.4: Enhance the library by defining one-dimensional trans-
formations as well ( LinearTransformation1 , AffineTransformation1 ,
ProjectiveTransformation1 ). The first two classes will be almost trivial. The
third is more interesting; include a constructor ProjectiveTransform1(double
p, double q, double r) that builds a projective map sending 0 to p ,1to q ,
and
...
to r (i.e., lim x →∞ T ( x )= r ). From such a constructor it's easy to build a
PointsToPoints transformation.
Exercise 12.5: Enhance the library we presented by adding a constructor
TransformXYZYPRDegrees(Point3 P, float yaw, float pitch, float roll) to
create a transformation that translates the origin to the point P , and applies the
specified yaw, pitch, and roll to the standard basis for 3-space.
Exercise 12.6: By hand, find a transformation sending the points P 1 =
( 2 ,1 ) , P 2 =( 1, 1 ) , P 3 =( 2 ,
1 ) to the points Q 1 =( 2 , 2 ) ,
1 ) , and P 4 =( 1,
Q 2 = P 2 , Q 3 =( 2 ,
1
2 ) , and Q 4 = P 4 .
 
Search WWH ::




Custom Search