Review questions (Oct. 05 2000) Clipping and Intersection 1. Given a triangle PQR in 3-space, and given a line segment describe an algorithm to determine if the line segment intersect the triangle properly? (By proper intersection we mean that the interior of the line intersects the interior of the triangle.) Also describe how to compute the coordinates of the point of intersection. 2. Suppose that a triangle is clipped to a rectangular window. After being clipped against the window, what is the maximum number of sides that the resulting clipped polygon might have? Draw an example to illustrate. Viewing Systems and Coordinate Transformations 1. Given a triple of noncollinear points P0 , P1 , and P2 in the plane, any other point Q in the plane can be expressed uniquely as an affine combination of these three Q 0 P0 1 P1 2 P2 (where 0 1 2 1) The triple ( 0 , 1 , 2 ) of scalars is called the barycentric coordinates of Q relative to the Pi ' s . For example, in the figure below, Q coordinates are (0.5,0, 0.5). P2 Q P1 P0 (a) Give a drawing that illustrates the regions of the plane that are associated with each of the possible sign classes (+ or -) of the 3 barycentric coordinates. That is, label the region in which all 3 coordinates are positive with (+, +, +), label the region in which only the first coordinate is negative with (-, -, -). etc. (b) Which sign class(es) are missing from the diagram? Why? 2. Using the vector representation of a quaternion as a generalized complex number q ( s, u ) s u x i u y j u z k . where the basis values i, j, and k satisfy the following multiplication rules: ij k , jk i, ki j ji k , kj i, ik j. i 2 j 2 k 2 1 Prove that q1q2 ( s1s2 (u1 u2 ), s1u2 s2u1 u1 x u2 ) (hint: Express q1 and q2 using the above form, multiply everything out, and collect terms that share common basis values. Be very careful in your algebra, or it will take forever to get it right.) 3. It is a fact that projective transformations map conic (e.g. circles, ellipses, parabolas, or hyperbolas) into conics. Consider the following projective transformation, which maps projective 3-space to 2-space: f ( x, y , z ) x / z, y / z ) . If f is applied to a circle in 3-space, and a hyperbola is the result, what can be said about the location of the circle, relative to the projection plane? How about if the circle is mapped into a parabola? 4. Prove that translation in the plane preserves affine combinations. That is, given the transformation T, defined T ( x, y ) ( x t x , y t y ) , and given any two points P ( p x , p y ), Q ( q x , q y ) and any scalar to prove that: T ((1 ) P Q ) (1 )T ( P ) T (Q ). 5. Consider the plane H in 3-space, defined by the following equation H : ax by cz d 0, for some nonzero constants a, b, c, and d. Suppose that we project this plane using our standard projective transformation P( x, y, z ) ( x /( z ), y /( z ), 1), which projects the points onto the projection plane z=-1. Points at infinity on plane H are mapped to a horizon line on the projection plane. As a function of a, b, c, and d, derive the line equation (on the x, y-projection plane) for the horizon line. (Hint: Consider the projections of any two points at infinity on H). Horizon line 6. Consider the rotation that maps shape A to B shown in the figure. (a) Give a set of Euler angles that represents this rotation (Hint: Rotate about x.) (b) Give a different set of Euler angles that represents this rotation. (Hint: Rotate about y and z.) (c) If we interpolate along the rotation given in (a) and interpolate along the rotation (b) will the intermediate result of the interpolations be the same? Explain. (d) Give a quaternion that represents the rotation from A to B. B z y x A 7. Give an affine transformation that maps the 400 x300 viewport shown below left to the 8 x 6 window shown on the right (Note the orde reversal along the y-axis). You may express your transformation either in equation form or as a 3 x 3 homogeneous matrix. 0 400 -4 0 3 300 -3 4 8. Consider the tetrahedron whose vertices are A = (1,1,1) B = (0,1,1), C = (0,0,1), and D = (0,0,0). (a). What are the normals of the four triangles that bound the tetrahedron? Remember that normals point to the outside of a closed object and that they are unit length. (b). Assume that the eyepoint is at the point (-1,-1,-1). For each triangle (ABC, ABD, ACD, or BCD) tell whether it is frontfacing, backfacing, or edge on, with respect to the eye position. 9. You don't like the usual restriction on windows and viewports that they be axis aligned, so you have decided to build a system which allows both to be rectangles at arbitrary orientations. You have decided to specify the window with two points Plw = (xlw, ylw) and Prw = (xrw, yrw) which specify the baseline of the window and a height hw which specifies the height of the window perpendicular to the baseline as shown below. The viewport is specified similarly using points Plv = (xlv, ylv) and Prv = (xrv, yrv) and height hv. (a). Specify a sequence of basic transformation steps, in words (but be precise about exactly what each step must accomplish), which will accomplish a window to viewport transformation in this system. (b). Give a sequence of 3x3 homogeneous transformation matrices containing formulas in terms of the window and viewport specification parameters that will accomplish this transformation. 10. Give physical examples of 3D object viewing where the natural choice is perspective viewing and another where the natural choice is orthographic views. Briefly explain the rationale behind your choice and examples. 11. Why is the order of applying affine transformations (translation, rotation, scaling) to 3D objects important? Give an example of when a change in order would yield different results? 12. Prove that every affine transformation in the plane can be expressed as the composition of the following basic transformations: translation, rotation (about the origin), (non-uniform) scaling, shearing (parallel to a coordinate axis). (Hint: Start by showing how to map an arbitrary parallelogram to a unit square. Example why this is sufficient.) Your may assume that the transformation is nonsingular, meaning that it is 1-1. 13. You are given a vertical line x=b and a pair of points P and Q in the plane. As a function of b and the coordinates of P and Q, compute the affine combination of P and Q that lies on this vertical line. Q n P2 P1 (1-a)P+aQ P P0 x=b Problem (14 ) problem (13) 14. Suppose that you have a triangle in 3-space, defined by the three point P0, , P1 , and P2 . As a function of these three points, derive a formula for a normal vector n that is normal to this triangle. The normal vector should be directed so that from a viewer on the same side as the normal vector, the points appear in counterclockwise order. 15. Consider the transformation that maps a square into the trapezoid (shown above). Is this transformation affine? Explain. 16. Consider the line y 2 x 5 in the 2-dimensional projective plane. What are the homogeneous coordinates of the (infinite) endpoints of this line? 17. Consider the line 0 2 x 3 y 5 in the 2-dimensional projective plane. What are the homogeneous coordinates of the (infinite) endpoints of this line? 18. Consider the paraboly y x 2 in the projective plane. Consider the extensions of the parabola out to infinity. What are the homogeneous coordinates of these points at infinity? 19. Consider the quaternion (1 conjugate of this quaternion? 2 ,0, 1 2 ,0) . Is this a unit quaternion? Is it a pure quaternion? What is the 20. Suppose that your company is designing a hand-held video panel that is h inches by w-inches and can display p pixels per inch along each side. If this panel is to support 24 bit color, and a depth-buffer capable of distinguishing between 256 different depths, what is the smallest possible size (in bytes) needed for the panel’s frame buffer? Express your answer as a function of h and w and p. 21. Suppose that hidden surface elimination is performed using a 16-bit integer depth buffer. Suppose that the furthest object to be displayed is x units away from the viewer, but the far clipping plane is set at distance 10x. What (if any) are some of the dangers of setting the far clipping plane at this unnecessarily large distance from the viewer? Object Representations 1. Suppose that we join two Bezier curves of order 2 end-to-end, using the control points sequence P0 , P1 , P2 , and P2 , P3 , P4 , respectively. Exactly what conditions must be satisfied by these five points for the combined curve to have C 1 parametric continuity at the point at which they are joined. Prove your answer carefully by showing the continuity of the derivatives at this point. P1 P4 P2 P 0 P 3 2. Show that for u = 0 the tangent vector for the cubic Bezier curve defined by four points P0 , P1 , P2 , P3 is collinear with the line segment P0, P1 . 3. Parametric Bezier and B-spline curves are both piecewise polynomial curves. How would you represent them in the computer so that you could interactively change their local shape, and additionally join two segment together? 4. Give the three blending functions for a Beizier cure of order 2 5. State clearly which properties of the Bezier blending functions, bi ,d (u ), guarantee that the Bezier curve lies within the convex hull of the control points. 6. Consider the limit of the sequence shown in the figure below. What is the fractal dimension of the final object? 7. B-splines possess a property called local support. What is local support, and why is this property desirable? 8. Finish the following: “The complex point c=a+bi lies in the Mandelbrot set if and only if the Julia set generated by c is __________________. 9. You want to know whether a point P lines on a given surface. From which representation of the surface is this question easier to answer: implicit or parametric? 10. What is a rational parameterization? Give an example of a shape that has a rational parameterization but no polynomial parameterization? (You are not required to give the parameterization, just the shape.) 11. Suppose that the polygon shown in the figure below is scan converted using the KrsU method. For each of the points A,B, C, D, and E, indicate weather or not it will be drawn by this algorithm. A E D B C Illumination and Lighting 1. Suppose that we have a sphere of radius 1 centered at the origin, and a world coordinate system with the zaxis pointing up, and a single point light source (whose location we do not know). A viewer is at the point with coordinates (2, 0, 2). The viewer observes that brightest diffuse point on the sphere is at its north pole (the point (0, 0, 1)). Assume a Phong model of illumination, and that the sphere has both diffuse and specular components. What does the viewer’s observation imply about the possible location of the light source? 2. Consider a new type of light called a spot-light. A spot-light is defined by giving a point P, a vector v (normalized to unit length) and an angle . The spot light illuminates any point that lies within an infinite 3 dimensional cone whose apex is P and whose angular radius about v is . Write a function which, given a point Q in 3-space, and P, v , and , determines whether Q is illuminated by the spot-light. P v Texture Consider the cone shown in the figure below. Its axis is along the z-axis, its apex is at the origin, its height is 1, and its base has a radius of 1. Also consider a texture that consists of a quarter circle of radius 1. The object is to wrap this texture around the cone (like wrapping a cover around an ice cream cone) so that the texture origin is mapped to the apex of the cone and the circular arc is mapped to the cone’s circular base. The seam where the texture wraps around on itself lies in the x z-plane. Cone Base z 1 1 1 1 1 y1 1 1 x 1 Cone apex 1 1 (a) Give an implicit function f(x,y,z)=0 that describes 1 the surface of the cone. (Don’t worry about trimming the cone at its base. The infinite surface is good1 enough.) (b) Give the inverse wrapping function, which maps a point (x, y, z) on the surface of the cone to a 1 corresponding point (s, t) in texture space. (Hint: 1 It may be easier to first derive the polar coordinates in texture space, and then convert to (s, t) coordinates.) 1 1 1 1 1 1