make_grid takes the number of cells instead of the number of vertices and specify that it is row major ordered.

This commit is contained in:
Maxime Gimeno 2017-05-24 09:22:10 +02:00
parent 7aaf98ef88
commit cf2ecfb232
2 changed files with 6 additions and 4 deletions

View File

@ -1028,7 +1028,7 @@ struct Identity_calculator
/**
* \ingroup PkgBGLHelperFct
* \brief Creates a grid with `w` vertices along the width and `h` vertices
* \brief Creates a row major ordered grid with `i` cells along the width and `j` cells
* along the height.
* \param g the graph in which the grid will be created.
* \param calculator the functor that will assign coordinates to the grid vertices.
@ -1046,14 +1046,15 @@ template<class Graph, class CoordinateFunctor>
template<class Graph, class CoordinateFunctor = Identity_calculator<Graph> >
#endif
typename boost::graph_traits<Graph>::halfedge_descriptor
make_grid(typename boost::graph_traits<Graph>::vertices_size_type w,
typename boost::graph_traits<Graph>::vertices_size_type h,
make_grid(typename boost::graph_traits<Graph>::vertices_size_type i,
typename boost::graph_traits<Graph>::vertices_size_type j,
Graph& g,
const CoordinateFunctor& calculator,
bool triangulated = false)
{
typedef typename boost::property_map<Graph,vertex_point_t>::type Point_property_map;
typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
typename boost::graph_traits<Graph>::vertices_size_type w(i+1), h(j+1);
Point_property_map vpmap = get(CGAL::vertex_point, g);
// create the initial icosahedron
//create the vertices

View File

@ -4,6 +4,7 @@
#include <QVector>
#include <QMessageBox>
#include <QBitmap>
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/Three/Scene_item.h>
#include <CGAL/Three/Viewer_interface.h>
@ -674,7 +675,7 @@ void Basic_generator_plugin::generateGrid()
//nb_points = nb_cells+1
Point_generator point_gen(nb_cells[0]+1, nb_cells[1]+1, extrema[0], extrema[1]);
CGAL::make_grid(nb_cells[0]+1, nb_cells[1]+1, grid, point_gen, triangulated);
CGAL::make_grid(nb_cells[0], nb_cells[1], grid, point_gen, triangulated);
Scene_polyhedron_item* grid_item = new Scene_polyhedron_item(grid);
grid_item->setName(dock_widget->name_lineEdit->text());
scene->addItem(grid_item);