Assignment 1 Introductory Graphics
The core of this assignment is understanding basic transformations on an image
You don’t need to use C# for the 2D stuff, but I’ve provided tutorials from MS in C# since most students are familiar with it.
1. Create a jpg and a bitmap image and load and display them in a window. In C# this can be easily accomplished using GDI+
https://docs.microsoft.com/en-us/dotnet/api/system.drawing.bitmap?view=dotnet-plat-ext-3.1
https://docs.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-loading-and-displaying-bitmaps-use
(Part of the GDI + tutorial)
Implement a simple example of the following basic transformations
(note transformations in 2D are a 3x3 matrix, in 3D we work in homogenous coordinates with a 4x4 matrix).
a. Rotation of an angle of 27 degrees
b. Translation: Translate some number of pixels (117 pixels) to the right.
If this moves the picture off the screen that’s ok.
c. Scale –up or down by 14%.
2. Fonts/Text. Using Direct2D overlay sample text on an image of your choosing (put the word TESTING).
3. Create a program (WebGL, OpenGL, or DirectX) that creates a series of random triangles. about 5-10 is probably good but you may need more or less to see what you’re doing. You can hard code these, but random in the sense that they aren’t all perfectly aligned facing the screen and all the same size.
https://webglfundamentals.org/webgl/lessons/webgl-drawing-multiple-things.html
Might be very very helpful….
Objects should
randomly translate, scale, rotate, and shear
(though not all at once generally) and preserve this state as they move around. Don’t pick values that are so crazy you can’t see any of this happening on screen. Randomly colour them as well.
Foundational Theory Questions
4. Write a program to properly compute Bresenham’s
line
drawing algorithm for a 3D line projected onto any of the 4 possible parts of a grid. Format for this question. Assume the input line starts at the origin, and that the grid is no more than from the range (-10: +10) in both X and Y. The user should be able to input a 3D coordinate of form x, y, z, and the program should output which cells will be solid as a list of the form.
(x1, y1)
(x2, y2)
Etc.
This is a math question where you’re writing a program to solve it. You can use any programming language you want. Show testing compared to the problem done by hand.