(Some) 3D Math for Games


Lab Image
Today's goal: Refresh your linear algebra! Read all of the directions.


Description


In today's lab we will be refreshing some of our math and building a small math library to fit some of our needs in this course. Throughout the course, this library will grow. You will additionally get some more experience in C++.

Your Task(s)

  1. Listen in on a small lecture. This will serve as a quick reference to some math concepts.
  2. Find your partner in the spreadsheet here. (Note: Today, you are working individually. Everybody needs to know the math!)
  3. Complete the section below: "Mathematics"

Files Given/Starter Code

  • Clicking the following link gives you immediate access to your github repository.
    • You may use your personal or Northeastern github account. I do not care, but please be consistent with what you choose.
    • Please do not click until class starts. Occasionally I make changes until a few minutes before class (usually spelling corrections and other small typos).
    • Click now: https://classroom.github.com/a/wDOhFSPQ

1. Mathematics


TinyMath3D.h

Complete: Write a Vector3 and Matrix3x3 math class and include at least 10 unit tests (More is better).

From the code repository, you will see the function prototypes for the library. Understanding the fundamentals of math is important for games, and the exercise of building a library will help you practice your C++. The good news is that one good math library really only needs to be written once (Unless math changes...in which case we have bigger problems!).

For this lab you have some flexibility if you want to add more functions or organize it in a different way. This is your personal math library.


2. (Optional) AVX Instructions


SIMD

Professional math libraries make use of AVX, AVX2, and AVX512 instructions to achieve more parallelism. This is handled on the cpu side. Read through the AVX samples provided and run them. I encourage (though not required) you to try to include some of the AVX functionality in your TinyMath3D (or perhaps implement TinyMathAccelerated3D.h).

Going Further


Finished Early? Did you enjoy this lab assignment? Here are some (optional) ways to further this assignment.
  • Implement more functions you think may be of use!
  • Implement Vector2D and Matrix4D
  • Once again, try the AVX!

Evaluation


  • You and your partner will receive the same grade from a scale of 0-2. (Individual labs you get your own grade)
  • At the start of the next lab I will circulate to check off your lab. You or your partner should be ready to show it.
    • 0 for no work completed.
    • 1 for some work completed, but something is not working properly or missing
    • 2 for a completed assignment (with possible 'going further' options completed)

More Resources


Some additional resources to help you through this lab assignment

Found a bug?


If you found a mistake (big or small, including spelling mistakes) in this lab, kindly send me an e-mail. It is not seen as nitpicky, but appreciated! (Or rather, future generations of students will appreciate it!)
  • Fun fact: The famous computer scientist Donald Knuth would pay folks one $2.56 for errors in his published works. [source]
  • Unfortunately, there is no monetary reward in this course :)