The file formats are based on the following references:
- C++ compiler with c++17 support
- CMake 3.5 or newer
- GNU make
- OpenGL mathematics library (glm)
To install, use:
sudo apt-get install cmake make libglm-dev
cd model_converter
mkdir build && cd build
cmake ..
make -j8
From the build folder, you can run the tests with the following command: ./bin/test_model_converter
The binary can be found in build/bin/model_converter
The dafult functionality can be used by supplying 2 parameters to the program.
path/to/obj/file
- this is a mandatory argumentpath/to/output/file
- this is optional, if not supplied, the output will be./out.stl
Example
./bin/model_converter some/obj/file.obj subfolder/output.stl
This will convert file.obj
in folder some/obj
into an stl file and place it into subfolder/ouput.stl
.
There are a few other functions, that can't be used from the command line interface (yet). However they can be used from c++ code and all of them operate on Model
types, that are the inner representation of obj files. You can found them in Computations.hpp
. There are also examples of how to use them in the unit tests, namely ComputationsTest.cpp
transform(model, transformation)
- transform every vertex position with the given transformation. Transformations can be generated using the built-in glm functions, as well as combined with matrix multiplication:
glm::translate(vector)
glm::scale(vector)
glm::rotate(angle, vector)
glm::translate(vec1) * glm::rotate(alpha, vec2)
- creates a transformation matrix that first rotates, then translates.
surface_area(model)
- computes the surface area of the model. This is the area of all the triangles the model consits of.is_point_inside_model(point, model)
- checks whether the given point is inside the model or outside. Uses triangle intersection with every triangle of the model. If the number of intersections is even, the point is outside, otherwise inside.