27#include <easy3d/viewer/viewer.h>
28#include <easy3d/core/model.h>
29#include <easy3d/renderer/drawable_points.h>
30#include <easy3d/renderer/renderer.h>
31#include <easy3d/algo/point_cloud_poisson_reconstruction.h>
32#include <easy3d/util/resource.h>
33#include <easy3d/util/initializer.h>
43 if (!viewer || !model)
46 auto cloud =
dynamic_cast<PointCloud *
>(model);
49 std::cerr <<
"Poisson surface reconstruction method requires normal information."
50 <<
" Please provide normal information. Alternatively, you can use the "
51 <<
" Tutorial_701_Cloud_NormalEstimation for normal estimation" << std::endl;
58 std::cout <<
"reconstruction depth: " << depth << std::endl;
60 if (surface !=
nullptr) {
70int main(
int argc,
char **argv) {
74 const std::string file = resource::directory() +
"/data/polyhedron.bin";
77 Viewer viewer(EXAMPLE_TITLE);
79 Model *model = viewer.add_model(file,
true);
81 LOG(ERROR) <<
"failed to load model. Please make sure the file exists and format is correct.";
88 drawable->set_point_size(3.0f);
91 viewer.set_usage(
"'Ctrl + r': run reconstruction");
93 viewer.bind(reconstruction, model, Viewer::KEY_R, Viewer::MODIF_CTRL);
The base class of renderable 3D models.
Definition: model.h:49
Renderer * renderer()
Gets the renderer of this model.
Definition: model.h:94
A data structure for point clouds.
Definition: point_cloud.h:45
VertexProperty< T > get_vertex_property(const std::string &name) const
get the vertex property named name of type T. returns an invalid VertexProperty if the property does ...
Definition: point_cloud.h:340
Poisson surface reconstruction.
Definition: point_cloud_poisson_reconstruction.h:41
void set_depth(int d)
Set reconstruction depth. This integer is the maximum depth of the tree that will be used for surface...
Definition: point_cloud_poisson_reconstruction.h:53
SurfaceMesh * apply(const PointCloud *cloud, const std::string &density_attr_name="v:density") const
reconstruction
Definition: point_cloud_poisson_reconstruction.cpp:193
PointsDrawable * get_points_drawable(const std::string &name) const
Definition: renderer.cpp:286
void set_uniform_coloring(const vec4 &color)
Definition: state.cpp:89
The built-in Easy3D viewer.
Definition: viewer.h:61
bool delete_model(Model *model)
Delete a model. The memory of the model will be released and its existing drawables also be deleted.
Definition: viewer.cpp:1273
virtual Model * add_model(const std::string &file_name, bool create_default_drawables=true)
Add a model from a file to the viewer to be visualized. On success, the viewer will be in charge of t...
Definition: viewer.cpp:1204
void update() const
Update the display (i.e., repaint).
Definition: viewer.cpp:631
Definition: collider.cpp:182
void initialize(bool use_log_file, bool use_setting_file, const std::string &resource_dir)
Initialization of Easy3D.
Definition: initializer.cpp:35