Topic 7. 3D graphics. Animation
Site: | Навчально-інформаційний портал НУБіП України |
Course: | Computers and Computer Technology (БЦІ). P2 ☑️ |
Book: | Topic 7. 3D graphics. Animation |
Printed by: | Гість-користувач |
Date: | Tuesday, 13 May 2025, 2:57 AM |
1. 3D graphics
In 1961, Sutherland launched the era of computer graphics.
In 1967, he and Evans began work on creating a computer graphics training course.
At that time, the Utah State University (U.S.) worked: Jim Clarke is the founder of Silicon Graphics Inc., John Warnock is the founder of Adobe Systems and the developer of such famous products as Photoshop and PostScript.
Initially, the bulk image of objects was formed on the basis of a set of geometric shapes (most often triangles).
The geometric shapes had a monotonous dent, and the foreground objects covered the ones that were placed in the background. In 1971 Gourou proposed to paint triangles with a linear change in the intensity between their vertices. This allowed for a more smooth change in the intensity along the surface of the objects. In 1974, Ketmell proposed the concept of Z-buffer, which accelerated the process of extracting hidden faces.
Another invention of Katmula is the overlay of a texture on the surface of three-dimensional objects, which ensures the realism of these objects. Wu Tong Fong suggested interpolating the shades of the whole surface of the polygon, which provides better smoothness, although it requires considerably higher computations.
In 1997, Macromedia acquired the FutureWare company 's small graphical Web application, which launched the well-known Macromedia Flash computer animation program. In May 1998, the Maya release began.
Presentation of graphics information
Maple implements all variants of mathematical graphs - from the construction of graphs of simple functions in Cartesian and polar coordinate systems, to create realistic images of complex structures in space with their functional coloring.
There are two methods for representing images - raster and vector.
When scanning method, the image appears as a set ( raster ) points or pixels (pixel by pixel element - element of the image).
For the encoding of brightness of any point there are enough eight digits, which allows to provide 256 color gradations, for example, gray - from black to white.
Any color that a person sees can be obtained by mixing three basic colors: R (red), G (green) and B (blue):
- red (255, 0, 0);
- yellow (255, 255, 0);
- white (255, 255, 255);
- green (0, 255, 0);
- blue (0, 255, 255);
- blue (0, 0, 255);
- purple (255, 0, 255).
This encoding system provides 16.5 million different colors (True color).
In addition to the RGB color coding model, also used:
- CMY (Cyan - Magenta - Yellow - blue-purple-yellow) - for receiving images on a white surface (sheets of paper);
- HSV (Hue, Saturation, Value - hue, saturation, magnitude) - something like the artwork with the palette of colors.
2. Curves of the line. Surfaces The body
In 3D space, coordinate systems are widely used: Cartesian, cylindrical, spherical, and others.
There are types of surface equations:
- obvious;
- implicit (canonical);
- parametric, etc .;
- polar
Surfaces of the 2nd order (quadrics)
The canonical equation of the surface of the 2nd order is quadratic (Table).
Ellipsoid |
Single-cavity hyperboloid |
Two-cavity hyperboloid |
|
|
|
|
|
Elliptic paraboloid |
Hyperbolic paraboloid |
Elliptical cone |
|
|
|
|
|
Cylindrical surfaces
Cylindrical surfaces are formed by the displacement of a direct (creature) parallel to a certain vector and cross a fixed curve (guideline).
The equation defines a cylindrical surface with a creature parallel to the axis.
Elliptical Cylinder |
Hyperbolic cylinder |
Parabolic cylinder |
|
|
y2 = 2 px
|
Operators of surface construction
The Maple core includes only two commands for building 3D graphics - plot3d and smartplot3d.
To construct with options, the plot3d command is used in the formats:
- plot3d (expr1, x = a..b, y = c..d, options) ;
- plot3d ([expr1, expr2, expr2], u = a..b, v = c..d, options) .
Побудова кількох поверхонь, що визначаються виразами expr1, expr2, ..., залежними від змінних var1[a, b], var2[c, d], здійснюється за допомогою команди:
plot3d({expr1, expr2, ..., exprn}, var1=a..b, var2=c..d, options).
Функції тривимірної графіки:
- contourplot(expr, var1 = a..b, var2 = c..d, options) - виведення ліній рівня функції (expr) змінних (var1, var2), яка ідентична plot3d з опцією style=CONTOUR.
- cylinderplot(expr, var1 = a..b, var2 = c..d, options) - поверхня, яка визначається виразом expr, в циліндричних координатах,
- implicitplot3d(expr=g, var1=a..b, var2=c..d, var3=e..f, options) - зображення поверхні expr від var1, var2, var3.
- matrixplot(M) - поверхня, заданої таблицею M.
- pointplot([[x1, y1, z1], ... [xn, yn, zn]], options) - виведення точок, заданих координатами x, y, z.
- polygonplot3 d ([pnt1, ..., pntn]) - output of the three-dimensional n-angle given by the points with coordinates pnt1 , ..., pntn (the first point connects to the last one).
- spacecurve ([exprx, expry, exprz], var = a..b, options) - construction of the curve in the space given parametrically exprx ( X- co-ordinate), expry ( Y ) and exprz ( Z ). Expressions exprx , expry , exprz must depend on one variable var .
- sphereplot (expr, var1 = a..b, var2 = c..d, options) - construction of a surface in spherical coordinates. The expression expr is the radius depending on two variables var1 and var2 .
- surfdata ([[x1, y1, z1], ... [xn, yn, zn]], options) - construction of a surface that passes through given points (given by its coordinates in space ( x, y, z )).
- tubeplot (exprx, expry, exprz, var = a..b, radius = r) is the construction of a surface determined by the parametric curve (given by the expressions exprx (X-coordinate), expry (Y) and exprz (Z) and radius r ). Expressions exprx , expry , exprz must depend on one variable var .
- setoptions3 d (options1 = exp1, ..., optionsn = expn) - control of the options of three-dimensional graphics accepted by default.
- display3 d ([pic1, pic2, ..., picn]) - construction of n three-dimensional graphic structures in the common axes of coordinates.
- coords = opt - type of coordinates ( CARTESIAN, SPHERICAL or CYLINDRICAL ),
- title = string - the output of the header contained in the string string ,
- axes = opt - the type of coordinate axes ( FRAME, NORMAL, BOXED, NONE ),
- scaling = opt - type of zoom ( UNCONSTRAINED, CONSTRAINED ),
- orientation = [angle1, angle2] - angles of angle in degrees,
- view = az .. bz or view = [ ax .. bx, ay .. by, az .. bz] - part of the image is displayed,
- projection = n - projection type, given by the number n [0,1] ,
- style = opt - output style ( POINT - points, LINE lines, HIDDEN - grid with removal of invisible lines, PATCH - filler, WIREFRAME - grid with conclusion of invisible lines, CONTOUR - line level, PATCHCONTOUR - level lines);
- shading = opt - the function of the filler density ( Z- axis Z , XY - depending on the coordinates XY, XYZ, ZGREYSCALE - on the Z- axis, gray halves , ZHUE , NONE ),
- grid = [ i 1, i 2] is the number of nodes on the X and Y axes to calculate the surface ( grid = [25,25] ),
- numpoints = n - the number of points deduced, is equivalent to grid = [,],
- color = opt - the color of the surface ( red, blue , ..),
- light = [ angl1, angl2, numr, numg, numb] - the brightness function in the angles angl1 , angl2 is determined by the percentage of red ( numr ), green ( numg ) and blue ( numb ), varying from 0 to 1,
- ambientlight = [ numr, numg, numb] - brightness in each direction,
- labels = [ str1, str2, str3] - inscriptions on the axes of coordinates given str1 , str2 , str3 .
Package plottools
The plottools package includes functions: [annulus, arc, arrow, circle, cone, cuboid, curve, cutin, cutout, cylinder, disk, dodecahedron, ellipse,ellipticArc, exportplot, extrude, getdata, hemisphere, hexahedron, homothety, hyperbola, icosahedron, importplot, line, octahedron, parserpipes, a connection, point, polygon, prism, project, rectangle, reflect, rotate, scale, sector, semitours, sphere, stellate, tetrahedron, torus, transform, translate ].
The chart the plot plottools is for construction graphicprimitives on a plane and in space - segments of straight lines, circles, cones, etc.
Most functions have a clear syntax. For example, a cone is constructed using the primitive cone (c, r, h ...), where c is the list of coordinates of the center, r is the radius of the base, h is the height, etc.
3. Animation
For an animation of three-dimensional figures, the function animate3d is used, where: Here F is a description of the function (or functions); x, y, and t are the ranges of the variables x, y and t.
animate3d (F, x, y, t, o).
To specify the number of frames N, you must use the parameter as frame = N.
Another way to get animated drawings is to create a series of graphical objects p1, p2, p3, etc. and their sequential output using functions display or
display (p1, p2, p3, .. insequence = true)
display3d (p1, p2, p3 ..., insequence = true)
Using the insequence = true parameter ensures output of one after another series of graphic objects p1, p2, p3, etc. In this case, objects appear one by one, and each previous object is erased before the appearance of a new object.
4. Self-checking
- What are the models? colors?
- How can I change the appearance of an image - its color, type, etc.?
- How to build multiple images in one window?
- What are the animation operators in Maple?
Font Face
Font Size
Text Colour
Background Colour
Font Kerning
Image Visibility
Letter Spacing
Line Height
Link Highlight