Tutor knowledgeComputer GraphicsLLM Files / Knowledge Files65 KB
This recap test comprises multiple-choice (MC) and open questions with formatted answers. This assignment helps you recap the linear algebra content necessary to master the learning goals in the “Computer Graphics” course. The exercises correspond to the content covered in the linear algebra recap lecture.
Progress State Explanation:
Result State Explanation:
| Assignment | Weight | Progress | Result | Due |
|---|---|---|---|---|
| Linear Algebra Recap Test | 1.0 of total 6.0 | not started yet | Nov 22 23:59 | |
| (Folder) Ungraded Linear Algebra Recap Assignments | 0.0 of total 21.0 | not started yet | Nov 22 23:59 | |
| (MC) Distance between two Points | 1.0 of total 21.0 | not started yet | Nov 22 23:59 | |
| (MC) Distance between two Points | 1.0 of total 21.0 | not started yet | Nov 22 23:59 | |
| (MC) Linear Independence | 1.0 of total 21.0 | not started yet | 23:59 |
Status: You are viewing this submission in read-only mode. Deadline passed. Weight: 1.0
In , the addition of two vectors can be visualized by attaching the endpoint of one vector to the origin and the endpoint of the other to the tip of the first. Visualize the addition with and . Verify the result of this addition by calculating the answer.
Options:
You are viewing this submission in read-only mode. Deadline passed.
Compute with and .
Select one option
This is a private discussion, only visible to course staff and submitter of this work.
Given two vectors and , calculate the vector .
You are viewing this submission in read-only mode. Deadline passed.
Given two vectors and , calculate the vector .
Deadline passed, this submission cannot be edited anymore.
Given two vectors and , calculate the vector .
This is a private discussion, only visible to course staff and submitter of this work.
You are viewing this submission in read-only mode. Deadline passed.
Given two vectosr and , calculate the vector .
The submission interface shows an area for the answer, but it is not populated in this view due to the deadline having passed.
What is the length of the vector ?
Select one option
You are viewing this submission in read-only mode. Deadline passed.
Compute the length of the vector .
You are viewing this submission in read-only mode. Deadline passed.
Compute the length of the vector .
You are viewing this submission in read-only mode. Deadline passed.
Determine the dot product between and .
Select one option
Given the vectors and , compute the dot product .
Given the vectors and , compute the dot product .
You are viewing this submission in read-only mode. Deadline passed.
Calculate the angle between the vectors and using the dot product.
This is a private discussion, only visible to course staff and submitter of this work.
You are viewing this submission in read-only mode. Deadline passed.
What is the distance between points and point ? Visualize the distance and verify it by computing it.
Select one option
You are viewing this submission in read-only mode. Deadline passed.
Select one option:
Possible Answers:
This is a private discussion, only visible to course staff and submitter of this work.
Given a vector , find vector such that is a basis of .
You are viewing this submission in read-only mode. Deadline passed.
Building a Basis (3D)
Given a vector , find vectors such that is a basis of .
Given the vector , compute a vector orthogonal to it. Then, is of the following form:
Select one option
This is a private discussion, only visible to course staff and submitter of this work.
You are viewing this submission in read-only mode. Deadline passed.
Given a vector , provide a vector that is orthogonal to .
Deadline passed, this submission cannot be edited anymore.
You are viewing this submission in read-only mode. Deadline passed.
Given a vector , provide a vector that is orthogonal to .
You are viewing this submission in read-only mode. Deadline passed.
Given the matrix Which of the following is an inverse of the matrix?
Select one option
You are viewing this submission in read-only mode. Deadline passed.
Inverse of a Matrix (3D)
Given a matrix with column vectors , and , i.e., the matrix
calculate its inverse.
Answer:
Deadline passed, this submission cannot be edited anymore.
Line 2D (MC)
Which of the following vector representations does correspond to the line given by the equation ?
Select one option
You are viewing this submission in read-only mode. Deadline passed.
Which of the following formulations corresponds to the line in that connects points (1,1,0)^t and (0,0,2)^t.
Select one option
You are viewing this submission in read-only mode. Deadline passed.
Given the line in , which of the following points are on that line: ?
Select one option
You are viewing this submission in read-only mode. Deadline passed.
Which of the following normal forms describes the plane \((0,1,2)^t+s(1,2,3)^t+r(4,3,2)^t\)?
\((-5, 10, -5)\cdot ( \mathbf{v} - (-4,13,0)^t) = 0 \)\((1, 2, 3)^t \cdot (\mathbf{v} - (1,3,5)^t) = 0\)\((4, 3, 2)^t\cdot (\mathbf{v} - (-4,13,0)^t) = 0\)\((-5, 10, -5)^t\cdot (\mathbf{v} - (1,3,5)^t) = 0\)Skip QuestionThis is a private discussion, only visible to course staff and submitter of this work.
You are viewing this submission in read-only mode. Deadline passed.
Which of the following vector forms does correspond to the plane given by normal form ?
Select one option
This is a private discussion, only visible to course staff and submitter of this work.
Note: You are viewing this submission in read-only mode. Deadline passed.
Given the plane , determine which of the points lie on the same side of the plane.
Select one option
This is a private discussion, only visible to course staff and submitter of this work.
Status: Deadline passed, viewing in read-only mode.
Given two points , compute the mid-point between the two points and the direction of the separating line between the points that is orthogonal to the line connecting and .
(The answer section is empty in the provided HTML.)
You are viewing this submission in read-only mode. Deadline passed.
Starting from the point , a line is shot in direction . It hits the -plane at point , where it is reflected such that the angle of incidence is equal to the angle of reflection. It then hits the -plane at point , see the (not to scale) depiction below.

