Presentation is loading. Please wait.

Presentation is loading. Please wait.

Geometric Objects 2001. 7. 6 Computer Graphics Lab. Sun-Jeong Kim.

Similar presentations


Presentation on theme: "Geometric Objects 2001. 7. 6 Computer Graphics Lab. Sun-Jeong Kim."— Presentation transcript:

1 Geometric Objects 2001. 7. 6 Computer Graphics Lab. Sun-Jeong Kim

2 Korea University Computer Graphics -2- Points  Single Coordinate Position  Set the bit value(color code) corresponding to a specified screen position within the frame buffer x y setPixel (x, y)

3 Korea University Computer Graphics -3- Lines  Intermediate Positions between Two Endpoints  DDA, Bresenham’s line algorithms Jaggies = Aliasing

4 Korea University Computer Graphics -4- DDA Algorithm  Digital Differential Analyzer  Slope >= 1  Unit x interval = 1  0 < Slope < 1  Unit y interval = 1  Slope <= -1  Unit x interval = -1  -1 < Slope < 0  Unit y interval = -1 x1 y1 x2 y2 x1 y1 x2 y2 x1 y1 x2 y2 x1 y1 x2 y2

5 Korea University Computer Graphics -5- Bresenham ’ s Line Algorithm  Midpoint Line Algorithm  Decision variable NE M Q  d > 0 : choose NE  : d new = d old +a  d <= 0 : choose E  : d new = d old +a+b P(x p, y p )E

6 Korea University Computer Graphics -6- Bresenham ’ s Algorithm(cont.)  Initial Value of d  Update d

7 Korea University Computer Graphics -7- Polygons  Filling Polygons  Scan-line fill algorithm  Inside-Outside tests  Boundary fill algorithm

8 Korea University Computer Graphics -8- Scan-Line Polygon Fill  Topological Difference between 2 Scan lines  y : intersection edges are opposite sides  y’ : intersection edges are same side y y’

9 Korea University Computer Graphics -9- Scan-Line Polygon Fill (cont.)  Edge Sorted Table C C’ B D E A 0 1 yAyA yDyD yCyC Scan-Line Number yEyE xAxA 1/m AE yByB xAxA 1/m AB y C’ xDxD 1/m DC yEyE xDxD 1/m DE yByB xCxC 1/m CB

10 Korea University Computer Graphics -10- Inside-Outside Tests  Self-Intersections  Odd-Even rule  Nonzero winding number rule exterior interior

11 Korea University Computer Graphics -11- Boundary-Fill Algorithm  Proceed to Neighboring Pixels  4-Connected  8-Connected

12 Korea University Computer Graphics -12- Antialiasing  Aliasing  Undersampling: Low-frequency sampling  Nyquist sampling frequency:  Nyquist sampling interval:

13 Korea University Computer Graphics -13- Antialiasing (cont.)  Supersampling (Postfiltering)  Pixel-weighting masks  Area Sampling (Prefiltering)  Pixel Phasing  Shift the display location of pixel areas  Micropositioning the electron beam in relation to object geometry

14 Korea University Computer Graphics -14- Supersampling  Subpixels  Increase resolution 101112 20 21 22 (10, 20): Maximum Intensity (11, 21): Next Highest Intensity (11, 20): Lowest Intensity

15 Korea University Computer Graphics -15- Pixel-Weighting Masks  Give More Weight to Supixels Near the Center of a Pixel Area 121 244 121

16 Korea University Computer Graphics -16- Area Sampling  Set Each Pixel Intensity Proportional to the Area of Overlap of Pixel  2 Adjacent vertical (or horizontal) screen grid lines  trapezoid 101112 20 21 22 (10, 20): 90% (10, 21): 15%

17 Korea University Computer Graphics -17- Filtering Techniques  Filter Functions (Weighting Surface) Box FilterCone FilterGaussian Filter

18 Mathematics for CG

19 Korea University Computer Graphics -19- Coordinate Reference Frames  2D Cartesian Reference Frames x y x y

20 Korea University Computer Graphics -20- 2D Polar Coordinate Reference Frame

21 Korea University Computer Graphics -21- 3D Cartesian Reference Frame  Right-Handed v.s. Left-Handed Right-handedLeft-handed

22 Korea University Computer Graphics -22- 3D Curvilinear Coordinate Systems  General Curvilinear Reference Frame  Orthogonal coordinate system  Each coordinate surfaces intersects at right angles

23 Korea University Computer Graphics -23- Cylindrical-Coordinate : radius of vertical cylinder : vertical plane containing z-axis : horizontal plane parallel to xy-plane constant Transform to Cartesian coordinator x axis y axis z axis

24 Korea University Computer Graphics -24- Spherical-Coordinate : radius of sphere : vertical plane containing z-axis : cone with the apex at the origin constant Transform to Cartesian coordinator x axis y axis z axis

25 Korea University Computer Graphics -25- Solid Angle  3D Angle Defined on a Sphere  Steradian Steradian : Total solid angle : steradian

26 Korea University Computer Graphics -26- Points & Vectors  Point  Position in some reference frame  Distance from the origin depends on the reference frame P Frame B Frame A x y

27 Korea University Computer Graphics -27- Points & Vectors (cont.)  Vector  Difference between two point positions  Properties : Magnitude & direction  Same properties within a single coordinate system  Magnitude is independent from coordinate frames Magnitude : Direction :

28 Korea University Computer Graphics -28- 3D Vector  Magnitude  Directional angle

29 Korea University Computer Graphics -29- Vector Addition & Scalar Multiplication  Addition  Scalar multiplication

30 Korea University Computer Graphics -30- Vector Multiplication  Scalar Product(Inner Product) Commutative : Distributive : Orthogonal :

31 Korea University Computer Graphics -31- Vector Multiplication (cont.)  Vector Product(Cross Product) Noncommutative : Nonassociative : Distributive : Right-handed rule!


Download ppt "Geometric Objects 2001. 7. 6 Computer Graphics Lab. Sun-Jeong Kim."

Similar presentations


Ads by Google