Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

Commit 0dc114ac authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

Merge cgogn:~jund/CGoGN

Conflicts:
	Apps/Examples/simpleGMap3.cpp
parents 156f13bd 53d599e2
...@@ -28,21 +28,23 @@ ...@@ -28,21 +28,23 @@
#include "Algo/Modelisation/primitives3d.h" #include "Algo/Modelisation/primitives3d.h"
#include "Algo/Modelisation/subdivision3.h" #include "Algo/Modelisation/subdivision3.h"
SimpleGMap3::SimpleGMap3() SimpleGMap3::SimpleGMap3()
{ {
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position"); position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
normal = myMap.addAttribute<PFP::VEC3>(VERTEX, "normal"); normal = myMap.addAttribute<PFP::VEC3>(VERTEX, "normal");
volume = myMap.addAttribute<PFP::VEC3>(VOLUME, "volume");
Algo::Modelisation::Primitive3D<PFP> primCat(myMap,position); Algo::Modelisation::Primitive3D<PFP> primCat(myMap,position);
Dart d = primCat.hexaGrid_topo(2,1,1); Dart d = primCat.hexaGrid_topo(3,1,1);
primCat.embedHexaGrid(1,1,1); primCat.embedHexaGrid(2,1,1);
myMap.check(); myMap.check();
DartMarker markOrient(myMap); DartMarker markOrient(myMap);
std::vector<Dart> orient; std::vector<Dart> orient;
FunctorStore fs(orient); FunctorStore fs(orient);
d = 49;
myMap.foreach_dart_of_oriented_volume(d, fs); myMap.foreach_dart_of_oriented_volume(d, fs);
for(std::vector<Dart>::iterator it = orient.begin() ; it != orient.end() ; ++it) for(std::vector<Dart>::iterator it = orient.begin() ; it != orient.end() ; ++it)
......
...@@ -54,6 +54,7 @@ public: ...@@ -54,6 +54,7 @@ public:
PFP::TVEC3 position ; PFP::TVEC3 position ;
PFP::TVEC3 normal ; PFP::TVEC3 normal ;
PFP::TVEC3 volume ;
SimpleGMap3() ; SimpleGMap3() ;
......
...@@ -38,51 +38,49 @@ namespace Modelisation ...@@ -38,51 +38,49 @@ namespace Modelisation
template <typename PFP> template <typename PFP>
Dart cut3Ear(typename PFP::MAP& map, Dart d) Dart cut3Ear(typename PFP::MAP& map, Dart d)
{ {
Dart e=d; Dart e = d;
int nb=0; int nb = 0;
Dart dNew; Dart dNew;
Dart dRing; Dart dRing;
Dart dRing2; Dart dRing2;
//count the valence of the vertex //count the valence of the vertex
do
{
nb++;
e=map.phi1(map.phi2(e));
} while (e!=d);
if(nb<3)
{
CGoGNout << "Warning : cannot cut 2 volumes without creating a degenerated face " << CGoGNendl;
return d;
}
else
{
//triangulate around the vertex
do do
{ {
Dart dN = map.phi1(map.phi2(e)); nb++;
if(map.template phi<111>(e)!=e) e = map.phi1(map.phi2(e));
map.splitFace(map.phi_1(e), map.phi1(e)); } while (e != d);
dRing = map.phi1(e);
dRing2 = map.phi2(dRing);
map.unsewFaces(dRing); if(nb < 3)
{
CGoGNout << "Warning : cannot cut 2 volumes without creating a degenerated face " << CGoGNendl;
return d;
}
else
{
//triangulate around the vertex
do
{
Dart dN = map.phi1(map.phi2(e));
if(map.template phi<111>(e) != e)
map.splitFace(map.phi_1(e), map.phi1(e));
e= dN; dRing = map.phi1(e);
} while (e!=d); dRing2 = map.phi2(dRing);
map.closeHole(dRing); map.unsewFaces(dRing);
map.closeHole(dRing2);
map.sewVolumes(map.phi2(dRing),map.phi2(dRing2));
}
return map.phi2(dRing); e = dN;
} } while (e != d);
map.closeHole(dRing);
map.closeHole(dRing2);
map.sewVolumes(map.phi2(dRing), map.phi2(dRing2));
}
return map.phi2(dRing);
}
template <typename PFP, typename EMBV, typename EMB> template <typename PFP, typename EMBV, typename EMB>
void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected) void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected)
...@@ -113,7 +111,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec ...@@ -113,7 +111,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
//memorize each vertices per volumes //memorize each vertices per volumes
if(selected(d) && !mv.isMarked(d)) if(selected(d) && !mv.isMarked(d))
{ {
std::cout << " d " << d << std::endl;
l_vertices.push_back(d); l_vertices.push_back(d);
mv.markOrbitInParent<typename PFP::MAP>(VERTEX,d); mv.markOrbitInParent<typename PFP::MAP>(VERTEX,d);
} }
...@@ -145,12 +142,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec ...@@ -145,12 +142,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
} }
} }
unsigned int nb_=0;
for(unsigned int nb= attributs.begin() ; nb != attributs.end() ; attributs.next(nb))
nb_++;
std::cout << "first " << nb_ << std::endl;
// second pass: quandrangule faces // second pass: quandrangule faces
std::map<Dart,Dart> toSew; std::map<Dart,Dart> toSew;
for (Dart d = map.begin(); d != map.end(); map.next(d)) for (Dart d = map.begin(); d != map.end(); map.next(d))
...@@ -230,12 +221,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec ...@@ -230,12 +221,6 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
} }
} }
nb_=0;
for(unsigned int nb= attributs.begin() ; nb != attributs.end() ; attributs.next(nb))
nb_++;
std::cout << "then " << nb_ << std::endl;
map.check(); map.check();
//sew all faces leading to the central vertex //sew all faces leading to the central vertex
...@@ -249,12 +234,9 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec ...@@ -249,12 +234,9 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
} }
} }
} //namespace Modelisation } //namespace Modelisation
} //namespace Algo } //namespace Algo
} //namespace CGoGN } //namespace CGoGN
...@@ -31,6 +31,11 @@ class ParticleBase ...@@ -31,6 +31,11 @@ class ParticleBase
m_position = position; m_position = position;
} }
virtual unsigned int getState()
{
return 0;
}
/** /**
* @param newPosition new position to reach * @param newPosition new position to reach
*/ */
......
...@@ -76,6 +76,11 @@ public : ...@@ -76,6 +76,11 @@ public :
void faceState(const VEC3& current); void faceState(const VEC3& current);
virtual unsigned int getState()
{
return state;
}
void move(const VEC3& newCurrent) void move(const VEC3& newCurrent)
{ {
crossCell = NO_CROSS ; crossCell = NO_CROSS ;
......
...@@ -70,6 +70,11 @@ public : ...@@ -70,6 +70,11 @@ public :
void faceState(VEC3 current); void faceState(VEC3 current);
virtual unsigned int getState()
{
return state;
}
void move(const VEC3& newCurrent) void move(const VEC3& newCurrent)
{ {
crossCell = NO_CROSS ; crossCell = NO_CROSS ;
......
...@@ -221,6 +221,16 @@ void ParticleCell2DAndHalf<PFP>::faceState(VEC3 current) ...@@ -221,6 +221,16 @@ void ParticleCell2DAndHalf<PFP>::faceState(VEC3 current)
assert(std::isfinite(current[0]) && std::isfinite(current[1]) && std::isfinite(current[2])); assert(std::isfinite(current[0]) && std::isfinite(current[1]) && std::isfinite(current[2]));
// assert(Algo::Geometry::isPointInConvexFace2D<PFP>(m,d,m_positions,m_position,true)); // assert(Algo::Geometry::isPointInConvexFace2D<PFP>(m,d,m_positions,m_position,true));
//project current within plane
VEC3 n1 = Algo::Geometry::faceNormal<PFP>(m,d,m_positions);
VEC3 n2 = current-m_position;
n1.normalize();
VEC3 n3 = n1^n2;
n3.normalize();
VEC3 n4 = n3^n1;
current = m_position+(n2*n4)*n4;
//track new position within map
Dart dd = d; Dart dd = d;
float wsoe = getOrientationFace(current, m_position, m.phi1(d)); float wsoe = getOrientationFace(current, m_position, m.phi1(d));
......
...@@ -182,7 +182,7 @@ void TopoRenderMapD::updateData(typename PFP::MAP& map, const typename PFP::TVEC ...@@ -182,7 +182,7 @@ void TopoRenderMapD::updateData(typename PFP::MAP& map, const typename PFP::TVEC
template<typename PFP> template<typename PFP>
void TopoRenderGMap::updateData(typename PFP::MAP& map, const typename PFP::TVEC3& positions, float ke, float kf, const FunctorSelect& good) void TopoRenderGMap::updateData(typename PFP::MAP& map, const typename PFP::TVEC3& positions, float ke, float kf, const FunctorSelect& good)
{ {
/* /*
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
typedef typename PFP::REAL REAL; typedef typename PFP::REAL REAL;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#ifndef __PICKABLES_H_ #ifndef __PICKABLES_H_
#define __PICKABLE_H_ #define __PICKABLES_H_
#include "Utils/vbo.h" #include "Utils/vbo.h"
#include "glm/glm.hpp" #include "glm/glm.hpp"
...@@ -270,7 +270,7 @@ class Grid: public LineDrawable ...@@ -270,7 +270,7 @@ class Grid: public LineDrawable
public: public:
/** /**
* constructor * constructor
* @param sub number of subdivision of grig * @param sub number of subdivision of grid
*/ */
Grid(unsigned int sub=5); Grid(unsigned int sub=5);
......
...@@ -394,8 +394,8 @@ bool EmbeddedGMap3::check() ...@@ -394,8 +394,8 @@ bool EmbeddedGMap3::check()
if(isOrbitEmbedded(VERTEX)) if(isOrbitEmbedded(VERTEX))
{ {
if( getEmbedding(VERTEX, d) != getEmbedding(VERTEX, beta1(d)) || if( getEmbedding(VERTEX, d) != getEmbedding(VERTEX, beta1(d)) ||
getEmbedding(VERTEX, d) != getEmbedding(VERTEX, beta2(d)) || getEmbedding(VERTEX, d) != getEmbedding(VERTEX, beta2(d)) ||
getEmbedding(VERTEX, d) != getEmbedding(VERTEX, beta3(d)) ) getEmbedding(VERTEX, d) != getEmbedding(VERTEX, beta3(d)) )
{ {
std::cout << "Embedding Check : different embeddings on vertex" << std::endl ; std::cout << "Embedding Check : different embeddings on vertex" << std::endl ;
return false ; return false ;
...@@ -405,8 +405,8 @@ bool EmbeddedGMap3::check() ...@@ -405,8 +405,8 @@ bool EmbeddedGMap3::check()
if(isOrbitEmbedded(EDGE)) if(isOrbitEmbedded(EDGE))
{ {
if( getEmbedding(EDGE, d) != getEmbedding(EDGE, beta0(d)) || if( getEmbedding(EDGE, d) != getEmbedding(EDGE, beta0(d)) ||
getEmbedding(EDGE, d) != getEmbedding(EDGE, beta2(d)) || getEmbedding(EDGE, d) != getEmbedding(EDGE, beta2(d)) ||
getEmbedding(EDGE, d) != getEmbedding(EDGE, beta3(d)) ) getEmbedding(EDGE, d) != getEmbedding(EDGE, beta3(d)) )
{ {
std::cout << "Embedding Check : different embeddings on edge" << std::endl ; std::cout << "Embedding Check : different embeddings on edge" << std::endl ;
return false ; return false ;
...@@ -416,8 +416,8 @@ bool EmbeddedGMap3::check() ...@@ -416,8 +416,8 @@ bool EmbeddedGMap3::check()
if (isOrbitEmbedded(FACE)) if (isOrbitEmbedded(FACE))
{ {
if( getEmbedding(FACE, d) != getEmbedding(FACE, beta0(d)) || if( getEmbedding(FACE, d) != getEmbedding(FACE, beta0(d)) ||
getEmbedding(FACE, d) != getEmbedding(FACE, beta1(d)) || getEmbedding(FACE, d) != getEmbedding(FACE, beta1(d)) ||
getEmbedding(FACE, d) != getEmbedding(FACE, beta3(d)) ) getEmbedding(FACE, d) != getEmbedding(FACE, beta3(d)) )
{ {
CGoGNout << "Check: different embeddings on face" << CGoGNendl ; CGoGNout << "Check: different embeddings on face" << CGoGNendl ;
return false ; return false ;
...@@ -427,8 +427,8 @@ bool EmbeddedGMap3::check() ...@@ -427,8 +427,8 @@ bool EmbeddedGMap3::check()
if (isOrbitEmbedded(VOLUME)) if (isOrbitEmbedded(VOLUME))
{ {
if( getEmbedding(VOLUME, d) != getEmbedding(VOLUME, beta0(d)) || if( getEmbedding(VOLUME, d) != getEmbedding(VOLUME, beta0(d)) ||
getEmbedding(VOLUME, d) != getEmbedding(VOLUME, beta1(d)) || getEmbedding(VOLUME, d) != getEmbedding(VOLUME, beta1(d)) ||
getEmbedding(VOLUME, d) != getEmbedding(VOLUME, beta2(d)) ) getEmbedding(VOLUME, d) != getEmbedding(VOLUME, beta2(d)) )
{ {
CGoGNout << "Check: different embeddings on volume" << CGoGNendl ; CGoGNout << "Check: different embeddings on volume" << CGoGNendl ;
return false ; return false ;
...@@ -441,3 +441,4 @@ bool EmbeddedGMap3::check() ...@@ -441,3 +441,4 @@ bool EmbeddedGMap3::check()
} }
} // namespace CGoGN } // namespace CGoGN
...@@ -134,7 +134,6 @@ glm::mat4& Pickable::transfo() ...@@ -134,7 +134,6 @@ glm::mat4& Pickable::transfo()
return m_transfo; return m_transfo;
} }
void Pickable::rotate(float angle, const Geom::Vec3f& Axis) void Pickable::rotate(float angle, const Geom::Vec3f& Axis)
{ {
m_transfo = glm::rotate(m_transfo, angle, glm::vec3(Axis[0],Axis[1],Axis[2])); m_transfo = glm::rotate(m_transfo, angle, glm::vec3(Axis[0],Axis[1],Axis[2]));
...@@ -472,7 +471,7 @@ unsigned int Sphere::pick(const Geom::Vec3f& P, const Geom::Vec3f& V, Geom::Vec3 ...@@ -472,7 +471,7 @@ unsigned int Sphere::pick(const Geom::Vec3f& P, const Geom::Vec3f& V, Geom::Vec3
I=P; I=P;
I.normalize(); // grossiere approximation TODO amelioerer approxim ? I.normalize(); // grossiere approximation TODO ameliorer approxim ?
return 1; return 1;
} }
......
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