Which of the following statements on the coordinates of and is correct?
You are viewing this submission in read-only mode.
The following code draws an image by setting the pixel colors. Which of the following images corresponds to the output of this code? (the mod(x,y) function returns x mod y)
bool PixelColor (int coordx, int coordy) {
int x = mod(coordx, 10);
int y = mod(coordy, 8);
if (y == 0 || y == 4)
return false;
if (y < 4 && x == 4)
return false;
if (y > 4 && x == 9)
return false;
return true;
}
void CreateImage () {
for (int i=0; i<20; ++i)
for (int j=0; j<20; ++j)
{
if (PixelColor(i,j))
Img.pixel(i,j) = (1.0, 0.0, 0.0);
else
Img.pixel(i,j) = (, , );
}
}



Skip Question




You are asked to simulate a 2D bicycle, as illustrated below. The centre of the bicycle is initially at position and the centre of the crank is at position . The centre of the pedal rotates around point . For every complete clockwise turn of the pedal, the bike moves unit forward (positive x-axis).
Given the initial position , compute the position of the pedal after a rotation of .

Write your answer in the form . For example, a possible answer could be:
Check your answer with the following information: .
We want to take a photo from inside a house looking out a window using a pinhole camera. The camera is mounted on a tripod that maintains its view vector in the same orientation as the x-axis. The coordinates of the window’s corners are , and the origin is inside the house. Given that the camera has fixed focal length and aspect ratio equals 1, where would you place the camera so that it covers the entire window and, at the same time, only captures the minimum amount of wall (or anything but the window)?
Write your answer in the form . For example, a possible answer could be:
Check your answer with the following information: adding the three coordinates of the answer adds to zero, i.e.,
A square in 3D space is projected onto the screen using a linear perspective transformation. The 2D coordinates of the square after projection are .
Considering the vanishing lines generated by the projected square, what are the 2D coordinates of the vanishing point that is not at infinity?
Develop an image filter that blurs the input image with a weighted average filter. Similar to the box filter from the lecture, this filter should use the pixel’s direct neighbour (3x3 neighbourhood). However, in this case, not all pixels contribute equally:
Border pixels should be treated. In this case, use only the existing neighbouring pixels for the filter.
There are three test images: checkerboard, flowers and random.
Here are the reference results for these three input:

