A C++ library for 3-dimensional vectors and polygons, developed for computer graphics study purposes.
git clone https://github.com/GPoleto27/Vectors.git
cd VectorsUse the provided Makefile to compile and run the project:
makemake runmake clean- Edit
main.cppto create your own test cases or examples. - Rebuild and run using
make runto see the results.
Vectors/
├── Makefile
├── Vector3.h
├── Vector3.cpp
├── Polygon.h
├── Polygon.cpp
├── main.cpp
└── README.md
-
Vector3
- Addition, subtraction, scalar multiplication/division
- Normalization
- Dot and cross products
- Triple scalar product
- Angle and cosine of angle between vectors
- Length (magnitude) calculation
-
Polygon
- Constructed from three vertices
- Normal vector computation
- Centroid calculation
- Area calculation
- Flat shading intensity based on a ray direction
- The code is written in modern C++17.
- The project uses
-Wall -Wextracompiler flags for best practices and safety. - Optimizations are enabled with
-O2.