0% found this document useful (0 votes)
34 views

Intro To Computer Graphics - Lab Exercises

This document provides exercises on vector and geometry math concepts for computer graphics. It includes calculating vectors, magnitudes, normalization, operations between vectors, dot and cross products, cubic curves, robot visibility areas, and transformations on triangles.

Uploaded by

Qasim Sami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Intro To Computer Graphics - Lab Exercises

This document provides exercises on vector and geometry math concepts for computer graphics. It includes calculating vectors, magnitudes, normalization, operations between vectors, dot and cross products, cubic curves, robot visibility areas, and transformations on triangles.

Uploaded by

Qasim Sami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Introduction to Maths for Computer Graphics - Lab exercises

1. Calculate the vector PP’ for the following pairs of 2D and 3D points:

(i) P(2, 0) and P’(0, 1) (ii) P(0, 0) and P’(0, 1) (iii) P(1, 0) and P’(7, 0)

(iv) P(9, 8, 0) and P’(-2, 4, 1) (v) P(2, 0, -3) and P’(4, 0, 1) (vi) P(-2, -3, -7) and P’(0, 1, 4)

2. Calculate the inverse vector P’P for (ii) and (v) from question 1

3. Calculate the magnitude for the following vectors:

(i) V1(3, 4) (ii) V2(2, 0, 4) (iii) V3(12, 7, -6)

4. Normalise the V1, V2, V3 vectors from question 3

5. Perform the required operations on the given vectors:

(i) Multiply V(3, -6, 1) with the scalar 3 (ii) Add V1(3, 7, 0) and V2(-2, -2, -2)

(iii) Add V1(-2, -2, -2) and V2(3, 7, 0) (ii) Subtract V1(121, -7, 80) and V2(-6, 0, 24)

6. Calculate the dot product for each of the following pairs of vectors:

(i) A(4, 0, 4) and B(22, 0, 0) (ii) C(3, 0, 9) and D(4, 201, -2)

7. Find the angle θ between A and B from question 6


8. Can you guess the result of the cross product between vectors V1 (4, 0, 0) and V2 (0, 0,
4)? Calculate it to see if you were right.

9. Can you guess the result of the cross product between V2 and V1 in question 8? Validate
your answer with a quick calculation and highlight what differs now.

10. Building on your experience from questions 8 and 9, can you determine new vectors for
V1 and V2 that result in cross product equal to vector V3 (0, -1, 0)? Is there more than
one selection?

11. Calculate and draw on paper (create a simple 2D coordinate system for this) the 2D
Cubic Bezier Curve with Control Points P0 (4, 0), P1 (3, 1), P2 (6, 4) and P3 (7, 0) using a
step of 0.2. How can you improve the smoothness of your curve?

12. You are developing a game in which you have to add an autonomous AI robot game
character that has a given visibility area. If the player character falls between the
visibility areas of the robot, then the robot can detect the player and attack, otherwise
the player remains undetected and the robot continues to patrol the area. The figure
below shows the two possible cases. In the left figure, the player is detected. In the right
one, it remains undetected. The viewing angle of the robot is 60 degrees. Given that at a
the current time the 2D position of the robot is RobotPos = (3, 2) and its front vector is
ViewingFront = (0, 1) and the position of the player is PlayerPos = (5, 5) find out if the
robot has detected the player. After you answer, test the same but now for PlayerPos =
(5, -5) and again for PlayerPos = (4, 5).

6060o
6
0
6
0
o
robot
robot

Figure 1: Robot: “Alert! Intruder detected!” Figure 2: Robot: “Patrolling area. All under control.”
13. Given a triangle made from points A(0, 1, 0), B(-1, -1, 0) and C(1, -1, 0) perform the
following:

 Draw the triangle on the XY plane (Z values are all zero, so there is no need to draw
the Z axis)
 Translate all points of the triangle by 1 on the Y axis. Draw the new triangle
 Using the initial values, rotate the triangle points on Z by 90 degrees. Draw the new
triangle. How will the triangle drawn if we change the rotation to -90 degrees?
 Using the initial values, scale the triangle points by 2 on the Y axis. Draw the new
triangle

ENJOY :)

You might also like