IT6501 notes.doc

download IT6501 notes.doc

of 54

Transcript of IT6501 notes.doc

  • 7/25/2019 IT6501 notes.doc

    1/54

    Introduction

    Def 1: The creation, storage and manipulation of images and drawings using a digital

    computer is called computer graphics.

    Def 2: Computer graphics are graphics created using computers and more generally the

    representation and manipulation of image data by a computer with help from specialized

    software and hardware.

    Computer contains two components.

    Computer hardware

    Computer hardware contains the graphics workstations, graphic input

    devices and graphic output devices.

    Computer Software

    Computer software contains the Operating systems which controls the

    basic operations, software packages used for geometric modeling like solid

    modeling, wire frame modeling and drafting, Application software which

    includes the program for design analysis, several application-specific software

    packages.

    The major use of computer graphics is in design processes like engineering and

    architectural systems. Now almost all the products are computer designed. t is generally referred

    as C!" #Computer !ided "esign$ . t is mainly used in the design of buildings, automobiles,

    aircraft, computers, te%tiles, etc.

    ine Drawing algorithm

    &lope-intersept e'uation for a straight line is

    ()m%*b

    m- slope of the line.

    b-constant

    Two end points of the line segment are #%+,y+$ , #%,y$

    &lope m ) y-y+ %-%+

    y%%- % interval / %-%+

    y / y interval / y-y+

    y ) m. %

    %)ym

  • 7/25/2019 IT6501 notes.doc

    2/54

    f the interval is known, we can find the ne%t point.

    %i*+) % i* % %i* ym

    yi*+) y i* yyi* m. %

    we sample at unit % interval and y interval then this e'uation becomes

    %i*+) % i* % %i* #+m$

    yi*+) y i* yyi* m.+

    The above e'uations are for the lines which are processed from left to right.

    The e'uations are for the lines which are processed from right to left is

    %i*+) % i* % %i- #+m$

    yi*+) y i* y yi- m.+

    &ince m can be any real number between 0 and + the y value must be rounded to the

    nearest integer.

    DDA Algorithm !Digital differential analy"er#

    +. 1et the two end points

    . Calculate the 2orizontal and vertical difference between two end points #d%,dy$

    3. The greatest difference value is taken as the length value.4. Calculate the step value d%)d%length, dy)dy length

    5. &tart plotting the line from the first point.

    6. 7epeat through 8 step up to length value times

    9. if d%:dy and %a;%b then increment % by + and increment y by m

  • 7/25/2019 IT6501 notes.doc

    3/54

    Disadvantages

    =loating point arithmetic in ""! algorithm is still time consuming

    The algorithm is orientation dependent.2ence end point accuracy is poor.

    $resenham%s ine Algorithm

    This algorithm uses only integer addition, subtraction, and multiplication by . &o it is

    efficient for scan converting algorithms. This algorithm increments either % or y by one unit

    depending on the slope of the line. The increment in the other variable is determined by e%amine

    the distance between the actual line location and the nearest pi%el. This distance is called

    decision varia&le or the error'

    n matemetical terms the error or decision variable is defined as

    e ) "b / "a

    f e:0 then the pi%el above the line is closer to the true line.

    >lse the pi%el below the line is closer to the true line.!ssume the current pi%el is #%k,yk$

    ?e have to find the ne%t pi%el position either ##%k*+,yk$ and #%k*+,yk*+$

    The y coordinate on the line at the pi%el position %k*+ s y ) m #%k*+ $ * c

    Then the distance d+) y - yk ) m #%k*+ $ * c-yk

    d) #yk*+-y$) yk*+-m #%k*+ $ * c

    d+-d ) m #%k*+$ * c-yk -yk--+-#yk*+$*m #%k*+ $ * c

    ) m #%k*+$- yk *c-+

    The error term is initially set as e ) y-% where y)y-y+ , %)%-%+

    $resenhams algorithm

    +. 1et the two end points

    . Calculate the values d%,dy,dy and dy-d% where d%)@-@+ and dy)(-(+

    3. Calculate the starting decision parameter d)dy-d%

    4. plot the first point

    5. !t each @k along the line, starting at k)0, perform the following test

    f pk;0 , the ne%t point to plot is #@k*+,(k$ and Ak*+)pk*dy

    Btherwise the ne%t point to plot is #@k*+,(k*+$ Ak*+)pk*dy-d%

    6. 7epeat step 5 for d% times.

    The following program is used to for generalized bresenham algorithm, which will work for all

    the four coordinates.

    (arallel ine algorithm

  • 7/25/2019 IT6501 notes.doc

    4/54

    ?e can calculate the pi%el position along the path simultaneously by partitioning the

    computations among the various processors available. Bne approach to the partitioning problem

    is to adapt an e%sisting se'uential algorithm to take advantage of multiple processors.

    !lternatively, we can look for other ways to set up the processing so that pi%el positions can be

    calculated efficiently in parallel.

    Circle )enerating algorithm

    (roperties of the Circle

    Circle is defined as a set of points that are all at a given distance r from a center position

    #@c,(c$. This distance relationship is e%pressed by the Aythagorean theorem in Cartesian

    coordinates as

    #@-@c$ *#(-(c$)r

    resenhamDs line algorithm for raster display is adapted to circle generation by setting up

    the decision parameters for finding the closest pi%el for each sampling step.

    ! method for direct distances comparison is to test the halfway position between two pi%els, to

    determine if this midpoint is inside or outside the circle boundary. This method is more easy .

    =or an integer circle radius, the midpoint approach generates the same pi%el position.

    *idpoint Circle Algorithm

    +.nput radius r and circle center #%c,yc$ and obtain the first point on the circumference of

    a circle centered on the origin as

    #%0,y0$)#0,r$

    .Calculate the initial value of the decision parameter as

    A0)54 /r

    3 !t each %k position, starting at k)0,perform the following testE

    if Ak;0 , then ne%t point along the circle centered on #0,0$ is #%k*+,yk$and

    Ak*+)Ak*%k*+ *+

    otherwise the ne%t point along the circle is #%k*+,yk-+$ and

    Ak*+)Ak * %k*+ *+ / yk*+

    where %k*+ )%k * , yk*+)yk-

    4. "etermine the symmetry points in the other seven octants

    5.Fove each calculated position#%,y$ onto the circular path centered on

    #%c,yc$ and plot the coordinate values %)%*%c,y)y*yc6.7epeat steps 3 to 5 until % : ) y

    +llipse generating Algorithm

    (roperties of the +llipse

  • 7/25/2019 IT6501 notes.doc

    5/54

    !n ellipse is a set of points such that the sum of the distances from two fi%ed positions #foci$ is

    the same for all points.f the distances to any two foci from any point A)#%,y$ on the ellipse are

    labeled d+ and d then the general e'uation of an an ellipse can be stated as d+ * d is constant.

    !n ellipse in standard position is symmetric between 'uadrants. ut it not symmetric between

    the two octants of the 'uadrant. &o, we must calculate the pi%el positions along the elliptical arc

    throughout one 'uadrant, then we obtained positions in the remaining three 'uadrants by

    symmetry.

    *idpoint +llipse Algorithm

    +.nput r%,ry and ellipse center #%c,yc$ and obtain the first point on an

    ellipse centered on the origin as

    #%0,y0$)#0,ry$

    .Calculate the initial value of the decision parameter in region + as

    p+0 ) ry-r%ry * G r%

    3.!t each %k position in region +,starting at k)0,perform the following test

    if p+k;0, the ne%t point along the ellipse centered on #0,0$is #%k*+,yk$

    otherwise the ne%t point along the circle is #%k*+,yk-+$ andp+k*+ ) p+k * ry%k*+ / ry%k*+ * ry

    with

    ry%k*+ ) ry%k * ry

    r%yk-r%yk / r%

    4.Calculate the initial value of the decision parameter in region using the

    last point #%0,y0$ calculated in region as

    p0 ) ry #%0*+$ * r%#y0-+$-r%ry

    5.!t each yk position in region starting at k)0 ,perform the following testif pk:0 the ne%t point along the ellipse centered on #0,0$ is

    #%k,yk-+$ and

    pk*+)pk-r%yk*+ * r%

    otherwise the ne%t point along the circle is #%k*+,yk-+$ and

    pk*+ ) pk * ry%k*+ / r%yk*+ *r%

    using the same incremental calculations for % and y as in region+

    6."etermine symmetry points in the other three 'uadrants.

    9.Fove each calculated pi%el position #%,y$ onto the elliptical path centered

    on #%c,yc$ and plot the coordinate values.

    @)%*%c,y)y*yc

  • 7/25/2019 IT6501 notes.doc

    6/54

  • 7/25/2019 IT6501 notes.doc

    7/54

    *ethods of antialising

    +. ncreasing 7esolution

    . Hnweighted area sampling

    3. ?eighted area sampling

    4. Thick line segments

    1' Increasing esolutionThe alising effect can be minimized by increasing resolution of the raster display. y

    increasing resolution and making it twice the original one, the line passes through twice as many

    column of pi%els and therefore has twice as many jags, but each jag is half as large in % and in y

    direction.

    This improvement cause increase in cost of memory, bandwidth of memory and scan-conversion

    time. &o it is a e%pensive method to reduce the aliasing method.

    2' nweighted area sampling

    n general the line drawing algorithm select the pi%els which is closer to the true line. n

    antialsing instead of picking closest pi%el, both pi%els are high lighted. 2owever their intensity

    values may differ.

    n unweighted area sampling, the intensity of pi%el is proportional to the amount

    of line area occupied by the pi%el. t produces better results than does setting pi%els either to full

    intensity or to zero intensity.

    3' -eighted area sampling

    n weighted area sampling small area closer to the pi%el center has greater

    intensity than does one at a greater distance. Thus in weighted area sampling the intensity of the

    pi%el is dependent on the line area occupied and the distance of area from the pi%elDs center.

    .' ,hick line segment

    n raster displays it is possible to draw lines with thickness greater than one pi%el. To

    produce a thick line, we have to run two line drawing algorithms in parallel to find the pi%els

    along the line edges, and while stepping along the line we have to turn on all the pi%els which lie

    between the boundaries.

    ,-O DI*+4SIO4A )A(5ICS ,A4S/O*A,IO4S

    )eometric ,ransformations

    Changes in size, shape are accomplished with geometric transformation. t alter the coordinate

    descriptions of object.

  • 7/25/2019 IT6501 notes.doc

    8/54

  • 7/25/2019 IT6501 notes.doc

    9/54

  • 7/25/2019 IT6501 notes.doc

    10/54

  • 7/25/2019 IT6501 notes.doc

    11/54

    &o we can write #h.%, h.y,h$, set h)+. >ach two dimensional position is represented with

    homogeneous coordinates#%,y,+$. Coordinates are represented with three element column vector.

    Transformation operations are written as 3 by 3 matrices.

    =or translation

    @D + 0 t% @

    (D 0 + ty (

    AD)T#t%,ty$IA

    + 0 0 + +

    nverse of the translation matri% is obtained by replacing t%, ty by /t%, -ty

    &imilarly rotation about the origin

    @D CosJ -&inJ 0 @

    (D &inJ CosJ 0 (

    + 0 0 + +AD) 7#J$IA

    ?e get the inverse rotation matri% when J is replaced with #-J$

    &imilarly scaling about the origin

    @D &% 0 0 @

    (D 0 &y 0 (

    + 0 0 + +

    AD) s%,sy$IA

    Composite transformations&e'uence of transformations is called as composite transformation. t is obtained by forming

    products of transformation matrices is referred as a concatenation #or$ composition of matrices.

    ,ranslation:

    Two successive translations

    + 0 t% + 0 t% + 0 t%+*t%

    0 + ty 0 + ty 0 + ty+*ty

    0 0 + 0 0 + 0 0 +

    T#t%+,ty+$ * T#t%,ty$ ) T#t%+*t%, ty+*ty$

    Two successive translations are additive.

    otation

    Two successive rotations are additive.

    7#J+$I 7#J$) 7#J+* J$

  • 7/25/2019 IT6501 notes.doc

    12/54

    AD)A. 7#J+* J$

    Scaling

    &%+ 0 0 &% 0 0 &%+.% 0 0

    0 &y+ 0 0 &y 0 0 &y+.y 0

    0 0 + 0 0 + 0 0 +

    %+,y+$.%,y$ ) s%+.s% , sy+.sy$

    +. the order we perform multiple transforms can matter

    eg. translate * scale can differ from scale * translate

    eg. rotate * translate can differ from translate * rotate

    eg. rotate * scale can differ from scale * rotate #when scaleK% differs from scaleKy$

    . ?hen does F+ * F ) F * F+L

    F+ F

    translate translate

    scale scale

    rotate rotate

    scale #s% ) sy$ rotate

    )eneral pivot point rotation

    7otation about any selected pivot point #%r,yr$ by performing the following se'uence of translate

    / rotate / translate operations.

    +. Translate the object so that the pivot point is at the co-ordinate origin.

    . 7otate the object about the coordinate origin

    3. Translate the object so that the pivot point is returned to its original position

    + 0 %r CosJ -&inJ 0 + 0 -%r

    0 + yr &inJ CosJ 0 0 + -yr

    0 0 + 0 0 + 0 0 +

    Concatenation properties

    T#%r,yr$.7#J$.T#-%r,-yr$ ) 7#%r,yr, J$

    Fatri% multiplication is associative. Transformation products may not be commutative.

    Combination of translations, roatations, and scaling can be e%pressed as

  • 7/25/2019 IT6501 notes.doc

    13/54

    @D r&%% r&%y tr&% @

    (D ) r&y% r&yy tr&y . (

    + 0 0 + +

    Other transformations

    esides basic transformations other transformations are reflection and shearing

    eflection :

    7eflection is a transformation that produces the mirror image of an object relative to an a%is of

    reflection. The mirror image is generated relative to an a%is of reflection by rotating the object by

    +

  • 7/25/2019 IT6501 notes.doc

    14/54

  • 7/25/2019 IT6501 notes.doc

    15/54

  • 7/25/2019 IT6501 notes.doc

    16/54

    The viewing transformation in several steps, as indicated in =ig. =irst, we construct the

    scene in world coordinates using the output primitives. Ne%t to obtain a particular orientation for

    the window, we can set up a two-dimensional viewing-coordinate system in the world coordinate

    plane, and define a window in the viewing-coordinate system. The viewing- coordinate reference

    frame is used to provide a method for setting up arbitrary orientations for rectangular windows.

    Bnce the viewing reference frame is established, we can transform descriptions in world

    coordinates to viewing coordinates. ?e then define a viewport in normalized coordinates #in the

    range from 0 to +$ and map the viewing-coordinate description of the scene to normalized

    coordinates.

    !t the final step all parts of the picture that lie outside the viewport are clipped, and the

    contents of the viewport are transferred to device coordinates. y changing the position of the

    viewport, we can view objects at different positions on the display area of an output device.

    ! point at position #%w,yw$ in a designated window is mapped to viewport coordinates

    #%v,yv$ so that relative positions in the two areas are the same. The figure illustrates the window

  • 7/25/2019 IT6501 notes.doc

    17/54

  • 7/25/2019 IT6501 notes.doc

    18/54

  • 7/25/2019 IT6501 notes.doc

    19/54

    +. Aoint clipping

    . ine clipping

    3. !rea clipping

    4. Curve Clipping

    5. Te%t Clipping

    (oint Clipping:

    The points are said to be interior to the clipping if

    @?min ;) @ ;)@? ma%

    (?min ;) ( ;)(? ma%

    The e'ual sign indicates that points on the window boundary are included within the window.

    ine ClippingE

    - The lines are said to be interior to the clipping window, if the two end points of the lines are

    interior to the window.

    - f the lines are completely right of, completely to the left of, completely above, or completely

    below the window, then it is discarded.

    - oth end points of the line are e%terior to the window, then the line is partially inside and

    partially outside the window.The lines which across one or more clipping boundaries re'uires

    calculation of multiple intersection points to decide the visible portion of them.To minimize the

    intersection calculation and increase the efficiency of the clipping algorithm, initially completely

    visible and invisible lines are identified and then intersection points are calculated for remaining

    lines.

    There are many clipping algorithms. They are

    1'Sutherland and cohen su&division line clipping algorithm

    t is developed by "an Cohen and van &utharland. To speed up the processing this algorithm

    performs initial tests that reduces the number of intersections that must be calculated.

    given a line segment, repeatedlyE

    +. check for trival acceptance

    both

    . check for trivial rejection

    both endpoints of the same side of clip rectangle

    3. both endpoints outside clip rectangle

    "ivide segment in two where one part can be trivially rejected

    Clip rectangle e%tended into a plane divided into 8 regions . >ach region is defined by a uni'ue

    4-bit string

  • 7/25/2019 IT6501 notes.doc

    20/54

    left bit ) +E above top edge #( : (ma%$

    nd bit ) +E below bottom edge #( ; (min$

    3rd bit ) +E right of right edge #@ : @ma%$

    right bit ) +E left of left edge #@ ; @min$

    left bit ) sign bit of #(ma% - ($

    nd bit ) sign bit of #( - (min$

    3rd bit ) sign bit of #@ma% - @$

    right bit ) sign bit of #@ - @min$

    #The sign bit being the most significant bit in the binary representation of the value. This bit is O+O

    if the number is negative, and O0O if the number is positive.$

    The frame buffer itself, in the center, has code 0000.

    +00+ P +000 P +0+0

    -------------------------

    000+ P 0000 P 00+0

    -------------------------

    0+0+ P 0+00 P 0++0

    =or each line segmentE

    +. each end point is given the 4-bit code of its region

    . repeat until acceptance or rejection

    +. if both codes are 0000 -: trivial acceptance

    . if logical !N" of codes is not 0000 -: trivial rejection3. divide line into segments using edge of clip rectangle

    +. find an endpoint with code not e'ual to 0000

    . lines that cannot be identified as completely inside or outside are checked for the intersection

    with two boundaries.

    3. break the line segment into line segments at the crossed edge

    4. forget about the new line segment lying completely outside the clip rectangle

    5. draw the line segment which lies within the boundary regin.

    2' *id point su&division algorithm

    f the line partially visible then it is subdivided in two e'ual parts. The visibility tests are

    then applied to each half. This subdivision process is repeated until we get completely visible

    and completely invisible line segments.

    Fid point sub division algorithm

    +. 7ead two end points of the line A+#%+,%$, A#%,y$

    . 7ead two corners #left top and right bottom$ of the window, say #?%+,?y+ and ?%, ?y$

  • 7/25/2019 IT6501 notes.doc

    21/54

  • 7/25/2019 IT6501 notes.doc

    22/54

  • 7/25/2019 IT6501 notes.doc

    23/54

    >lse

    Q

    Check whether the line is horizontal or vertical and check the line endpoint with the

    corresponding boundaries. f it is within the boundary area then use them to draw a line.

    Btherwise use boundary coordinate to draw a line. 1oto stop.

    R

    6. initialize values for H+ and H as H+)0,H)+

    9. Calculate the values forH) 'ipi for )+,,3,4

  • 7/25/2019 IT6501 notes.doc

    24/54

  • 7/25/2019 IT6501 notes.doc

    25/54

    . else determine a uni'ue clip window edge for the intersection calculation.

    e. To determine the region of p compare the slope of the line to the slope of the boundaries

    of the clip regions.

    ine clipping using non rectangular clip window

    Circles and other curved boundaries clipped regions are possible, but less commonly used.

    Clipping algorithm for those curve are slower.

    +. ines clipped against the bounding rectangle of the curved clipping region. ines outside the

    region is completely discarded.

    . >nd points of the line with circle center distance is calculated . f the s'ure of the points less

    than or e'ual to the radious then save the line else calculate the intersection point of the line.

    (olygon clipping

    Splitting the concave polygon

    t uses the vector method , that calculate the edge vector cross products in a counter clock wiseorder and note the sign of the z component of the cross products. f any z component turns out to

    be negative, the polygon is concave and we can split it along the line of the first edge vector in

    the cross product pair.

    Sutherland > 5odgeman polygon Clipping Algorithm

    +. 7ead the coordinates of all vertices of the polygon.

    . 7ead the coordinates of the clipping window.

    3. Consider the left edge of the window.

    4. Compare the vertices of each edge of the polygon, ndividually with the clipping plane.

    5. &ave the resulting intersections and vertices in the new list of vertices according to four

    possible relationships between the edge and the clipping boundary discussed earlier.

    6. 7epeats the steps 4 and 5 for remaining edges of the clipping window. >ach time the resultant

    vertices is successively passed the ne%t edge of the clipping window.

    9. &top.

    The &utherland /2odgeman polygon clipping algorithm clips conve% polygons correctly,

    ut in case of concave polygons clipped polygon may be displayed with e%traneous lines. t can

    be solved by separating concave polygon into two or more conve% polygons and processing each

    conve% polygons separately.

    The following e%ample illustrates a simple case of polygon clipping.

  • 7/25/2019 IT6501 notes.doc

    26/54

    -+I+ >Atherton Algorithm

    nstead of proceding around the polygon edges as vertices are processed, we sometime wants to

    follow the window boundaries.=or clockwise processing of polygon vertices, we use the

    following rules.

    - =or an outside to inside pair of vertices, follow the polygon boundary.

    - =or an inside to outside pair of vertices, follow a window boundary in a clockwise direction.

    Curve Clipping

    t involves non linear e'uations. The boundary rectangle is used to test for overlap with a

    rectangular clipwindow. f the boundary rectangle for the object is completely inside the window

    , then save the object #or$ discard the object.f it fails we can use the coordinate e%tends of

    individual 'uadrants and then octants for preliminary testing before calculating curve windowintersection.

    ,e0t Clipping

    The simplest method for processing character strings relative to a window boundary is to use the

    all or none string clipping strategy. f all the string is inside then accept it else omit it.

    ?e discard only those character that are not completely inside the window. 2ere the boundary

    limits of individual characters are compared to the window.

    +0terior clipping

    The picture part to be saved are those that are outside the region. This is referred to as e%terior

    clipping. !n application of e%terior clipping is in multiple window systems.

    Bbjects within a window are clipped to the interior of that window. ?hen other higher prioritywindows overlap these objects , the ojects are also clipped to the e%terior of the overlapping

    window.

  • 7/25/2019 IT6501 notes.doc

    27/54

  • 7/25/2019 IT6501 notes.doc

    28/54

    isting the geometric data in three tables provides a convenient reference to the individual

    components #vertices, edges and polygons$ of each object.

    The object can be displayed efficiently by using data from the edge table to draw the component

    lines.

    >%tra information can be added to the data tables for faster information e%traction. =or instance,

    edge table can be e%panded to include forward points into the polygon table so that common

    edges between polygons can be identified more rapidly.

    >+ E M+, M, &+

    > E M, M3, &+

    >3 E M3, M+, &+, &

    >4 E M3, M4, &

    >5 E M4, M5, &

    >6 E M5, M+, &

    is useful for the rendering procedure that must vary surface shading smoothly across the edges

    from one polygon to the ne%t. &imilarly, the verte% table can be e%panded so that vertices are

    cross-referenced to corresponding edges.

    !dditional geometric information that is stored in the data tables includes the slope for each edge

    and the coordinate e%tends for each polygon. !s vertices are input, we can calculate edge slopes

    and we can scan the coordinate values to identify the minimum and ma%imum %, y and z values

    for individual polygons.

  • 7/25/2019 IT6501 notes.doc

    29/54

  • 7/25/2019 IT6501 notes.doc

    30/54

  • 7/25/2019 IT6501 notes.doc

    31/54

  • 7/25/2019 IT6501 notes.doc

    32/54

    nterpolation curves are used to digitize drawings or to specify animation paths.

    !ppro%imation curves are used as design tools to structure object surfaces. ! spline curve is

    designed , modified and manipulated with operations on the control points.The curve can be

    translated, rotated or scaled with transformation applied to the control points. The conve%

    polygon boundary that encloses a set of control points is called the conve0 hull. The shape of the

    conve% hull is to imagine a rubber band stretched around the position of the control points so that

    each control point is either on the perimeter of the hull or inside it. Conve0 hull shapes !dashed

    lines# for two sets of control points

    (arametric Continuity Conditions

    =or a smooth transition from one section of a piecewise parametric curve to the ne%t various

    continuity conditions are needed at the connection points.

    f each section of a spline in described with a set of parametric coordinate functions or the form

    % ) %#u$, y ) y#u$, z ) z#u$, u+;) u ;) u -----#a$

    ?e set parametric continuity by matching the parametric derivatives of adjoining curvesections at their common boundary.

    Hero order parametric continuity referred to as C0 continuity, means that the curves meet.

    #i.e$ the values of %,y, and z evaluated at u for the first curve section are e'ual. 7espectively, to

    the value of %,y, and z evaluated at u+ for the ne%t curve section.

    /irst order parametric continuity referred to as C+ continuity means that the first parametric

    derivatives of the coordinate functions in e'uation #a$ for two successive curve sections are e'ual

    at their joining point.

    Second order parametric continuity, or C continuity means that both the first and second

    parametric derivatives of the two curve sections are e'ual at their intersection.

    2igher order parametric continuity conditions are defined similarly.(iecewise construction of a curve &y Foining two curve segments using different orders of

    continuity

    a#Hero order continuity only

    /irst order continuity only

  • 7/25/2019 IT6501 notes.doc

    33/54

  • 7/25/2019 IT6501 notes.doc

    34/54

  • 7/25/2019 IT6501 notes.doc

    35/54

  • 7/25/2019 IT6501 notes.doc

    36/54

    7otations n 3-" ?hen we performed rotations in two dimensions we only had the choice of

    rotating about the z a%is n the case of three dimensions we have more options / 7otate about % /

    7otate about y / 7otate about z

  • 7/25/2019 IT6501 notes.doc

    37/54

  • 7/25/2019 IT6501 notes.doc

    38/54

    1eneral 3" 7otations X 7otation about an a%is that is parallel to one of the coordinate

    a%es E +. Translate the object so that the rotation a%is coincides with the parallel coordinate a%is

    . Aerform the specified rotation about the a%is 3. Translate the object so that the rotation a%is is

    moved back to its original position X Not parallel E +. Translate the object so that the rotation a%is

    passes through the coordinate origin . 7otate the object so that the a%is of rotation coincides

    with one of the coordinate a%es 3. Aerform the specified rotation about the a%is 4. !pply inverse

    rotations to bring the rotation a%is back to its original orientation 5. !pply the inverse translation

    to bring back the rotation a%is to its original position

    3 " Transformation functions X =unctions are / translate3#translateMector, matri%Translate$ /

    rotate@#theta@, %Fatri%7otate$ / rotate(#theta(, yFatri%7otate$ / rotate#theta,

    zFatri%7otate$ / scale3#scaleMector,matri%&cale$ X To apply transformation matri% to the

    specified points , / transformAoint3#inAoint, matri%,outAoint$ X ?e can construct composite

    transformations with the following functions / composeFatri%3 / buildTransformationFatri%3 /

    composeTransformationFatri%3 C&9+KComputer 1raphicsK"ept of C&> 34 7eflections n 3-" XThree "imensional 7eflections can be performed relative to a selected reflection a%is or a

    selected reflection plane X Consider a reflection that converts coordinate specifications from a

    right handed system to left handed system. X This transformation changes the sign of

    coordinate leaving % and y coordinates

    Shears In 3D

    &hearing transformations are used to distortions in the shape of an object. n ", shearing is

    applied to % or y a%es. n 3" it can applied to z a%is also

    The following transformation produces an a%is shear

    + 0 a 0

    &2z

    0 + b 0

    0 0 + 0

    0 0 0 +

  • 7/25/2019 IT6501 notes.doc

    39/54

    Aarameters a and b can be assigned any real values

    3D iewing

    X ?orld coordinate system#where the objects are modeled and defined$

    X Miewing coordinate system#viewing objects with respect to another user

    defined coordinate system$

    X Arojection coordinate system#coordinate positions to be on the projection

    plane$

    X "evice Coordinate &ystem #pi%el positions in the plane of the output

    device$

    steps to establish a Miewing coordinate system or view reference coordinate

    system and the view plane

    ,ransformation from world to viewing coordinates

    X Translate the view reference point to the origin of the world

    coordinate system

    X !pply rotations to align the a%es

    / Three rotations of three a%es

    / Composite transformation matri% #unit vectors u, v, n$

    X n) NPNP

    X u ) #MIN$ PMINP

  • 7/25/2019 IT6501 notes.doc

    40/54

  • 7/25/2019 IT6501 notes.doc

    41/54

  • 7/25/2019 IT6501 notes.doc

    42/54

  • 7/25/2019 IT6501 notes.doc

    43/54

    where @,( and represent vectors in a 3", additive color space.

    !ny color CY is e%pressed as

    CY ) @< * (? * H------------- #+$

    to match CY.

    ?here @,( and designates the amounts of the standard primaries needed

    t is convenient to normalize the amount in e'uation #+$ against luminance

    #@* (* $. Normalized amounts are calculated as,

    % ) @#@*(*$, y ) (#@*(*$, z ) #@*(*$

    with % * y * z ) +

    !ny color can be represented with just the % and y amounts. The parameters % and y are

    called the chromaticity values because they depend only on hue and purity.

    f we specify colors only with % and y, we cannot obtain the amounts @, ( and . so, a

    complete description of a color in given with the 3 values %, y and (.

    @ ) #%y$(, ) #zy$(

    ?here z ) +-%-y.

    Intuitive Color Concepts

    Color paintings can be created by mi%ing color pigments with white and black

    pigments to form the various shades, tints and tones.

    &tarting with the pigment for a Zpure color[ the color is added to black pigment to

    produce different shades. The more black pigment produces darker shades.

    "ifferent tints of the color are obtained by adding a white pigment to the original color,

    making it lighter as more white is added.

    Tones of the color are produced by adding both black and white pigments.

  • 7/25/2019 IT6501 notes.doc

    44/54

    )$ Color *odel

    ased on the tristimulus theory of version, our eyes perceive color through the

    stimulation of three visual pigments in the cones on the retina.

    These visual pigments have a peak sensitivity at wavelengths of about 630 nm #red$, 530

    nm #green$ and 450 nm #blue$.

    y comparing intensities in a light source, we perceive the color of the light.

    This is the basis for displaying color output on a video monitor using the 3 color primaries,

    red, green, and blue referred to as the 71 color model. t is represented in the below

    figure

    Mertices of the cube on the a%es represent the primary colors, the remaining verticesrepresents the complementary color for each of the primary colors.

    The 71 color scheme is an additive model. #i.e.,$ ntensities of the primary colors are

    added to produce other colors.

    >ach color point within the bounds of the cube can be represented as the triple #7,1,$

    where values for 7, 1 and are assigned in the range from 0 to+.

    The color CY is e%pressed in 71 component as

    CY ) 7 * 1) * $

    The magenta verte% is obtained by adding red and blue to produce the triple #+,0,+$ and

    white at #+,+,+$ in the sum of the red, green and blue vertices.

    &hades of gray are represented along the main diagonal of the cube from the origin #black$

    to the white verte%.

  • 7/25/2019 IT6501 notes.doc

    45/54

    ?IJ Color *odel

    The National Television &ystem Committee #NT&C$ color model for forming the

    composite video signal in the (\ model.

    n the (\ color model, luminance #brightness$ information in contained in the (

    parameter, chromaticity information #hue and purity$ is contained into the and \

    parameters.

    ! combination of red, green and blue intensities are chosen for the ( parameter to yield

    the standard luminosity curve.

    &ince ( contains the luminance information, black and white TM monitors use only the (

    signal.

    Aarameter contain orange-cyan hue information that provides the flash-tone shading and

    occupies a bandwidth of +.5 F2z.

    Aarameter \ carries green-magenta hue information in a bandwidth of about 0.6F2z.

    C*? Color *odel

    ! color model defined with the primary colors cyan, magenta, and yellow #CF($ in

    useful for describing color output to hard copy devices.

    t is a subtractive color model #i.e.,$ cyan can be formed by adding green and blue light.

    ?hen white light is reflected from cyan-colored ink, the reflected light must have no redcomponent. i.e., red light is absorbed or subtracted by the link.

    Fagenta ink subtracts the green component from incident light and yellow subtracts the

    blue component.

  • 7/25/2019 IT6501 notes.doc

    46/54

    n CF( model, point #+,+,+$ represents black because all components of the incident

    light are subtracted.

    The origin represents white light.

    >'ual amounts of each of the primary colors produce grays along the main diagonal of

    the cube.

    ! combination of cyan and magenta ink produces blue light because the red and green

    components of the incident light are absorbed.

    The printing process often used with the CF( model generates a color point with a

    collection of 4 ink dotsU one dot is used for each of the primary colors #cyan, magenta and

    yellow$ and one dot in black.

    5S Color *odel

    The 2&M model uses color descriptions that have a more interactive appeal to a user.

    Color parameters in this model are hue #2$, saturation #&$, and value #M$. The 3"

    representation of the 2&M model is derived from the 71 cube. The outline of the

    cube has the he%agon shape.

    The boundary of the he%agon represents the various hues, and it is used as the top of

    the 2&M he%cone.

    n the he%cone, saturation is measured along a horizontal a%is, and value is along a

    vertical a%is through the center of the he%cone.

    2ue is represented as an angle about the vertical a%is, ranging from 00

    at red

    through 3600. Mertices of the he%agon are separated by 60

    0intervals. (ellow is at

    600, green at +0

    0and cyan opposite red at 2 ) +

  • 7/25/2019 IT6501 notes.doc

    47/54

  • 7/25/2019 IT6501 notes.doc

    48/54

  • 7/25/2019 IT6501 notes.doc

    49/54

    In&etweens

    n betweens are the intermediate frames between the key frames.

    The number of in between needed is determined by the media to be used to display

    the animation.

    =ilm re'uires 4 frames per second and graphics terminals are refreshed at the rate of

    30 to 60 frames per seconds.

    Time intervals for the motion are setup so there are from 3 to 5 in-between for each

    pair of key frames.

    "epending on the speed of the motion, some key frames can be duplicated.

    =or a + min film se'uence with no duplication, +440 frames are needed.

    Bther re'uired tasks are

    Fotion verification

    >diting

    Aroduction and synchronization of a sound track.

    )eneral Computer Animation /unctions

    &teps in the development of an animation se'uence are,

    o Bbject manipulation and rendering

    o Camera motion

    o 1eneration of in-betweens

    !nimation packages such as wave front provide special functions for designing the

    animation and processing individuals objects.

    !nimation packages facilitate to store and manage the object database.

    Bbject shapes and associated parameter are stored and updated in the database. Fotion can

    be generated according to specified constraints using " and 3" transformations.

    &tandard functions can be applied to identify visible surfaces and apply therendering algorithms.

    Camera movement functions such as zooming, panning and tilting are used formotion simulation.

    1iven the specification for the key frames, the in-betweens can be automatically

    generated.

  • 7/25/2019 IT6501 notes.doc

    50/54

  • 7/25/2019 IT6501 notes.doc

    51/54

  • 7/25/2019 IT6501 notes.doc

    52/54

  • 7/25/2019 IT6501 notes.doc

    53/54

    &uppose we e'ualize the edge count and parameters k and k*+ denote

    the number of line segments in two consecutive frames. ?e define,

    ma% ) ma% #k, k*+$

    min ) min#k , k*+$

    Ne ) ma% mod min

    Ns ) int #ma%min$

    The preprocessing is accomplished by

    "ividing Ne edges of keyframemin into Ns*+ section.

    "ividing the remaining lines of keyframemin into Ns sections.

    =or e%ample, if k ) +5 and k*+ ) ++, we divide 4 lines of keyframek*+ into

    sections each. The remaining lines of keyframek*+ are left infact.

    f the vector counts in e'ualized parameters Mk and Mk*+ are used to denote the

    number of vertices in the two consecutive frames. n this case we define

    Mma% ) ma%#Mk,Mk*+$, Mmin ) min# Mk,Mk*+$ and

    Nls ) #Mma% -+$ mod #Mmin / +$

    Np ) int ##Mma%/ +$#Mmin / + $$

    Areprocessing using verte% count is performed by

    !dding Np points to Nls line section of keyframemin.

    !dding Np-+ points to the remaining edges of keyframemin.

    Simulating Accelerations

    Curve-fitting techni'ues are often used to specify the animation paths between key frames.

    1iven the verte% positions at the key frames, we can fit the positions with linear or nonlinear

    paths. =igure illustrates a nonlinear fit of key-frame positions. This determines the trajectories

    for the in-betweens. To simulate accelerations, we can adjust the time spacing for the in-

    betweens.

    =or constant speed #zero acceleration$, we use e'ual-interval time spacing for the in-

    betweens. &uppose we want n in-betweens for key frames at times t+ and t.

    The time interval between key frames is then divided into n * + subintervals, yielding an in-

    between spacing of

  • 7/25/2019 IT6501 notes.doc

    54/54

    ) t-t+n*+

    we can calculate the time for any in-between as

    tj ) t+*j t, j ) +,, . . . . . . n

    *otion Specification

    These are several ways in which the motions of objects can be specified in an

    animation system.

    Direct *otion Specification

    2ere the rotation angles and translation vectors are e%plicitly given.

    Then the geometric transformation matrices are applied to transform coordinate

    positions.

    ?e can appro%imate the path of a bouncing ball with a damped, rectified, sine

    curve

    y #%$ ) ! sin#% * J0$ e-k%

    where ! is the initial amplitude, is the angular fre'uency, J0 is the phase angle and k is the

    damping constant.