关键词 > C语言代写

BA (Hons) Computer Animation Technical Arts Level 4 2022/23

发布时间:2023-01-18

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

BA (Hons) Computer Animation Technical Arts

Level 4

2022/23

Programming Principles

Programming Project

THE BRIEF

This programming project assignment requires the design and implementation of a computer graphics application supported by a report discussing its design and implementation (counting for 50% of unit mark). It assesses software development practice, knowledge of procedural programming concepts as well as understanding of basic 2D computer graphics techniques and algorithms. This is in relation to the following ILO’s (Intended Learning Outcomes) of the Programming Principles Unit:

• Being able to implement algorithms in general and basic CG algorithms using a suitable Application Programming Interface (API).

• Demonstrating an ability to design and implement suitable data structures.

• Demonstrating an ability to apply suitable software engineering principles.

All assignments must be written in C (not C++) and make use of the SDL library (and appropriate SDL extensions such as SDL_image or SDL_ttf) for creating windows, accessing images and pixel drawing operations (as well as OpenGL for option 3) and must include a working “makefile” that will successfully build the project on the lab machines (on Linux).

Project Option 1: Turtle Graphics & Drawing Spirolateral Curves

Turtle graphics (http://en.wikipedia.org/wiki/Turtle_graphics) is a simple and well know method for drawing complex shapes from simple lines. Turtle graphics employs the concept of a “turtle”, which is a simple robot or agent in the shape of a turtle that has the following attributes (usually implemented using a record data structure):

• a position (x, y) in 2D space,

• a heading or angle measured in degrees or radians, and

• a flag/variable pen that could be set either as Up (True/drawing) or as Down (False/not drawing)

If the turtle's pen is set to have the value Down and the turtle moves then the turtle leaves a trace while it moves. It accepts the following simple instructions (usually implemented as functions):

• pen_up sets the state of the turtle's pen to Up,

• pen_down sets the state of the turtle's pen to Down,

• move n makes the turtle move n units along its heading (usually implemented by drawing a line segment between the start point and the end point), and

• turn α turns the heading of the turtle by α degrees.

While there are some similarities between turtle graphics and L-systems, turtles and L-systems are not the same and need to be

treated/implemented differently.

A spirolateral is a geometric shape/pattern that is constructed from a series of straight lines of growing length that are attached at an angle, which, if repeated after one another, will result in a closed curve (http://mathworld.wolfram.com/Spirolateral.html).

Your task is to first implement a simple turtle library (data structure & a set of related functions – not implemented as an L-system) using C in combination with the SDL library for 2D pixel drawing and then to use this library to create a spirolateral drawing program with a simple user interface (that may be graphical or text-based) that is capable of the following:

1. allow the user to interactively (through the user interface) select/change the drawing parameters such as drawing and background colours, the initial length and number of line segments. These parameters should also include the number of repetitions of the initial pattern, the drawing angle etc.

2. provide a set of (at least) three pre-set spirolaterals that are selectable by the user for drawing

3. save the resulting spirolaterals as image files, and optionally save the spirolateral drawing as an image sequence that shows the addition of each line segment as a separate (animation) frame that would show the curve being drawn step by step

Recommended reading:

• Krawczyk, R.J. (1999). “Spirolaterals, Complexity from Simplicity”, in Proceedings of the 1999 Conference of The International Society of the Arts, Mathematics and Architecture. Available from: http://mypages.iit.edu/~krawczyk/isama99.pdf

• Krawczyk, R.J. (2000). “The Art of Spirolaterals”, in Proceedings MOSAIC 2000, the Millennial Open Symposium on the Arts and Interdisiciplinary Computing. Available from: http://mypages.iit.edu/~krawczyk/mosaic00.pdf

• Reed, D. (2002), “CSC 107, Lab 2: Functions and Turtle Graphics”, in Nifty Assignments – SIGCSE 2002. Available from: http://dave-reed.com/Nifty/WalkLab.html

Project Option 2: Raster Graphics Editor (Paint Program)

Your task is to write a Raster Graphics Editor (https://en.wikipedia.org/wiki/Raster_graphics_editor) in C/C++, i.e. a 2D computer graphics paint program for creating and manipulating bitmap images.

Your program should be able to load and save user-selected images and include a user interface (e.g. buttons for selecting drawing operations – to simplify the user interface creation, buttons could be placed into a separate window from the image drawing surface).

As a minimum the program should also include the following common operations for image editing:

1. allow the user to select the drawing colour

2. drawing on a window by placing individual (pixel) points or by using a brush (pre-defined pixel combination) and filling an image area with the drawing colour (bucket-fill), as well as erasing pixels from the image

3. drawing lines straight lines and pre-defined geometric shapes (filled and outlined boxes and circles), ideally with “Rubber Banding”, which requires some creative frame-buffer/drawing surface management (https://www.javatpoint.com/computer-graphics-elastic-or-rubber-band-techniques)

Recommended reading:

• http://gigi.nullneuron.net/gigilabs/sdl2-pixel-drawing/

• https://wiki.libsdl.org/CategoryMouse

• Willis, P. (1984), “A paint program for the graphic arts in printing”, in Proceedings of the European Graphics Conference and Exhibition, pp. 109-120. Available from: https://researchportal.bath.ac.uk/en/publications/a-paint-program-for-the-graphic-arts-in-printing

• Smith, A.R. (1997) “Digital Paint Systems - Historical Overview”, Technical Memo 14, Microsoft. Available from: http://alvyray.com/Memos/CG/Microsoft/14_paint.pdf

Project Option 3: Breakout

Your task is to write a clone of the classic arcade video game “Breakout” (released in 1976), making use of the OpenGL API in conjunction with the SDL library (see: https://en.wikipedia.org/wiki/Breakout_(video_game), https://en.wikipedia.org/wiki/Arkanoid and https://www.youtube.com/watch?v=Up-a5x3coC0).

In the game Breakout, the player controls a horizontal paddle at the bottom of the screen that is used to hit a bouncing ball towards a wall of bricks at the top of the screen, which get ‘destroyed’ when hit with the ball (different types of bricks may need a different number of hits to break). The speed of the ball is variable, depending on different factors (e.g. the ‘angle’ of connection with the paddle) If the player misses the ball, i.e. if the ball falls below the bottom of the screen, the player loses a ‘life’.

As a minimum, your program should include the following features:

1. a keyboard-controlled paddle for the player and three player ‘lives’

2. two different types of brick and three different levels that show a different target-wall (hard-coded or possibly loaded from a file)

3. at least one power-up (e.g. gained by hitting a certain number of bricks in a short time or a special brick being destroyed etc.) that provides a bonus to the player (e.g. short-term slow-down of the ball, a wider paddle, an extra ‘life’ etc.)

Recommended reading:

• https://www.c64-wiki.com/wiki/Arkanoid

Project Option 4: Image Manipulation Application

Your task is to write an image manipulation (https://en.wikipedia.org/wiki/Digital_image_processing) application tool in C/C++, i.e. a 2D computer graphics program for manipulating/modifying of bitmap images.

Your program should be able to load and save user-selected images and include a user interface (e.g. buttons for selecting image processing operations – to simplify the user interface creation, buttons could be placed into a separate window from the image drawing surface). As a minimum the program should also include the following common operations for image manipulation:

• allow the user to select areas of images (e.g. rectangular areas) or whole images

• allow the user to blur or sharpen selected areas of images

• allow users to change the brightness, contrast and gamma and add glare of selected areas of images

• allow the user to use thresholding, grayscaling, image highlights and RGB colour filters on selected areas of images

Do not hard-coded filenames of files that the user is supposed to manipulate (e.g. the filename for images a user loads or saves)!

Recommended reading:

• https://wiki.libsdl.org/CategoryMouse

• https://web.archive.org/web/20170711021400/http://www.cs.umb.edu/~jreyes/csit114-fall-2007/project4/filters.html

• http://gigi.nullneuron.net/gigilabs/converting-an-image-to-grayscale-using-sdl2/

• http://www.codeproject.com/Articles/33838/Image-Processing-using-C

Marking Criteria:

• The quality of the source code and usability of the program. This includes effective use of programming techniques, such as using structured and procedural programming, recursion, relevant control structures and data structures, etc., but also encompasses adherence to the brief (such as the use of the prescribed programming language and libraries). This will count for 50% of the mark of your assignment.

The remaining 50% will be determined by:

• The project report, including Background, Implementation, Results (see section 3 of the submission details below) and references using BU Harvard referencing.

• The (visual) Impact (i.e. how well it achieves the intended results) of the generated artefacts (based on the Results section of your report, and/or submitted generated artefacts, see submission details).

• Source code documentation (relevant and appropriate comments in the source code).

SUBMISSION DETAILS

Your submission needs to include the following:

1. One or more well commented C source code files and a working Makefile that will build an executable program without errors; the program should run on University machines.

2. A PDF user Manual for your application. The User Manual should explain how to initialise and run your program (this does not include compilation).

3. A PDF report documenting and explaining your application. As a guide, the report should be approximately 6-8 A4 pages of text and appropriate diagrams (such as design drawings/flow charts but also including resulting images/screenshots). The report should contain a section called “Background” or “Introduction” explaining related work, the algorithms, techniques, and ideas used in your project. It should also have a section called “Implementation” explaining the structure of your program in terms of the implementation of the algorithms and techniques used, describing flow of control, and explain the implementation of the most important functions or procedures. This section should serve to illuminate but not replicate your code. Finally, the report should contain a section called “Results” which includes images, or references to images (and video) demonstrating and explaining the results produced by your program. Sources used or referred to must be cited using BU Harvard referencing.

4. Appropriate sample results (and source data, such as original and images where this applies), such as animations or images generated by your program.

Note: this assignment is not a group project assignment but an individual project assignment, and apart from trivial parts of your source code, we expect to see a substantial amount of original/different source code and original reports submitted by different students.

Ensure all requested deliverables are present. Make sure your programs compile and run on the Linux workstations in the lab. It is your responsibility to include examples, images (screen shots), other data and relevant documentation regarding the operation of the programs submitted.

Make sure that any 3rd party source code (e.g. found in a book or downloaded from the web) or source

code you may have been given by fellow students or members staff is credited, i.e. cited in the report and included in comments explaining where the code was found and stating who is the author – if you received help with parts of your code the person helping you should be acknowledged in a source code comment as well as in your report. Borrowed/3rd party code should be bracketed by comments:

/* source from “Author” starts here; it originates from ... and does ... */

… code …

/* source from “Author” ends here */

If the author is unknown state the web-site or location where the source code was found. If the source is modified, but the modifications are small, start and end the comments with “ source based on “Author” ”. For example :

/* source from Ari Sarafopoulos starts here : ~/asarafop/CFG */

int ival(double v) /* return the closest integer */

{

return ((v - floor(v)) > 0.5) ? (int)ceil(v): (int)floor(v);

}

/* source from Ari Sarafopoulos ends here */

Submit via the assignment submission link in the navigation bar in the appropriate unit on Brightspace.

Please be aware of the following restrictions.

• Individual files (including zipped folders) must be less than 3GB.

• It is strongly recommended that you upload large files while on campus using a University computer.

It is your responsibility to ensure that you are submitting to the correct submission box in the correct unit on Brightspace. You should check and retain your receipt for all submissions. If you are uploading multiple files you should check all files are listed on your receipt.

If you have any technical problems submitting your work then you must contact the IT Service Desk to log the problem immediately and before the deadline.

Contact the IT Service Desk (24/7) on 01202 965515 or freephone 0808 196 2332, or online via the IT Service Portal.