Computer Graphics Review Notes

Source: Internet
Author: User

Computer Graphics Review Notes

(Personal finishing, only do review with:D, reproduced annotated Source: http://blog.csdn.net/hcbbt/article/details/42779341)

The first chapter of computer graphics summary
  • Research content

    • The concept of graphics: The research object of computer graphics

      • Objective object that can produce visual impression in human visual system
      • Including natural scenery, captured pictures, mathematical descriptions of graphics, etc.
    • Elements of a graphic

      • Geometric elements: Depicting objects ' outlines, shapes, etc.
      • Non-geometrical elements: depicting the object's color, material, etc.
    • Graphical representation

      • Lattice representation
        Enumerates all the dots in the graph, referred to as images .
      • Parameter representation
        It is represented by the shape parameters of the graph (the coefficients of the equation or analytic expression, the endpoint coordinates of the segment, etc.) + the attribute parameters (color, linetype, etc.), referred to as the graph .
    • Relationship with related disciplines

      • Image transformation (image processing)
      • Image generation (computer graphics)
      • Model (feature) extraction (computer vision, pattern recognition)
      • Model Transformations (computational geometry)
  • Development history _ Software development and software standards

    • General standards
      • GKS (first official standard, 1977)
      • Phigs
    • Fact Standard
      • DirectX (MS)
      • OpenGL (SGI)
      • Adobe company PostScript
  • The application of computer graphics

    • Graphical user interface: A communication between man and computer, man and machine.
    • CAD/CAM: design, layout
    • Visualization of scientific computations
    • Transaction management
    • Geographic Information System (GIS)
    • Multimedia
    • Entertainment
    • Computer Art
    • Virtual reality
  • Current research trends

    • Moulding Technology
    • Realistic graphic rendering technology
    • Human-Machine Interaction technology
    • Close integration with computer network technology
Chapter II Overview of graphic systems
  • Video display device

    • Refresh CRT

      • Most video monitor operations are standard-based cathode ray tubes (CRT)
      • CRT electron gun, focusing system, acceleration electrode, deflection system, screen composition
      • The screen glows by collecting an electron beam through a fluorescent substance.
      • Continuous glow Time: When the electron beam leaves a point, the luminance value of the point decays to the initial value of 1/10 of the time required
      • refresh rate : The number of times to redraw the screen per second: The minimum refresh frequency required for the CRT to produce a stable image = 1 seconds/duration of fluorescence material
      • Pixel: The smallest element that makes up a screen (image)
      • Resolution: The maximum number of pixels that the CRT can recognize in horizontal or vertical units of length, usually dpi
    • Raster Scan Display

      • Scan line, in the raster scanning system, the electron beam transverse scan screen, one line, from top to bottom, each line is called a scan line;
      • Frame, frame refers to the entire screen range;
      • Frame cache or refresh the cache, the graphical definition is stored in a memory called flush cache or frame cache, which holds a set of intensity values corresponding to all points on the screen, and the intensity value of the beam is removed from the refresh cache or the frame cache when the electrons are moved point-by-step on the screen.
      • Cache depth or bit plane number, the number of bits per pixel is called the cache depth or bit plane number;
      • Bitmap, a per-pixel frame cache is often referred to as a bitmap;
      • Pixel graph, multi-bit frame cache per pixel is called pixel graph;
      • Horizontal back sweep, after each scan line is refreshed, the electron beam returns to the left end of the screen, called the horizontal sweep of the electron beam;
      • Vertical sweep, at the end of each frame, the electron beam returns to the upper-left corner of the screen, beginning to show the next frame, called the vertical sweep of the electron beam;
      • Interlaced scanning, first starting from line No. 0, scanning every other row, the even line is scanned after the vertical sweep, the electron beam starts from line 1th scan all odd lines.
    • Random Scan Display

      • The electron beam only displays part of the graphic on the screen. The electron beam tracks the composition lines of the graph, creating a line chart.
      • Refresh display file: The flush rate of the random scan system depends on the number of lines displayed.
    • Color CRT monitor
      • Electron beam penetration: an anti-recurrence display of color graphics coated with different layers of fluorescent powder on the screen, the emission color is determined by the penetration depth of the electron beam in the fluorescence layer.
      • Shadow Mask Method: Commonly used in grating scanning system, it can produce a color range than the electron beam penetration method much larger
    • Flat Panel Display
      • Divided into: Transmitter display (not practical) and non-transmitting display (LCD)
    • Three-dimensional observation equipment
      • 3D Glasses
  • Grating Scanning system

    • Advantages:
      • Low cost
      • Easy to draw filled graphics
      • Color Rich
      • Refresh frequency must be irrelevant to the complexity of the graph
      • Easy to modify graphics
    • Disadvantages:
      • Scan conversion Required
      • will create confusion (aliasing)
    • Normal graphics card = Video Controller + cache (memory)
    • Graphics accelerator card = Video Controller + memory + Display Processor (GPU)
  • Input device

    • Two-dimensional: mouse, coordinate digitizer, tracking ball, stylus, touch screen, joystick, scanner.
    • Three-dimensional: space ball, data glove.
  • Hard copy Device

    • Long-term Save graphics
    • Example: Plotter, printer
  • Graphics software

    • Coordinate representation:
      • World coordinate system: Usually the world coordinate system is a three-dimensional Cartesian coordinate system. It is a global coordinate system, usually a right-handed coordinate.
      • Modeling coordinate system (local coordinate system): a two-dimensional or three-dimensional Cartesian coordinate system defined independently of the world coordinate system is called a local coordinate system for the sake of geometrical modeling and observing objects.
      • Device coordinate system or screen coordinate system: the screen coordinate system is also known as the device coordinate system, which is used primarily for the definition of a point on a particular computer graphics display device, such as a raster display.
    • Device coordinates, normalized coordinates, world coordinates, modeling coordinates
    • The basic building blocks of a graph are called output elements
    • The modeling transformation uses the object description given by the modeling coordinates to form the scene
    • observation transforms are used to specify the view to be displayed and the range that appears in the output display area
    • Main Tasks :
      • Vertex datasets for modeling (Modeling) objects
      • The geometry processing (geometric processing) object is a vertex, including: projection, element assembly, Clipper, shading
      • Rasterize or Scan Transformations (rasterization) generate fragments from cropped objects
      • Chip handling (Fragment processing)
  • Opengl

    • About OpenGL
      Core library (GL): Base library.
      Utility Library (GLU): An additional library that handles specialized operations.
      Utility Function Toolkit (GLUT): Utility Toolkit.

    • OpenGL Basic Syntax
      Xxx

Chapter Three output elements
  • Generation of primitives (scan transformations):

    • The transformation from the parameter representation of an entity (as specified by the consumer of the graphics package) to the bitmap representation (the representation required by the raster Display system refresh).
    • The main tasks include: determining the set of pixels and their colors, and displaying graphical objects.
  • Line Drawing algorithm

    • Digital differential (DDA) line drawing algorithm
      void lineDDA(int x0, int y0, int xEnd, int yEnd) {    int dx = xEnd - x0, dy = yEnd - y0, steps, k;    float xIncrement, yIncrement, x = x0, y = y0;    if (abs(dx) > abs(dy))  //判断斜率是否大于        steps = abs(dx);    else        steps = abs(dy);    xIncrement = float(dx) / float(steps);    yIncrement = float(dy) / float(steps);    setPixel(round(x), round(y));    for (k = 0; k < steps; k++) {        x += xIncrement;        y += yIncrement;        setPixel(round(x), round(y));    }}
    • Bresenham Drawing Line algorithm
      // 下面的是斜率 < 1.0 的程序// 斜率 > 1.0 的只要交换 x x和 y 方向的规则即可void lineBres(int x0, int y0, int xEnd, int yEnd) {    int dx = fabs(xEnd - x0);    int dy = fabs(yEnd - y0);    int p = 2 * dy - dx;    int twoDy = 2 * dy, twoDyMinusDx = 2 * (dy - dx);    int x, y;    if (x0 > xEnd) {        x = xEnd;        y = yEnd;        xEnd = x0;    } else {        x = x0;        y = y0;    }    setPixel(x, y);    while (x < xEnd) {        x++;        if (p < 0)            p += twoDy;        else {            y++;            p += twoDyMinusDx;        }        setPixel(x, y);    }}
    • Discussion on the algorithm of drawing line
      • Order of Line end points
      • The brightness of the segment
    • Drawing line Algorithm Assessment method:
      1. Formula derivation
      2. Give specific examples, such as the Point (8,10), which depicts the middle point.
  • Generation of circular arc ellipses

    • Circle Generation
      • direct discretization: discrete points, discrete angles
      • Midpoint Circle Method SPAN>&NBSP : Detailed demo
        • f (x, y) =x^2+y^2-r^2
        • if F (x+1,y+0.5) >=0 , the next point is (x+2,y-0.5)
        • if F (x+1,y+0.5) <0 , the next point is (x+2,y-1.5)
        • Set D value, per Increment can
      • positive and negative draw a circle
        • if f (xi,yi) <0, the Point pi is in the circle, then the next step should go outside the circle
        • if f (xi,y i) >0, stating that the point pi is outside the circle, then the next step should go inside the circle
  • Polygon Fill Area

    • Polygon Bump Determination:
      • Extension method: Extend each side to see if the vertices are distributed on both sides of the extension line, concave polygons
      • Vector method
        1. Calculates the cross product of a polygon's edge vector in a counterclockwise direction
        2. A symbol that records the z component of the cross product result.
        3. If the z component becomes negative, the polygon is a concave polygon, which can be decomposed by an extension line along the first edge of the cross-vector pair
    • Determine the internal and external relationships between points and polygons:
      • X-ray method (parity rule): From the point of departure to any direction for the Ray, calculate this ray and polygon all the intersection number, if the number of intersections is odd, then point inside the polygon, if the number of intersections is even, then point in the polygon outside.
      • Non-0 Wrapping rule: All edges are counted by uniform direction how many are passed through this ray from the same side, and how many are passed from the other side of the ray, and then subtracted if the result is zero, indicating that the previously selected point is outside the graph, and all other non-zero are represented internally
    • Method of polygon mesh representation
      • An explicit representation
      • Pointer to vertex table
      • Pointer to edge table
      • Equation representation
Fourth. Attributes of an entity
  • Colors and Lookup Tables

    • Color is a basic property of all entities
    • In color grating systems, the number of colors available depends on the storage capacity provided in the frame cache.
    • Color information has two storage methods: direct storage of RGB encoding. Store Color codes (lookup table)
    • Use a color table to provide a reasonable number of simultaneous displays
  • The properties of the point

    • Color
    • Size
  • Properties of the line

    • Line width
    • Brushes and paint brushes
    • Linear
  • Fill Area Properties

    • Fill mode
    • Color Blend Fill Area
  • Universal Scan Line filling algorithm

    • The scanning line algorithm is to calculate the intersection interval of scan line and polygon according to the scanning line order, and then display the pixels of these intervals with the required color to complete the conversion work. The endpoints of the interval can be obtained by calculating the intersection of the scan line and the polygon boundary.
    • For a scan line, the scanning conversion process for polygons can be divided into four steps:
      1. Intersection: Calculates the intersections between the scanned lines and the polygon edges;
      2. Sort: Sorts all intersections in ascending order of X-values;
      3. Pairing: The first with the second, the third and the fourth, and so on; each pair of intersections represents an intersection of a scan line and a polygon,
      4. Coloring: The pixels in the intersection interval are placed into a polygon color, and the pixels outside the intersecting interval are placed into the background color.
  • Irregular boundary Area Fill method

    • recursive algorithm
        void flood_fill_4 (int x, y, Old_color, fill_color) {int current;    Current = Read_pixel (x, y);        if (current = = Old_color && Current! = Fill_color) {write_pixel (x, y, Fill_color);   Flood_fill_4 (x-1, y, Old_color, Fill_color);  /* Left */flood_fill_4 (x, y + 1, old_color, Fill_color);  /* On */flood_fill_4 (x + 1, y, Old_color, Fill_color);   /* Right */flood_fill_4 (x, Y-1, Old_color, Fill_color); /* below */}}  
    • Scan line algorithm demo
      void Scanline(int x, int y) {    if (x < 0 || x >= ROW || y < 0 || y >= COL || vis[x][y])        return;    int xl = 0, xr = 0, i;    drawPoint(x, y, 2);    for (xl = x - 1; xl >= 0; xl--) {        if (!vis[xl][y])            drawPoint(xl, y, 2);        else            break;    }    for (xr = x + 1; xr < ROW; xr++) {        if (!vis[xr][y])            drawPoint(xr, y, 2);        else            break;    }    for (i = xl + 1; i < xr; i++) {        Scanline(i, y - 1);        Scanline(i, y + 1);    }}
  • Anti-aliasing

    • Aliasing
      • The distortion caused by a continuous amount (graph) in discrete quantities (pixels), called confusion or aliasing (aliasing).
    • The aliasing phenomenon of raster graphics:
      • Ladder-like boundary;
      • Distorted graphic details;
      • Small graphics lost: The animation sequence is hidden and flashing.
Fifth chapter geometric transformations
  • Mathematical basis of matrix operation
  • Basic two-dimensional geometric transformations

    • Panning x‘=x+tx, y‘=y+ty
    • Rotate x‘=xcosθ-ysinθ, y‘=xsinθ+ycosθ
    • Zoom x‘=sxx, y‘=syy
  • Matrix representation and homogeneous coordinates

    • Homogeneous coordinates: Using n+1 dimension to represent n-dimensional vectors
  • Inverse transformation

    • Inverse matrix of the translation transform T (tx,ty) is T (-tx,-ty)
    • Inverse matrix of rotation transform R (θ) is R (-θ)
    • The inverse matrix of the scaling transform s (sx,sy) is S (1/sx,1/sy)
  • Two-dimensional composite transformation

    • Matrix multiplication is not exchangeable
    • The efficient implementation of composite two-dimensional transformation should be: first, by using matrix multiplication, several basic two-dimensional transformation matrices are combined into a composite two-dimensional transformation matrix, and then the transformed coordinates are computed.
  • Other two-dimensional transformations

    • Symmetric transformations
    • Split-cut transformation
  • Transformation between two-dimensional coordinate systems

    • Steps:
      1. Translates the coordinate origin of the X ' Y ' system to the origin of the XY system.
      2. Rotate the x ' axis onto the x-axis.
    • M = R(- θ)*T(-x0,-y0)
  • Geometric transformation of three-dimensional space

    • Right-hand coordinate
    • Three-dimensional translation
      // x 轴0   1   0   00   C   -S  00   S   C   00   0   0   1// y 轴C   0   S   00   1   0   0-S  0   C   00   0   0   1// z 轴C   -S  0   0S   C   0   00   0   1   00   0   0   1
    • Three-dimensional rotation
      1. Pan the point P1 to the coordinate origin
      2. Rotates around the x-axis, transforms the vector u to the xz plane for U '
      3. Rotates around the y-axis, transforming the unit vector u ' to the z-axis positive direction
      4. Angle of rotation around Z axis θ
      5. Transform the axis of rotation back to its original position using the inverse transform of the first 3 steps
      6. R(θ)=T(x1,y1,z1)·Rx(α)T·Ry(β)T·Rz(θ)·Ry(β)·Rx(α)·T(-x1,-y1,-z1)
    • Three-dimensional scaling
      Sx  0   0   00   Sx  0   00   0   Sz  00   0   0   1
  • Three-dimensional composite transformation

    • Matrix multiplication Merge
    • The rightmost matrix is the first transformation that acts on an object, and the leftmost matrix is the last
  • Transformation between three-dimensional coordinate system

    • Use the unit axis vector to achieve:
      Ux1 Ux2 Ux3 0Uy1 Uy2 Uy3 0Uz1 Uz2 Uz3 00   0   0   1
  • Affine transformations

    • Translation, rotation, scaling, reflection, and error cutting are special cases of two-dimensional affine transformations
The sixth chapter two-dimensional observation
  • Two-dimensional observation line

    • The area to be displayed in the world coordinate system is called a window (clipping window)
    • The area that the window maps to the display is called a viewport.
    • The window defines what is displayed, and where the viewport definition appears.
    • An operation that typically maps a portion of a world coordinate system to a device coordinate system is called an observation transformation.
    • Device coordinates, normalized coordinates, world coordinates, modeling coordinates
  • OpenGL Two-dimensional observation function

    • gluOrtho2D(xwmin, xwmax, ywmin, ywmax);glViewport(xvmin, yvmin, width, height);
  • Clipping of two-dimensional points

    • xwmin <= x <= xwmax; ywmin <= y <= ywmax; The point is preserved if satisfied.
  • Clipping of two-dimensional lines

    • Cohen-sutherland algorithm
      • Basic idea:
        1. If the two endpoints of the line are P1P2 completely inside the window, the segment is displayed p1p2, for short, "take"
        2. If the two endpoints of the line p1p2 clearly outside the window, the segment is discarded, for short, "Discard"
        3. Line clipping
      • Area code
        位       4   3   2   1坐标区   上  下  右  左
      • It is very convenient to use area code, detailed algorithm analysis
    • Midpoint segmentation algorithm
      • Also use area code
      • Basic ideas The first two steps are the same as the Cohen-sutherland algorithm:
        • 3 Midpoint Segmentation method to find the intersection between the line segment and the window: that is, from the P0 point to locate the closest visible point from P0 A and from the P1 point to find the closest visible point from P1 B, two visible points between the lines is the visible part of the segment p0p1.
      • Comparison of Cohen-sutherland algorithm and midpoint segmentation algorithm
    • Cyrus-beck algorithm
      • The line segment is represented as a parametric equation, and the parameters of the intersection point of the segment and the window boundary are determined, and the visible part of the segment is calculated and the intersection coordinates are computed by the parameters of the intersection.
      • Suitable for convex polygon cropping window
    • Liang Youdong-barsky algorithm
      • simplified parametric re-processing up<=q
      • The second part of the detailed algorithm analysis
    • NLN algorithm
      • Basic idea:
        • To the four corners of the window to be treated with a ray of light
The seventh chapter three-dimensional observation
    • Three-dimensional observation concept Overview

      • projection
      • depth
      • visible lines and meeting decisions
    • Three-dimensional observation pipeline

      • Model coordinates--(modeling transformations), world coordinates (see transformations), observation coordinates---projection transformation-- > (normalized transformations and cropping), normalized coordinates---(viewport transform), device coordinates
    • Three-dimensional observation coordinate parameters

      • observation Point (observation position, viewpoint, camera position)
      • watch up vector
    • Transformation of the world coordinate system to the viewing coordinate system

      • M = R * T
      • T (-x0,-y0,-z0)
      • R (UVN) (see ' Three-dimensional coordinate system ' Transform ')
    • projection transform

      • A projection transformation is the transformation of a point with a dimension n to a point where the dimension is less than N.
      • Type:
        • parallel projection
        • perspective projection
        • Spherical projection
        • cylindrical projection
      • positive projection

        • axis side positive projection
      • oblique projection

        • when the projection path is not perpendicular to the observation plane, the map is called oblique parallel projection
      • Perspective projection

        • vanishing Point
Eighth three-dimensional object representation
    • Multipatch

      • Method of polygon mesh representation
        • An explicit representation
        • Pointer to vertex table
        • Pointer to edge table
        • Equation representation
    • OpenGL Multipatch Functions

      • Function
        // 三棱锥glutWiredTetrahedron();glutSolidTetrahedron();// 立方体glutWireCube(edgeLength);glutSolidCube(edgeLength);// 八面体glutWireOctahedron();glutSolidOctahedron();// 12glutWireDodecahedron();glutSolidDodecahedron();// 20glutWireIcosahedron();glutSolidIcosahedron();
    • Surface

      • Common surfaces: Two-times surfaces, super two-times surfaces, polynomial and exponential functions, spline surfaces
    • Two-time surface

      • x=rcosΦcosθ             (-π/2 <=Φ<=π/2)y=rcosΦsinθ              (-π<=θ<=π) z=rsinθ
The Nineth chapter can meet the discriminant algorithm
  • Visible face discrimination (hidden face elimination) algorithm

    • Category: Object space and image space
    • Improve algorithmic performance with sequencing and coherence
  • Discrimination of Back-face Detection in the posterior face

    • Thought:
      • Ax+by+cz+d=0
      • If the point (x, Y, z) is a point on the line of sight and satisfies the ax+by+cz+d <0
      • The plane is a back face
    • Test method: Polygon plane normal vector n * line of sight vector v > 0, then back face
  • Depth-buffer Method Depth Buffering algorithm

    • Thought: Comparing the surface depth of each pixel on the projection plane
    • belongs to the image space algorithm
    • Algorithm:
      1. Initialize the frame cache and the depth depthBuff(x, y) = 1.0 cache ,frameBuff(x, y) = backgndColor
      2. Handle each object in the scene: Calculate the depth of each point , and if so z < depthBuff(x, y) , update
  • A-buffer method A-Buffering algorithm

    • The basic method is to extend the depth buffer so that each pixel position corresponds to a surface linked list
    • Each cell contains two domains: Depth field, intensity field
  • Scan-line method Scanning Line algorithm

    • The surface of the mesh is projected onto the projection plane, and the intersection interval between the scan line and the projected polygon is computed. The intersecting interval belongs to the same surface, the color information of the surface is displayed directly, and the depth test is used to determine which surface strength information is used when overlapping intervals occur.
  • Depth-sorting method Depth-sorting algorithm

    • If any polygon surface in the scene does not penetrate or loop through the depth, the order of precedence of each polygon is fully determined
    • Algorithm:
      • Sort the surface in descending direction of depth
      • The surface is scanned and converted, starting with the largest surface of the depth
OpenGL Section

A big problem, the main study of the basic graphics application and OpenGL programming framework master.

OpenGL statements, only need to understand, do not need to remember.

Computer Graphics Review Notes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.