-
-
Save visorz/a6e1f6a2e3ded3519109 to your computer and use it in GitHub Desktop.
A minimal demonstration of what an point iterator in Surfacemesh should be able to do.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <CGAL/Simple_cartesian.h> | |
typedef CGAL::Simple_cartesian<double> Kernel; | |
typedef Kernel::FT Scalar; | |
typedef Kernel::Point_3 Point; | |
typedef Kernel::Vector_3 Vector; | |
#include <CGAL/Surface_mesh.h> | |
typedef CGAL::Surface_mesh<Point> Surfacemesh; | |
#include <CGAL/centroid.h> | |
#include <CGAL/bounding_box.h> | |
// uses boost iterators | |
template <class SM> | |
struct V2P { | |
typedef Point result_type; | |
const SM& sm; | |
V2P( SM& sm ) : sm( sm ) {} | |
const Point& operator()( typename SM::Vertex_index v ) const { return sm.point( v ); } | |
}; | |
int main( int argc, char* argv[] ) | |
{ | |
Surfacemesh s; | |
typedef boost::transform_iterator<V2P<Surfacemesh>, Surfacemesh::Vertex_iterator> Point_iterator; | |
V2P<Surfacemesh> v2p( s ); | |
Point_iterator b = boost::make_transform_iterator( s.vertices().begin(), v2p ); | |
Point_iterator e = boost::make_transform_iterator( s.vertices().end(), v2p ); | |
CGAL::centroid( b, e ); // succeeds | |
CGAL::bounding_box( b, e ); // fails | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment