Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS2405 - COMPUTER GRAPHICS LABORATORY. LIST OF EXPERIMENTS 1.Implementation of Bresenhams Algorithm – Line, Circle, Ellipse. 2.Implementation of Line,

Similar presentations


Presentation on theme: "CS2405 - COMPUTER GRAPHICS LABORATORY. LIST OF EXPERIMENTS 1.Implementation of Bresenhams Algorithm – Line, Circle, Ellipse. 2.Implementation of Line,"— Presentation transcript:

1 CS2405 - COMPUTER GRAPHICS LABORATORY

2 LIST OF EXPERIMENTS 1.Implementation of Bresenhams Algorithm – Line, Circle, Ellipse. 2.Implementation of Line, Circle and Ellipse Attributes 3.Two Dimensional transformations - Translation, Rotation, Scaling, Reflection, Shear. 4.Composite 2D Transformations 5.Cohen Sutherland 2D line clipping and Windowing 6.Sutherland – Hodgeman Polygon clipping Algorithm 7.Three dimensional transformations - Translation, Rotation, Scaling 8.Composite 3D transformations 9.Drawing three dimensional objects and Scenes 10.Generating Fractal images

3 List of Equipments and Components 1.Software : 1) Turbo C 2) Visual C++ with OPENGL 3) Any 3D animation software like 3DSMAX, Maya, Blender 2. Operating system : WINDOWS 2000 / XP

4 Bresenham’s Algorithm – Line, Circle & Ellipse The Bresenham's line-drawing algorithm is based on drawing an approximation of the true line. The true line is indicated in bright color, and its approximation is indicated in black pixels. In this example the starting point of the line is (0, 0) and the ending point of the line at (9, 6).

5 Line, Circle and Ellipse Attributes Any parameter that affects the way a primitive is to be displayed is referred to as an attribute parameter. Line attributesCircle attributesEllipse attributes

6 2D Transformations Transformaions are a fundamental part of computer graphics. Transformations are used to position objects, to shape objects, to change viewing positions, and even to change how something is viewed (e.g. the type of perspective that is used). Translation Assume you are given a point at (x,y)=(2,1). Where will the point be if you move it 3 units to the right and 1 unit up? Ans: (x',y') = (5,2). How was this obtained? - (x',y') = (x+3,y+1). That is, to move a point by some amount dx to the right and dy up, you must add dx to the x- coordinate and add dy to the y-coordinate. What was the required transformation to move the green triangle to the red triangle? Here the green triangle is represented by 3 points triangle = { p1=(1,0), p2=(2,0), p3=(1.5,2) }

7 Scaling Suppose we want to double the size of a 2-D object. That is, we must specify how much to change the size along each dimension. Below we see a triangle and a house that have been doubled in both width and height (note, the area is more than doubled). Rotation Below, we see objects that have been rotate by 25 degrees.

8 A sequence of transformations calculate composite transformation matrix rather than applying individual transformations Composite two-dimensional translations Apply two successive translations, T 1 and T 2 Composite transformation matrix in coordinate form Composite transformation

9 2D Clipping & windowing Clipping Techniques in 2D Clipping in Two dimensions Look at some possible cases. 1.Unclipped image 2.Clipped image

10 Window to Viewport Mapping Start with 3D scene, but eventually project to 2D scene 2D scene is infinite plane. Device has a finite visible rectangle. Answer: map rectangular region of 2D device scene to device. Window:rectangular region of interest in scene. Viewport:rectangular region on device. Usually, both rectangles are aligned with the coordinate axes.

11 The Sutherland - Hodgman algorithm performs a clipping of a polygon against each window edge in turn. It accepts an ordered sequence of verices v1, v2, v3,..., vn and puts out a set of vertices defining the clipped polygon. This figure represents a polygon (the large, solid, upward pointing arrow) before clipping has occurred. The following figures show how this algorithm works at each edge, clipping the polygon. Clipping against the left side of the clip window. Clipping against the top side of the clip window. Clipping against the right side of the clip window. Clipping against the bottom side of the clip window. Sutherland - Hodgman Polygon Clipping

12 3-D Transformations Transformations allow the developer to reposition, resize, and reorient models without changing the base values that define them. Translation It moves all the points in the Model3D in the direction of the offset vector with the OffsetX, OffsetY, and OffsetZ properties. For example, one vertex (2,2,2), an offset vector of (0,1.6,1) would move that vertex (2,2,2) to (2,3.6,3). The cube's vertex is still (2,2,2) in model space, but now that model space has changed its relationship to world space so that (2,2,2) in model space is (2,3.6,3) in world space.

13 Scaling It changes the model's scale by a specified scale vector with reference to a center point. Specify a uniform scale, which scales the model by the same value in the X, Y, and Z axes, to change the model's size proportionally. For example, setting the transform's ScaleX, ScaleY, and ScaleZ properties to 0.5 halves the size of the model; setting the same properties to 2 doubles its scale in all three axes.ScaleXScaleYScaleZ

14 Rotation Axis-angle rotations assume rotation about the origin if a value is not specified for the CenterX, CenterY, and CenterZ properties on RotateTransform3D.CenterXCenterYCenterZ As with scaling, it's helpful to remember that the rotation transforms the model's entire coordinate space. If the model was not created about the origin, or has been translated previously, the rotation might "pivot" about the origin instead of rotating in place.

15 Drawing three dimensional objects and Scenes

16 Animation is the rapid display of a sequence of images to create an illusion illusion of movement. The most common method of presenting animation is as a motion picture or video program. The bouncing ball animation consists of these six frames(Flash). This animation moves at 10 frames per second.

17 Generating Fractal images Self similarity between parts and overall features of the object is called fractal.

18


Download ppt "CS2405 - COMPUTER GRAPHICS LABORATORY. LIST OF EXPERIMENTS 1.Implementation of Bresenhams Algorithm – Line, Circle, Ellipse. 2.Implementation of Line,"

Similar presentations


Ads by Google