| File | Download |
|---|---|
| <code>flowers.png</code> | <span class="pull-right"><a class="small text-muted navigate" href="https://weblab.tudelft.nl/downloadData/131941/3c47d533-ef14-4d2d-bc3e-81e4c0ea8d8e"><span class="glyphicon glyphicon-download"></span> Download</a></span> |
| <code>checkerboard.png</code> | <span class="pull-right"><a class="small text-muted navigate" href="https://weblab.tudelft.nl/downloadData/131941/d7c35fa9-6178-4220-8f51-e8649036d001"><span class="glyphicon glyphicon-download"></span> Download</a></span> |
| <code>random.png</code> | <span class="pull-right"><a class="small text-muted navigate" href="https://weblab.tudelft.nl/downloadData/131941/e9e01b88-e3e8-4880-aa14-7901d3347c16"><span class="glyphicon glyphicon-download"></span> Download</a></span> |
#include "library.cpp"
// You can access an image i-th pixel by: input.pixels[i][c], where c={0,1,2} (color channels)
// Note that you need to access the images with a single index, each pixel is a glm::vec3
// Likewise you can write to a pixel using the same notation
// You can query the image width and height by: image.width or image.height
// All images are in RGB format (three channels)
void filter (const Image &input, Image &output) {
}
int main() {
// you can change the image to flowers.png for further testing
// you can also change to random.png.
std::string image_name = "../checkerboard.png";
Image input (image_name);
// for simplicity, create an ouput image as a copy of input (could have been a blank image)
// running the program without modifications should output the same image as the input
Image output (image_name);
(input, output);
output.();
}
// Suppress warnings in third-party code.
#include "library.cpp"
// Suppress warnings in third-party code.
#include <framework/disable_all_warnings.h>
DISABLE_WARNINGS_PUSH()
#include <glm/glm.hpp>
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>
DISABLE_WARNINGS_POP()
#include <iostream>
#include <framework/image.h>
We want to install a projector. Unfortunately, it cannot be placed perfectly aligned with the diffuse screen. Assuming the projection direction along the optical axis of the projector and the screen normal form an angle of (radians), how much would one need to scale up the brightness of the projector, in order to deliver the same projected image brightness in the projection centre as a perfectly aligned projector at the same distance?
REMARK: “how much would one need to scale up the brightness of the projector?” asks about a factor that needs to be multiplied by the original brightness.
Select one option
This is a private discussion, only visible to course staff and submitter of this work.
LED lamps often combine several colored lamps to simulate white light. Assume S1, S2, S3 are light sources with RGB emission (0.3,0.4,0.2), (0.2,0.1,0.2), (0.2,0.1,0.4) respectively. Calculate the values of , such that the added emission matches (1,1,1).
Write your answer in the following format: (number comma number comma number)
Check your answer with the following hash:
Iridescence (or goniochromism) is a light-matter phenomenon where the surface appearance changes color (not only intensity) as the light and view direction change. Common examples are butterfly wings, soap bubbles and some car paints.
Consider a simplified iridescence effect that assumes the material to be diffuse, but its diffuse coefficient is given by , where is the cosine between the surface normal and light direction, and is the cosine between the surface normal and the view direction.
Consider a point at the material surface with normal direction . Further, consider a point light source at position that emits white light. Compute the perceived color for a viewer at position , looking at point .
Write your answer in the form: R, G, B (number comma number comma number).
Check you answer with the following hash:
During triangle rasterization you can use an Axis-Aligned-Bounding-Box (AABB) to reduce the search space; limit the number of pixels whose centers will be checked for being inside/outside the triangle.
Consider now that we want to approximate 2D circles by using a GL_TRIANGLE_FAN primitive. It is similar to GL_TRIANGLE_STRIP, but after the three first vertices, every new vertex connects to the first and last vertex. So, for a sequence of vertices the following triangles are created .
To create approximations of a circle in 2D space we use the method below. Note that we are using 2D vertices instead of 3D.
// input is center of circle and vector from center to first point
void draw (c_x, c_y, v_x, v_y) {
float x = v_x;
float y = v_y;
float cos = 1.0f/sqrt(2.0f);
float sin = 1.0f/sqrt(2.0f);
glBegin(GL_TRIANGLE_FAN);
glVertex2f ( c_x, c_y);
glVertex2f ( c_x+x, c_y+y);
for (int i = 0; i < 8; ++i) {
float px = cos*x - sin*y;
float py = cos*x + sin*y;
glVertex2f ( c_x+px, c_y+py);
x = px;
y = py;
}
glEnd();
}
The rasterizer is now modified to create and then rely on AABBs for these fans that approximate circles.
If we call the method with parameters
draw (3.5, 4.3, 2.0/sqrt(2.0), 2.0/sqrt(2.0)) {
what are the coordinates of the four corners of the respective AABB?
Write your answer in the form:
where is bottom-left, is bottom-right, is top-right and is top-left.
Check your answer with the following hash
and
Create a function that draws a 3D spiral. The spiral should be created using line segments (GL_LINES).
It starts at the origin and spirals counterclockwise and outwards.
Start with a 2D spiral on the plane. From the origin, the next vertex is translated by and rotated by . For each consecutive vertex, we accumulate a new translation of and rotation of . Note that we and do not .
Once your 2D spiral works, make it spiral outwards (z-axis) by incrementing at each step units along this axis.
Your final spiral should be composed of 600 line segments.
#include "library.cpp"
void drawSpiral3d (void) {
// create an arbitrary line as an example
glBegin(GL_LINES);
glVertex3f(-100.0, -100.0, -100.0);
glVertex3f( 100.0, 100.0, 100.0);
glEnd();
}
int main(int /* argc */, char** argv) {
// output image resolution
glm::ivec2 resolution (400);
Window window { argv[0], resolution, OpenGLVersion::GL2, false };
initializeGL (window);
clearScreen(window);
loadMatrices (window);
glm::mat4 transform ;
transform = glm::(transform, glm::(, , ));
transform = glm::(transform, glm::(), glm::(, , ));
(glm::(transform));
();
(window, );
window.();
}
// Suppress warnings in third-party code.
#include <framework/disable_all_warnings.h>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtx/transform.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <framework/opengl_includes.h>
#include <framework/image.h>
#include <framework/window.h>
#include <iostream>
void {
(!((GLADloadproc)glfwGetProcAddress)) {
();
std::cerr << << std::endl;
();
}
window.();
(, , window.().x, window.().y);
(GL_DEPTH_TEST);
}
{
(, , , );
(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
{
(GL_PROJECTION);
glm::mat4 projectionMatrix = glm::(glm::(),
()window.().x/()window.().y, , );
(glm::(projectionMatrix));
(GL_MODELVIEW);
}
{
window.(filename, );
window.();
size = std::filesystem::(filename);
(size > ) {
std::cerr << << std::endl;
std::cerr << << std::endl;
}
}
Your task is to draw a pyramid using OpenGL. The angle between a side of the pyramid and the floor is . Each face should be symmetrical in regards to the positive or negative or axis (the center of the lower edge is on the axis). The pyramid floor is a 1x1 square composed of four triangles.
There should not be gaps or overlap between the triangles.

The faces should have the following colors:
You cannot call glVertex in your code, but you can use the function drawTriangle that will render a triangle with the following coordinates: .
The following transformation methods are available from the library file.
glm::mat4 rotationMatrixX(float angle);
glm::mat4 rotationMatrixY(float angle);
glm::mat4 rotationMatrixZ(float angle);
glm::mat4 translationMatrix(glm::vec3 t);
glm::mat4 scaleMatrix(glm::vec3 s);
Below are some useful OpenGL commands (you can also find them in the code as comments):
// working with glm::mat4 and the transformations
glm::mat4 transform (1.0f); //creates an identity matrix
transform = translationMatrix (glm::vec(x,y,z)) * ;rotationMatrix (glm::radians(360.0f));
// operating with the GL_MODELVIEW matrix
glMultMatrixf(glm::value_ptr(transform)); //multiplies the current matrix by transform
glLoadIdentity(); // resets to identiy
glLoadMatrixf(glm::value_ptr(transform)); // loads a new matrix (transform)
// push and pop from the stack with
glPushMatrix();
glPopMatrix();
// set the current color
glColor3fv(glm::value_ptr(getColor(i))); // where i is the color index (see library code)
// i=0 -> (1.0f, 1.0f, 0.0f); // yellow
// i=1 -> (0.0f, 1.0f, 0.0f); // green
// i=2 -> (1.0f, 0.0f, 0.0f); // red
// i=3 -> (0.0f, 0.0f, 1.0f); // blue
#include "library.cpp"
void drawPyramid (void) {
// a glm 4x4 identity matrix
glm::mat4 transform (1.0f);
// to reset, load or multiply a matrix to the GL_MODELVIEW use
// glMultMatrixf(glm::value_ptr(transform)); multiplies the current matrix by transform
// glLoadIdentity(); // resets matrix on top of the stack to identity
();
}
{
;
Window window { argv[], resolution, OpenGLVersion::GL2, };
(window);
(window);
(window);
;
transform = glm::(transform, glm::(, , ));
transform = glm::(transform, glm::(), glm::(, , ));
(glm::(transform));
();
();
(window, );
window.();
}
Part 1 of 2 — loading the next…
| (Auto) Building a Basis (2D) | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (Auto) Building a Basis (3D) | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (Auto) Building a Basis (3D) | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (MC) Orthogonal Vectors | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (MC) Orthogonal Vectors | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (Auto) Orthogonal Vector (2D) | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (Auto) Orthogonal Vector (3D) | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (MC) Inverse of a Matrix | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (MC) Inverse of a Matrix | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (Auto) Inverse of a Matrix (3D) | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (MC) Line 2D | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (MC) Line 3D | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (MC) Points on a Line | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (MC) Normal form | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (MC) Vector Form | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (MC) Points on sides of a Plane | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| Separating Line | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |
| (MC) Line Reflection | 1.0 of total 21.0 | not started yet | Nov 22 23:59 |