MCPcopy Create free account
hub / github.com/JeremyBYU/polylidar / main

Function main

examples/cpp/debug.cpp:20–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20int main(int argc, char const *argv[])
21{
22 const std::string SPARSE_MESH = "./fixtures/meshes/sparse_basement.ply";
23 Eigen::Matrix3d mesh_rotation;
24 std::shared_ptr<o3d::geometry::TriangleMesh> sparse_mesh_o3d;
25
26 // Rotation for mesh, camera axis to global frame
27 mesh_rotation << 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, -1.0, 0.0;
28 // Sparse Mesh In O3D Format
29 sparse_mesh_o3d = o3d::io::CreateMeshFromFile(SPARSE_MESH);
30 sparse_mesh_o3d->Rotate(mesh_rotation);
31 // sparse_mesh_o3d->Rotate();
32 // Sparse Mesh In HalfEdgeTriangulation
33 auto triangles_ptr = reinterpret_cast<int*>(sparse_mesh_o3d->triangles_.data());
34 auto num_triangles = sparse_mesh_o3d->triangles_.size();
35 auto vertices_ptr = reinterpret_cast<double*>(sparse_mesh_o3d->vertices_.data());
36 auto num_vertices = sparse_mesh_o3d->vertices_.size();
37 Matrix<int> triangles(triangles_ptr, num_triangles, 3);
38 Matrix<double> vertices(vertices_ptr, num_vertices, 3);
39
40 TriMesh sparse_mesh = MeshHelper::CreateTriMeshCopy(vertices, triangles, true);
41
42 // MeshHelper::BilateralFilterNormals(sparse_mesh, 1, 0.1, 0.1);
43 // alpha, lmax, min_tri, min_hole_vert, z_thresh, norm__thresh, norm_thresh_min, _task_threads
44 Polylidar3D pl3d(0.0, 0.1, 1000, 6, 0.03, 0.95, 0.90);
45 auto planes_and_polygons = pl3d.ExtractPlanesAndPolygonsOptimized(sparse_mesh, {{0.0, 0.0, 1.0}});
46 std::cout << "Stop Here";
47
48
49 return 0;
50}

Callers

nothing calls this directly

Calls 2

CreateTriMeshCopyFunction · 0.85

Tested by

no test coverage detected