27#include <easy3d/viewer/viewer.h>
28#include <easy3d/core/point_cloud.h>
29#include <easy3d/core/random.h>
30#include <easy3d/renderer/renderer.h>
31#include <easy3d/renderer/drawable_points.h>
32#include <easy3d/util/initializer.h>
33#include <easy3d/util/timer.h>
50 for (
int i = 0; i < 100; ++i) {
60 std::cout <<
"#points: " << cloud->
n_vertices() << std::endl;
64int main(
int argc,
char **argv) {
69 Viewer viewer(EXAMPLE_TITLE);
75 for (
int i = 0; i < 100; ++i) {
78 colors[v] =
vec3(1.0f, 0.0f, 0.0f);
81 viewer.add_model(cloud);
84 auto drawable = cloud->renderer()->get_points_drawable(
"vertices");
86 drawable->set_point_size(10.0f);
88 drawable->set_coloring(Drawable::COLOR_PROPERTY, Drawable::VERTEX,
"v:color");
100 for (
int i = 0; i < 50; ++i) {
102 std::this_thread::sleep_for(std::chrono::milliseconds(300));
103 std::thread t(edit_model, cloud, &viewer);
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 > vertex_property(const std::string &name, const T t=T())
if a vertex property of type T with name name exists, it is returned. otherwise this property is adde...
Definition: point_cloud.h:361
VertexProperty< T > add_vertex_property(const std::string &name, const T t=T())
add a vertex property of type T with name name and default value t. fails if a property named name ex...
Definition: point_cloud.h:319
unsigned int n_vertices() const
returns number of vertices in the cloud
Definition: point_cloud.h:279
Vertex add_vertex(const vec3 &p)
add a new vertex with position p
Definition: point_cloud.cpp:177
void update()
Invalidates the rendering buffers of the model and thus updates the rendering (delayed in rendering).
Definition: renderer.cpp:276
A light-weight implementation of the timer mechanism.
Definition: timer.h:49
void set_interval(int interval, std::function< void(Args...)> const &func, Args... args) const
Executes function func for every interval milliseconds.
Definition: timer.h:268
The built-in Easy3D viewer.
Definition: viewer.h:61
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
float random_float()
Random real in [0, 1].
Definition: random.h:39