Created
July 9, 2018 07:59
-
-
Save sloriot/7093e7e4a77a494f0df8b3389f09e8f7 to your computer and use it in GitHub Desktop.
This file contains 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/Exact_predicates_inexact_constructions_kernel.h> | |
#include <CGAL/Polygon_mesh_processing/bbox.h> | |
#include <CGAL/boost/graph/helpers.h> | |
#include <CGAL/Surface_mesh.h> | |
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; | |
typedef CGAL::Surface_mesh<K::Point_3> SM; | |
template <class Point, class Vector> | |
struct Translate_point_map | |
{ | |
typedef Point value_type; | |
typedef Point reference; | |
typedef boost::readable_property_map_tag category; | |
typedef typename CGAL::Surface_mesh<Point>::Vertex_index key_type; | |
Translate_point_map(const CGAL::Surface_mesh<Point>& sm, | |
const Vector& v) | |
: sm(sm) | |
, v(v) | |
{} | |
friend value_type get(const Translate_point_map& m, key_type k) | |
{ | |
return m.sm.point(k) + m.v; | |
} | |
const CGAL::Surface_mesh<Point>& sm; | |
Vector v; | |
}; | |
int main() | |
{ | |
// create a tetrahedron mesh | |
SM sm; | |
CGAL::make_tetrahedron(K::Point_3(0,0,0), | |
K::Point_3(0,1,0), | |
K::Point_3(1,0,0), | |
K::Point_3(1,1,0), | |
sm); | |
CGAL::Bbox_3 bbox1 = CGAL::Polygon_mesh_processing::bbox(sm);// using the default point map | |
Translate_point_map<K::Point_3, K::Vector_3> vpm(sm, K::Vector_3(1,1,1)); | |
CGAL::Bbox_3 bbox2 = CGAL::Polygon_mesh_processing::bbox(sm, | |
CGAL::parameters::vertex_point_map(vpm));// using the default point map | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment