Commit 492e71b3 authored by untereiner's avatar untereiner

Adding volume Regular tilings

Cubic tiling ok
parent 0bd11b96
......@@ -1115,9 +1115,9 @@ int main(int argc, char** argv)
else
{
sqt.position = sqt.myMap.addAttribute<PFP::VEC3, VERTEX>("position");
Algo::Volume::Modelisation::Primitive3D<PFP> prim(sqt.myMap, sqt.position);
prim.hexaGrid_topo(10,10,10);
prim.embedHexaGrid(1.0f,1.0f,1.0f);
Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(sqt.myMap, 10,10,10);
cubic.embedIntoGrid(sqt.position, 1.0f, 1.0f, 1.0f);
}
sqt.initGUI();
......
......@@ -57,7 +57,7 @@
#include "Utils/cgognStream.h"
#include "Utils/drawer.h"
#include "Algo/Modelisation/primitives3d.h"
#include "Algo/Tiling/Volume/cubic.h"
#include <string>
#include <sstream>
......
......@@ -25,7 +25,7 @@
#include "simpleGMap3.h"
#include "Utils/GLSLShader.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Modelisation/primitives3d.h"
#include "Algo/Tiling/Volume/cubic.h"
#include "Algo/Modelisation/subdivision3.h"
SimpleGMap3::SimpleGMap3()
......@@ -35,22 +35,21 @@ SimpleGMap3::SimpleGMap3()
// CellMarker<EDGE> mE(myMap);
Algo::Volume::Modelisation::Primitive3D<PFP> primCat(myMap,position);
Dart d = primCat.hexaGrid_topo(1,1,1);
primCat.embedHexaGrid(1,1,1);
Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(myMap, 1, 1, 1);
cubic.embedIntoGrid(position, 1.0f, 1.0f, 1.0f);
myMap.check();
Dart dp = Algo::Surface::Modelisation::createQuadrangularPyramid<PFP>(myMap);
// Dart dp = Algo::Surface::Modelisation::createQuadrangularPyramid<PFP>(myMap);
position[dp] = typename PFP::VEC3(0.5,0.5,-0.5);
position[myMap.phi1(dp)] = typename PFP::VEC3(0.5,0.5,0.5);
position[myMap.phi1(myMap.phi1(dp))] = typename PFP::VEC3(0.5,-0.5,0.5);
position[myMap.phi_1(dp)] = typename PFP::VEC3(0.5,-0.5,-0.5);
position[myMap.phi_1(myMap.phi2(dp))] = typename PFP::VEC3(1.5f, 0.0f, 0.0f);
// position[dp] = typename PFP::VEC3(0.5,0.5,-0.5);
// position[myMap.phi1(dp)] = typename PFP::VEC3(0.5,0.5,0.5);
// position[myMap.phi1(myMap.phi1(dp))] = typename PFP::VEC3(0.5,-0.5,0.5);
// position[myMap.phi_1(dp)] = typename PFP::VEC3(0.5,-0.5,-0.5);
// position[myMap.phi_1(myMap.phi2(dp))] = typename PFP::VEC3(1.5f, 0.0f, 0.0f);
Dart dtemp = myMap.beta1(myMap.beta0(myMap.beta1(myMap.beta2(myMap.beta1(myMap.beta0(myMap.beta1(myMap.beta2(d))))))));
// Dart dtemp = myMap.beta1(myMap.beta0(myMap.beta1(myMap.beta2(myMap.beta1(myMap.beta0(myMap.beta1(myMap.beta2(d))))))));
myMap.sewVolumes(dtemp,dp);
// myMap.sewVolumes(dtemp,dp);
// Geom::Plane3D<PFP::REAL> pl(VEC3(-1,-0.5,-0.5),VEC3(-1,-0.5,0.5),VEC3(1,0.5,0.5));
// Algo::Volume::Modelisation::sliceConvexVolume<PFP>(myMap, position, d, pl);
......
......@@ -25,35 +25,34 @@
#include "simpleMap3.h"
#include "Utils/GLSLShader.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Modelisation/primitives3d.h"
#include "Algo/Tiling/Volume/cubic.h"
#include "Algo/Modelisation/subdivision3.h"
SimpleMap3::SimpleMap3()
{
position = myMap.addAttribute<VEC3, VERTEX>("position");
Algo::Volume::Modelisation::Primitive3D<PFP> primCat(myMap,position);
Dart d = primCat.hexaGrid_topo(1,1,1);
primCat.embedHexaGrid(1,1,1);
myMap.closeMap();
Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(myMap, 1, 1, 1);
cubic.embedIntoGrid(position, 1.0f, 1.0f, 1.0f);
myMap.check();
Dart dp = Algo::Surface::Modelisation::createQuadrangularPyramid<PFP>(myMap);
position[dp] = typename PFP::VEC3(0.5,0.5,-0.5);
position[myMap.phi1(dp)] = typename PFP::VEC3(0.5,0.5,0.5);
position[myMap.phi1(myMap.phi1(dp))] = typename PFP::VEC3(0.5,-0.5,0.5);
position[myMap.phi_1(dp)] = typename PFP::VEC3(0.5,-0.5,-0.5);
position[myMap.phi_1(myMap.phi2(dp))] = typename PFP::VEC3(1.5f, 0.0f, 0.0f);
// Dart dp = Algo::Surface::Modelisation::createQuadrangularPyramid<PFP>(myMap);
// position[dp] = typename PFP::VEC3(0.5,0.5,-0.5);
// position[myMap.phi1(dp)] = typename PFP::VEC3(0.5,0.5,0.5);
// position[myMap.phi1(myMap.phi1(dp))] = typename PFP::VEC3(0.5,-0.5,0.5);
// position[myMap.phi_1(dp)] = typename PFP::VEC3(0.5,-0.5,-0.5);
// position[myMap.phi_1(myMap.phi2(dp))] = typename PFP::VEC3(1.5f, 0.0f, 0.0f);
Dart dtemp = myMap.phi_1(myMap.phi2(myMap.phi_1(myMap.phi_1(myMap.phi2(d)))));
// Dart dtemp = myMap.phi_1(myMap.phi2(myMap.phi_1(myMap.phi_1(myMap.phi2(d)))));
myMap.sewVolumes(dtemp,dp);
// myMap.sewVolumes(dtemp,dp);
// Algo::Volume::Modelisation::Primitive3D<PFP> primCat(myMap, position);
// Dart d = primCat.hexaGrid_topo(2,1,1);
// primCat.embedHexaGrid(1,1,1);
// myMap.closeMap();
// Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(myMap, 2, 1, 1);
// cubic.embedIntoGrid(position, 1.0f, 1.0f, 1.0f);
// myMap.check();
// unsigned int nb=0;
// for(unsigned int i = position.begin(); i!=position.end(); position.next(i))
......
......@@ -26,7 +26,7 @@
#include "volumeExplorer.h"
#include <iostream>
#include "Algo/Modelisation/primitives3d.h"
#include "Algo/Tiling/Volume/cubic.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Import/import.h"
#include "Algo/Geometry/volume.h"
......@@ -440,10 +440,10 @@ int main(int argc, char **argv)
else
{
position = myMap.addAttribute<PFP::VEC3, VERTEX>("position");
Algo::Volume::Modelisation::Primitive3D<PFP> prim(myMap, position);
int nb = 8;
prim.hexaGrid_topo(nb,nb,nb);
prim.embedHexaGrid(1.0f,1.0f,1.0f);
Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(myMap, nb, nb, nb);
cubic.embedIntoGrid(position, 1.0f, 1.0f, 1.0f);
for (unsigned int i=position.begin(); i != position.end(); position.next(i))
{
......
......@@ -26,7 +26,8 @@ ENDIF(WIN32)
add_executable(multi_att multi_att.cpp)
target_link_libraries(multi_att ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
add_executable(tilings tilings.cpp)
QT4_WRAP_CPP(tilings_moc tilings.h)
add_executable(tilings tilings.cpp ${tilings_moc})
target_link_libraries(tilings ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
# Example with Qt
......
......@@ -22,19 +22,19 @@
* *
*******************************************************************************/
#include <iostream>
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#include "tilings.h"
#include "Geometry/vector_gen.h"
#include "Algo/Export/export.h"
#include "Algo/Import/import.h"
#include "Algo/Geometry/boundingbox.h"
#include "Utils/GLSLShader.h"
//#include "Algo/Geometry/area.h"
#include "Algo/Geometry/normal.h"
#include "Algo/Tiling/square.h"
//#include "Algo/Tiling/triangular.h"
//#include "Algo/Tiling/hexagonal.h"
#include "Utils/cgognStream.h"
#include "Utils/chrono.h"
using namespace CGoGN ;
......@@ -48,25 +48,60 @@ struct PFP: public PFP_STANDARD
typedef EmbeddedMap2 MAP;
};
int main(int argc, char **argv)
PFP::MAP myMap;
VertexAttribute<PFP::VEC3> position;
VertexAttribute<PFP::VEC3> position2;
VertexAttribute<PFP::VEC3> normal;
void MyQT::cb_initGL()
{
if(argc != 2)
{
CGoGNout << "Usage : " << argv[0] << " tiling-type" << CGoGNendl;
return 0;
}
Utils::GLSLShader::setCurrentOGLVersion(2);
// create the render
m_render = new Algo::Render::GL2::MapRender();
// create VBO for position
m_positionVBO = new Utils::VBO();
m_positionVBO->updateData(position);
unsigned int tiling;
std::istringstream iss(argv[1]);
iss >> tiling;
m_normalVBO = new Utils::VBO();
// declaration of the map
PFP::MAP myMap;
m_shader = new Utils::ShaderSimpleColor();
m_shader->setAttributePosition(m_positionVBO);
m_shader->setColor(Geom::Vec4f(1.,1.,0.,0.));
VertexAttribute<PFP::VEC3> position = myMap.addAttribute<PFP::VEC3, VERTEX>("position");
m_lines = new Utils::ShaderVectorPerVertex();
m_lines->setAttributePosition(m_positionVBO);
m_lines->setAttributeVector(m_normalVBO);
m_lines->setScale(0.2f);
m_lines->setColor(Geom::Vec4f(0.0f, 1.0f, 0.2f, 0.0f));
switch(tiling)
Algo::Surface::Geometry::computeNormalVertices<PFP>(myMap, position, normal) ;
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::LINES);
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::POINTS);
registerShader(m_shader);
registerShader(m_lines);
m_normalVBO->updateData(normal);
}
void MyQT::cb_redraw()
{
m_render->draw(m_shader, Algo::Render::GL2::LINES);
m_render->draw(m_lines, Algo::Render::GL2::POINTS);
}
// mouse picking
void MyQT::tiling(int code)
{
//myMap.clear(false);
switch(code)
{
case 1:
{
......@@ -74,8 +109,6 @@ int main(int argc, char **argv)
Algo::Surface::Tilings::Square::Grid<PFP> g(myMap,10,10,true);
g.embedIntoGrid(position,50,50);
Algo::Surface::Export::exportOFF<PFP>(myMap,position,"square_grid.off");
break;
}
case 2:
......@@ -84,8 +117,6 @@ int main(int argc, char **argv)
Algo::Surface::Tilings::Square::Grid<PFP> g(myMap,10,10,true);
g.embedIntoTwistedStrip(position, 0.3, 0.8, 5);
Algo::Surface::Export::exportOFF<PFP>(myMap,position,"square_grid_strip.off");
break;
}
case 3:
......@@ -94,45 +125,109 @@ int main(int argc, char **argv)
Algo::Surface::Tilings::Square::Grid<PFP> g(myMap,20,20,true);
g.embedIntoHelicoid(position, 0.3, 0.8, 5.0, 2.0);
Algo::Surface::Export::exportOFF<PFP>(myMap,position,"square_grid_helicoid.off");
break;
}
case 4:
{
std::cout << "square cylinder tiling" << std::endl;
Algo::Surface::Tilings::Square::Cylinder<PFP> c(myMap,20,20);
c.closeTop();
c.closeBottom();
//c.triangleTop();
//c.triangleBottom();
c.embedIntoCylinder(position,0.5,0.7,5.0);
Algo::Surface::Export::exportOFF<PFP>(myMap,position,"square_cylinder.off");
break;
}
case 5:
{
std::cout << "square cylinder tiling" << std::endl;
Algo::Surface::Tilings::Square::Cylinder<PFP> c(myMap,20,20);
c.triangleBottom();
c.triangleTop();
c.embedIntoCylinder(position,0.5,0.7,5.0);
break;
}
case 6:
{
std::cout << "square cylinder sphere tiling" << std::endl;
Algo::Surface::Tilings::Square::Cylinder<PFP> c(myMap,20,20);
c.closeTop();
c.closeBottom();
c.triangleTop();
c.triangleBottom();
c.embedIntoSphere(position,0.5);
Algo::Surface::Export::exportOFF<PFP>(myMap,position,"square_cylinder_sphere.off");
break;
}
case 7:
{
std::cout << "square cylinder cone tiling" << std::endl;
Algo::Surface::Tilings::Square::Cylinder<PFP> c(myMap,20,20);
c.triangleTop();
c.triangleBottom();
c.embedIntoCone(position,0.5, 5.0);
break;
}
case 8:
{
std::cout << "square cylinder cone tiling" << std::endl;
Algo::Surface::Tilings::Square::Cube<PFP> c(myMap,20,20,20);
c.embedIntoCube(position,5.0,5.0, 5.0);
break;
}
case 9:
{
std::cout << "square cylinder cone tiling" << std::endl;
Algo::Surface::Tilings::Square::Tore<PFP> c(myMap,20,10);
c.embedIntoTore(position,5.0,2.0);
break;
}
default:
{
break;
}
}
// m_positionVBO->updateData(position);
// m_lines->setAttributePosition(m_positionVBO);
// updateGL();
}
int main(int argc, char **argv)
{
// interface:
QApplication app(argc, argv);
MyQT sqt;
sqt.statusMsg("Neww to create a sphere or Load for a mesh file");
CGoGNStream::allToConsole(&sqt);
if (!position.isValid())
position = myMap.addAttribute<PFP::VEC3, VERTEX>("position");
if (!normal.isValid())
normal = myMap.addAttribute<PFP::VEC3, VERTEX>("normal");
if(argc == 2)
{
sqt.tiling(atoi(argv[1]));
}
// bounding box
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position);
float lWidthObj = std::max<PFP::REAL>(std::max<PFP::REAL>(bb.size(0), bb.size(1)), bb.size(2));
Geom::Vec3f lPosObj = (bb.min() + bb.max()) / PFP::REAL(2);
CGoGNout << "lPosObj=" << lPosObj << CGoGNendl;
CGoGNout << "lWidthObj=" << lWidthObj << CGoGNendl;
sqt.setParamObject(lWidthObj,lPosObj.data());
// myMap.enableQuickTraversal<EDGE>() ;
// myMap.enableQuickTraversal<VERTEX>() ;
sqt.show();
return 0;
return app.exec();
}
......@@ -25,7 +25,7 @@
#include "show_traversors.h"
#include <iostream>
#include "Algo/Modelisation/primitives3d.h"
#include "Algo/Tiling/Volume/cubic.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Modelisation/subdivision.h"
......@@ -613,9 +613,9 @@ int main(int argc, char **argv)
{
position = myMap.addAttribute<VEC3, VERTEX>( "position");
Algo::Volume::Modelisation::Primitive3D<PFP> prim(myMap, position);
dglobal = prim.hexaGrid_topo(3,3,3);
prim.embedHexaGrid(1.0f,1.0f,1.0f);
Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(myMap, 3, 3, 3);
cubic.embedIntoGrid(position, 1.0f, 1.0f, 1.0f);
dglobal = NIL;
}
else
{
......
......@@ -25,7 +25,7 @@
#include "tuto5.h"
#include <iostream>
#include "Algo/Modelisation/primitives3d.h"
#include "Algo/Tiling/Volume/cubic.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Modelisation/subdivision.h"
#include "Algo/Modelisation/subdivision3.h"
......@@ -275,12 +275,12 @@ int main(int argc, char **argv)
CGoGNout << 5.34 << " toto "<< Geom::Vec3f(2.5f, 2.2f, 4.3f) << CGoGNendl;
CGoGNout << 3 << " tutu "<< 4 << CGoGNendl;
Algo::Volume::Modelisation::Primitive3D<PFP> prim(myMap, position);
int nb=3;
if (argc>1)
nb = atoi(argv[1]);
dglobal = prim.hexaGrid_topo(nb,nb,nb);
prim.embedHexaGrid(1.0f,1.0f,1.0f);
Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(myMap, nb, nb, nb);
cubic.embedIntoGrid(position, 1.0f, 1.0f, 1.0f);
dglobal = NIL;
// un peu d'interface
QApplication app(argc, argv);
......
......@@ -26,7 +26,7 @@
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Modelisation/tetrahedralization.h"
#include "Algo/Modelisation/primitives3d.h"
#include "Algo/Tiling/Volume/cubic.h"
#include "Algo/Geometry/centroid.h"
#include "Algo/Geometry/normal.h"
#include "Algo/Import/import.h"
......@@ -262,15 +262,8 @@ void MyQT::createMap(int n)
position = myMap.getAttribute<VEC3, VERTEX>("position");
if (!position.isValid())
position = myMap.addAttribute<VEC3, VERTEX>("position");
Algo::Volume::Modelisation::Primitive3D<PFP> prim(myMap, position);
prim.hexaGrid_topo(n,n,n);
prim.embedHexaGrid(1.0f,1.0f,1.0f);
// Algo::Surface::Modelisation::Polyhedron<PFP> poly(myMap, position);
// poly.cylinder_topo(6,1,true,true);
// poly.embedCylinder(6.0,6.0,5.0);
myMap.closeMap();
Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(myMap, n, n, n);
cubic.embedIntoGrid(position, 1.0f, 1.0f, 1.0f);
// Dart d = Algo::Surface::Modelisation::embedPrism<PFP>(myMap, position, 5, true,6.0,6.0,5.0);
// Dart d2 = Algo::Surface::Modelisation::embedPyramid<PFP>(myMap, position, 4, true,6.0,5.0);
......
......@@ -27,7 +27,7 @@
#include <iostream>
#include "Algo/Modelisation/primitives3d.h"
#include "Algo/Tiling/Volume/cubic.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Modelisation/subdivision.h"
......@@ -200,10 +200,9 @@ void MyQT::initMap()
std::cout << "INIT MAP"<< std::endl;
position = myMap.addAttribute<VEC3, VERTEX>("position");
Algo::Volume::Modelisation::Primitive3D<PFP> prim(myMap, position);
int nb=2;
prim.hexaGrid_topo(nb,nb,nb);
prim.embedHexaGrid(1.0f,1.0f,1.0f);
Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(myMap, nb, nb, nb);
cubic.embedIntoGrid(position, 1.0f, 1.0f, 1.0f);
m_att_orbits[0] = new AttributeHandler<int, VERTEX>(myMap.addAttribute<int, VERTEX>("vertex"));
m_att_orbits[1] = new AttributeHandler<int, EDGE>(myMap.addAttribute<int, EDGE>("edge"));
......
......@@ -798,10 +798,10 @@ bool MeshTablesVolume<PFP>::importMSH(const std::string& filename, std::vector<s
oss >> s2;
oss >> s3;
typename PFP::VEC3 P = position[verticesID[s0]];
typename PFP::VEC3 A = position[verticesID[s1]];
typename PFP::VEC3 B = position[verticesID[s2]];
typename PFP::VEC3 C = position[verticesID[s3]];
typename PFP::VEC3 P = position[verticesMapID[s0]];
typename PFP::VEC3 A = position[verticesMapID[s1]];
typename PFP::VEC3 B = position[verticesMapID[s2]];
typename PFP::VEC3 C = position[verticesMapID[s3]];
if(Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::UNDER)
{
......@@ -812,13 +812,14 @@ bool MeshTablesVolume<PFP>::importMSH(const std::string& filename, std::vector<s
s1 = ui;
}
unsigned int nbe;
//if regions are defined use this number
oss >> nbe; //ignored here
m_emb.push_back(verticesID[s0]);
m_emb.push_back(verticesID[s1]);
m_emb.push_back(verticesID[s2]);
m_emb.push_back(verticesID[s3]);
m_emb.push_back(verticesMapID[s0]);
m_emb.push_back(verticesMapID[s1]);
m_emb.push_back(verticesMapID[s2]);
m_emb.push_back(verticesMapID[s3]);
}
else if((type_elm==5) && (nb==8))
{
......
......@@ -22,8 +22,10 @@
* *
*******************************************************************************/
#ifndef _TILINGS_H_
#define _TILINGS_H_
#include "Algo/Tiling/tiling.h"
#ifndef _TILING_HEXAGONAL_H_
#define _TILING_HEXAGONAL_H_
namespace CGoGN
{
......@@ -37,57 +39,77 @@ namespace Surface
namespace Tilings
{
//square -> grid -> open or closed (closeHole)
//square -> cylinder -> grid + finish sewing -> open or closed (closeHole) -> triangule face
//square -> tore -> cylinder + finish sewing
namespace Hexagonal
{
/*! \brief The class of regular grid square tiling
*/
template <typename PFP>
class Square
class Grid : public Tiling<PFP>
{
typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3;
protected:
/**
* Map in which we are working
*/
MAP& m_map;
/**
* Table of vertex darts (one dart per vertex)
* Order depend on Polyhedron kind
*/
std::vector<Dart> m_tableVertDarts;
public:
Square(MAP& map):
m_map(map)
Grid(MAP& map, unsigned int x, unsigned int y, bool close):
Tiling<PFP>(map,x,y,-1)
{
grid(x,y,close);
}
Grid(MAP& map, unsigned int x, unsigned int y):
Grid<PFP>(map,x,y,-1,true)
{ }
void grid(unsigned int x, unsigned int y, bool closed);
/*! @name Embedding Operators
* Tiling creation
*************************************************************************/
void cylinder(unsigned int n, unsigned int z, bool top_closed, bool bottom_closed);
//@{
//! Embed a topological grid
/*! @param position Attribute used to store vertices positions
* @param x size in X
* @param x size in Y
* @param y position in Z (centered on 0 by default)
*/
void embedIntoGrid(VertexAttribute<VEC3>& position, float x, float y, float z = 0.0f);
void tore(unsigned int n, unsigned int m);
//! Embed a topological grid into a twister open ribbon with turns=PI it is a Moebius strip, needs only to be closed (if model allow it)
/*! @param position Attribute used to store vertices positions
* @param radius_min
* @param radius_max
* @param turns number of turn multiplied by 2*PI
*/
void embedIntoTwistedStrip(VertexAttribute<VEC3>& position, float radius_min, float radius_max, float turns);
//! Embed a topological grid into a helicoid
/*! @param position Attribute used to store vertices positions
* @param radius_min
* @param radius_max
* @param maxHeight height to reach
* @param turns number of turn
*/
void embedIntoHelicoid(VertexAttribute<VEC3>& position, float radius_min, float radius_max, float maxHeight, float nbTurn, int orient = 1);
//@}
protected:
/*! @name Topological Operators
* Tiling creation
*************************************************************************/
//@{
//! Create a 2D grid
/*! @param x nb of squares in x
* @param y nb of squares in y
* @param closed close the boundary face of the 2D grid
*/
void grid(unsigned int x, unsigned int y, bool close);