NetDEM v1.0
Loading...
Searching...
No Matches
shape_netsdf.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "igl_wrapper.hpp"
4#include "regression_net.hpp"
5#include "sdf_calculator.hpp"
6#include "shape.hpp"
7#include "stl_model.hpp"
8#include "stl_reader.hpp"
9#include <iostream>
10#include <string>
11
12namespace netdem {
13
26class NetSDF : public Shape {
27public:
28 // ann for netsdf
31
32 // for reconstructing surface from point cloud
33 double alpha{0.7};
34
38 NetSDF();
39
49 void InitFromModelFiles(std::string const &net_sdf_file,
50 std::string const &net_spf_file);
51
58 void Init();
59
68 nlohmann::json PackJson() override;
69
78 void InitFromJson(nlohmann::json const &js) override;
79
86 void UpdateSurfaceNodes() override;
87
94 void UpdateShapeProperties() override;
95
104 void SetSize(double d) override;
105
113 Shape *Clone() const override;
114
125 STLModel GetSTLModel(int num_nodes = 200) override;
126
138 double SignedDistance(Vec3d const &pos) const override;
139
152 Vec3d SurfacePoint(Vec3d const &pos) override;
153
157 ~NetSDF();
158
165 void Print() override;
166
167private:
168 STLModel surface_stl;
169};
170
171} // namespace netdem
A class for representing a shape using a neural network-based signed distance function (SDF).
Definition shape_netsdf.hpp:26
STLModel GetSTLModel(int num_nodes=200) override
Generate an STL model of the NetSDF object.
Definition shape_netsdf.cpp:119
void UpdateShapeProperties() override
Update the shape properties of the NetSDF object.
Definition shape_netsdf.cpp:68
RegressionNet net_spf_model
Definition shape_netsdf.hpp:30
NetSDF()
Default constructor.
Definition shape_netsdf.cpp:10
Shape * Clone() const override
Clone the NetSDF object.
Definition shape_netsdf.cpp:117
Vec3d SurfacePoint(Vec3d const &pos) override
Compute the surface point closest to a given position on the NetSDF object.
Definition shape_netsdf.cpp:165
RegressionNet net_sdf_model
Definition shape_netsdf.hpp:29
nlohmann::json PackJson() override
Pack the NetSDF object into a JSON structure.
Definition shape_netsdf.cpp:32
double alpha
Definition shape_netsdf.hpp:33
void Print() override
Print information about the NetSDF object.
Definition shape_netsdf.cpp:179
void Init()
Initialize the NetSDF object.
Definition shape_netsdf.cpp:23
~NetSDF()
Destructor.
Definition shape_netsdf.cpp:177
void SetSize(double d) override
Set the size of the NetSDF object.
Definition shape_netsdf.cpp:112
void UpdateSurfaceNodes() override
Update the surface nodes of the NetSDF object.
Definition shape_netsdf.cpp:43
double SignedDistance(Vec3d const &pos) const override
Compute the signed distance from a given position to the surface of the NetSDF object.
Definition shape_netsdf.cpp:152
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
void InitFromJson(nlohmann::json const &js) override
Initialize the NetSDF object from a JSON structure.
Definition shape_netsdf.cpp:37
A class that represents a feedforward neural network for regression.
Definition regression_net.hpp:21
Class for working with STL models.
Definition stl_model.hpp:17
This class represents different types of shapes and performs various calculations on them.
Definition shape.hpp:15
Definition bond_entry.hpp:7
pos
Definition json_serilization.hpp:19
std::array< double, 3 > Vec3d
Definition utils_macros.hpp:18