27#include <easy3d/core/point_cloud.h>
28#include <easy3d/core/random.h>
29#include <easy3d/util/initializer.h>
39int main(
int argc,
char** argv) {
50 for (
int i=-5; i<5; ++i) {
51 for (
int j = -5; j < 5; ++j)
52 cloud->
add_vertex(
vec3(
static_cast<float>(i),
static_cast<float>(j), 0));
54 std::cout <<
"point cloud has " << cloud->n_vertices() <<
" points" << std::endl;
66 auto colors = cloud->add_vertex_property<
vec3>(
"v:color");
67 for (
auto v : cloud->vertices())
75 auto points = cloud->get_vertex_property<
vec3>(
"v:point");
76 for (
auto v : cloud->vertices())
77 std::cout <<
"index: " << v.idx() <<
", xyz: " << points[v] <<
", color: " << colors[v] << std::endl;
A data structure for point clouds.
Definition: point_cloud.h:45
Vertex add_vertex(const vec3 &p)
add a new vertex with position p
Definition: point_cloud.cpp:177
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
vec3 random_color(bool allow_dark=false)
Generates a random color. The parameter allow_dark controls if too dark colors are allowed.
Definition: random.h:49