NetDEM v1.0
Loading...
Searching...
No Matches
05_test_shape_netsdf.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_netsdf.hpp"
#include "shape_plane.hpp"
#include "simulation.hpp"
#include "stl_model.hpp"
#include <iostream>
#include <unordered_map>
using namespace netdem;
using namespace std;
void TestShapeNetSDF() {
// case1 trimesh
TriMesh trimesh;
trimesh.InitFromSTL("shape_template.stl");
trimesh.Decimate(500);
trimesh.AlignAxes();
trimesh.SetSize(1.0);
// shape template and particles
NetSDF netsdf;
netsdf.InitFromModelFiles("ann_SDF.xml", "ann_SPF.xml");
trimesh.SaveAsSTL("test_shape_original.stl");
netsdf.SaveAsSTL("test_shape_netsdf.stl");
}
A class for representing a shape using a neural network-based signed distance function (SDF).
Definition shape_netsdf.hpp:26
void InitFromModelFiles(std::string const &net_sdf_file, std::string const &net_spf_file)
Initialize the NetSDF object from pre-trained neural network models.
Definition shape_netsdf.cpp:15
virtual void SaveAsSTL(std::string const &filename)
Saves the shape instance as an STL file.
Definition shape.cpp:353
A class representing a triangular mesh in 3D space.
Definition shape_trimesh.hpp:23
void InitFromSTL(std::string const &file)
Initialize the TriMesh object from an STL file.
void Decimate(int num_nodes)
Decimate the TriMesh object.
Definition shape_trimesh.cpp:121
void AlignAxes()
Align the axes of the TriMesh object.
Definition shape_trimesh.cpp:107
void SetSize(double d) override
Set the size of the TriMesh object.
Definition shape_trimesh.cpp:207
Definition bond_entry.hpp:7