NetDEM v1.0
Loading...
Searching...
No Matches
03_simplify_cobble.cpp

This is an example of how to use the netdem library.

#include "data_dumper.hpp"
#include "gen_pack.hpp"
#include "gravity.hpp"
#include "shape_sphere.hpp"
#include "simulation.hpp"
#include <filesystem>
#include <iostream>
#include <unordered_map>
using namespace netdem;
using namespace std;
void SimplifyCobble(int argc, char **argv) {
filesystem::create_directories("simplified/");
for (int i = 84; i <= 199; i++) {
string filename = to_string(i) + ".stl";
if (IO::FileExist(filename)) {
STLModel tmp_stl;
tmp_stl.InitFromSTL(filename);
tmp_stl.MakeConvex();
tmp_stl.Decimate(2000);
tmp_stl.Standardize();
tmp_stl.SaveAsSTL("simplified/" + filename);
}
}
}
Class for working with STL models.
Definition stl_model.hpp:17
void MakeConvex()
Make the model convex.
Definition stl_model.cpp:341
void Decimate(int num_nodes)
Decimate the model by a given number of nodes.
Definition stl_model.cpp:280
void Standardize()
Standardize the model.
Definition stl_model.cpp:290
void InitFromSTL(std::string const &file)
Initialize the model from an STL file.
Definition stl_model.cpp:25
void SaveAsSTL(std::string const &file) const
Save the model as an STL file.
Definition stl_model.cpp:205
Definition bond_entry.hpp:7