Commit 10e52114 authored by untereiner's avatar untereiner

Tilings :

- changed all polyhedron to tiling square
- renamed primitives3d to kick out
IHM2 :
- renamed Algo/IHM/ihm.h/hpp to kick out (use Topology/ihmap/ihm2.h instead)
- add ihm2_PrimalRegular object wich is similar implicit equivalent to map2MR_PrimalRegular
parent 492e71b3
......@@ -26,6 +26,7 @@
#include "Utils/GLSLShader.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Tiling/Surface/square.h"
SimpleGMap2::SimpleGMap2()
{
......@@ -41,11 +42,9 @@ SimpleGMap2::SimpleGMap2()
myMap.cutEdge(d);
position[myMap.phi1(d)] = mid;
Algo::Surface::Modelisation::Polyhedron<PFP> poly(myMap, position);
d = poly.cylinder_topo(5, 1, false, false);
poly.embedCylinder(10, 10, 5);
Algo::Surface::Tilings::Square::Cylinder<PFP> poly(myMap, 5 ,1, false, false);
d = poly.getDart();
poly.embedIntoCylinder(position, 10, 10, 5);
d = myMap.phi1(d);
Dart dd = myMap.beta2(d);
......
......@@ -24,7 +24,7 @@
#include "texturesExample.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Tiling/Surface/square.h"
#include "Utils/vbo.h"
TexView::TexView():
......@@ -215,9 +215,9 @@ void TexView::computeTore()
VertexAttribute<VEC3> position = myMap.addAttribute<VEC3, VERTEX>("position");
VertexAttribute<Geom::Vec2f> texcoord = myMap.addAttribute<Geom::Vec2f, VERTEX>("texcoord");
Algo::Surface::Modelisation::Polyhedron<PFP> prim(myMap, position);
prim.tore_topo(NB, NB);
prim.embedTore(40.0f,20.0f);
//Algo::Surface::Modelisation::Polyhedron<PFP> prim(myMap, position);
Algo::Surface::Tilings::Square::Tore<PFP> prim(myMap, NB, NB);
prim.embedIntoTore(position, 40.0f,20.0f);
Dart d = prim.getDart();
for(unsigned int i=0; i<NB; ++i)
{
......
......@@ -25,7 +25,7 @@
#include "tuto3.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Selection/raySelector.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Tiling/Surface/square.h"
using namespace CGoGN ;
......@@ -154,9 +154,8 @@ void MyQT::createMap()
position = myMap.addAttribute<PFP::VEC3, VERTEX>("position");
Algo::Surface::Modelisation::Polyhedron<PFP> prim1(myMap, position);
prim1.cylinder_topo(256, 256, true, true); // topo of sphere is a closed cylinder
prim1.embedSphere(2.0f);
Algo::Surface::Tilings::Square::Cylinder<PFP> prim1(myMap, 256,256,true,true);
prim1.embedIntoSphere(position, 2.0f);
// Dart d2 = d1;
// position[d2] = PFP::VEC3(1, 0, 0);
......@@ -167,14 +166,14 @@ void MyQT::createMap()
// d2 = PHI<211>(d2);
// position[d2] = PFP::VEC3(0, 1, 2);
Algo::Surface::Modelisation::Polyhedron<PFP> prim2(myMap, position);
prim2.cylinder_topo(256, 256, true, true); // topo of sphere is a closed cylinder
prim2.embedSphere(2.0f);
Algo::Surface::Tilings::Square::Cylinder<PFP> prim2(myMap, 256 ,256, true, true);
prim2.embedIntoSphere(position, 2.0f);
Geom::Matrix44f trf;
trf.identity();
Geom::translate<float>(5.0f, 0.0, 0.0, trf);
prim2.transform(trf);
prim2.transform(position, trf);
xd1 = prim2.getDart();
......
......@@ -36,7 +36,8 @@
#include "Utils/GLSLShader.h"
//#include "Algo/Geometry/area.h"
#include "Algo/Geometry/normal.h"
#include "Algo/Modelisation/polyhedron.h"
//#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Tiling/Surface/square.h"
#include "Algo/Parallel/parallel_foreach.h"
......@@ -298,9 +299,8 @@ int main(int argc, char **argv)
if (argc==2)
nbt = atoi(argv[1]);
// create a sphere
Algo::Surface::Modelisation::Polyhedron<PFP> prim(myMap, position);
prim.cylinder_topo(nbt,nbt, true, true);
prim.embedSphere(20.0f);
Algo::Surface::Tilings::Square::Cylinder<PFP> prim(myMap, nbt, nbt, true, true);
prim.embedIntoSphere(position, 20.0f);
// bounding box
......
......@@ -24,7 +24,7 @@
#include "tuto_oper2.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Tiling/Surface/square.h"
#include "Algo/Geometry/centroid.h"
#include "Algo/Import/import.h"
#include "Algo/Export/export.h"
......@@ -175,9 +175,8 @@ void MyQT::createMap(int n)
position = myMap.addAttribute<VEC3, VERTEX>("position");
colorDarts = myMap.addAttribute<VEC3, DART>("color");
Algo::Surface::Modelisation::Polyhedron<PFP> grid(myMap,position);
grid.grid_topo(n,n);
grid.embedGrid(1.,1.,0.);
Algo::Surface::Tilings::Square::Grid<PFP> grid(myMap, n, n, true);
grid.embedIntoGrid(position, 1.,1.,0.);
// bounding box of scene
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
......
......@@ -94,65 +94,65 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP:
Dart dd = map.phi1(old) ;
Dart e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ; // insert a new edge
//unsigned int id = map.getNewEdgeId() ;
//map.setEdgeId(map.phi_1(dd), id) ; // set the edge id of the inserted
//map.setEdgeId(map.phi_1(e), id) ; // edge to the next available id
unsigned int id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id) ; // set the edge id of the inserted
map.setEdgeId(map.phi_1(e), id) ; // edge to the next available id
dd = e ;
e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ;
//id = map.getNewEdgeId() ;
//map.setEdgeId(map.phi_1(dd), id) ;
//map.setEdgeId(map.phi_1(e), id) ;
id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id) ;
map.setEdgeId(map.phi_1(e), id) ;
dd = e ;
e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ;
//id = map.getNewEdgeId() ;
//map.setEdgeId(map.phi_1(dd), id) ;
//map.setEdgeId(map.phi_1(e), id) ;
Dart stop = map.phi2(map.phi1(old));
Dart dit = stop;
do
{
unsigned int dId = map.getEdgeId(map.phi_1(map.phi2(dit)));
unsigned int eId = map.getEdgeId(map.phi1(map.phi2(dit)));
unsigned int t = dId + eId;
if(t == 0)
{
map.setEdgeId(dit, 1);
map.setEdgeId(map.phi2(dit), 1);
}
else if(t == 1)
{
map.setEdgeId(dit, 2);
map.setEdgeId(map.phi2(dit), 2);
}
else if(t == 2)
{
if(dId == eId)
{
map.setEdgeId(dit, 0);
map.setEdgeId(map.phi2(dit), 0);
}
else
{
map.setEdgeId(dit, 1);
map.setEdgeId(map.phi2(dit), 1);
}
}
else if(t == 3)
{
map.setEdgeId(dit, 0);
map.setEdgeId(map.phi2(dit), 0);
}
dit = map.phi1(dit);
}while(dit != stop);
id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id) ;
map.setEdgeId(map.phi_1(e), id) ;
// Dart stop = map.phi2(map.phi1(old));
// Dart dit = stop;
// do
// {
// unsigned int dId = map.getEdgeId(map.phi_1(map.phi2(dit)));
// unsigned int eId = map.getEdgeId(map.phi1(map.phi2(dit)));
// unsigned int t = dId + eId;
// if(t == 0)
// {
// map.setEdgeId(dit, 1);
// map.setEdgeId(map.phi2(dit), 1);
// }
// else if(t == 1)
// {
// map.setEdgeId(dit, 2);
// map.setEdgeId(map.phi2(dit), 2);
// }
// else if(t == 2)
// {
// if(dId == eId)
// {
// map.setEdgeId(dit, 0);
// map.setEdgeId(map.phi2(dit), 0);
// }
// else
// {
// map.setEdgeId(dit, 1);
// map.setEdgeId(map.phi2(dit), 1);
// }
// }
// else if(t == 3)
// {
// map.setEdgeId(dit, 0);
// map.setEdgeId(map.phi2(dit), 0);
// }
// dit = map.phi1(dit);
// }while(dit != stop);
}
else // if subdividing a polygonal face
......@@ -160,15 +160,15 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP:
Dart dd = map.phi1(old) ;
map.splitFace(dd, map.phi1(map.phi1(dd))) ; // insert a first edge
Dart ne = map.alpha1(dd) ;
//Dart ne2 = map.phi2(ne) ;
Dart ne2 = map.phi2(ne) ;
map.cutEdge(ne) ; // cut the new edge to insert the central vertex
//unsigned int id = map.getNewEdgeId() ;
//map.setEdgeId(ne, id) ;
//map.setEdgeId(map.phi2(ne), id) ; // set the edge id of the inserted
//id = map.getNewEdgeId() ;
//map.setEdgeId(ne2, id) ; // edges to the next available ids
//map.setEdgeId(map.phi2(ne2), id) ;
unsigned int id = map.getNewEdgeId() ;
map.setEdgeId(ne, id) ;
map.setEdgeId(map.phi2(ne), id) ; // set the edge id of the inserted
id = map.getNewEdgeId() ;
map.setEdgeId(ne2, id) ; // edges to the next available ids
map.setEdgeId(map.phi2(ne2), id) ;
position[map.phi2(ne)] = p ;
......@@ -177,30 +177,30 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP:
{ // linked to the central vertex
Dart next = map.phi1(map.phi1(dd)) ;
map.splitFace(map.phi1(ne), dd) ;
//Dart nne = map.alpha1(dd) ;
//id = map.getNewEdgeId() ;
//map.setEdgeId(nne, id) ;
//map.setEdgeId(map.phi2(nne), id) ;
Dart nne = map.alpha1(dd) ;
id = map.getNewEdgeId() ;
map.setEdgeId(nne, id) ;
map.setEdgeId(map.phi2(nne), id) ;
dd = next ;
}
Dart dit = map.phi2(ne);
do
{
unsigned int eId = map.getEdgeId(map.phi1(dit));
if(eId == 0)
{
map.setEdgeId(dit, 1);
map.setEdgeId(map.phi2(dit), 1);
}
else if(eId == 1)
{
map.setEdgeId(dit, 0);
map.setEdgeId(map.phi2(dit), 0);
}
dit = map.phi2(map.phi_1(dit));
}
while(dit != map.phi2(ne));
// Dart dit = map.phi2(ne);
// do
// {
// unsigned int eId = map.getEdgeId(map.phi1(dit));
// if(eId == 0)
// {
// map.setEdgeId(dit, 1);
// map.setEdgeId(map.phi2(dit), 1);
// }
// else if(eId == 1)
// {
// map.setEdgeId(dit, 0);
// map.setEdgeId(map.phi2(dit), 0);
// }
// dit = map.phi2(map.phi_1(dit));
// }
// while(dit != map.phi2(ne));
}
map.setCurrentLevel(cur) ;
......
......@@ -27,7 +27,7 @@
#include <math.h>
#include <vector>
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Tiling/Surface/square.h"
#include "Algo/Modelisation/subdivision.h"
#include "Algo/Geometry/normal.h"
......@@ -82,7 +82,8 @@ Dart extrusion_scale(typename PFP::MAP& the_map, VertexAttribute<typename PFP::V
* size of vector must be the same as path
*/
template<typename PFP>
Polyhedron<PFP>* extrusion_scale_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& positions,
//Polyhedron<PFP>* extrusion_scale_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& positions,
Algo::Surface::Tilings::Tiling<PFP>* extrusion_scale_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& positions,
const std::vector<typename PFP::VEC3>& profile,
const typename PFP::VEC3& centerProfile,
const typename PFP::VEC3& normalProfile,
......@@ -106,7 +107,8 @@ Polyhedron<PFP>* extrusion_scale_prim(typename PFP::MAP& the_map, VertexAttribut
* size of vector must be the same as path
*/
template<typename PFP>
Polyhedron<PFP>* extrusion_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& positions,
//Polyhedron<PFP>* extrusion_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& positions,
Algo::Surface::Tilings::Tiling<PFP>* extrusion_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& positions,
const std::vector<typename PFP::VEC3>& profile,
const typename PFP::VEC3& centerProfile,
const typename PFP::VEC3& normalProfile,
......@@ -146,7 +148,8 @@ Dart extrusion(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>&
* @param nbSide number of steps around the revolution
*/
template<typename PFP>
Polyhedron<PFP>* revolution_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& positions,
//Polyhedron<PFP>* revolution_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& positions,
Algo::Surface::Tilings::Tiling<PFP>* revolution_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& positions,
const std::vector<typename PFP::VEC3>& profile,
const typename PFP::VEC3& center,
const typename PFP::VEC3& axis,
......@@ -197,7 +200,7 @@ Dart extrudeRegion(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC
} // namespace Modelisation
}
} // namespace Surface
} // namespace Algo
......
......@@ -38,7 +38,8 @@ namespace Modelisation
{
template<typename PFP>
Polyhedron<PFP>* revolution_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& position, const std::vector<typename PFP::VEC3>& profile, const typename PFP::VEC3& center,
//Polyhedron<PFP>* revolution_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& position, const std::vector<typename PFP::VEC3>& profile, const typename PFP::VEC3& center,
Algo::Surface::Tilings::Tiling<PFP>* revolution_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& position, const std::vector<typename PFP::VEC3>& profile, const typename PFP::VEC3& center,
const typename PFP::VEC3& axis, bool profile_closed, int nbSides)
{
typedef typename PFP::VEC3 VEC3 ;
......@@ -70,7 +71,8 @@ template<typename PFP>
Dart revolution(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& position, const std::vector<typename PFP::VEC3>& profile, const typename PFP::VEC3& center,
const typename PFP::VEC3& axis, bool profile_closed, int nbSides)
{
Polyhedron<PFP> *prim = revolution_prim<PFP>(the_map, position, profile, center, axis, profile_closed, nbSides);
//Polyhedron<PFP> *prim = revolution_prim<PFP>(the_map, position, profile, center, axis, profile_closed, nbSides);
Algo::Surface::Tilings::Tiling<PFP> *prim = revolution_prim<PFP>(the_map, position, profile, center, axis, profile_closed, nbSides);
Dart d = prim->getDart();
delete prim;
return d;
......@@ -81,7 +83,8 @@ template<typename PFP>
Dart extrusion_scale(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& position, const std::vector<typename PFP::VEC3>& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normalProfile, bool profile_closed,
const std::vector<typename PFP::VEC3>& path, bool path_closed, const std::vector<float>& scalePath)
{
Polyhedron<PFP> *prim = extrusion_scale_prim<PFP>(the_map, position, profile, centerProfile, normalProfile, profile_closed, path, path_closed,scalePath);
//Polyhedron<PFP> *prim = extrusion_scale_prim<PFP>(the_map, position, profile, centerProfile, normalProfile, profile_closed, path, path_closed,scalePath);
Algo::Surface::Tilings::Tiling<PFP> *prim = extrusion_scale_prim<PFP>(the_map, position, profile, centerProfile, normalProfile, profile_closed, path, path_closed,scalePath);
Dart d = prim->getDart();
delete prim;
return d;
......@@ -92,14 +95,16 @@ Dart extrusion(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>&
const std::vector<typename PFP::VEC3>& path, bool path_closed)
{
std::vector<float> scalePath;
Polyhedron<PFP> *prim = extrusion_scale_prim<PFP>(the_map, position, profile, centerProfile, normalProfile, profile_closed, path, path_closed,scalePath);
//Polyhedron<PFP> *prim = extrusion_scale_prim<PFP>(the_map, position, profile, centerProfile, normalProfile, profile_closed, path, path_closed,scalePath);
Algo::Surface::Tilings::Tiling<PFP> *prim = extrusion_scale_prim<PFP>(the_map, position, profile, centerProfile, normalProfile, profile_closed, path, path_closed,scalePath);
Dart d = prim->getDart();
delete prim;
return d;
}
template<typename PFP>
Polyhedron<PFP>* extrusion_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& position, const std::vector<typename PFP::VEC3>& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normalProfile, bool profile_closed,
//Polyhedron<PFP>* extrusion_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& position, const std::vector<typename PFP::VEC3>& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normalProfile, bool profile_closed,
Algo::Surface::Tilings::Tiling<PFP>* extrusion_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& position, const std::vector<typename PFP::VEC3>& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normalProfile, bool profile_closed,
const std::vector<typename PFP::VEC3>& path, bool path_closed)
{
std::vector<float> scalePath;
......@@ -107,24 +112,30 @@ Polyhedron<PFP>* extrusion_prim(typename PFP::MAP& the_map, VertexAttribute<type
}
template<typename PFP>
Polyhedron<PFP>* extrusion_scale_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& position, const std::vector<typename PFP::VEC3>& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normal, bool profile_closed, const std::vector<typename PFP::VEC3>& path, bool path_closed, const std::vector<float>& scalePath)
//Polyhedron<PFP>* extrusion_scale_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& position, const std::vector<typename PFP::VEC3>& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normal, bool profile_closed, const std::vector<typename PFP::VEC3>& path, bool path_closed, const std::vector<float>& scalePath)
Algo::Surface::Tilings::Tiling<PFP>* extrusion_scale_prim(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC3>& position, const std::vector<typename PFP::VEC3>& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normal, bool profile_closed, const std::vector<typename PFP::VEC3>& path, bool path_closed, const std::vector<float>& scalePath)
{
// topological creation
Polyhedron<PFP> *prim = new Polyhedron<PFP>(the_map, position);
Dart grid;
//Polyhedron<PFP> *prim = new Polyhedron<PFP>(the_map, position);
Algo::Surface::Tilings::Tiling<PFP>* prim;
//Dart grid;
if (profile_closed)
{
if (path_closed)
grid = prim->tore_topo(profile.size() ,path.size());
//grid = prim->tore_topo(profile.size() ,path.size());
prim = new Algo::Surface::Tilings::Square::Tore<PFP>(the_map, profile.size(), path.size());
else
grid = prim->cylinder_topo(profile.size() ,path.size()-1, false, false);
//grid = prim->cylinder_topo(profile.size() ,path.size()-1, false, false);
prim = new Algo::Surface::Tilings::Square::Cylinder<PFP>(the_map, profile.size(), path.size()-1,false, false);
}
else
{
if (path_closed)
{
grid = prim->grid_topo(profile.size()-1 ,path.size());
//grid = prim->grid_topo(profile.size()-1 ,path.size());
prim = new Algo::Surface::Tilings::Square::Grid<PFP>(the_map, profile.size()-1 ,path.size(), true);
// sewing boundaries correponding to path boundaries
std::vector<Dart>& darts = prim->getVertexDarts();
int index = profile.size()*path.size();
......@@ -138,7 +149,8 @@ Polyhedron<PFP>* extrusion_scale_prim(typename PFP::MAP& the_map, VertexAttribut
}
else
grid = prim->grid_topo(profile.size()-1 ,path.size()-1);
//grid = prim->grid_topo(profile.size()-1 ,path.size()-1);
prim = new Algo::Surface::Tilings::Square::Grid<PFP>(the_map, profile.size()-1 ,path.size()-1, true);
}
glPushMatrix();
......@@ -478,7 +490,7 @@ Dart extrudeRegion(typename PFP::MAP& the_map, VertexAttribute<typename PFP::VEC
} // namespace Modelisation
}
} // namespace Surface
} // namespace Algo
......
......@@ -45,7 +45,7 @@ namespace Surface
namespace Modelisation
{
enum { NONE, GRID, CUBE, CYLINDER, CONE, SPHERE, TORE, COMPOSED };
//enum { NONE, GRID, CUBE, CYLINDER, CONE, SPHERE, TORE, COMPOSED };
//template <typename PFP>
//void sewFaceEmb(typename PFP::MAP& map, Dart d, Dart e);
......@@ -149,263 +149,263 @@ Dart embedPyramid(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& p
/**
* class of geometric Polyhedron
* It alloaw the creation of:
* - grid 2D
* - subdivided cube
* - subdivided cone
* - subdivided cylinder
* - subdivided tore
* - subdivided sphere (with pole)
*
* Topological creation methods are separated from embedding to
* easily allow specific embedding.
*/
template <typename PFP>
class Polyhedron
{
typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3;
public:
enum {NONE,GRID, CUBE, CYLINDER, CONE, SPHERE, TORE, COMPOSED};
protected:
/**
* Map in which we are working
*/
MAP& m_map;
/**
* Reference dart of Polyhedron
*/
Dart m_dart;
/**
* Kind of Polyhedron (grid, cylinder,
*/
int m_kind;
/**
* Table of vertex darts (one dart per vertex)
* Order depend on Polyhedron kind
*/
std::vector<Dart> m_tableVertDarts;
/**
* numbers that defined the subdivision of Polyhedron
*/
unsigned int m_nx;
unsigned int m_ny;
unsigned int m_nz;
bool m_top_closed;
bool m_bottom_closed;
VertexAttribute<VEC3>& m_positions;
VEC3 m_center;
/**
* return the dart of next vertex when traversing the boundary of a quad or trifan grid
*/
Dart nextDV(Dart d) { return m_map.phi1(m_map.phi2(m_map.phi1(d))); }
/**
* return the dart of preceding vertex when traversing the boundary of a quad or trifan grid
*/
Dart precDV(Dart d) { return m_map.phi_1(m_map.phi2(m_map.phi_1(d))); }
void computeCenter();
Dart grid_topo_open(unsigned int x, unsigned int y);
Dart cylinder_topo_open(unsigned int n, unsigned int z);
public:
/**
* Constructor
* @param map the map in which we want to work
* @param idPositions id of attribute position
*/
Polyhedron(MAP& map, VertexAttribute<VEC3>& position):
m_map(map),
m_kind(NONE),
m_nx(-1), m_ny(-1), m_nz(-1),
m_top_closed(false), m_bottom_closed(false),
m_positions(position)
{
computeCenter();
}
/**
* Polyhedron fusion: give a COMPOSED type
* @param p1 first Polyhedron
* @param p1 second Polyhedron
*/
Polyhedron(const Polyhedron<PFP>& p1, const Polyhedron<PFP>& p2);
/*
* get the reference dart
*/
Dart getDart() { return m_dart; }
/*
* get the center of Polyhedron
*/
const typename PFP::VEC3& getCenter() { return m_center; }
/**
* get the table of darts (one per vertex)
*/
std::vector<Dart>& getVertexDarts() { return m_tableVertDarts; }
/**
* Create a 2D grid
* quads are oriented counter-clockwise and the returned dart
* is the lower left dart (upper right it is symetric)
* @param x nb of quads in x
* @param y nb of quads in y
* @return the dart
*/
Dart grid_topo(unsigned int x, unsigned int y);
/**
* Create a subdivided (surface) cylinder
* @param n nb of quads around circunference
* @param z nb of quads in height