The best revenge is massive SUCCESS
--Your friends at LectureNotes

Computer Graphics

by Ravi Shankar
Type: NoteInstitute: JNTUK KAKINADA Course: B.Tech Specialization: Computer Science EngineeringViews: 14Uploaded: 8 months agoAdd to Favourite

Share it with your friends

Suggested Materials

Leave your Comments


Ravi Shankar
Ravi Shankar
1|Page Fractal: Def: A fractal is a geometric object with fractional dimension. A fractal is an abstract object used to describe and simulate naturally occurring objects. Artificially created fractals commonly exhibit similar patterns at increasingly small scales. Fractals are of 2 types: ➢ Additive fractals ex: cross fractal ➢ Replacement Fractals ex: Sierpinski triangle Self Similarity: Fractals can also be classified according to their self similarity. These are of 3 types: 1) Exact self similarity 2) Quasi self similarity 3) Statistical self similarity Exact self similarity: This is the strongest type of self-similarity; the fractal appears identical at different scales. Fractals defined by iterated function systems often display exact self-similarity. For example, the Sierpinski triangle and Koch snowflake exhibit exact self-similarity Quasi self similarity: This is a looser form of self-similarity; the fractal appears approximately (but not exactly) identical at different scales. Quasi-self-similar fractals contain small copies of the entire fractal in distorted and degenerate forms. Fractals defined by recurrence relations are usually quasi-self-similar. The Mandelbrot set is quasiself-similar, as the satellites are approximations of the entire set, but not exact copies. Statistical self-similarity: This is the weakest type of self-similarity; the fractal has numerical or statistical measures which are preserved across scales. Most reasonable definitions of "fractal" trivially imply some form of statistical self-similarity.(Fractal dimension itself is a numerical measure which is preserved across scales.) Random fractals are examples of fractals which are statistically self-similar. The coastline of Britain is another example; one cannot expect to find microscopic Britain’s (even distorted ones) by looking at a small section of the coast with a magnifying glass.
2|Page Sample code for additive fractal: Def fractal(x,y,size, depth) { Drawcross(x,y,size); If (depth>1) { Fractal(y+size, y, size/2, depth-1); Fractal(x-size, y, size/2, depth-1); Fractal(x, y+size, size/2, depth-1); Fractal(x, y-size, size/2, depth-1); } } Sample code for replacement fractal: Def fractal(x, y, size, depth) { If (depth<=1) { Drawtriangle(x, y, size); } else Fractal(x, y, size/2, depth-1); Fractal(x-size/2, y-size*√3, size/2, depth-1); Fractal(x+size/2, y-size*√3, size/2, depth-1); } } Creating an Image By Means of Iterative Function Systems Another way to approach infinity is to apply a transformation to a picture again and again and examine the results. This technique also provides an another method to create fractal shapes An Experimental Copier We take an initial image I0 and put it through a special photocopier that produces a new image I1. I1 is not a copy of I0 rather it is a superposition of several reduced versions of I0. We then take I1 and feed it back into the copier again, to produce image I2. This process is repeated, obtaining a sequence of images I0, I1, I2… called the orbit of I0. Making new copies from old In general this copier will have N lenses, each of which perform an affine mapping and then adds its image to the output. The collection of the N affine transformations is called an “iterated function system”. An iterated function system is a collection of N affine transformations Ti, for i=1,2,…N.
3|Page Underlying Theory of the Copying Process Each lens in the copier builds an image by transforming every point in the input image and drawing it on the output image. A black and white image I can be described simply as the set of its black points: I = set of all black points = { (x,y) such that (x,y) is colored black } I is the input image to the copier. Then the ith lens characterized by transformation Ti, builds a new set of points we denote as Ti(I) and adds them to the image being produced at the current iteration. Each added set Ti(I) is the set of all transformed points I: Ti(I) = { (x’,y’) such that (x’,y’) = Ti(P) for some point P in I } Upon superposing the three transformed images, we obtain the output image as the union of the outputs from the three lenses: Output image = T1(I) U T2(I) U T3(I) The overall mapping from input image to output image as W(.). It maps one set of points – one image – into another and is given by: W(.)=T1(.) U T2(.) U T3(.) For instance the copy of the first image I0 is the set W (I0). Each affine map reduces the size of its image at least slightly, the orbit converge to a unique image called the attractor of the IFS. We denote the attractor by the set A, some of its important properties are: 1. The attractor set A is a fixed point of the mapping W(.), which we write as W(A)=A. That is putting A through the copier again produces exactly the same image A. The iterates have already converged to the set A, so iterating once more makes no difference. 2. Starting with any input image B and iterating the copying process enough times, we find that the orbit of images always converges to the same A. If Ik = W (k) (B) is the kth iterate of image B, then as k goes to infinity Ik becomes indistinguishable from the attractor A. Drawbacks • Inefficient • Huge amount of memory is required. THE MANDELBROT SET Graphics provides a powerful tool for studying a fascinating collection of sets that are the most complicated objects in mathematics. Julia and Mandelbrot sets arise from a branch of analysis known as iteration theory, which asks what happens when one iterates a function endlessly. Mandelbrot used computer graphics to perform experiments. Mandelbrot Sets and Iterated Function Systems A view of the Mandelbrot set is shown in the below figure. It is the black inner portion, which appears to consist of a cardoid along with a number of wartlike circles glued to it.
4|Page The IFS uses the simple function f(z) = z2 + c -------------------------------(1) where c is some constant. The system produces each output by squaring its input and adding c. We assume that the process begins with the starting value s, so the system generates the sequence of values or orbit d1= (s)2 + c d2= ((s)2 + c)2 + c d3= (((s)2 + c)2 + c)2 + c d4= ((((s)2 + c)2 + c)2 + c)2 + c ------------------------------(2) The orbit depends on two ingredients the starting point s the given value of c Given two values of s and c how do points dk along the orbit behaves as k gets larger and larger. Specifically, does the orbit remain finite or explode. Orbits that remain finite lie in their corresponding Julia or Mandelbrot set, whereas those that explode lie outside the set. When s and c are chosen to be complex numbers , complex arithmetic is used each time the function is applied. The Mandelbrot and Julia sets live in the complex plane – plane of complex numbers. The IFS works well with both complex and real numbers. Both s and c are complex numbers and at each iteration we square the previous result and add c. Squaring a complex number z = x + yi yields the new complex number: ( x + yi)2 = (x2 – y2) + (2xy)i ----------------------------------(3) having real part equal to x2 – y2 and imaginary part equal to 2xy. Defining the Mandelbrot Set The Mandelbrot set considers different values of c, always using the starting point s =0. For each value of c, the set reports on the nature of the orbit of 0, whose first few values are as follows: orbit of 0: 0, c, c2+c, (c2+c)2+c, ((c2+c)2+c)2 +c,…….. Definition: The Mandelbrot set M is the set of all complex numbers c that produce a finite orbit of 0. If c is chosen outside of M, the resulting orbit explodes. If c is chosen just

Lecture Notes