Skip to content

Provide graph traits and properties for pmp::SurfaceMesh #4460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions BGL/examples/BGL_PMP/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
project( BGL_PMP_Examples )


cmake_minimum_required(VERSION 2.8.11)

find_package(pmp)

if ( NOT pmp_FOUND )

message(STATUS "This project requires the PMP library, and will not be compiled.")
return()

endif()


# CGAL and its components
find_package( CGAL QUIET COMPONENTS )

if ( NOT CGAL_FOUND )

message(STATUS "This project requires the CGAL library, and will not be compiled.")
return()

endif()

find_package(Eigen3 3.2.0)
if (EIGEN3_FOUND)
# Executables that require Eigen 3.2
include( CGAL_Eigen_support )
endif()

# Boost and its components
find_package( Boost REQUIRED )

if ( NOT Boost_FOUND )

message(STATUS "This project requires the Boost library, and will not be compiled.")

return()

endif()


create_single_source_cgal_program( "bgl_pmp.cpp" )

target_link_libraries(bgl_pmp PRIVATE pmp)
target_link_libraries(bgl_pmp PUBLIC CGAL::Eigen_support)
44 changes: 44 additions & 0 deletions BGL/examples/BGL_PMP/bgl_pmp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <pmp/SurfaceMesh.h>

#include <CGAL/boost/graph/graph_traits_SurfaceMesh.h>
#include <CGAL/boost/graph/properties_SurfaceMesh.h>

#include <boost/graph/kruskal_min_spanning_tree.hpp>

#include <CGAL/boost/graph/helpers.h>
#include <iostream>
#include <fstream>
#include <vector>

typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point_3;

typedef boost::graph_traits<pmp::SurfaceMesh>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<pmp::SurfaceMesh>::edge_descriptor edge_descriptor;
typedef boost::graph_traits<pmp::SurfaceMesh>::halfedge_descriptor halfedge_descriptor;
typedef boost::graph_traits<pmp::SurfaceMesh>::face_descriptor face_descriptor;

int main(int argc, char* argv[])
{
pmp::SurfaceMesh sm;
vertex_descriptor v0, v1, v2, v3;
v0 = sm.add_vertex(pmp::Point(0,0,0));
v1 = sm.add_vertex(pmp::Point(1,0,0));
v2 = sm.add_vertex(pmp::Point(0,2,0));

sm.add_triangle(v0,v1,v2);

std::list<edge_descriptor> mst;

boost::kruskal_minimum_spanning_tree(sm,
std::back_inserter(mst));

for(edge_descriptor e : mst){
vertex_descriptor s = source(e,sm);
vertex_descriptor t = target(e,sm);
std::cout << sm.position(s) << " -- " << sm.position(t) << std::endl;
}
return 0;
}
4 changes: 1 addition & 3 deletions BGL/examples/BGL_polyhedron_3/kruskal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ kruskal(const Polyhedron& P)
" }\n"
" coordIndex [\n";

for(std::list<edge_descriptor>::iterator it = mst.begin(); it != mst.end(); ++it)
{
edge_descriptor e = *it ;
for(edge_descriptor e : mst){
vertex_descriptor s = source(e,P);
vertex_descriptor t = target(e,P);
std::cout << " " << vertex_index_pmap[s] << ", " << vertex_index_pmap[t] << ", -1\n";
Expand Down
Loading