CG_QB.pdf

45
http://www.francisxavier.ac.in Page 1 Unit I - 2D Primitives Part A[ 2 Marks Questions with Answers] 1. Name a few graphics software standards. GKS Graphics Kernel System CGS Computer Graphics Interface. PHIGS Programmer‟s Hierarchical Interactive Graphics Standard. CGM Computer Graphics Metafile. 2. What is the significance of the terms “Windows” and “Viewport” in graphics? Window - World coordinate area selected for display. It defines what is to be displayed. Viewport An area on display device where window is mapped. It defines where it is to be displayed. Window and view port allows a user to specify which part of a picture is to be displayed and where that part is to be displayed on the display device. 3. Prove that two consecutive rotations are additive. P‟=r(Ɵ1) P P‟‟=r(Ɵ2)P‟ => P‟‟=r(Ɵ1+ Ɵ2) P x‟=xcos Ɵ1-ysin Ɵ1 y‟=xsin Ɵ1+ycos Ɵ1 Assume Ɵ1=90 o ; Ɵ2=90 o P=(2,3) After R(Ɵ1) : x‟=-3 ; y‟=2 P‟=(-3,2) After R(Ɵ2) : x’’=-2;y’’=-3 P‟‟=(-2,-3) Ɵ1+ Ɵ2 =180 o R(Ɵ1+ Ɵ2) P”= (-2,-3) Note:Sin180 o =0 Cos180 o =-1 R(Ɵ1+ Ɵ2)=r(Ɵ1)+r(Ɵ2) 4. Plot straight line from (5, 10) to (15, 30) by symmetrical method. Bresenhams Method. dx=10 dy=20 2*dy=40 2*(dy-dx)=20 Slope = 2 ie m>1 (6,11),(7,12),(7,13),(9,14),(10,15),(11,16),(11,17),(11,18),(12,19),(12,20),(13,21),(14,22 ), (14,23),(15,24),(15,25),(15,26),(15,27),(15,28),(15,29),(15,30) 5. Name all the attributes of text. Text attributes control the appearance of displayed characters. Font type , Font Size, Color, CharacterHeight,Character Spacing, Upvector, Text Alignment, Text Precision and Orientation. 6. What is antialiasing? How is antialiasing different from dithering? The distortion of information due to low frequency sampling is called Aliasing. Antialiasing is a technique to improve the appearance of displayed raster line to compensate the undersampling process.

