This page was last updated: September 29, 2022
As we discussed in class, GLM is a set of math functions to manipulate 3D vectors and matrices. You are to create a GLM-based C++ program that allows you to perform certain operations on 3-element vectors (vec3).
Start by downloading the file glm.zip if you are using Windows, or glm.tar if you are using Linux. Un-zip or un-tar ("tar xvf glm.tar") this file in whatever folder you are using to develop the project in. It will create a sub-folder called glm.
Then, write a main program that you will use to test your functions. Place these #includes and #defines at the top of it.
#include <stdio.h> #include <string> #define _USE_MATH_DEFINES #include <cmath> #define GLM_FORCE_RADIANS #include "glm/vec2.hpp" #include "glm/vec3.hpp" #include "glm/mat4x4.hpp" #include "glm/gtc/matrix_transform.hpp" #include "glm/gtc/matrix_inverse.hpp"
To prove that you know how to use GLM to accomplish useful vector functionality, you will create the following functions:
In order for me to find out who submitted this project, I will rely on you telling me.
Create your WhoAmI( ) function exactly like this:
void
WhoAmI( std::string &yourName, std::string &yourEmailAddress )
{
yourName = "Joe Graphics";
yourEmailAddress = "jgraphics@oregonstate.edu" ;
}
except use your name and ONID login.
Un-zip and double-click on the .sln file, then select Build→Clean Solution, then select Build→Build VectorProject, then select Debug→Start Without Debugging
Un-tar this folder by saying tar xvf VectorProject.tar, then cd VectorProject, then type make, then type ./vectortemplate
In a .cpp file, turn in
only the functions!
Do not turn in any:
I will link your functions with my own main program which will use some input values that I provide. This will automatically compute your score. It is recommended that you test your functions before submitting them.
The easiest way to compile and test your functions is on a Linux system, such as flip.engr.oregonstate.edu. The commands to compile and run are:
g++ -o proj01 proj01.cpp
./proj01
Make up some good examples, hand-calculate them, and see if your code produces the right answers.
This is exactly how I am going to compile your assignment. If your functions do not compile, then I will know that you didn't take advantage of this information, and your grade will be a zero.
Click here to get the test01.o file to test with. It is just like the grading program I will use, but it will only tell you your final score. If you don't get full credit, it will not tell you what you are getting wrong. It is meant to reassure, not to replace your own testing and debugging!
Use it like this (assuming the file you are planning to turn in is called proj01.cpp):
For those of you using your own Linux system and getting "PIE" error messages, try this version of the .o file:
Click here to get the test01B.o file to test with.
(It was compiled with a newer version of g++.)
g++ proj01.cpp test01.o -o proj01
./proj01
Use it like this (assuming the file you are planning to turn in is called proj01.cpp):
g++ proj01.cpp test01B.o -o proj01
./proj01
Because you are compiling separate from my code, you will need the following lines up at the top:
#include <stdio.h>
#include <string>
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include <cmath>
#ifndef GLM_FORCE_RADIANS
#define GLM_FORCE_RADIANS
#endif
#include "glm/vec2.hpp"
#include "glm/vec3.hpp"
#include "glm/mat4x4.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include "glm/gtc/matrix_inverse.hpp"
You must not have these lines in your final turnin .cpp file.
Note that when you run your own tests, you will need a main( ) program. You must not have a main( ) program when you run with test01.o or when you turn in your .cpp file. In those two cases, I am providing the main( ) program.
Your electronic turnin will be done at
http://engr.oregonstate.edu/teach
and will consist of:
This is due at 23:59:59 on the listed due date.
If your code does not compile, then your grade for this project is a zero!
Feature | Points |
---|---|
WhatPartOfALivesInBDir | 10 |
WhatPartOfALivesPerpToB | 10 |
UnitSurfaceNormal | 10 |
Area | 10 |
IsPointInTriangle | 10 |
DistanceFromPointToPlane | 10 |
TOTAL | 60 |