Commit 6ad82bac authored by Pierre Kraemer's avatar Pierre Kraemer

added EmbeddedMap2::newFace to create needed cells

parent 45d8bfb6
...@@ -46,6 +46,10 @@ int main(int argc, char **argv) ...@@ -46,6 +46,10 @@ int main(int argc, char **argv)
void MyQT::createMap() void MyQT::createMap()
{ {
// creation of a new attribute on vertices of type 3D vector for position.
// a handler to this attribute is returned
position = myMap.addAttribute<VEC3, VERTEX>("position");
// creation of 2 new faces: 1 triangle and 1 square // creation of 2 new faces: 1 triangle and 1 square
Dart d1 = myMap.newFace(3); Dart d1 = myMap.newFace(3);
Dart d2 = myMap.newFace(4); Dart d2 = myMap.newFace(4);
...@@ -53,10 +57,6 @@ void MyQT::createMap() ...@@ -53,10 +57,6 @@ void MyQT::createMap()
// sew these faces along one of their edge // sew these faces along one of their edge
myMap.sewFaces(d1, d2); myMap.sewFaces(d1, d2);
// creation of a new attribute on vertices of type 3D vector for position.
// a handler to this attribute is returned
position = myMap.addAttribute<VEC3, VERTEX>("position");
// affect position by moving in the map // affect position by moving in the map
position[d1] = VEC3(0, 0, 0); position[d1] = VEC3(0, 0, 0);
position[PHI1(d1)] = VEC3(2, 0, 0); position[PHI1(d1)] = VEC3(2, 0, 0);
......
...@@ -39,6 +39,11 @@ class EmbeddedMap2 : public Map2 ...@@ -39,6 +39,11 @@ class EmbeddedMap2 : public Map2
public: public:
typedef Map2 TOPO_MAP; typedef Map2 TOPO_MAP;
/*
*
*/
virtual Dart newFace(unsigned int nbEdges, bool withBoundary = true) ;
/** /**
* The attributes attached to the old vertex are duplicated on both resulting vertices * The attributes attached to the old vertex are duplicated on both resulting vertices
*/ */
......
...@@ -30,6 +30,35 @@ ...@@ -30,6 +30,35 @@
namespace CGoGN namespace CGoGN
{ {
Dart EmbeddedMap2::newFace(unsigned int nbEdges, bool withBoundary)
{
Dart d = Map2::newFace(nbEdges, withBoundary);
if(withBoundary)
{
if (isOrbitEmbedded<VERTEX>())
{
Traversor2FV<EmbeddedMap2> t(*this, d);
for(Dart it = t.begin(); it != t.end(); it = t.next())
initOrbitEmbeddingNewCell<VERTEX>(it) ;
}
if(isOrbitEmbedded<EDGE>())
{
Traversor2FE<EmbeddedMap2> t(*this, d);
for(Dart it = t.begin(); it != t.end(); it = t.next())
initOrbitEmbeddingNewCell<EDGE>(it) ;
}
if(isOrbitEmbedded<FACE>())
{
initOrbitEmbeddingNewCell<FACE>(d) ;
initOrbitEmbeddingNewCell<FACE>(phi2(d)) ;
}
}
return d ;
}
void EmbeddedMap2::splitVertex(Dart d, Dart e) void EmbeddedMap2::splitVertex(Dart d, Dart e)
{ {
Dart dd = phi2(d) ; Dart dd = phi2(d) ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment