Fundamentals of Computer Graphics - Computer Graphics Review Notes

Words: 11746

Reference: Fundamentals of Computer Graphics (OpenGL Edition) and online materials.

Chapter 1

What is computer graphics, and what does it mainly study?

Computer graphics is a discipline that studies converting data into graphics with computers and displaying and processing them on dedicated devices. It focuses on the principles, methods, and techniques of graphics generation and processing, and is a new multi-disciplinary applied technology.

It covers graphics theory, applied mathematics, computer science, and other disciplines.

Main research content:

Centered on: software and hardware technology in the graphics processing pipeline, and the accuracy, realism, and real-time performance of representing graphics and images.

Includes: the research content is divided into nine directions.

  1. Device-based basic graphics generation algorithms, such as lines and arcs;
  2. Clipping and geometric transformation techniques for graphics primitives;
  3. Curve and surface processing techniques: interpolation, approximation, joining, and decomposition;
  4. 3D geometric modeling techniques;
  5. Real-time display of 3D shapes and parallel graphics processing techniques;
  6. Photorealistic image generation techniques and simulation systems;
  7. Simulation and generation techniques for random shapes or fuzzy scenes;
  8. Generation and control techniques for virtual reality environments;
  9. Visualization techniques for 3D or high-dimensional data fields.

What are the constituent elements and representation methods of graphics?

  • Constituent elements of graphics
    • Geometric elements: describe the contour, shape, etc. of an object;
    • Non-geometric elements: describe the color, material, etc. of an object.
  • Representation methods of graphics
    • Raster representation: enumerate all points in the graphic, referred to as an image;
    • Parametric representation: shape parameters + attribute parameters, referred to as a graphic.

Chapter 2

Briefly summarize the tasks, content, and characteristics of the three stages of graphics system architecture.

The three stages of graphics system architecture: the application stage, the geometry processing stage, and the pixel processing stage.

Application stage: provides data to graphics hardware in the form of primitives, and also provides images or bitmaps used for surface texture mapping. Developers have full control over what happens in this stage and can change actual performance by changing the implementation method. At the end of the application stage, the geometry to be drawn is fed into the next stage of the rendering pipeline.

Geometry processing stage: the process of processing geometric primitives on a per-vertex basis and transforming them from 3D coordinates to 2D screen coordinates. The geometry processing stage is mainly responsible for most polygon and vertex operations, and can be divided into several functional stages such as model and viewing transformations, lighting, projection, clipping, and screen mapping. Depending on the specific implementation, this stage may or may not be equivalent to a pipeline pass. The geometry processing stage performs highly computation-intensive tasks.

Pixel processing stage: screen objects are first sent to the pixel processor for rasterization, then each pixel is shaded, and then output to the framebuffer, and finally output to the display. After primitives are sent through the raster stage, what is seen from the camera viewpoint can be displayed on the screen. These primitives can be drawn with a suitable shading model, and if texture techniques are applied, texture effects will be displayed. Unlike the polygon operations performed in the geometry stage, the raster stage performs per-pixel operations. For high-performance graphics systems, the raster stage must be completed in hardware.

From the perspective of graphics hardware display principles, think about and analyze how to display a straight line.

When the electron beam scans to the position (coordinates) of a certain pixel on the screen, the processor DPU in the display simultaneously retrieves the pixel value from the corresponding display buffer unit, uses it to look up the address in the color table, obtains the red, green, and blue components of the pixel from that address, and after D/A conversion controls the three primary-color electron guns respectively, so that the pixel on the screen displays the mixed color of the three primary colors. To display a straight line, it is only necessary to find all points that satisfy the equation of the line according to the line equation, and fully display on the screen the graphic drawn by the computer.

What parts does a computer graphics system consist of, and what functions does each implement?

It consists of graphics software and graphics hardware. Hardware devices are the material basis for the existence and development of computer graphics, and mainly consist of a central host (graphics display processor), graphics input devices, and graphics output devices. Graphics software is divided into three parts: graphics application software, graphics support software, and graphics application data structures, and interfaces with external graphics devices. The three are interconnected, call each other, and support each other, forming the software part of the graphics system.

What are the commonly used graphics input and output devices? What are their characteristics?

Locator devices: implement the positioning function, that is, input the coordinates of a point, including light pens, digitizers, mice, and numeric keys on keyboards.

Stroke devices: implement the stroke function, input a series of point coordinates; their physical devices are the same as locator devices.

Valuator devices: implement the value-setting function, including knobs, numeric keys, direction keys, and programmable function keys.

Choice devices: obtain a certain choice according to a positive integer, including light pens, touchpads, digitizers, and mice.

Pick devices: implement the picking function, that is, identify a displayed graphics element, including various locator devices, programmable function keys, and string input devices.

String devices: implement string input, including keyboards, light pens, and voice recognition devices.

Graphics display devices: display devices such as liquid crystal displays that display graphics.

Graphics drawing devices: output devices such as printers and plotters that output visualizations and can preserve graphics for a long time.

How many layers is graphics software divided into? What are the characteristics of each layer?

The software system consists of layer-0 graphics software (drivers, interface programs), layer-1 graphics software (basic subroutines), layer-2 graphics software (general programs), and layer-3 graphics software (application programs). Layers zero through two are called basic graphics software or support software; layer three and above are application graphics software.

Graphics support software can generally be divided into the following three levels. The first level is system-oriented and is the lowest-level software, also called device drivers. It mainly addresses issues such as the communication interface between graphics devices and computers, and includes some of the most basic input and output programs. The second level is both system-oriented and user-oriented. It is built on top of device drivers and is also called basic subroutines, including program modules such as primitive generation and device management. The third level is user-oriented and is written on the basis of basic subroutines; it is also called functional subroutines, and its main task is to establish graphics data structures, define, modify, and output graphics.

Be familiar with the structure of a raster scan display system.

The logical composition of a raster scan display system mainly consists of three parts: the display, the video controller, and the framebuffer memory. The classic structure of early raster scan display systems: CPU, system main memory, display controller, display. The framebuffer can be located anywhere in system main memory, and the display controller accesses the framebuffer to refresh the screen. However, at this time the display controller must access the framebuffer through the system bus, so the bus becomes the main bottleneck of the system. Currently commonly used: CPU, system main memory-framebuffer, display controller, display. The framebuffer is directly accessed by the display controller; it can use either a fixed area of system main memory or dedicated display memory. The computational load of scan conversion is considerable and increases the burden on the CPU. In addition to the framebuffer and display controller, an advanced raster graphics system structure also includes a display processor and independent display processor memory.

Understand the meanings of common terms such as resolution, framebuffer, pixel, and image distance.

Resolution: the total number of pixels on the display screen, divided into horizontal resolution and vertical resolution, commonly expressed by the number of pixels on the screen. The higher the resolution, the smaller the image distance, and the clearer the displayed characters or images.

Framebuffer: framebuffer memory, abbreviated as framebuffer or video memory, is a direct image of the picture displayed on the screen, also called a bitmap or raster. The framebuffer is a contiguous block of computer memory used to store graphics and image information for dynamic refresh. Each storage unit of the framebuffer corresponds to one pixel on the screen, and the entire framebuffer corresponds to one frame of image.

Pixel: in a raster scan graphics display, the smallest unit on the screen that can be lit or turned off.

Image distance: the distance from the image to the screen.

Horizontal frequency, frame frequency: the horizontal scanning frequency is the horizontal frequency. The vertical scanning frequency is the frame frequency.

Interlaced scanning: scan the even-numbered scan lines first, then the odd-numbered scan lines.

Display speed: the speed of displaying characters, graphics, and images.

Dot pitch: the dot pitch of an LCD is the distance between two liquid crystal particles, that is, the width or height of the liquid crystal panel divided by the number of horizontal or vertical pixels.

Refresh rate: in an LCD, each pixel continuously emits light under a certain signal (voltage) until another signal (voltage) arrives, at which point the luminous intensity changes. Therefore, LCDs actually do not have a refresh rate problem.

Viewing angle: the visible angle.

Response time: an excessively long response time will cause ghosting when the picture changes rapidly.

Brightness: brightness refers to the degree of brightness of the picture; the maximum brightness is usually determined by the backlight.

Contrast ratio: the ratio of the brightness of the same point on the screen when it is brightest (white) to when it is darkest (black). High contrast means relatively high brightness and vividness.

Chapter 3

Briefly describe the algorithmic ideas of the DDA algorithm, the midpoint line algorithm, and the Bresenham algorithm.

The DDA algorithm is called the digital differential analyzer line drawing algorithm. According to the degree of slope deviation, it decides whether to use x or y as the stepping direction. Then, in the corresponding stepping direction, the step vector increases by one pixel each time, and the other related coordinate variable can also be obtained from the slope.

The midpoint line algorithm assumes that the line slope k is between 0 and 1, and the current pixel point is (xp, yp). Then the next pixel point has two possible choices: P1 (xp+1, yp) or P2 (xp+1, yp+1). If the midpoint of P1 and P2, (xp+1, yp+0.5), is called M, and Q is the intersection of the ideal line with the vertical line x=xp+1, then when M is below Q, P2 should be taken as the next pixel point; when M is above Q, P1 should be taken as the next pixel point. Other slopes are handled similarly.

The Bresenham algorithm constructs a set of virtual grid lines through the centers of pixels in each row and column, computes the intersections of the line with each vertical grid line in order from the start point to the end point, and then determines the pixel in that column closest to the intersection. Incremental computation can be used, so that for each column, it is only necessary to check the sign of an error term to determine the pixel sought in that column.

Write out the process of the Bresenham line drawing algorithm or draw its flowchart.

  1. Assign the line start point to the moving point P(x, y);
  2. Compute the endpoint coordinate differences: dx and dy;
  3. Compute the total number of loop steps N
    1. The value of di at the start point;
  4. Loop to compute the coordinates of intermediate interpolated points:
    1. If the current step count ≥ N, the program ends.
    2. Otherwise:
      1. Display the current point P;
      2. If di is greater than 0, add 1 to the y coordinate;
      3. Compute the current value of di;
      4. Add 1 to the x coordinate.

What are the attributes of a line?

The attributes of a line include line style, line width, and line color, etc.

  1. Line style: line style represents different solid shapes.
  2. Line width: lines with width are used to represent the shape and position of solid surfaces.
  3. Line color: system color, defined by a color model space, such as the RGB model. Calling method: use dedicated functions to set different color values. Graphics use two colors: background color and foreground color. Background color: the color defined for drawing the system background interface. Foreground color: the various colors required for drawing graphics.

What are the commonly used algorithms for arc generation?

The point-by-point comparison method, the midpoint circle algorithm, the Bresenham algorithm, the angle discretization method, etc.

Point-by-point comparison method: set the stepping direction in different quadrants, with the principle of minimizing the approximation error and keeping the pen movement direction consistent with the drawing trend, and determine the next pixel according to the error discriminant.

Midpoint circle algorithm: use the 8-way symmetry of a circle, consider the one-eighth arc in the first quadrant of a circle centered at the origin with radius R, and determine this arc clockwise from point (0, R) to point (R’, R’). Assume that a point Pi(xi, yi) is already the point on this arc closest to the actual arc; then the next point after Pi can only be one of P1 directly to the right or P2 to the lower right. Construct the discriminant function F(x, y) = x2 + y2 - R2, substitute the midpoint M into the function. If F(M) < 0, M is inside the circle, and the next point is T; if F(M) ≥ 0, M is on or outside the circle, and the next point is S, and so on.

Bresenham algorithm: the Bresenham circle drawing algorithm is suitable for generating a complete circle. It uses an error quantity to measure how closely the selected point approximates the circle. It uses the 8-way symmetry method and only computes points within 90° to 45°, with movement direction +x, -y. Let (xi, yi) be the coordinates selected at step i of the scan; the next selected point may be T or S. According to the relationship between the difference of the square of the distance from the coordinate to the origin and the square of the radius, T or S can be chosen, and thus the complete circle can be generated.

Which model is used for the error discriminant in arc generation algorithms?

The difference between the square of the distance from the current point to the center and the square of the radius.

What is the fastest algorithm for a complete arc?

The Bresenham algorithm.

Explain the terms approximation, interpolation, control point, and data point.

Approximation: by establishing a mathematical model, the constructed curve is required to be closest to the given data points in some sense; this is called approximating these data points, and the constructed curve is called an approximating curve.

Interpolation: given a set of ordered data points Pi (i=0, 1, 2, …, n), construct a curve by establishing a mathematical model so that it passes through the data points in order; the constructed curve is called an interpolating curve.

Fitting: the collective term for interpolation and approximation methods.

Data point: a data point on a curve obtained by measurement or computation that describes the geometric shape of the curve.

Control point: a special shape point used to control or adjust the shape of a curve, while the curve itself does not pass through this point.

Explain the terms: region, region filling, seed, active edge.

Region: a set of adjacent and connected pixels forming a closed region with the same attributes.

Region filling: the process of determining a seed within a region and extending this attribute to the entire region.

Seed: a pixel or pixel combination with a certain filling attribute unit.

Active edge: an edge of the boundary that intersects the current scan line.

Master the methods for testing whether a point is inside a region.

Ray method: cast a ray from point P in any direction. If the number of intersections of the ray with the polygon is odd, then P is inside the polygon; if even, then P is outside the polygon. Note, however, that when the ray intersects the polygon boundary at a vertex (singular point), different calculation methods must be used depending on whether it is an extremum point (the two edges adjacent to the vertex are on the same side of the ray) or a non-extremum point (intersections at extremum points are counted as two intersections, otherwise as one).

Arc length method: assume the polygon consists of directed edges. With the tested point as the center, draw a unit circle, project all directed edges radially onto the unit circle, and compute the algebraic sum of the projections of all edges on the unit circle. If the algebraic sum is 0, the tested point is outside the polygon; if the algebraic sum is 2π, the tested point is inside the polygon.

Combined method: cast a ray to the right from the start point P. If it encounters an upward-directed edge intersecting the ray, increment the counter by 1; if it encounters a downward-directed edge intersecting the ray, decrement the counter by 1. When the final counter is 0, P is outside the polygon, but singular points also need to be handled.

Be able to accurately distinguish the connectivity of regions.

4-connected region: starting from a point in the region, visit the 4-neighbors of known points and traverse all pixel points in the region without leaving the region.

8-connected region: starting from a point in the region, visit the 8-neighbors of known points and traverse all pixel points in the region without leaving the region.

Understand and master regions, scan lines, and boundary continuity.

A contiguous block of pixels with the same color or pattern attributes is a region. The process of filling and coloring all pixels in a region is called region filling. There are two types of region definitions: one is a closed polygon defined by a given vertex sequence. The second type of region is the part enclosed by all known boundary pixels, and it is a region described in raster form. The second type of region also has two different definitions: one is a boundary-defined region, and the other is an interior-defined region.

The scan line algorithm uses region continuity, scan line continuity, and boundary continuity to determine the intersection intervals of horizontal scan lines with the polygon, and assigns a new color value to all pixels in the interval at once.

Boundary continuity: arrange the endpoints of the boundary according to their y coordinates, y0, y1, …, yi, yik ≥ yik+1, 0 ≤ k ≤ n-1, with equal numbers of intersection points; points with the same number lie on the same edge.

Understand and master the principles and steps of the scan line filling algorithm.

The scan line filling algorithm makes full use of the continuity between the intersections of the polygon boundary with two adjacent scan lines and the continuity between pixels on the same scan line.

For each scan line, perform the following 3 steps:

Find intersections: compute the intersections of the current scan line with all edges of the polygon.

Sort and pair: sort all intersections in increasing order of x value, and pair the sorted intersections into intervals.

Fill color: set the pixel values in each interval to the target color value.

  1. Sort the region boundary vertices by Y coordinate;
  2. Determine the intervals of the scan lines;
  3. Build the active edge table of boundary edges;
  4. Find intersections;
  5. Sort intersections;
  6. Pair intersections;
  7. Fill colors.

Write out the principle of the DDA line drawing algorithm.

Write out the principle of the DDA line drawing algorithm.

Master the classification of region filling algorithms and the steps of the scan line algorithm.

Region filling algorithms

  • Scan line filling algorithms — scan line order
    • Ordered edge table algorithm
    • Edge filling algorithm
  • Seed filling algorithms — starting from an interior point
    • Simple seed algorithm
    • Scan line seed algorithm
  • Pattern filling algorithms — filling structured graphics
    • Hatch filling algorithm
    • Image filling algorithm

How many kinds of characters are commonly used in graphics systems?

Character generation methods include dot matrix, vector, and encoding.

Commonly used characters include:

  1. ASCII codes
  2. Chinese characters
  3. Other characters
  4. Other engineering-specific symbols.

How many graphical representation methods are there for characters? What are their characteristics?

Dot matrix characters represent a character as a rectangular dot matrix, and the shape of the character is expressed by different values of the dots in the matrix.

Vector characters represent a character as a sequence of point coordinates; two adjacent points represent a vector, and the shape of the character is characterized by the vector sequence.

Chapter 4

Memorize the basic transformation matrices of 2D transformations and their geometric characteristics.

Translation transformation

Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P’=\begin{bmatrix} x’ \\ y’ \end{bmatrix}$, transformation matrix: $T=\begin{bmatrix} t_{x} \\ t_{y} \end{bmatrix}$

Translation equation: $P’=P+T$

Rotation transformation about the coordinate origin

Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P’=\begin{bmatrix} x’ \\ y’ \end{bmatrix}$, transformation matrix: $R=\begin{bmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{bmatrix}$

Transformation equation: $P’=R\cdot P$, $\begin{cases}x’=x\cos \theta -y\sin \theta \\ y’=x\sin \theta -y\cos \theta \end{cases}$

Scaling transformation with the coordinate origin as the reference point

Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P’=\begin{bmatrix} x’ \\ y’ \end{bmatrix}$, transformation matrix: $R=\begin{bmatrix} s_{x} & 0 \\ 0 & s_{y} \end{bmatrix}$

Transformation equation: $P’=S\cdot P$

Reflection transformation

Transformation equation: $P’=T\cdot P$

Reflection about the y-axis

Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P’=\begin{bmatrix} x’ \\ y’ \end{bmatrix}$, transformation matrix: $S=\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}$

Reflection about the x-axis

Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P’=\begin{bmatrix} x’ \\ y’ \end{bmatrix}$, transformation matrix: $S=\begin{bmatrix} -1 & 0 \\ 0 & 1 \end{bmatrix}$

Reflection about the coordinate origin

Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P’=\begin{bmatrix} x’ \\ y’ \end{bmatrix}$, transformation matrix: $S=\begin{bmatrix} -1 & 0 \\ 0 & -1 \end{bmatrix}$

Reflection about an arbitrary point

Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P’=\begin{bmatrix} x’ \\ y’ \end{bmatrix}$, transformation matrix: translate first, then rotate, then translate

Reflection about the diagonal y=x

Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P’=\begin{bmatrix} x’ \\ y’ \end{bmatrix}$, transformation matrix: $S=\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$

Reflection about the diagonal y=-x

First rotate 45° clockwise, reflect about the y-axis, and finally rotate 45° counterclockwise.

Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P’=\begin{bmatrix} x’ \\ y’ \end{bmatrix}$, transformation matrix: $S=\begin{bmatrix} 0 & -1 \\ -1 & 0 \end{bmatrix}$

Reflection about an arbitrary line y=mx+b

Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P’=\begin{bmatrix} x’ \\ y’ \end{bmatrix}$, transformation matrix: translation-rotation-reflection transformation

Shear transformation

x-direction shear along the x-axis

Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P’=\begin{bmatrix} x’ \\ y’ \end{bmatrix}$, transformation matrix: $S=\begin{bmatrix} 1 & sh_{x} \\ 0 & 1 \end{bmatrix}$

Transformation equation: $P’=S\cdot P$, $x’=x+ sh_{x} \cdot y$, $y’=y$

y-direction shear along the y-axis

Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P’=\begin{bmatrix} x’ \\ y’ \end{bmatrix}$, transformation matrix: $S=\begin{bmatrix} 1 & 0 \\ sh_{y} & 1 \end{bmatrix}$

Transformation equation: $P’=S\cdot P$, $x’=x$, $y’=y+ sh_{y} \cdot x$

General transformation form

Original point: $P=\begin{bmatrix} x \\ y \end{bmatrix}$, transformed point: $P’=\begin{bmatrix} x’ \\ y’ \end{bmatrix}$

Transformation equation: $P’=M_{1}\cdot P + M_{2}$

What is the definition of homogeneous coordinates?

The method of representing an n-dimensional vector with an (n+1)-dimensional vector is called homogeneous coordinate representation, and coordinates in (n+1)-dimensional space are called homogeneous coordinates.

  1. Represent various transformations with matrices of uniform order.
  2. Convenient for representing points at infinity.
  3. The homogeneous coordinate transformation matrix maps lines to line segments, planes to planes, polygons to polygons, and polyhedra to polyhedra.
  4. Transformations have the advantage of a unified representation, which facilitates transformation composition and hardware implementation.

Master the homogeneous coordinate forms of basic 2D and 3D transformations.

Translation transformation

$\begin{bmatrix} x’ \\ y’ \\ 1 \end{bmatrix}=\begin{bmatrix} 1 & 0 & t_{x} \\ 0 & 1 & t_{y} \\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$

Rotation transformation

$\begin{bmatrix} x’ \\ y’ \\ 1 \end{bmatrix}=\begin{bmatrix} \cos \theta & -\sin \theta & 0 \\ \sin \theta & \cos \theta & 0 \\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$

Scaling transformation

$\begin{bmatrix} x’ \\ y’ \\ 1 \end{bmatrix}=\begin{bmatrix} s_{x} & 0 & 0 \\ 0 & s_{y} & 0 \\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$

Reflection transformation

Reflection about the x-axis

$\begin{bmatrix} x’ \\ y’ \\ 1 \end{bmatrix}=\begin{bmatrix} 1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$

Reflection about the y-axis

$\begin{bmatrix} x’ \\ y’ \\ 1 \end{bmatrix}=\begin{bmatrix} -1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$

Reflection about the origin

$\begin{bmatrix} x’ \\ y’ \\ 1 \end{bmatrix}=\begin{bmatrix} -1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$

Reflection about the diagonal y=x

$\begin{bmatrix} x’ \\ y’ \\ 1 \end{bmatrix}=\begin{bmatrix} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$

Reflection about the diagonal y=-x

$\begin{bmatrix} x’ \\ y’ \\ 1 \end{bmatrix}=\begin{bmatrix} 0 & -1 & 0 \\ -1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$

Shear transformation

x-direction shear relative to the line $y=y_{ref}$

$\begin{bmatrix} x’ \\ y’ \\ 1 \end{bmatrix}=\begin{bmatrix} 1 & sh_{x} & -sh_{x}\cdot y_{ref} \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$

y-direction shear relative to the line $x=x_{ref}$

$\begin{bmatrix} x’ \\ y’ \\ 1 \end{bmatrix}=\begin{bmatrix} 1 & 0 & 0 \\ sh_{y} & 1 & -sh_{y}\cdot x_{ref} \\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}$

Memorize the basic transformation matrices of 3D transformations and their geometric characteristics.

Translation transformation

$\begin{bmatrix} x’ \\ y’ \\ z’ \\ 1 \end{bmatrix}=\begin{bmatrix} 1 & 0 & 0 & t_{x} \\ 0 & 1 & 0 & t_{y} \\ 0 & 0 & 1 & t_{z} \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$

Scaling transformation relative to the origin

$\begin{bmatrix} x’ \\ y’ \\ z’ \\ 1 \end{bmatrix}=\begin{bmatrix} s_{x} & 0 & 0 & 0 \\ 0 & s_{y} & 0 & 0 \\ 0 & 0 & s_{z} & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$

Rotation transformations about the 3D coordinate axes

Rotation about the z-axis

$\begin{bmatrix} x’ \\ y’ \\ z’ \\ 1 \end{bmatrix}=\begin{bmatrix} \cos \theta & -\sin \theta & 0 & 0 \\ \sin \theta & \cos \theta & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$

Rotation about the x-axis

$\begin{bmatrix} x’ \\ y’ \\ z’ \\ 1 \end{bmatrix}=\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos \theta & -\sin \theta & 0 \\ 0 & \sin \theta & \cos \theta & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$

Rotation about the y-axis

$\begin{bmatrix} x’ \\ y’ \\ z’ \\ 1 \end{bmatrix}=\begin{bmatrix} \cos \theta & 0 & \sin \theta & 0 \\ 0 & 1 & 0 & 0 \\ -\sin \theta & 0 & \cos \theta & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$

Reflection transformation

About the xy plane

$\begin{bmatrix} x’ \\ y’ \\ z’ \\ 1 \end{bmatrix}=\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$

About the yz plane

$\begin{bmatrix} x’ \\ y’ \\ z’ \\ 1 \end{bmatrix}=\begin{bmatrix} -1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$

About the xz plane

$\begin{bmatrix} x’ \\ y’ \\ z’ \\ 1 \end{bmatrix}=\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$

Shear transformation

z-axis

$\begin{bmatrix} x’ \\ y’ \\ z’ \\ 1 \end{bmatrix}=\begin{bmatrix} 1 & 0 & sh_{zx} & -sh_{zx} \cdot z_{ref} \\ 0 & 1 & sh_{zy} & -sh_{zy} \cdot z_{ref} \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$

General transformation form

$T_{3D}=\begin{bmatrix} a & b & c & l \\ d & e & f & m \\ h & i & j & n \\ p & q & r & s \end{bmatrix}$

where $\begin{bmatrix} a & b & c \\ d & e & f \\ h & i & j \end{bmatrix}$ produces geometric transformations such as scaling, rotation, symmetry, and shear; $\begin{bmatrix} 1 \\ m \\ n \end{bmatrix}$ produces translation; $\begin{bmatrix} p & q & r \end{bmatrix}$ produces perspective transformation; $\begin{bmatrix} s \end{bmatrix}$ produces overall scaling.

According to the graphics changes, write out the transformation matrix for 2D composition.

Refer to the comprehensive transformation application problems in the exam papers.

Chapter 5

What are the disadvantages of Cohen-Sutherland encoding clipping? How does the Liang-Barsky parametric clipping algorithm improve on it?

Because it uses bitwise AND operations, it imposes special requirements on program implementation, and it is inconvenient in some high-level languages.

The all-reject test is only suitable for line segments that lie entirely on the same window side; for line segments that cross the entire region, it cannot make a single judgment and reject them.

The Liang-Barsky parametric clipping algorithm requires less computation. Each modification requires only one division, and after u1 and u2 are determined, the intersection of the line with the window boundary needs to be computed only once.

Understand and master the definitions of the 5 coordinate systems.

Modeling coordinate system

The modeling coordinate system is a local coordinate system and also a typical planar rectangular coordinate system. It mainly exists to facilitate model construction and transformation.

World coordinate system

To determine the position of each object and its relative position with respect to other objects, it is necessary to abandon each object’s own coordinate system and place it into a unified coordinate system. This coordinate system is called the world coordinate system, also called the user coordinate system, and it is a global coordinate system.

Viewing coordinate system

Once a 2D graphics scene is determined, the user can define the viewing region and viewing direction according to the requirements of graphic display to obtain the desired display result. This actually requires defining the position and direction of the viewpoint (or camera), completing the repositioning and description of objects in the entire world coordinate system from the observer’s perspective, and simplifying the derivation and computation of subsequent 2D graphics imaging on the projection plane. Therefore, it is necessary to introduce the viewing coordinate system.

Normalized device coordinate system

To make viewing processing independent of output devices, we can transform the object description into an intermediate coordinate system that is both device-independent and easily convertible to a device coordinate system. This intermediate coordinate system is usually called the normalized device coordinate system.

Device coordinate system

To facilitate the output of 2D viewing results, the device coordinate system is used to define image space, and may also be called the screen coordinate system or pixel coordinate system.

Explain the concepts of user domain, window, screen domain, and viewport.

User domain: user space, the real-number domain used by users to define and design objects; it is continuous and infinite.

Window region: the user outputs an arbitrary specified region in the user domain to the screen.

Screen domain: the maximum region on a graphics device used to output graphics; it is a finite, discrete integer domain.

Viewport: the region defined in the screen domain for displaying graphics is called the viewport.

Understand and master the matrix form of the window-to-viewport transformation equation.

Window w, viewport v: $\begin{bmatrix} x_{v} & y_{v} & 1 \end{bmatrix}=\begin{bmatrix} x_{w} & y_{w} & 1 \end{bmatrix} \cdot \begin{bmatrix} a & 0 & 0 \\ 0 & -c & 0 \\ b & d & 1 \end{bmatrix}$

$X_{v}=X_{v1}+\dfrac{X_{v2}-X_{v1}}{X_{w2}-X_{w1}}(X_{w} - X_{w1})$

$Y_{v}=Y_{v1}+\dfrac{Y_{v2}-Y_{v1}}{Y_{w2}-Y_{w1}}(Y_{w} - Y_{w1})$

If the viewport size remains unchanged and the window is reduced or enlarged, the graphic will be enlarged or reduced.

If the window size remains unchanged and the viewport is reduced or enlarged, the graphic will be reduced or enlarged accordingly.

If the window and viewport have the same size, the graphic size ratio remains unchanged.

If the viewport and window have different aspect ratios, the graphic will be stretched and deformed.

Write out the principles and steps of the line segment encoding clipping algorithm.

Encoding clipping algorithm

Extend the window boundaries to divide the plane into 9 regions, encode each region with a 4-bit binary number, and determine positions according to the encoded values or logical operations.

  1. If the 4-bit codes of both endpoints of a line segment are all 0, then the line segment is inside the window and can be output directly;
  2. If the logical AND (bitwise product) of the codes of the two endpoints is not 0, then the line segment is entirely outside the window and is discarded;
  3. Otherwise, the line segment intersects the window, so find the intersection. Find the intersection of the line with the window boundary, use the intersection to split the line segment, and discard the part beyond the intersection; use the intersection as a boundary to further test for intersections and split; clipping order: according to the encoded value; termination criterion: all encoded values are zero.

Midpoint subdivision algorithm

A binary recursive search method: check whether the midpoint is inside the region and compute recursively.

Vector (Liang-Barsky) clipping algorithm

Determine the start and end edges; find the intersections of the line with the window edges; among the two intersections with the start edge, take the point closest to P2 and assign it to Ps; among the two intersections with the end edge, take the point closest to P1 and assign it to Pe; output the valid line segment PsPe.

Fast clipping algorithm

  1. Determine whether the line is completely inside the window
  2. If the X coordinates of the endpoints are the same, if not
  3. Compute the slope of line P1 P2
  4. Compute the value of the discriminant according to k; if it is not greater than 0
  5. Compute the intersections of the line with the four window boundaries and sort them in one direction
  6. Take the two middle points to form the line segment inside the window and output it.

Sorted clipping algorithm

See the reference materials for details.

Write out the principles and steps of the polygon edge-by-edge clipping algorithm.

Polygon clipping algorithms are divided into: edge-by-edge clipping and dual-edge clipping.

Edge-by-edge clipping

  1. First form an ordered point sequence from the vertices of the polygon to be clipped;
  2. Adjacent two points form an edge, such as P1P2, P3P4, …, PnP1, for a total of N edges;
  3. Use the four window edges to clip each edge of the polygon in turn and find the valid intersection points.
  4. Connect the valid endpoints to form a new polygon.

Dual-edge clipping

  1. Arrange the polygon vertices counterclockwise into an ordered point loop;
  2. Sort the window vertices according to the polygon sorting method;
  3. Starting from any vertex of the polygon, search along the loop direction for polygon vertices, vertices inside the window, and valid intersections between the polygon and the window;
    1. When an entry point is encountered, do not change the search direction.
    2. When an exit point is encountered, change the search direction:
      1. Turn at the exit point, with the turning direction consistent with the vertex sorting direction;
      2. Proceed along the direction of the valid window edge, searching for intersections between that edge and the polygon until a new intersection is encountered.
      3. When a new intersection is encountered, lift the pen and return to the original exit point.
      4. Then continue searching along the original direction.
  4. End when the search start point is reached.

The code of a line endpoint is 0010. Write out the relationship between its endpoint coordinates and the four window boundaries.

It should be in the middle region on the far right, outside the window.

Chapter 6

Understand and master the definition and classification of projection.

The process of transforming a 3D object into a 2D graphic representation is generally called projection transformation.

According to the distance between the projection center and the projection plane, projection can be divided into parallel projection and perspective projection.

Understand and master the transformation matrices formed by the three views.

Front view

$\begin{bmatrix} x’ \\ y’ \\ z’ \\ 1 \end{bmatrix}=T_{v} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$

Top view

$\begin{bmatrix} x’ \\ y’ \\ z’ \\ 1 \end{bmatrix}=T_{v} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & -1 & 0 & -z_{0} \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$

Side view

$\begin{bmatrix} x’ \\ y’ \\ z’ \\ 1 \end{bmatrix}=T_{v} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix} = \begin{bmatrix} 0 & -1 & 0 & -x_{0} \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}$

Understand the coordinate forms and their transformations in the 3D viewing process.

An axonometric drawing is a kind of stereoscopic drawing produced on a 2D plane by parallel projection that simultaneously reflects the shape of an object in the three directions of length, width, and height.

  1. First rotate the shape around the z-axis by angle α:

$T_{1}=\begin{bmatrix} \cos \alpha & \sin \alpha & 0 & 0 \\ -\sin \alpha & \cos \alpha & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}$

  1. Then rotate the shape around the x-axis by angle β in the reverse direction (β<0):

$T_{2}=\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos \beta & \sin \beta & 0 \\ 0 & -\sin \beta & \cos \beta & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}$

  1. Compress the shape toward the xoz plane:

$T_{3}=\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}$

  1. Transformation matrix of the axonometric drawing:

$T=T_{1}\cdot T_{2}\cdot T_{3}$

Chapter 7

What is a solid? What attributes does a solid have?

A set of spatial points, or a space enclosed by closed surfaces; it is a non-empty, bounded, closed point set.

Shape invariance: a solid must have an invariant shape, and the shape is independent of the solid’s position and orientation.

Dimensional consistency: every part of a solid must be three-dimensional; there are no isolated points or dangling edges.

Spatial finiteness: it occupies finite space, and its boundary is determinate and closed.

Properties of a solid boundary:

Connectivity: there is always a path between any two points.

Boundedness: the solid surface divides space into two parts, one of which is bounded.

Orientability: the two sides of the surface clearly define the inside and outside belonging to the solid.

Non-self-intersection: the solid surface cannot intersect itself.

Closure: each edge has two and only two points, and each edge connects two or more faces.

What are the basic elements that constitute a solid? What parts of information describe a solid?

Basic elements constituting a solid: point, edge, loop, face, body

Information describing a solid: geometric information, topological information

What are the conditions and formula of the Euler formula for judging solids?

A polyhedron that satisfies the Euler formula is not necessarily a solid; the Euler formula is only a necessary condition for checking the validity of a solid.

Simple polyhedron: V: number of vertices, E: number of edges, F: number of faces

$$V-E+F=2$$

Non-simple polyhedron: H: number of holes on the polyhedron surface, G: number of holes passing through the polyhedron, C: number of independent, disconnected polyhedra.

$$V–E+F–H=2(C–G)$$

How many representation methods are there for solids?

  • Boundary representation
  • Sweep representation
  • Constructive solid geometry representation (CSG)
  • Spatial subdivision representation

Understand the mathematical and geometric significance of parametric curve continuity.

Curves used in engineering are generally required to be smooth curves and to be generated according to a specified point sequence; these are spline curves. A spline curve is a curve formed by connecting polynomial curve segments, and adjacent segments are required to satisfy specific continuity conditions at their boundaries.

Master the matrix form and blending functions of the H curve, and the influence of endpoint tangent vectors on curve shape.

Matrix form:

$$Q(t)=\begin{bmatrix} t^{3} & t^{2} & t & 1 \end{bmatrix} \cdot \begin{bmatrix} a \\\ b \\\ c \\\ d \end{bmatrix}(0 \le t \le 1)$$

Blending functions:

$$ \begin{aligned} Fh(t) &= T \cdot Mh \\ &= \begin{bmatrix} t^3 & t^2 & t & 1 \end{bmatrix} \cdot \begin{bmatrix} 2 & -2 & 1 & 1 \\ -3 & 3 & -2 & -1 \\ 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \end{bmatrix} \\ &= \begin{bmatrix} Fh1 & Fh2 & Fh3 & Fh4 \end{bmatrix} \end{aligned} $$

Tangent vectors:

Tangent direction: when its length remains unchanged, as the tangent angle increases, the convex hull property of the tangent also increases.

Tangent magnitude: the tangent vectors at the two endpoints of the curve are Q’(0) and Q’(1), and the unit vectors are respectively: $E_{0}=\dfrac{Q’\left( 0\right) }{\left| Q’\left( 0\right) \right| }$, $E_{1}=\dfrac{Q’\left( 1\right) }{\left| Q’\left( 1\right) \right| }$ Let: |Q’(0)|=k0, |Q’(1)|=k1, then: Q’(0)= R0=k0E0, Q’(1)=R1=k1E1. Changing the values of k0 and k1 changes the tangent length, and the convex hull property of the tangent also increases.

Master the continuity conditions and boundary conditions of H curve segments?

Continuity conditions

At the connection point, the second derivative is continuous (the first derivative is equal).

Boundary conditions

Boundary conditions are divided into free end, clamped end, parabolic end, and cyclic end.

Free end: according to mechanical conditions, the second derivative at both endpoints is 0.

Understand and master the relationship between the characteristic polygon and the shape and degree of the B curve.

A B curve is defined by the vertices of a set of polygonal polylines. If the vertices of the polyline are fixed, the Bezier curve defined by them is unique. Among the vertices of the polyline, only the first and last points lie on the curve and serve as the start and end of the curve; the other points are used to control the shape and degree of the curve.

Understand the properties of the B curve and the relationship between endpoint tangent vectors and edge lengths.

Endpoint property

A Bezier curve is tangent to the corresponding control polygon at the start and end points, and the tangent directions at the start and end points are consistent with the directions of the first and last edges of the control polygon.

Symmetry

As long as the vertex positions of the characteristic polygon remain unchanged but their order is reversed, the shape of the resulting new Bezier curve remains unchanged, only the direction of parameter variation is reversed.

Convex hull property

A Bezier curve always lies within the convex hull of its control polygon.

Geometric invariance

The shape of a Bezier curve does not change with coordinate transformation; it depends only on the relative positions of the control vertices.

The tangent length at the endpoints is equal to n times the length of the first and last edges of the characteristic polygon.

The degree of curves used in engineering is not greater than 3.

Understand and master the conditions for joining B curves.

Satisfy C¹ and C² continuity at the connection.

Master the matrix forms of Bezier and B-spline curves.

Linear Bezier curve:

$Q(t)=\begin{bmatrix} t & 1 \end{bmatrix}\begin{bmatrix} -1 & 1 \\ 1 & 0 \end{bmatrix}\begin{bmatrix} P_{0} \\ P_{1} \end{bmatrix}$

Quadratic Bezier curve:

$Q(t)=\begin{bmatrix} t^{2} & t & 1 \end{bmatrix}\begin{bmatrix} 1 & -2 & 1 \\ -2 & 2 & 0 \\ 1 & 0 & 0 \end{bmatrix}\begin{bmatrix} P_{0} \\ P_{1} \\ P_{2} \end{bmatrix}$

Cubic Bezier curve:

$Q(t)=\begin{bmatrix} t^{3} & t^{2} & t & 1 \end{bmatrix}\begin{bmatrix} -1 & 3 & -3 & 1 \\ 3 & -6 & 3 & 0 \\ -3 & 3 & 0 & 0 \\ 1 & 0 & 0 & 0 \end{bmatrix}\begin{bmatrix} P_{0} \\ P_{1} \\ P_{2} \\ P_{3} \end{bmatrix}$

Linear B-spline curve:

$Q_{i,1}(t)=\begin{bmatrix} t & 1 \end{bmatrix}\begin{bmatrix} -1 & 1 \\ 1 & 0 \end{bmatrix}\begin{bmatrix} P_{0} \\ P_{1} \end{bmatrix}$

Quadratic B-spline curve:

$Q_{i,2}(t)=\begin{bmatrix} t^{2} & t & 1 \end{bmatrix}\begin{bmatrix} 1 & -2 & 1 \\ -2 & 2 & 0 \\ 1 & 1 & 0 \end{bmatrix}\begin{bmatrix} P_{0} \\ P_{1} \\ P_{2} \end{bmatrix}$

Cubic B-spline curve:

$Q_{i,3}(t)=\begin{bmatrix} t^{3} & t^{2} & t & 1 \end{bmatrix}\begin{bmatrix} -1 & 3 & -3 & 1 \\ 3 & -6 & 3 & 0 \\ -3 & 0 & 3 & 0 \\ 1 & 4 & 1 & 0 \end{bmatrix}\begin{bmatrix} P_{0} \\ P_{1} \\ P_{2} \\ P_{3} \end{bmatrix}$

Master the relationship between the characteristic polygon and the shape and degree of Bezier and B-spline curves.

If m+n+1 vertices are given, then the B-spline curve function of the i-th segment with n-th degree equal-distance subdivision is

$$Q_{i,n}\left( t\right) =\sum ^{n}_{i=0}P_{i+1}F_{l,n}\left( t\right) , l=0,l\dots n, t\in [0,1]$$

Understand the properties and endpoint conditions of Bezier and B-spline curves.

The start and end points of the curve are located at the midpoints of the first and last segments.

Understand and master the conditions for joining Bezier curves.

Have first and second derivative continuity at the connection.

Be proficient in the drawing method and geometric characteristics of the endpoints of cubic B-spline curve segments.

  1. Determine the data points Qi (i=1, 2, …, n);
  2. According to the curve type, establish the matrix form for back-solving the characteristic points;
  3. Compute the vertex table of the polygon;
  4. Determine the number of interpolation points according to the accuracy requirement, and draw the spline curve.
    1. Reverse extension: Take a point $P_{-1}$ on the extension line of $P_{1} P_{0}$ such that:

      $$P_{-1} P_{0}= P_{0} P_{1}$$

      $$P_{n} P_{n+1}= P_{n-1}P_{n}$$

      image-1 Obtain:

      $$P_{-1}= 2 P_{0} - P_{1}$$

      $$P_{4}= 2 P_{3} - P_{2}$$
    2. Key technique: image-2 Use coincident points at the start and end points, such that:

      $$P_{-2}\equiv P_{-1} \equiv P_{0}$$

      $$P_{n+2}\equiv P_{n+1} \equiv P_{n}$$

      $Q_{-1}$ is located at one third of $P_{0} P_{1}$.

Understand and master the local modification and extension properties of B-spline curves.

When the position of a control point is changed, at most four curve segments are affected.

Adding a control point adds one B-spline curve segment; the original B-spline curve is unaffected, and the new curve segment and the original curve have first and second derivative continuity at the connection.

Understand and master the construction conditions of surface patches

Curves intersect to form a spatial grid, and the set of all intersection points constitutes a surface patch.

Master the matrix form and boundary conditions of the Coons surface

$C=\begin{bmatrix} P_{00} & P_{01} & P_{00}^{v} & P_{01}^{v} \\ P_{10} & P_{11} & P_{10}^{v} & P_{11}^{v} \\ P_{00}^{u} & P_{10}^{u} & 0 & 0 \\ P_{10}^{u} & P_{11}^{u} & 0 & 0 \end{bmatrix}$

Four corner points, four boundary curves, eight tangent vectors

Be able to write the matrix form of an arbitrary position vector on the boundary of a Coons surface

Refer to the textbook and PPT

Understand and master the conditions for joining Coons surface patches

C1 continuity at the join.

$P_{10} \equiv Q_{00}$, $P_{11} \equiv Q_{01}$

$P_{10}^{w} \equiv Q_{00}^{w}$, $P_{11}^{w} \equiv Q_{01}^{w}$

$P_{1j}^{u} \equiv Q_{0j}^{u}$

$P_{1j}^{u} \equiv a Q_{0j}^{u}$

Chapter 8

How many categories can hidden surface removal algorithms be divided into? What is the classification principle?

According to the hidden object: line hidden surface removal, surface hidden surface removal

According to the hidden surface removal algorithm space: object space hidden surface removal algorithms, image space hidden surface removal algorithms

Hidden surface removal: the process of eliminating hidden lines (surfaces) in a shape view

Basic principles of hidden surface removal: sorting, coherence

What is the basic principle of the outward normal hidden surface removal algorithm? Write out its algorithm steps.

Visibility is determined according to the direction cosine of the outward normal in the projection direction.

Convex polyhedron

  1. According to the surface data structure, take the vertex data and compute the outward normal of the surface
    • line vector;
  2. Compute the value of the component of the outward normal in the projection direction;
  3. Determine the visibility of the surface according to the value of the component;
  4. When B>0, 0o≤a < 90o, the surface faces the observer and is visible.
  5. If the surface is visible, draw it; otherwise process the next surface.

Concave polyhedron

  1. First compute the outward normal of the surface, and compute the direction cosine value cosa in its projection direction;
  2. Determine visibility according to the direction cosine value;
  3. For front-facing surfaces, compute the maximum depth value of the surface;
  4. Compute the coordinates of the box corners of the front-facing surface;
  5. Take the surface with the maximum depth value as the current surface;
  6. Loop to compute the occlusion relationship between other surfaces and the current surface.

What is the basic principle of the depth buffer hidden surface removal algorithm? Write out its algorithm steps.

For each pixel on the screen, record the depth value of the scene surface within that pixel closest to the observer, and at the same time record all recorded values of the color (or grayscale) of that scene surface, and output the graphic according to the recorded data.

Allocate a memory array; initialize the array; loop to compute the depth value of each pixel.

Explain outward normal, front-facing surface, and convex polygon.

Outward normal: a line pointing from the interior of the shape to the exterior, or from the shape surface to external space.

Front-facing surface: indicates that the surface normal points forward, and the surface is visible.

Back-facing surface: indicates that the surface normal points backward, and the surface is not visible.

Convex polygon: the line segment connecting any two points of the polygon lies inside the polygon.

Briefly describe color models, and be able to explain the RGB model space and common colors

A color model refers to a set of visible photons in a 3D color space, which contains all colors in a certain color gamut. Most color graphics display devices generally use the three primary colors red, green, and blue, and the main color model in our photorealistic graphics is also the RGB model.

Explain: illumination model, ambient light, pure specular reflected light

Illumination model: a mathematical expression, based on relevant laws of optical physics, for computing the luminous intensity and color composition of light projected from each point on an object’s surface into the observer’s eye. (A mathematical model capable of computing the lighting effect of a scene given the physical form of the object and the properties of the light source)

$$incident light=diffuse reflected light+specular reflection+ambient light$$
  • Diffuse reflected light: the optical phenomenon when light strikes a rough, lusterless surface.
    • Characteristics: comes from one direction and is reflected in all directions.
  • Ambient light: the optical phenomenon when light strikes a rough, lusterless surface. (The indirect influence of the light source on the object; it is the light that finally reaches equilibrium after multiple reflections between the object and the environment.)
    • Characteristics: comes from one direction and is reflected in all directions.
  • Specular reflected light: the optical phenomenon when light strikes a very smooth object surface
    • Characteristics: the light source comes from one direction, and the reflected light is concentrated in the reflection direction.

Briefly describe the composition and construction steps of the simple light reflection model.

Assumptions:

  • The light source is a point light source
  • The object is opaque

Simulate the reflection phenomenon produced when light strikes an object surface.

$$incident light=diffuse reflected light+specular reflected light+ambient light$$

Briefly describe the computation process of the bilinear interpolation (intensity or normal) algorithm.

Intensity interpolation method

  1. Compute the outward normal vector of the polygon surface;
  2. Compute the normal vector at each vertex of the polygon;
  3. Compute the intensity value at each vertex;
  4. Compute the intensity values at the intersections of the scan line with the polygon edges;
  5. Compute the intensity values at each point on the scan line.

Normal vector interpolation method

  1. Compute the outward normal vector of each polygon face according to the vertex information;
  2. Compute the normal vector at each vertex of the polygon;
  3. Compute the normal vectors at the intersections of the scan line with the polygon edges;
  4. Compute the normal vectors at points on the scan line;
  5. Compute the intensity values at each point on the scan line.

Chapter 9

What techniques are included in basic interaction techniques?

Positioning, selection, numeric input, text output.

What are the ways of graphics picking?

Point picking, line segment picking, region picking, accelerated graphics picking.

What are rubber banding and double buffering? What is the relationship between them?

Rubber banding technique: rubber banding refers to the straight lines and curves that follow the cursor during drawing; when the cursor moves, the shape changes accordingly, that is, a dynamically changing process.

Double buffering technique: create another buffer in memory. When the graphics on the screen change, the refresh of the framebuffer is performed in the background, and what is seen on the screen is only the refreshed and redrawn graphics, so screen changes become coherent and smooth.

What is a primitive group?

Primitive group: a group formed by merging a set of related primitives

What constraints does geometric constraint mainly include?

Positioning constraints, orientation constraints, regularity constraints.

Terminology

Constructed curve

Given a set of ordered discrete points Pi (i=0, 1, …, n), a curve can be constructed through these control points.

Interpolating curve

Construct a curve by establishing a mathematical model so that the curve passes through the given data points in order; the constructed curve is called an interpolating curve.

Data point

When constructing a curve, the curve passes through each given point in order; these points are called data points.

Curve approximation

When a set of given discrete points is used and a mathematical model is established so that the constructed curve is closest to the given data points in some sense, this is called approximating these data points, and the constructed curve is called an approximating curve.

Control point

A special shape point used to control or adjust the shape of a curve, while the curve itself does not pass through this point.

Fitting

The collective term for interpolation and approximation methods.

Computer graphics

The theories, methods, and techniques for using computers to build, store, and process a model of an object, and to produce graphical output of that object according to the model, are called computer graphics.

Computer graphics standards

Computer graphics standards refer to interface standards for data transmission and communication between the graphics system and its related application programs.

Graphics hidden surface removal

In order to reflect real graphics, the computer eliminates hidden parts from the image.

Geometric transformation

The basic method of geometric transformation is to treat the transformation matrix as an operator and apply it to the position vectors of a series of vertices of the graphic, thereby obtaining a new vertex sequence for these vertices after the geometric transformation. Connecting the new vertex sequence yields the transformed graphic.

Computational geometry

Computational geometry is the discipline that studies geometric models and data processing. It discusses the computer representation, analysis, and synthesis of geometric shapes, and studies how to conveniently, flexibly, and effectively establish mathematical models of geometric shapes and better store and manage these model data in computers.

Clipping

The process of identifying the parts of a graphic inside and outside a specified region is called a clipping algorithm, or clipping for short.

Perspective projection

The perspective projection of any point in space is the intersection of the projection line formed by the projection center and the spatial point with the projection plane.

Projection transformation

The transformation that converts a 3D object into a 2D graphic representation is called projection transformation.

Aliasing

When drawing non-horizontal and non-vertical lines or polygon boundaries on a raster display, jagged edges will appear to a greater or lesser extent. This is because the corresponding graphics of lines or polygon boundaries on a raster display are all composed of a series of discrete pixels of the same brightness. This distortion caused by representing continuous quantities with discrete quantities is called aliasing.

Anti-aliasing

Techniques used to reduce and eliminate the distortion effect caused by representing continuous quantities with discrete quantities are called anti-aliasing.

Window

The range of world coordinates is infinite. In order to give the objects in the world coordinate system displayed on normalized device coordinates a suitable range and size, a display range must first be specified for the world coordinate system. It is usually a rectangle, and this rectangle is called a window.

Viewport

A rectangular region corresponding to the window must also be specified on the normalized device coordinate system to display the contents of the window. This rectangle is called the viewport.

Coordinate system

The reference framework used to describe, analyze, and measure the size, shape, position, orientation, and various relationships among geometric objects is called a coordinate system.

User coordinate system

The user coordinate system is the coordinate system used by users when processing their own graphics, and the units are determined by the users themselves.

Normalized device coordinate system

The device coordinate system obtained by converting the data in each device coordinate system into a unified data range.

Normalization transformation

Graphics software automatically implements the conversion from world coordinates to normalized device coordinates according to the one-to-one correspondence between the window and the viewport. This transformation from window to viewport is called normalization transformation.

Algorithm Analysis Problems

Digital differential analyzer method

The DDA algorithm is called the digital differential analyzer line drawing algorithm, and it draws a line according to the differential equation of the line. According to the degree of slope deviation, it decides whether to use x or y as the stepping direction. Then, in the corresponding stepping direction, the step vector increases by one pixel each time, and the other related coordinate variable can also be obtained from the slope.

  1. Determine dm=max(|△x|,|△y|) according to whether the line slope is greater than 1.
  2. Determine the step size of the other direction relative to the counting direction.
  3. According to the change of 1 in the counting direction and the obtained step size in the other direction, loop to draw points until the counting direction reaches dm and ends.

Point-by-point comparison method

During the drawing process, each stroke (step) is compared with the standard graphic, and then the direction of the next step is determined, drawing the specified graphic by step-by-step approximation.

  1. Set the stepping direction in different quadrants, in principle minimizing the approximation error and keeping the pen movement direction consistent with the drawing trend.
  2. Start drawing from the start point: first lift the pen to the start point.
  3. Deviation calculation: compute the position deviation of the current point relative to the line.
    • Compute according to the deviation judgment formula.
    • Compute according to the recurrence formula.
  4. Endpoint judgment.
    • Coordinate judgment: Xm≥Xa, Ym≥Ya
    • Step count control: that is, the number of steps in one direction and the total number of steps.

Bresenham algorithm

The Bresenham algorithm is an improvement on the DDA algorithm and is the most widely used line generation algorithm. It uses addition, subtraction, and multiplication by 2 (that is, implemented by shift operations).

Construct a set of virtual grid lines through the centers of pixels in each row and column, compute the intersections of the line with each vertical grid line in order from the start point to the end point, and then determine the pixel in that column closest to the intersection. Incremental computation can be used, so that for each column, it is only necessary to check the sign of an error term to determine the pixel sought in that column.

  1. Assign the line start point to the moving point P(x, y);
  2. Compute the endpoint coordinate differences: dx and dy;
  3. Compute the total number of loop steps N and the value of di at the start point;
  4. Loop to compute the coordinates of intermediate interpolated points:

If the current step count ≥ N, the program ends. Otherwise:

  1. Display the current point P;
  2. If di is greater than 0, add 1 to the y coordinate;
  3. Compute the current value of di;
  4. Add 1 to the x coordinate.

Midpoint line algorithm

Midpoint line algorithm: assume that the line slope k is between 0 and 1, and the current pixel point is (xp, yp). Then the next pixel point has two possible choices: P1 (xp+1, yp) or P2 (xp+1, yp+1). If the midpoint of P1 and P2, (xp+1, yp+0.5), is called M, and Q is the intersection of the ideal line with the vertical line x=xp+1, then when M is below Q, P2 should be taken as the next pixel point; when M is above Q, P1 should be taken as the next pixel point; if M coincides with Q, either P1 or P2 may be chosen. Other slopes are handled similarly.

Algorithm steps of the midpoint line algorithm:

  1. Input the two endpoints P1(x1, y1) and P2(x2, y2) of the line segment, and ensure x1<x2 by comparison.
  2. Initialization: dy, dx, d=dy+0.5dx, x=x1, y=y1, draw point (x, y); if -1<k<0, then x=x2, y=y2.
  3. Loop to draw points.
    • 0≤k≤1
    1. If x<x2, execute the following steps; otherwise the algorithm ends.
    2. Judge the sign of d; if d<0, update (x, y) to (x+1, y+1), and update d to d+a+b; otherwise update (x, y) to (x+1, y), and update d to d+a.
    3. Draw point (x, y).
    • 1<k<0
    1. If x>x1, execute the following steps; otherwise the algorithm ends.
    2. Judge the sign of d; if d<0, update (x, y) to (x-1, y+1), and update d to d-a+b; otherwise update (x, y) to (x-1, y), and update d to d-a.
    3. Draw point (x, y).

Simple seed filling algorithm

Assume that a point in the region is known and use it as a seed. Starting from this point, search along the connected direction of the region for points adjacent to the seed and inside the region, make them new seeds, and then continue searching recursively. If an adjacent point is not inside the region, the boundary has been reached.

  1. Determine the boundary and the attributes of the boundary;
  2. Determine the attribute value for region filling;
  3. Test the attribute value of a point in the region to determine whether it is inside the filling region and has not been filled,
  4. If it is inside the region and its attribute value differs from the boundary, assign the filling attribute and use this point as a seed;
  5. Along the 4-connected (or 8-connected) directions, test other points;
  6. Compare each tested point with the boundary attribute; if different, assign the filling attribute;
  7. If the same, the boundary has been reached, then turn to another connectivity direction;
  8. The testing of all points is implemented in a recursive loop.

Scan line seed filling algorithm

Use scan lines to scan from top to bottom a multi-segment polygon composed of point line segments. Each scan line produces a series of intersections with the polygon edges. Sort the intersections by x (or y) coordinate, then take them in pairs as two endpoints and draw a horizontal line with the fill color.

When a seed point is given, first fill a segment on the scan line containing the seed point that lies within the given region, then determine the segments within the given region on the upper and lower scan lines connected to this segment, and save them in turn. Repeat this process until filling is complete.

Scan line algorithm

Use region continuity, scan line continuity, and boundary continuity.

  1. Sort the region boundary vertices by Y coordinate;
  2. Determine the intervals of the scan lines;
  3. Build the active edge table of boundary edges;
  4. Find intersections: compute the intersections of the current scan line with all edges of the polygon;
  5. Sort intersections: sort all intersections in increasing order of x value;
  6. Pair intersections: pair the sorted intersections into intervals;
  7. Fill colors: set the pixel values in each interval to the target color value.

The specific algorithm steps are as follows:

  1. Initialize the edge table ET: store each edge of the polygon in the ET bucket corresponding to its ymin value according to that edge’s ymin value.
  2. Initialize the active edge table AET as an empty table.
  3. Set the y value to the minimum y value listed in ET, that is, the y value of the first non-empty bucket.
  4. Repeat the following steps until both AET and ET are empty:
    1. When the y value of the scan line becomes greater than or equal to the value of a certain y bucket in ET, add all nodes of that bucket to AET (and delete them from ET at the same time), and sort the records in AET by x value.
    2. For scan line y, fill the required pixel values between each pair of intersections.
    3. Delete entries in AET with y>ymax.
    4. Update the x value of all remaining nodes in AET, replacing x with x+1/m. (When a node enters AET in the current loop iteration, its recorded x value is xmin.)
    5. Re-sort the nodes in AET by x value.
    6. Increment y by 1 and enter the next loop iteration.

Line encoding clipping algorithm

Extend the window boundaries to divide the plane into 9 regions, encode each region with a 4-bit binary number, and determine positions according to the encoded values or logical operations.

  1. Endpoint encoding Positions from the left: the 1st bit is 1 if the endpoint is above yT, that is, y>yT; the 2nd bit is 1 if the endpoint is below yB, that is, y<yB; the 3rd bit is 1 if the endpoint is to the right of xR, that is, x>xR; the 4th bit is 1 if the endpoint is to the left of xL, that is, x<xL; otherwise, the corresponding position is 0.
  2. Determine positions according to the encoded values or logical operations.
    1. If the 4-bit codes of both endpoints of a line segment are all 0, then the line segment is inside the window and can be output directly;
    2. If the logical AND (bitwise product) of the codes of the two endpoints is not 0, then the line segment is entirely outside the window and is discarded;
    3. Otherwise, the line segment intersects the window, so find the intersection.
  3. Intersection process
    1. Find the intersection of the line with the window boundary, use the intersection to split the line segment, and discard the part beyond the intersection
    2. Use the intersection as a boundary to further test for intersections and split
    3. Clipping order: according to the encoded value;
    4. Termination criterion: all encoded values are zero.

Outward normal hidden surface removal algorithm

Outward normal hidden surface removal algorithm: used for hidden surface removal of planar solids

Algorithm steps for hidden surface removal of an arbitrary planar solid:

  1. First compute the outward normal of the surface, and compute the direction cosine value cosa in its projection direction;
  2. Determine visibility according to the direction cosine value: cosa>0 front-facing; cosa≤0 back-facing
  3. For front-facing surfaces, compute the maximum depth value of the surface;
  4. Compute the coordinates of the box corners of the front-facing surface;
  5. Take the surface with the maximum depth value as the current surface;
  6. Loop to compute the occlusion relationship between other surfaces and the current surface;
    1. Extract each edge of the surface and determine its relationship with the current surface: fully occluded, completely unoccluded, or partially occluded;
    2. If fully occluded, treat it as an invisible edge and delete it or change its line style;
    3. If completely unoccluded, treat it as a visible edge and draw it;
    4. If partially occluded, use line segment clipping to find the part of the line segment outside the polygon: the visible line segment, and draw it;
    5. For the part of the line segment inside the polygon: the invisible line segment, delete it or change its line style.

Depth buffer hidden surface removal algorithm

The basic idea of the depth buffer hidden surface removal algorithm is: compare the depths of all patches (planes or surfaces) corresponding to each pixel of the projection plane, and then take the attribute value of the patch closest to the line of sight as the attribute value of that pixel.

Initially, all units of the depth buffer are set to the minimum z value, and each unit of the frame buffer is set to the background color. Then process each patch in the polygon table one by one. For each scan line, compute the depth value z(x, y) corresponding to each pixel point (x, y) in that row, and compare the depth with the depth value ZB(x, y) stored in that pixel unit in the depth buffer.

If Z>ZB(x, y), then ZB(x, y)=z, and at the same time write the attribute value I(x, y) of that pixel into the frame buffer, that is, FB(x, y)=i(x, y); otherwise leave it unchanged.

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...