Transcript of CG_QB.pdf

  • http://www.francisxavier.ac.in Page 1

    Unit I - 2D Primitives

    Part A[ 2 Marks Questions with Answers]

    1. Name a few graphics software standards.

    GKS Graphics Kernel System

    CGS Computer Graphics Interface.

    PHIGS Programmers Hierarchical Interactive Graphics Standard.

    CGM Computer Graphics Metafile.

    2. What is the significance of the terms Windows and Viewport in graphics?

    Window - World coordinate area selected for display. It defines what is to be displayed.

    Viewport An area on display device where window is mapped. It defines where it is to

    be displayed.

    Window and view port allows a user to specify which part of a picture is to be displayed

    and where that part is to be displayed on the display device.

    3. Prove that two consecutive rotations are additive.

    P=r(1) P P=r(2)P => P=r(1+ 2) P

    x=xcos 1-ysin 1 y=xsin 1+ycos 1

    Assume 1=90o ; 2=90o P=(2,3)

    After R(1) : x=-3 ; y=2 P=(-3,2)

    After R(2) : x=-2;y=-3 P=(-2,-3)

    1+ 2 =180o R(1+ 2) P= (-2,-3) Note:Sin180o=0 Cos180o=-1

    R(1+ 2)=r(1)+r(2)

    4. Plot straight line from (5, 10) to (15, 30) by symmetrical method.

    Bresenhams Method. dx=10 dy=20 2*dy=40 2*(dy-dx)=20

    Slope = 2 ie m>1

    (6,11),(7,12),(7,13),(9,14),(10,15),(11,16),(11,17),(11,18),(12,19),(12,20),(13,21),(14,22

    ), (14,23),(15,24),(15,25),(15,26),(15,27),(15,28),(15,29),(15,30)

    5. Name all the attributes of text.

    Text attributes control the appearance of displayed characters.

    Font type , Font Size, Color, CharacterHeight,Character Spacing, Upvector, Text Alignment,

    Text Precision and Orientation.

    6. What is antialiasing? How is antialiasing different from dithering?

    The distortion of information due to low frequency sampling is called Aliasing.

    Antialiasing is a technique to improve the appearance of displayed raster line to compensate the

    undersampling process.

  • http://www.francisxavier.ac.in Page 2

    Dithering is a technique used for approximation half tones without reducing resolution. It

    adds noise over an entire picture to soften intensity boundaries.

    7. What are the common attributes of line?

    Attributes of line control the basic display characteristics of the line.

    Line Type Solid,Dashed,Dotted

    Line Width , Pen and Brush Options and Line Color

    8. How will you perform transformation between coordinate systems?

    Constructing a World coordinate scene using modelling transformations, transferring

    world coordinates to viewing coordinates, mapping the viewing coordinate descriptions of

    object to normalized device coordinates and finally mapping to device coordinates.

    MC Construct world coordinate scene WC Convert WC to VC VC Map VC to

    NVC NVC Map NVC to Cartesian Device coordinates DC

    Transformation is performed from Cartesian reference frames to cartesian device

    coordinates. Origin and axes of the reference frame is made to map with the origin and axes of

    the Cartesian device coordinate system.

    9. What do you understand by Octant Symmetry of a circle?

    The circle is divided into 8 equal octants with 45o dividing line. The point(x,y) can be

    mapped into seven other points in seven other octants.

    A point (x,y) can me mapped into seven Points (-x,y),(x,-y),(-x,-y),(y,x),(-y,x),(y,-x)

    and (-y,-x).

    10. Give transformation matrix for 2D reflection w.r.t the line x=y.

    0 1 0

    1 0 0

    0 0 1

    11. What is aspect ratio?

    The ratio of vertical to horizontal points necessary to produce equal length lines in

    both directions on the screen. Eg . Aspect ratio of 3/4 means 3 vertical points produce a line of

    equal length produced by 4 horizontal points.

    12. Give the transformation matrix for 2D Translation.

    T =

    1 0 0 1 0 0 1

    => P = P + T = >

    =

    +

    1 0 0 1 0 0 1

    x=x+tx y=y+ty z=z+tz

  • http://www.francisxavier.ac.in Page 3

    13. Give the transformation matrix for 2D rotation.

    R = cos 0 0

    0 0 1 => P = R*P = >

    = cos 0 0

    0 0 1 *

    x=xcos -y sin y=x sin + y cos

    14. Give the transformation matrix for 2D Scaling.

    S =

    0 00 00 0 1

    => P = S * P = >

    =

    0 00 00 0 1

    *

    x=sx * x ; y=sy*y

    15. Define Persistence.

    Persistence specifies the property of phosphor that how long it can glow. It is defined as the

    time it takes for the emitted light from the screen to decay to one tenth of its original intensity.

    Low Persistence phosphors require high refresh rates.

    16. State the difference between window and viewport.

    Window - World coordinate area selected for display. It defines what is to be displayed.

    Viewport An area on display device where window is mapped. It defines where it is to be

    displayed.

    17. How to map a window to viewport?

    Window - World coordinate area selected for display. It defines what is to be displayed.

    Viewport - An area on display device where window is mapped. It defines where it is to be

    displayed.

    A point(xw,yw) in window is mapped to (xv,yv) in view port.

    xv-xvmin/ xvmax-xvmin = xw-xwmin/xwmax-xwmin

    yv-yvmin/ yvmax-yvmin = yw-ywmin/ywmax-ywmin

    18. What is the basic principle in Midpoint Circle Drawing algorithm?

    Circle is generated by setting up decision parameters for finding the closest pixel to the

    circumference at each step. Test the half way position between two pixels to determine if the

    midpoint is inside, outside or on the circle. The points are generated only for one octant and the

    other point are obtained by Octant symmetry Property of circle.

    19. What is the basic principle in Bresenhams Line Drawing algorithm?

    Bresenhams Linedrawing is an accurate and efficient raster line generating algorithm.

    Sampling at unit intervals along one axis we need to decide which of the two possible pixel

    position along other coordinate is closest to the line path.

    Po = 2dy dx if px0 then pk+1 = pk+2dy 2dx

  • http://www.francisxavier.ac.in Page 4

    20. Define vanishing point.

    The point at which a set of projected parallel lines appear to converge is called a

    vanishing point. Each such set of projected parallel lines will have a separate vanishing point.

    The vanishing point for any set of lines that are parallel to one of the principal axes of

    an object is referred to as principal vanishing point.

    21. Explain the disadvantages of DDA line drawing algorithm.

    Generates jagged lines

    Rounding operations are time consuming

    Involves Floating point arithmetic.

    22. What is scan conversion?

    Scan conversion is the process of digitizing or converting a picture definition given in an

    application program into a set of pixel intensity values for storage in frame buffer. This process

    is also known as digitization.

    23. How do you correct the shape of line ends for very thick and inclined lines?

    The shape of line ends for very thick and inclined lines can be corrected using line caps to

    have better appearance.

    Eg. Butt Cap, Round Cap and Projecting Square cap.

    24. What is the use of digitizer?

    Digitizer converts picture definition given in an application program into a set of pixel

    intensity values for storage in frame buffer. This process is known as scan conversion.

    25. What is a Composite Transformation?

    Composite transformation is the sequence of transformations. Composite transformation

    involves basic transformations applied in sequence to the position of an object.

    26. Differentiate Random and Raster Scan Systems.

    Raster Scan Systems Random Scan Systems

    1. Complete screen is scanned for 1. Patterns are drawn by directing the electron

    displaying a picture. Beam along the lines of picture.

    2. Lower resolution than random scan. 2. Higher resolution than raster systems.

    3. Picture information is stored in frame 3. Picture information is stored in display file

    buffer. as line drawing instructions.

    4. Produce jagged lines. 4. Produce smooth lines.

    5. Can produce realistic pictures 5.Cannot produce realistic pictures.

    27. Define Viewup vector.

  • http://www.francisxavier.ac.in Page 5

    View up vector V is a world vector that defines and establishes the positive direction for the yv

    axis. Vector V is projected into a plane that is perpendicular to the normal vector N.

    28. What are the inequalities in Point Clipping?

    The point is saved against clipping if the following inequalities are satisfied:

    xwmin

  • http://www.francisxavier.ac.in Page 6

    Each coordinate position(x,y) can be represented as (xh,yh,h) such that

    X Xh / h

    Y = Yh / h

    1 1

    Expressing positions in homogeneous coordinates allow us to represent all geometric equations

    as matrix multiplications.

    39. What are the advantages of homogeneous coordinates?

    The coordinates of points, including points at infinity, can be represented using finite

    coordinates.

    Formulas involving homogeneous coordinates are often simpler and more symmetric

    than their Cartesian counterparts.

    Homogeneous coordinates have a range of applications, including computer graphics

    and 3D computer vision, where they allow affine transformations and, in general, projective

    transformations to be easily represented by a matrix.

    40. How is point plotting accomplished?

    Point plotting is used in frame buffer displays, where the intensity of each dot must be separately computed.

    These are based on the Cartesian coordinate system. Points are addressed by their x and y coordinates. The

    value of x increases from left to right and that of y from bottom to top. Points are plotted in response to the digital

    signals from the computer.

  • http://www.francisxavier.ac.in Page 7

    Part B

    16 MARKS

    1. Explain DDA Line drawing procedure.

    Scan Conversion Algorithm based on dy and dx

    dy=m.dx dx=dy/m

    Yk+1 = Yk + m Xk+1 = Xk + 1/m

    Algorithm:

    Step 1: Input the line endpoints and store the left endpoint in (x1, y1) and right endpoint

    in (x2, y2)

    Step 2: Calculate the values of dx and dy using dx = xb xa, dy = yb ya

    Step 3: if the values of dx > dy assign values of steps as dx otherwise the values of steps

    as dy

    Step 4: Calculate the values of X increment and Y increment and assign the value x= xa

    and y = ya

    Step 5: for k=1 to steps do

    X = X + X increment Y= Y + Y increment

    Putpixel(ceil(x), ceil(y),15)

    2. Discuss about any two popular antialiasing Techniques.

    The distortion of information due to low frequency sampling is called Aliasing.

    Antialiasing is a technique to improve the appearance of displayed raster line to compensate the

    undersampling process.

    Anti-aliasing is the technique of minimizing the distortion artifacts known as aliasing when

    representing a high-resolution image at a lower resolution. Anti-aliasing is used in digital photography,

    computer graphics, digital audio, and many other applications. It reduces jagged apperarence and it is

    also called as oversampling.

    This is a techinque that determines pixel intensity based on the amount that a particular pixel is

    covered by an object in the scene. Determining such areas requires extensive calculations and integral

    approximations. While the precision of prefiltering does generate more accurate antialiasing effects, its

    complexity and expensive calculations at times make it an undesirable method to minimize aliasing

    effects.

    Classification of Antialiasing Methods:

    Super sampling

  • http://www.francisxavier.ac.in Page 8

    Area sampling

    - unweighted

    - weighted

    Weighted Prefiltering

    This is a subset of prefiltering that assigns different weights to the area calculations

    based on their position within the pixel.

    Pixel Phasing

    Lines are smoothed by moving the electronbeam to a closer approximate of the

    mathematical line. Pixel Phasing: Pixel positions can be shifted by a fraction of a pixel

    diameter (1/4, 1/2, or 3/4) to plot points closer to the mathematical line.

    Postfiltering or Supersampling

    The concept of postfiltering as an implementation of antialiasing is to increase the

    sampling frequency of the rendering process. In doing so, a more accurate pixel grid can be

    generated if more samples of a scene are made. For this reason, postfiltering is commonly

    referred to as supersampling. The generated supersampled image is then passed through a filter

    that will perform pixel averaging and reduce the supersampled grid back to the desired

    resolution.

    3. Scan convert one quadrant of ellipse using mid-point algorithm.

    Properties of Ellipse and diagram

    Symmetry property of ellipse and principle of midpoint algorithm

  • http://www.francisxavier.ac.in Page 9

    4. What is polygon clipping? Explain Sutherland Hodgeman algorithm for polygon clipping.

    Clipping polygon which lies inside the clipping window

    Four possible cases

    If the first vertex is outside the window boundary and the second vertex

    inside

    If the first vertex is inside the window boundary and the second vertex

    outside

    If both are outside

    If both are inside

    Repeat the process of algorithm

    Convex polygon are correctly clipped using this clipping

    Concave and convex polygon are also used

    5. Explain Cohen Sutherland algorithm for line segment clipping.

    speed up the processing of the line segments by performing initial test

    and reduce the no of instersections to be calculated.

    uses 4 bit code is called region code or outcode.

    each bit indicates four relative position

    b4 b3 b2 b1

    above below right left

    y co-ord of intersecting point; y=y1+m(x-x1)

    x co-ord of intersecting point;x=x1+1/m(y-y1)

    Algorithm with diagram and example

    Explain the midpoint Circle algorithm.

    Write about Properties of circle , its equation and Octant symmetry of circle

    Algorithm:

    Step 1:Input radius r and circle center(Xc, Yc)and obtain the first point on the

    circumference of a circle centered on the origin as (X0, Y0) = (0, r)

  • http://www.francisxavier.ac.in Page 10

    Step 2: Calculate the initial values of the decision parameter as P0 = 5/4 r

    Step 3: At each position starting at k perform the following test:

    If Pk < 0, the next point to plot is (Xk+1, Yk) and Pk+1 = Pk+2 Xk+1 + 1

    Otherwise the next point is (Xk+1, Yk+1) and Pk+1 = Pk+2 Xk+1 + 1- 2 Yk-1

    Step 4: Determine symmetry points in the other seven octants

    Step 5: Move each pixel position(X, Y) onto the circular path centred on

    (Xc, Yc) and plot the coordinate values as X = X + Xc Y = Y + Yc

    Step 6: Repeat steps 3 through until X>=Y

    Pk + 1= Pk + 2 dY

    Otherwise, the next point is (Xk+1, Yk+1) and Pk + 1= Pk + 2 dY - 2 dX

    Step 5: Repeat steps 4 dX times

    6. Explain the 2D transformations in detail and obtain transformation matrix for each.

    - Any changes in the orientation size and shape are the coordination descriptions of objects are

    known as geometric transformations.

    Basic Transformations: [Explain with diagram, Matrix and example]

    Translation - Changes in the position of the object along a st line from one co-ord

    location to another co-ordinate location.

    Scaling - Changes in the size of an object

    Rotation - Repositioning the object along a circular path in (x,y) plane.

    Reflection - It produces mirror image of an object

    Shearing - A transformation that distorts the shape of an object such that ransformed

    shape appers as if the object were composed of internal layers that had been caused

    to slide over is termed as shearing

    7. Describe the Bresenhams Line drawing algorithm for lines with all possible slopes.

    In Bresenhams approach the pixel position along a line path are determined by

    sampling unit X intervals. Starting from the left end point(X0, Y0)of a given line we step to

    each successive columns and plot the pixel whose scan line Y-value is closest to the line

    path.Assuming the Kth step in process, determined that the pixel at (Xk, Yk)decide which pixel

    to plot in column Xk+1.The choices are (Xk+1, Yk) and (Xk+1, Yk+1)

    Algorithm

    Step 1: Input the line endpoints and store the left endpoint in (X0, Y0)

    Step 2: Load (X0, Y0) in to the frame buffer

    Step 3: Calculate constants dx, dy, 2 dy, -2 dx, and obtain the decision parameters as

    P0 = 2 dy dx

    Step 4 : At each Xk along the line, starting at k = 0, perform the following test

  • http://www.francisxavier.ac.in Page 11

    If Pk < 0, the next point to plot is (Xk+1, Yk) and Pk+1 = Pk+2 dy

    Otherwise, the next point to plot is (Xk+1, Yk+1) and Pk+1 = Pk+2 dy - 2 dx

    Step 5: Repeat step 4 dx times

    Problems

    1. Using Bresenhams algorithm , find all the points on a triangle in the first quadrant with

    vertices at (0,2), (6,2) and (3,6).

    2. Write a procedure to shear a square along x-axis.

    3. Magnify the triangle with vertices A(0,0), B(1,1) and C(5,2) to twice its size while keeping C

    fixed.

    4. Scale the triangle with vertices A(0,0), B(2,2) and C(5,3) to 2.5 times its size keeping A fixed

    position.

    5. Compute the points on the line between (2,10) and (4,0) using Bresenhams Line drawing

    Procedure.

    6. Find the clipped coordinates of the following lines against a clip window with its lower left

    corner at (3,4) and upper right corner at (10,9)

    7. Clip the two lines p1(40,15),p2(75,45) and s1(70,20) , s2(100,10) against a window with lower

    left corner A(50,10) and upper right corner (80,40) using Cohen Sutherland Line clipping

    algorithm.

    8. Find the points on the ellipse in the first quadrant with major axis rx=6 units and minor axis

    ry=4 units.

    9. Find the reflection of a triangle with vertices at (4,10),(6,12) and (4,12) about the line y=x+5.

    10. Describe the Bresenhams Line drawing algorithm for lines with all possible slopes. Using this

    algorithm , find all the points on a triangle in the first quadrant with vertices at (0,2), (6,2) and

    (3,6).

    11. Find the reflection of the point (2,4) w.r.t the line y=x+1.

    12. Apply cohen Sutherland line clipping to clip a line with end points(1,7) and (7,5) against a

    window with boundaries xwmin=2, xwmax=6, ywmin=2, ywmax=6.

    13. Perform a 45o rotation of object A(2,1),B(5,1) and C(5,6) in clockwise direction and give the

    new coordinates of the object.

    14. Consider a triangle ABC with A(4,1), B(5,2) and C(4,3)

    (1) Reflect about X-axis

    (2) Reflect about Y-axis

    (3) Reflect about line Y=X

    15. Find the new position of the triangle (5,4), (8,3), (8,8) after rotation by 900 clockwise about

    Centroid.

  • http://www.francisxavier.ac.in Page 12

    Unit II - 3D Concepts

    Part A[ 2 Marks Questions with Answers]

    1. Define Projection

    The process of displaying 3D object into a 2D display unit is known as projection. The

    projection transforms 3D objects into a 2D projection plane. The process of converting the

    description of objects from world coordinates to viewing coordinates is known as projection.

    2. Compare and contrast Parallel and Perspective Projection.

    Parallel Projection Perspective Projection

    1. Project points on the object surface 1. Project points to the display plane

    along parallel lines onto display plane. along converging paths.

    2. Maintain relative proportion of the object. 2. Relative proportion is not

    maintained.

    3. Does not produce realistic pictures 3. Produce realistic pictures.

    3. What are the advantages of parallel Projection?

    Project points on the object surface along parallel lines onto display plane.

    Maintain relative proportion of the object.

    Used in Engineering and architectural drawings.

    4. How is Polygon stored in graphics application?

    Polygon is stored as polygon data tables : geometric and attribute tables.

    Geometric table : Vertex table, Edge table and polygon Surface table.

    Attribute table: transparency, reflectivity and texture characteristics.

    5. Depict the 3D viewing Pipeline.

    Modeling coordinates Modeling Transformation World coordinates Viewing

    Transformation Viewing coordinatesProjection transformation projection

    coordinates Workstation transformation Device coordinates

    6. List two viewing Parameters of a 3D object.

    Camera parameters, view volume and Projection (reference frame)

    7. Compare cavalier and cabinet projection.(Oblique Parallel Projection)

    Cavalier Projection Cabinet Projection

    1. The views obtained when tan =1 ie =45o 1. The views obtained when tan =2

    2. All lines perpendicular to projection plane 2. All lines perpendicular to projection plane

    are projected with no change in length. are projected at one half their length.

    3. Does not appear realistic 3. Appear more realistic.

  • http://www.francisxavier.ac.in Page 13

    8. What is axonometric and isometric projection? (Orthographic Parallel Projection)

    Axonometric Projection Isometric Projection

    Display more than one face of an object. Aligns the projection plane so that it

    intersects each coordinate axis.

    Relative proportions are not maintained Relative Proportions are maintained.

    9. What are Blobby Objects?

    Some objects do not maintain a fixed shape, but change their surface characteristics in certain

    motions or when in proximity to other objects. That is known as blobby objects.

    Example molecular structures, water droplets.

    10. Define B-Spline curve.

    A B-Spline curve is a set of piecewise (usually cubic) polynomial segments that pass

    close to a set of control points. However the curve does not pass through these control points, it

    only passes close to them.

    11. Define the term Spline Curve.

    To produce a smooth curve through a designed set of points, a flexible strip called spline is

    used. Such a spline curve can be mathematically described with a piecewise cubic polynomial

    function whose first and second derivatives are continuous across various curve section

    12. What is a Cubic Spline?

    Cubic splines are a straight forward extension of the concepts underlying parabolic spline. The

    total curve in this case is a sequence of arcs of cubic rather than parabolic curves.

    Each cubic satisfies :ax3 + bx 2+ cx + d

    13. List the properties of Bezier curve.

    It needs only four control points

    It always passes through the first and last control points

    The curve lies entirely within the convex half formed by four control points.

    14. Differentiate interpolating and approximation Spline curve.

    When the spline curve passes through all the control points then it is called interpolate. When

    the curve is not passing through all the control points then that curve is called approximation spline.

    15. What are quadric surfaces?

    A class of objects which are described with second degree equations. Eg. Sphere,

    Ellipsoids and torus.

    16. Mention the classification of visible surface detection algorithms.

  • http://www.francisxavier.ac.in Page 14

    Image space method: Deal with projected images and visibility is decided at each pixel

    point.

    Object space method : compares object and parts of object to each other.

    17. Define Depth cueing.

    A simple method for indicating depth with wire frame displays is to vary the intensity of

    objects.

    18. Give transformation matrix for 3D reflection w.r.t the line x=y.

    19. Give the transformation matrix for 3D translation.

    20. Give the transformation matrix for 3D Scaling.

    21. Define Super quadrics.

    A class of objects formed by incorporating additional parameters to quadrics to provide

    increased flexibility for adjusting object shapes. One parameter for curve and two parameters

    for surfaces.

    22. Define graftals or L-grammar fractals

    The fractals that uses production rules to describe the shape of objects is known as

    graftals. Eg. Tree Structure.

    23. Define Octrees.

    Hierarchical tree structures called octrees, are used to represent solid objects in some

    graphics systems. Medical imaging and other applications that require displays of object cross

    sections commonly use octree representation.

    24. Define Affine transformation?

    A coordinate transformation of the form X= axxx + axyy + bx , y ayxx + ayy y +by

    is called a two-dimensional affine transformation. Each of the transformed coordinates x and y

    is a linear function of the original coordinates x and y , and parameters aij and bk are constants

    determined by the transformation type.

  • http://www.francisxavier.ac.in Page 15

    Part B

    16 Marks

    1. Derive the oblique projection Matrix in XY Plane.

    An example of a simple non-orthogonal (oblique) projection (for definition see below) is

    Via matrix multiplication, one sees that

    proving that P is indeed a projection.

    Derivation with diagram. (Refer notes)

    2. Discuss briefly about the characteristics of Cubic Bezier Curves. How is it different from

    B-Spline curve?

    Cubic Bezier curve:

    It needs only four control points

    It always passes through the first and last control points

    The curve lies entirely within the convex half formed by four control points.

    Degree of the order 3

    A B-Spline curve is a set of piecewise (usually cubic) polynomial segments that pass close

    to a set of control points. However the curve does not pass through these control points, it only

    passes close to them.

    3. How do you represent 3D object using Octrees?

    Hierarchical tree structures called octrees, are used to represent solid objects in some

    graphics systems. Medical imaging and other applications that require displays of object cross

    sections commonly use octree representation. Diagram and explanation

    4. How would you perform general 3D rotations? Explain.

    Explain 3D transformation Matrix for rotation (i) arbitrary axis (ii) an arbitrary Plane.

    Transformation sequences

    P = T.Rx () .T.P

    Rotation in five steps

  • http://www.francisxavier.ac.in Page 16

    Translate the object that rotates in parallel coordinate axis

    Rotate the object with one coordinate axis

    Apply inverse rotation to its original position

    Apply inverse translation to its original position

    V = p2 p1

    After rotation to original position

    o R()) = T.M.T

    5. Explain 3D basic transformations with an Example.

    Translation - Changes in the position of the object along a st line from one co-ord

    location to another co-ordinate location.

    Scaling - Changes in the size of an object

    Rotation - Repositioning the object along a circular path in (x,y) plane.

    Explain with matrix, diagram and example.

    6. Write a short note on B-Spline Curve.

    It is referred to a curve drawn in a different manner

    Interpolation and approximation splines

    Set of coordinate points called control points

    Curve can be translated , rotated and scaled

    Enclosing a set of points called convex hull

    Set of connected points is often called control graph

    Parametric continuity condition

    Geometric continuity condition

    Spline specification

    A B-Spline curve is a set of piecewise (usually cubic) polynomial segments that pass close to a

    set of control points. However the curve does not pass through these control points, it only passes

    close to them

    7. How to represent 3D objects in a scene?

    The objects in a scene using a simple language and place the description in a file. The

    drawing program becomes a general-purpose program: It reads a scene file at run-time and

    draws whatever objects are encountered in the file.

    The Scene Description Language (SDL), provides a Scene class, that supports the reading of

    an SDL file and the drawing of the objects described in the file.

    A global Scene object is created:

    Scene scn; // create a scene object

    Read in a scene file using the read method of the class:

  • http://www.francisxavier.ac.in Page 17

    scn.read("example.dat"); // read the scene file & build an object list

    ! example.dat: simple scene: 1 light and 4 shapes

    ! beginning ! is a comment; extends to end of line

    background 0 0 1 ! create a blue background

    light 2 9 8 1 1 1 ! put a white light at (2, 9, 8)

    diffuse .9 .1 .1 ! make following objects reddish

    translate 3 5 2 sphere ! put a sphere at 3 5 2

    translate 4 6 8 cone ! put a cone in the scene

    translate 1 1 1 cube ! add a cube

    diffuse 0 1 0 ! make following objects green

    translate 40 5 2 scale .2 .2 .2 sphere ! tiny sphere

    SDL is substantially more compact than the corresponding OpenGL code file.

    8. Explain in detail about parallel and perspective projection.

    The production of the 2D display of the 3D scene is called projection

    Project points on the object surface along the parallel lines on to the display plane

    Different 2D views of objects can be produced by projecting the visible points

    Parallel projection - Diagram

    Parallel projection is classified as

    Orthographics parallel projection

    Axanometric Projection

    Isometric Projection

    Oblique Parallel Projection -- Derive Projection Matrix

    Cabinet Projection

    Cavalier Projection

    Perspective projection - Diagram

    Done by the projecting points to the display plane along the converging points

    Causes the objects farther from the viewing point should be smaller of the same sized

    object present here.

    Locate the new coordinates of a standard unit cube after rotation w.r.t x-axis by 180o.

  • http://www.francisxavier.ac.in Page 18

    9. Explain in detail about the various visible surface detection algorithms.

    Image space method: Deal with projected images and visibility is decided at each pixel point.

    Object space method : compares object and parts of object to each other.

    Backface Detection method

    Fast and simple object space method

    For identifying the back faces of a polyhedron

    Based ion inside outside test

    Plane parameters A, B, C, D

    Ax +By+ Cz +D < 0

    Inside point is along the line of sight to the surface V.N = Vz C

    Polygon is back face if C < 0

    Polygon cannot see on any face if C = 0

    Z component value is C

  • http://www.francisxavier.ac.in Page 19

    Image space method

    The relative characteristic of surface area

    Surrounding surface

    Inside surface

    Outside surface

    Conditions for subdivision

    All surfaces are outside surfaces with respect to the area

    Only one inside

    A surrounding surface with in the area boundaries

    Depth Sorting

    Both image and object space operations

    Perform the basic function

    Surface are sorted in order of decreasing depth

    Surface are scan converted in order, starting with the surface of greatest depth

    Often referred as painters algorithm

    Test listed in the order of increasing difficulty

    Surface do not overlap

    Projections of the two surfaces on to the view plane do not overlap.

  • http://www.francisxavier.ac.in Page 20

    Unit III - Graphics Programming

    Part A[ 2 Marks Questions with Answers]

    1. Define the term Complementary Colours.

    If two color sources combine to produce white light, the colors are termed as

    complementary colors. Eg, Red and Cyan, Green and Magenta

    2. What does Y, I and Q represent in YIQ colour model?

    Y represents Luminance (brightness) information

    I and Q represent Chromaticity information (Hue and Saturation)

    I Orange Cyan Hue information (1.5 MHz) Q Green Magenta Hue information(0.6 MHz)

    3. What is a Colour Gamut?

    The combination of colors that are used to obtain wide range of colors in a color model

    are known as Color Gamut of the model.

    4. What is Morph animation?

    Animation that involves the transformation of shapes from one form to other is known as

    Morph animation. It can be applied to any motion or transition involving a change in shape.

    5. What is Cell animation?

    Rough sketches of the key frames (extremes of an action) in a scene are known as cels.

    This type animation is used in animation cartoons.

    6. List the properties of Light.

    Light is a narrow frequency band with electromagnetic spectrum.

    Speed of light C= ,

    Saturation : Purity

    Hue: Predominant frequency in reflected light.

    Luminance: It is the brightness / Perceived intensity of the light.

    Chromaticity Hue + Saturation

    7. What do you mean by Key Frame animation?

    Key frame systems generate in-betweens from the user specified key frames. Motion

    Path can be specified for the objects to be animated.

    8. List the features of OPENGL.

    Window Based programming, Portable,Scalable, Opensource

    9. Define Hue and Saturation

    Hue: Predominant frequency in reflected light.

    Luminance: It is the brightness / Perceived intensity of the light.

  • http://www.francisxavier.ac.in Page 21

    10. Define Chromaticity.

    Chromaticity refers collectively to the two properties purity (saturation) and dominant

    frequency (Hue).

    11. Give the advantages of Chromaticity diagram.

    a. Identify Complementary Colors

    b. Compare color gamuts for different models

    c. To determine dominant wavelength and purity of given color.

    12. What are OPENGL data types?

    GLbyte (8 bit), GLshort(16 bit), GLint(32 bit), GLfloat(32 bit), GLdouble(64 bit), GLubyte(8

    bit),GLushort(16 bit)

    13. What are the steps involved in designing an animation sequence?

    Scene description define the object, Position the object and light sources, define the

    photometric parameters and camera parameters.

    Action Specification specifies the layout of motion paths for the object and camera.

    14. How to draw lines and Points using OPENGL?

    glBegin(GL_LINES) glBegin(GL_POINTS)

    glVertex2i(100,200); glVertex2i(100,200);

    glVertex2i(300,400); glEnd();

    glEnd();

    15. What is the command used in OPENGL to clear the screen?

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glLoadIdentity();

    16. What is animation?

    Time Sequence of visual changes in a scene. Depends on display time variations in

    object, size, color, transparency and surface texture

    17. How to draw three dimensional scenes in OPENGL?

    Scene file has information about background, diffusion, light and translate.

    3D scenes are described using : SDL Scene Description Language.

    Scene scn;

    Scn.read(a.dat);

    18. Explain the structure of OPENGL Program.

    int main(int argc, char** argv){

    glutInit(&argc, argv);

  • http://www.francisxavier.ac.in Page 22

    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);

    glutInitWindowSize (250, 250);

    glutInitWindowPosition (100, 100);

    glutCreateWindow ("hello");

    init ();

    glutDisplayFunc(display);

    glutMainLoop();

    return 0;

    }

    void init (void)

    {

    /* select clearing (background) color */

    glClearColor (0.0, 0.0, 0.0, 0.0);

    /* initialize viewing values */

    glMatrixMode(GL_PROJECTION);

    glLoadIdentity();

    glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);

    }

    19. List few animation Languages.

    GENESYS

    DIAL

    S-Dynamics system and ASAS

    20. What is story boarding?

    Storyboarding is a process of organizing the graphics in the form of illustrations or

    images in a proper sequence and it is used for the purpose of pre-visualizing a motion picture,

    animation, motion graphic or interactive media sequence. It is used in animating cartoons.

  • http://www.francisxavier.ac.in Page 23

    Part B

    16 Marks

    1. Develop algorithms to convert between the following color models:

    (1) HSV to RGB color model

    (2) RGB to HSV color model.

    void rgbtohsv(float r,float g,float b,float *h,float *s,float *v)

    {

    float max=MAX(r,MAX(g,b)),min=MIN(r,MIN(g,b));

    float delta=max-min;

    *v=max;

    if(max!=0.0)

    *s=delta/max;

    else

    *s=0.0;

    if(*s==0.0) *h=NO_HUE;

    else

    {

    if(r==max)

    *h=(g-b)/delta;

    else if(g==max)

    *h=2+(b-r)/delta;

    else if(b==max)

    *h=4+(r-g)/delta;

    *h*=60.0;

    if(*h

  • http://www.francisxavier.ac.in Page 24

    {

    case 0:

    *r=v;

    *g=cc;

    *b=aa;

    printf("R= %f G=%f B=%f",*r,*g,*b);

    break;

    case 1:

    *r=bb;

    *g=v;

    *b=aa;

    printf("R= %f G=%f B=%f",*r,*g,*b);

    break;

    case 2:

    *r=aa;

    *g=v;

    *b=cc;

    printf("R= %f G=%f B=%f",*r,*g,*b);

    break;

    case 3:

    *r=aa;

    *g=bb;

    *b=v;

    printf("R= %f G=%f B=%f",*r,*g,*b);

    break;

    case 4:

    *r=cc;

    *g=aa;

    *b=v;

    printf("R= %f G=%f B=%f",*r,*g,*b);

    break;

    case 5:

    *r=v;

    *g=aa;

    *b=bb;

    printf("R= %f G=%f B=%f",*r,*g,*b);

    break; }

    } }

    2. Write notes on the following

    (1) Cel animation

    (2) Skew stretch

    (3) Stop Animation

    3. How is morphing animation performed? Discuss with an example.

  • http://www.francisxavier.ac.in Page 25

    Morphing

    Transformation of object shapes from one form to another is called morphing

    Two key frames for an object transformation Preprocessing using vertex count

    4. What do you understand by key frame animation? Give examples.

    Key frame systems

    Motion path can be given with a kinematics description Physically based on force acting object Frame in to individual component or object called cells Diagrams and examples

    5. Write about CIE color model? What are its advantages?

    Chromaticity diagram: Draw CIE diagram with explanation

    a. Identify Complementary Colors

    b. Compare color gamuts for different models

    c. To determine dominant wavelength and purity of given color.

    6. Explain in detail about the various color models. (or) Depict and discuss HSV color

    model.

    Color model is a method for explaining a property or behaviour of a color within some

    particular context.it is helpful by understanding how color is represented on the video monitor

    RGB

    CMY

    RGB CMY conversion

    YIQ

    RGB YIQ conversion

    HSV

    Draw the diagram and explain the terms with conversion Refer Notes

    7. How to specify objects motion in animation system?

    Key frame systems

    Motion path can be given with a kinematics description Physically based on force acting object Frame in to individual component or object called cells

    Morphing

    Transformation of object shapes from one form to another is called morphing

    Two key frames for an object transformation Preprocessing using vertex count Simulating accelerations

    Time interval between keyframe is divided in to n + 1 dt = (t2 t1) / n = 1 tBj = t1 + jdt, j = 1,2,3 , Time for jth in- between is

  • http://www.francisxavier.ac.in Page 26

    tBj = t1 + dt[ ( 1-cos[j / (n + 1)] ) / 2], j= 1, 2, 3, .

    8. Discuss about the properties of Light. Also draw the CIE chromaticity diagram and

    explain.

    Light is a narrow frequency band with electromagnetic spectrum.

    Speed of light C= ,

    Saturation : Purity

    Hue: Predominant frequency in reflected light.

    Luminance: It is the brightness / Perceived intensity of the light.

    Chromaticity Hue + Saturation

    Chromaticity diagram: Draw CIE diagram with explanation

    d. Identify Complementary Colors

    e. Compare color gamuts for different models

    f. To determine dominant wavelength and purity of given color.

    9. Explain 3D viewing transformations in detail.

    Modeling coordinates Modeling Transformation World coordinates Viewing

    Transformation Viewing coordinatesProjection transformation projection coordinates

    Workstation transformation Device coordinates

    Viewing Parameters

    Explanation of each transformation

  • http://www.francisxavier.ac.in Page 27

    Unit IV - Rendering

    Part A[ 2 Marks Questions with Answers]

    1. What is a Shading Model?

    A shading model specifies how light is scattered or reflected from the surface. It provides

    rendering so that the intensity can be obtained at each point of the surface.

    2. Differentiate Flat shading and smooth shading.

    Flat Shading is a constant intensity shading where a single intensity is calculated for each

    face of the object. There is much discontinuities.

    Smooth shading calculates intensity at more points on a face. Less discontinuities in color.

    3. What is Gouraud shading?

    Gouraud shading is a intensity interpolation technique (or) smooth shading that renders a

    polygon surface by linearly interpolating intensity values across the surface.

    It determines the average unit normal vector at each vertex, applies illumination model to

    each vertex and linearly interpolates the intensity over the surface.

    4. Define Phong model.

    Phong model is an accurate model for rendering a polygon surface by interpolating normal

    vectors and apply illumination model to each surface point.

    5. What is meant by Texture mapping?

    Texture mapping is a method for adding detail, surface texture (a bitmap or raster

    image), or color to a computer-generated graphic or 3D mode. It produces realistic scenes.

    6. What is diffuse reflectivity?

    Diffuse reflectivity is the fractional amount of incident light that is diffusely reflected. It

    can be set for each surface with parameter Kd. Kd is the diffuse reflection coefficient or diffuse

    reflectivity which is a function of surface color and it varies between 0 and 1. Kd = 1 , high

    reflective surface.

    7. What are the rendering techniques for shaded images?

    Projective Texturing , Bitmap Texturing

    Procedural Texturing

    Using Shadow buffer.

    8. What are the components of specular reflection?

    Components of specular reflection are :

    Specular reflection coefficient

    Vector r in the direction at which angle of reflection is equal to angle of incidence.

    Vector v is from P to the viewers eye.

    9. Define the class in OPENGL to build a camera in a program.

  • http://www.francisxavier.ac.in Page 28

    class Camera {

    private:

    point3 p;

    vector3 u,v,w;

    double viewangle,aspect,near,far;

    void serModelViewMatrix;

    public:

    camera();

    void set (point3 eye, point3 look, point3 ray);

    void roll( float angle);

    void pitch(float angle);

    void yaw(float angle);

    void shape(float angle, float near, float far);

    }

    10. List the different ways of adding texture to surfaces.

    Projective Texturing

    Bitmap Texturing

    Procedural Texturing

    11. What is surface rendering?

    Surface rendering is a processing of computing intensity values at each point on the

    surface of an object. It produces realistic pictures. Rendering is done with shading models.

    12. Differentiate Diffuse scattering and specular reflection.

    Incident light penetrates the surface and it is reradiated uniformly in all directions. Color

    of the surface is affected.

    Incident light do not penetrate the object and it is reflected directly from outer surface. It

    is highly directional and objects look shiny.

    13. What is ambient light source?

    Ambient light source spreads light in all directions uniformly. It provides a uniform

    background glow in the environment.

    14. How do you create and enable light source in opengl?

  • http://www.francisxavier.ac.in Page 29

    glLightfv(GL_LIGHT0,GL_POSITION,mylightposition);

    glEnable(GL_LIGHTING);

    glEnable(GL_LIGHT0);

    GL_POSITION may be GL_AMBIENT, GL_DIFFUSE,GL_SPECULAR

    15. How do you specify Shading model in openGL?

    glShadeModel(GL_FLAT);

    glShadeModel(GL_SMOOTH);

    16. What are Opengl Error codes?

    The function glGetError() tells if an error has occurred in the program.

    Error Codes:

    GL_INVALID_ENUM Argument Out Of Range

    GL_OUT_OF_MEMORY Not enough memory

    17. State Lamberts Law.

    Lambert's Law says that the radiant intensity observed from an ideal diffusely reflecting

    surface is directly proportional to the cosine of the angle between the observer's line of sight

    and the surface normal. The law is also known as the cosine emission law or Lambert's

    emission law.

    18. What is texture function and texels?

    The function texture(s,t) produces a color or intensity values for each value of s and t

    between 0 and 1. The texture representations of images in an array txtr[c] [r] ie the color values

    are called texels.

    19. What is the use of shadow buffer?

    The Shadow buffer is a secondary depth buffer employed for each light source to perform

    the removal of hidden surface. The shadow buffer contains the depth picture of the scene from

    the point of view of light source. It records the distance from the source to the closest object in

    its direction.It used for rendering.

    20. What are the methods to create shadows?

    By painting the shadow as a texture

    By using Shadow buffer

  • http://www.francisxavier.ac.in Page 30

    Part B[ 16 Marks Questions]

    1) Explain in detail about shading models.

    - Geometric Ingredients for finding Reflected light

    - Computing the diffuse component

    - Specular Reflection

    - The role of ambient light and exploiting human perception

    - Combining Light Contributions

    - Adding Color

    - Shading and the Graphics Pipeline

    - Using light sources in OpenGL

    - Working with material properties in OpenGL

    - Shading of Scenes specified by SDL

    2) Describe in detail about flat and smooth shading models.

    - Flat shading definition

    - Smooth shading definition

    -TYPES OF SMOOTH SHADING

    - Gouraud Shading

    - Phong Shading

    3) Write briefly about adding texture to faces and shadows of an object.

    - Adding texture to faces definition

    -Painting the texture onto a flat surface

    -Rendering the texture

    -Adding shadows of object definition

    -Shadows as texture

    -Creating shadows with the use of a shadow buffer

    4) Write in detail about the rendering techniques for shadow images. Shadow mapping or projective shadowing is a process by which shadows are added to

    3D computer graphics. Shadows are created by testing whether a pixel is visible from the

    light source, by comparing it to a z-buffer or depth image of the light source's view, stored

    in the form of a texture. Rendering a shadowed scene involves two major drawing steps.

    The first produces the shadow map itself, and the second applies it to the scene.Creating the

    shadow map.The first step renders the scene from the light's point of view. For a point light

    source, the view should be a perspective projection as wide as its desired angle of effect (it

    will be a sort of square spotlight). For directional light (e.g., that from the Sun), an

    orthographic projection should be used.From this rendering, the depth buffer is extracted

    and saved. Because only the depth information is relevant, it is usual to avoid updating the

    color buffers and disable all lighting and texture calculations for this rendering, in order to

    save drawing time. This depth map is often stored as a texture in graphics memory. This

  • http://www.francisxavier.ac.in Page 31

    depth map must be updated any time there are changes to either the light or the objects in

    the scene, but can be reused in other situations, such as those where only the viewing

    camera moves. (If there are multiple lights, a separate depth map must be used for each

    light.)

    Shading the scene

    The second step is to draw the scene from the usual camera viewpoint, applying the

    shadow map. This process has three major components, the first is to find the coordinates of

    the object as seen from the light, the second is the test which compares that coordinate

    against the depth map, and finally, once accomplished, the object must be drawn either in

    shadow or in light.

    Bitmap texturing

    Shadow buffer

    The Shadow buffer is a secondary depth buffer employed for each light source to

    perform the removal of hidden surface. The shadow buffer contains the depth picture of

    the scene from the point of view of light source. It records the distance from the source

    to the closest object in its direction.It used for rendering.

    5) Write a OPENGL program to create 3D objects with lighting models.

    #include

    void init (void){

    GLfloat light_ambient[] = { 1.0, 1.0, 0.0, 1.0 };

    GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };

    GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 };

    GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };

    glLightfv (GL_LIGHT0, GL_AMBIENT, light_ambient);

    glLightfv (GL_LIGHT0, GL_DIFFUSE, light_diffuse);

    glLightfv (GL_LIGHT0, GL_SPECULAR, light_specular);

    glLightfv (GL_LIGHT0, GL_POSITION, light_position);

    glEnable (GL_LIGHTING);

    glEnable (GL_LIGHT0);

    glEnable(GL_DEPTH_TEST);}

    void display (void)

    {

    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glPushMatrix ();

    glRotatef (20.0, 1.0, 0.0, 0.0);

    glPushMatrix ();

    glTranslatef (-0.75, 0.5, 0.0);

    glRotatef (90.0, 1.0, 0.0, 0.0);

    glutSolidTorus (0.275, 0.85, 15, 15);

    glPopMatrix ();

    glPushMatrix ();

    glTranslatef (-0.75, -0.5, 0.0);

    glRotatef (270.0, 1.0, 0.0, 0.0);

    glutSolidCone (1.0, 2.0, 15, 15);

    glPopMatrix ();

    glPushMatrix ();

  • http://www.francisxavier.ac.in Page 32

    glTranslatef (0.75, 0.0, 1.0);

    glutSolidSphere (1.0, 15, 15);

    glPopMatrix (); glPopMatrix ();

    glFlush ();}

    void reshape(int w, int h)

    {

    glViewport (0, 0, (GLsizei) w, (GLsizei) h);

    glMatrixMode (GL_PROJECTION);

    glLoadIdentity ();

    if (w

  • http://www.francisxavier.ac.in Page 33

    8) Explain in detail about drawing shadows in OPENGL.

    -Two Types of light

    -Positional light source

    -Directional light source

    -Stencil Buffer

    -Stencil Buffer Operations

    -Blending

    -Shadow Transformation

  • http://www.francisxavier.ac.in Page 34

    Unit V - Graphics Programming

    Part A[ 2 Marks Questions with Answers]

    1. What is a Fractal?

    A fractal has been defined as "a rough or fragmented geometric shape that can be split

    into parts, each of which is a reduced-size copy of the whole, satisfying a property

    called self-similarity.

    2. What are the characteristics of a fractal object?

    A Fractal object has the following characteristics:

    Infinite detail at every point

    Self- Similarity between the object parts and the overall features of the object.

    It has a simple and recursive definition.

    It has a fine structure at arbitrarily small scales.

    It is too irregular to be easily described in traditional Euclidean geometric

    language

    3. Define Self affine Fractal.

    Self Affine fractals have parts that are formed with different scaling parameters in

    different coordinate directions. It is a statistically self similar fractal. Eg. Terrain, Cloud and

    Water.

    4. Define Self Squaring Fractal.

    Complex self squaring functions can be used to generate fractal shapes. Eg.Mandelbrot

    set and Julia set. These fractals can have the following results that the new position

    can diverge to infinity

    can converge to finite limit point

    remain on the boundary of the object

    5. Classify the fractals.

    Fractals are classified as

    1. Self Similar Fractals :

    (1) Statistically self similar Fractal - Appears statistically identical.

    i. Random Fractal

    ii Self affine Fractal different scaling parameters in different directions.

  • http://www.francisxavier.ac.in Page 35

    (2) Exactly self similar - Appears exactly identical at different scales. Eg.Sierpinski

    gasket , Koch curve

    2. Invariant Fractals - Appears approximately identical at different scales with nonlinear

    transformations

    (1) Self Squaring Fractals Eg.Mandelbrot Set

    (2) Self Inverse Fractals

    6. Define Julia Set.

    Julia set is an self squaring fractal with the iterative function using

    .

    where C is constant, and Zo varies. The value of C determines the shape of the Julia set

    7. Define Mandelbrot Set.

    The Mandelbrot set is a particular mathematical set of points, whose boundary

    generates a distinctive and easily recognizable two-dimensional fractal shape.

    The Mandelbrot set is the set of values of c in the complex plane whose iterative

    function is of the complex quadratic polynomial. That is, a complex number, c, is part of the

    Mandelbrot set if, when starting with z0 = 0 and applying the iteration repeatedly, Z=Z2 +C.

    8. What is a Peano curve?

    Fractal Curve with fractal dimension D=2 is known as a Peano curve.It is used to fill the

    finite 2D space.

    9. What is Ray tracing?

    Ray tracing is a technique for generating an image by tracing the path of light

    through pixels in an image plane and simulating the effects of its encounters with virtual

    objects. The technique is capable of producing a very high degree of visual realism, usually

    higher than that of typical scanline rendering methods, but at a greater computational cost.

    10. What is texture mapping?

    Texture mapping is a method for adding detail, surface texture (a bitmap or raster

    image), or color to a computer-generated graphic or 3D mode. It produces realistic scenes.

    11. Define Fractal Dimension.

    Fractal Dimension is a measure of roughness or fragmentation of the object. The detail

    variation in an object can be represented by this number D.

    D = ln n / ln S where S is the scaling factor and n is the number of subparts.

    12. What do you understand by turbulence in texturing?

    Turbulence is a noise generating method where several noise components are mixed and

    they fluctuate slowly as they move through the space.

  • http://www.francisxavier.ac.in Page 36

    Turb(s,x,y,z)=1/2 noise(s,x,y,z) +1/4 noise(s,x,y,z) + 1/8 noise(s,x,y,z)

    13. What is a Sierpinski gasket?

    The sierpinski Triangle is created by infinite removals. Each triangle is divided into 4

    smaller upside down triangles..The center of the 4 triangles is removed. As the process is

    iterated infinite number of times, the total area of the set goes to infinity as the size of the

    each new triangle goes to zero.

    14. What are Self-Inverse Fractals?

    Self Inverse fractals are obtained by applying non linear inversion operations to

    transform the initial points into a fractal.

    15. What is Constructive Solid Geometry (CSG)?

    CSG is a technique to develop ray tracing method for complex shapes obtained by

    combining simple shapes to give much richer and interesting scenes.Such complex objects

    are called Compound Boolean or CSG objects.

    16. What is Koch curve?

    The Koch curve can be drawn by dividing line into 4 equal segments with scaling factor

    1/3 and middle 2 segments are so adjusted that they form adjustment sides of an equilateral

    triangle.

    Part -B

    16 Marks

    1. How to create Fractals by Iterated functions? Explain with Koch Snowflake curve.

    Exactly self similar - Appears exactly identical at different scales. Eg.Sierpinski

    gasket , Koch curve

    The Koch curve can be drawn by dividing line into 4 equal segments with scaling factor

    1/3 and middle 2 segments are so adjusted that they form adjustment sides of an equilateral

    triangle.

    To draw kn:

    If (n equals 0) draw a straight line

    else {

    Draw kn+1

    Turn left 600

  • http://www.francisxavier.ac.in Page 37

    Draw kn-1

    Turn left 1200

    Draw kn-1

    Turn left 600

    Draw kn-1

    }

    - Diagram and explanation

    2. Describe in detail about Ray tracing methods. Explain the intersection of rays with

    various objects.

    `Ray Tracing : Ray tracing is a technique for generating an image by tracing the path of light

    through pixels in an image plane and simulating the effects of its encounters with virtual

    objects. The technique is capable of producing a very high degree of visual realism, usually

    higher than that of typical scanline rendering methods, but at a greater computational cost.

    This makes ray tracing best suited for applications where the image can be rendered

    slowly ahead of time, such as in still images and film and television special effects, and more

    poorly suited for real-time applications like video games where speed is critical. Ray tracing is

    capable of simulating a wide variety of optical effects, such as reflection and refraction,

    scattering, and dispersion phenomena (such as chromatic aberration).

    Optical ray tracing describes a method for producing visual images constructed in 3D

    computer graphics environments, with more photorealism than either ray casting or scanline

    rendering techniques. It works by tracing a path from an imaginary eye through each pixel in a

    virtual screen, and calculating the color of the object visible through it.

    Each ray must be tested for intersection with some subset of all the objects in the scene.

    Once the nearest object has been identified, the algorithm will estimate the incoming light at

    the point of intersection, examine the material properties of the object, and combine this

    information to calculate the final color of the pixel. The light intensity of this pixel is computed

    using a number of algorithms, which may include the classic rendering algorithm.

    In nature, a light source emits a ray of light which travels, eventually, to a surface that

    interrupts its progress. One can think of this "ray" as a stream of photons traveling along the

  • http://www.francisxavier.ac.in Page 38

    same path. In a perfect vacuum this ray will be a straight line (ignoring relativistic effects). In

    reality, any combination of four things might happen with this light ray: absorption, reflection,

    refraction and fluorescence.

    Advantages:

    Realistic simulation of lighting over other rendering methods (such as scanline rendering or ray

    casting). Effects such as reflections and shadows, which are difficult to simulate using other

    algorithms, are a natural result of the ray tracing algorithm. Relatively simple to implement yet

    yielding impressive visual results, ray tracing often represents a first foray into graphics

    programming. The computational independence of each ray makes ray tracing amenable to

    parallelization.

    Disadvantages:

    Performance:

    Scanline algorithms and other algorithms use data coherence to share computations between

    pixels, while ray tracing normally starts the process anew, treating each eye ray separately.

    traditional ray tracing is also not necessarily photorealistic.

    True photorealism occurs when the rendering equation is closely approximated or fully

    implemented. The process of shooting rays from the eye to the light source to render an image

    is sometimes called backwards ray tracing. This integration of eye-based and light-based rays

    is often expressed as bidirectional path tracing,

    Intersection of Ray with Objects:

    The general idea behind ray-object intersections is to put the mathematical equation for the ray

    into the equation for the object and determine if there is a real solution. If there is a real

    solution then there is an intersection (hit) and we must return the closest point of intersection

    and the normal (N) at the intersection point.

    Intersection with plane , sphere , Square and Polygon with Equations.

    3. Write about Reflections and Transparency.

    Reflection

    Laws of reflection

    Refraction

    Difference reflection and refraction

    Coefficients

    4. Explain about CSG and the various Boolean operations on objects.

  • http://www.francisxavier.ac.in Page 39

    Constructive solid geometry (CSG) is a technique used in solid modeling. Constructive

    solid geometry allows a modeler to create a complex surface or object by using Boolean

    operators to combine objects. Often CSG presents a model or surface that appears visually

    complex, but is actually little more than cleverly combined or decombined objects.

    In 3D computer graphics and CAD CSG is often used in procedural modeling. CSG can

    also be performed on polygonal meshes, and may or may not be procedural and/or parametric.

    The simplest solid objects used for the representation are called primitives. Typically they are

    the objects of simple shape: cuboids, cylinders, prisms, pyramids, spheres, cones. The set of

    allowable primitives is limited by each software package. Some software packages allow CSG

    on curved objects while other packages do not.

    It is said that an object is constructed from primitives by means of allowable operations,

    which are typically Boolean operations on sets: union, intersection and difference.

    A primitive can typically be described by a procedure which accepts some number of

    parameters; for example, a sphere may be described by the coordinates of its center point, along

    with a radius value. These primitives can be combined into compound objects using operations

    like these:

    5. Explain in detail about self squaring fractals Mandelbrot and Julia sets? How do they

    differ from each other?

    Mandelbrot Set: (8 Marks)

    The Mandelbrot set is a particular mathematical set of points, whose boundary generates a

    distinctive and easily recognisable two-dimensional fractal shape.

    The Mandelbrot set is the set of values of c in the complex plane for which the orbit of 0

    under iteration of the complex quadratic polynomial. That is, a complex number, c, is part of

    Operations in constructive solid geometry

    (1) Boolean union (2) Boolean Difference (3) Boolean Intersection

    Constructive solid geometry has a number of practical uses. It is used in cases where simple

    geometric objects are desired, or where mathematical accuracy is important. One of the

    advantages of CSG is that it can easily assure that objects are "solid" or water-tight if all of the

    primitive shapes are water-tight.

    This can be important for some manufacturing or engineering computation applications. it is

    easy to classify arbitrary points as being either inside or outside the shape created by CSG. The

    point is simply classified against all the underlying primitives and the resulting boolean

    expression is evaluated. This is a desirable quality for some applications such as collision

    detection.

  • http://www.francisxavier.ac.in Page 40

    the Mandelbrot set if, when starting with z0 = 0 and applying the iteration repeatedly, the

    absolute value of zn never exceeds a certain number (that number depends on c) however large

    n gets. Images of the Mandelbrot set display an elaborate boundary that reveals progressively

    ever-finer recursive detail at increasing magnifications.

    The "style" of this repeating detail depends on the region of the set being examined. The

    set's boundary also incorporates smaller versions of the main shape, so the fractal property of

    self-similarity applies to the whole set, and not just to its parts.

    `The Mandelbrot set has become popular outside mathematics both for its aesthetic

    appeal and as an example of a complex structure arising from the application of simple rules,

    and is one of the best-known examples of mathematical visualization.

    The Mandelbrot set M is defined by a family of complex quadratic polynomials

    given by

    where c is a complex parameter.

    The Mandelbrot set is a compact set, contained in the closed disk of radius 2 around the

    origin. In fact, a point c belongs to the Mandelbrot set if and only if

    for all .

    In other words, if the absolute value of ever becomes larger than 2, the

    sequence will escape to infinity. The large cardioid-shaped region in the center. This main

    cardioid is the region of parameters c for which Pc has an attracting fixed point.

    Procedure for drawing Mandelbrot Set:

    for(int r=0;r

  • http://www.francisxavier.ac.in Page 41

    The points of the Mandelbrot set have been colored black.

    It is also possible to assign a

    color to the points outside the Mandelbrot set. Their colors depend on how many iterations have

    been required to determine that they are outside the Mandelbrot set.

    points far from the Mandelbrot set rapidly move towards infinity,

    points close to the Mandelbrot set slowly escape to infinity,

    points inside the Mandelbrot set never escape to infinity.

    Julia Set: (8 Marks)

    Julia sets are strictly connected with the Mandelbrot set. The iterative function that is used

    to produce them is the same as for the Mandelbrot set. The only difference is the way this

    formula is used. In order to draw a picture of the Mandelbrot set, we iterate the formula for each

    point C of the complex plane, always starting with . If we want to make a picture of a

    Julia set, C must be constant during the whole generation process, while the value of varies.

    The value of C determines the shape of the Julia set; in other words, each point of the complex

    plane is associated with a particular Julia set.

    How is a Julia set created?

    We have to pick a point C) on the complex plane. The following algorithm determines

    whether or not a point on complex plane Z) belongs to the Julia set associated with C, and

    determines the color that should be assigned to it. To see if Z belongs to the set, we have to

    iterate the function using .

    What happens to the initial point Z when the formula is iterated? Will it remain near to

    the origin or will it go away from it, increasing its distance from the origin without limit? In

    the first case, it belongs to the Julia set; otherwise it goes to infinity and we assign a color to

    Z depending on the speed the point "escapes" from the origin. To produce an image of the

  • http://www.francisxavier.ac.in Page 42

    whole Julia set associated with C, we must repeat this process for all the points Z whose

    coordinates are included in this range:

    ;

    The most important relationship between Julia sets and Mandelbrot set is that while the

    Mandelbrot set is connected (it is a single piece), a Julia set is connected only if it is associated

    with a point inside the Mandelbrot set. For example: the Julia set associated with is

    connected; the Julia set associated with is not connected (see picture below).

    Iterated Function System Fractals

    Iterated Function System (IFS) fractals are created on the basis of simple plane

    transformations: scaling, dislocation and the plane axes rotation. Creating an IFS fractal

    consists of following steps:

    1. defining a set of plane transformations,

    2. drawing an initial pattern on the plane (any pattern),

    3. transforming the initial pattern using the transformations defined in first step,

    4. transforming the new picture (combination of initial and transformed

    patterns) using the same set of transformations, repeating the fourth step as

    many times as possible

    6) Write a OPENGL program for fractal generation Sierpinski Gasket.

  • http://www.francisxavier.ac.in Page 43

    The sierpinski Triangle is created by infinite removals. Each triangle is divided into 4 smaller upside

    down triangles..The center of the 4 triangles is removed. As the process is iterated infinite number of

    times, the total area of the set goes to infinity as the size of the each new triangle goes to zero.

    Procedure :

    1. The sierpinski Triangle is created by infinite removals

    2. Each triangle is divided into 4 smaller upside down triangles

    3. The center of the 4 triangles is removed

    4. As the process is iterated infinite number of times, the total area of the set goes to infinity as

    the size of the each new triangle goes to zero

    5. After closer examination magnification factor is 2.

    6. With each magnification there are 3 divisions of a triangle

    Dimension D=ln(3)/ln(2) D=1.5850

    Program:

    #include

    #include

    typedef float point[3];

    /* initial tetrahedron */

    point v[]={{0.0, 0.0, 1.0}, {0.0, 0.942809, -0.33333}, {-0.816497, -0.471405, -0.333333},

    {0.816497, -0.471405,-0.333333}};

    static GLfloat theta[] = {0.0,0.0,0.0};

    int n;

    void triangle( point a, point b, point c)

    /* display one triangle using a line loop for wire frame, a single

    normal for constant shading, or three normals for interpolative shading */

    {

    glBegin(GL_POLYGON);

    glNormal3fv(a);

    glVertex3fv(a);

    glVertex3fv(b);

    glVertex3fv(c);

    glEnd();

    }

    void divide_triangle(point a, point b, point c, int m){

    /* triangle subdivision using vertex numbers

    righthand rule applied to create outward pointing faces */

  • http://www.francisxavier.ac.in Page 44

    point v1, v2, v3;

    int j;

    if(m>0) {

    for(j=0; j

  • http://www.francisxavier.ac.in Page 45

    if (w