NetDEM v1.0
Loading...
Searching...
No Matches
shape_coded_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
24class CodedNetSDF : public Shape {
25public:
31
36
41
54 void InitFromModelFiles(std::string const &net_sdf_file,
55 std::string const &latent_code_file, int id);
56
63 void Init();
64
73 nlohmann::json PackJson() override;
74
83 void InitFromJson(nlohmann::json const &js) override;
84
91 void UpdateSurfaceNodes() override;
92
99 void UpdateShapeProperties() override;
100
109 void SetSize(double d) override;
110
118 Shape *Clone() const override;
119
130 STLModel GetSTLModel(int num_nodes = 200) override;
131
144 double SignedDistance(Vec3d const &pos) const override;
145
158 Vec3d SurfacePoint(Vec3d const &pos) override;
159
163 ~CodedNetSDF();
164
171 void Print() override;
172
173private:
174 int num_latent_code{0};
175
182 STLModel surface_stl;
183};
184
185} // namespace netdem
A class for representing a shape using a neural network-generated signed distance function and a late...
Definition shape_coded_netsdf.hpp:24
void UpdateSurfaceNodes() override
Update the surface nodes of the CodedNetSDF object.
Definition shape_coded_netsdf.cpp:51
void Print() override
Print information about the CodedNetSDF object.
Definition shape_coded_netsdf.cpp:214
void InitFromJson(nlohmann::json const &js) override
Initialize the CodedNetSDF object from a JSON structure.
Definition shape_coded_netsdf.cpp:45
CodedNetSDF()
Default constructor.
Definition shape_coded_netsdf.cpp:11
~CodedNetSDF()
Destructor.
Definition shape_coded_netsdf.cpp:212
VecXT< double > latent_code
The latent code used as input to the neural network model.
Definition shape_coded_netsdf.hpp:35
RegressionNet net_sdf_model
The neural network model used to generate the signed distance function.
Definition shape_coded_netsdf.hpp:30
void InitFromModelFiles(std::string const &net_sdf_file, std::string const &latent_code_file, int id)
Initialize the CodedNetSDF object from model files.
Definition shape_coded_netsdf.cpp:16
void UpdateShapeProperties() override
Update the shape properties of the CodedNetSDF object.
Definition shape_coded_netsdf.cpp:75
double SignedDistance(Vec3d const &pos) const override
Compute the signed distance from a given position to the surface of the CodedNetSDF object.
Definition shape_coded_netsdf.cpp:168
STLModel GetSTLModel(int num_nodes=200) override
Generate an STL model of the CodedNetSDF object.
Definition shape_coded_netsdf.cpp:126
Shape * Clone() const override
Clone the CodedNetSDF object.
Definition shape_coded_netsdf.cpp:124
void SetSize(double d) override
Set the size of the CodedNetSDF object.
Definition shape_coded_netsdf.cpp:119
void Init()
Initialize the CodedNetSDF object.
Definition shape_coded_netsdf.cpp:31
nlohmann::json PackJson() override
Pack the CodedNetSDF object into a JSON structure.
Definition shape_coded_netsdf.cpp:40
Vec3d SurfacePoint(Vec3d const &pos) override
Compute the surface point closest to a given position on the CodedNetSDF object.
Definition shape_coded_netsdf.cpp:184
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
std::vector< T > VecXT
Definition utils_macros.hpp:31
pos
Definition json_serilization.hpp:19
std::array< double, 3 > Vec3d
Definition utils_macros.hpp:18