Commit 3b468c90 authored by Pierre Kraemer's avatar Pierre Kraemer

last commit before merge !

parent 995544b7
...@@ -85,7 +85,7 @@ void Viewer::cb_initGL() ...@@ -85,7 +85,7 @@ void Viewer::cb_initGL()
Utils::GLSLShader::setCurrentOGLVersion(2) ; Utils::GLSLShader::setCurrentOGLVersion(2) ;
m_render = new Algo::Render::GL2::MapRender() ; m_render = new Algo::Render::GL2::MapRender() ;
m_topoRender = new Algo::Render::GL2::TopoRender() ; m_topoRender = new Algo::Render::GL2::TopoRenderMap<PFP>() ;
m_topoRender->setInitialDartsColor(0.25f, 0.25f, 0.25f) ; m_topoRender->setInitialDartsColor(0.25f, 0.25f, 0.25f) ;
...@@ -211,7 +211,7 @@ void Viewer::cb_keyPress(int keycode) ...@@ -211,7 +211,7 @@ void Viewer::cb_keyPress(int keycode)
Geom::Plane3D<PFP::REAL> plan(n,o); Geom::Plane3D<PFP::REAL> plan(n,o);
CellMarker<FACE> over(myMap); CellMarker<MAP, FACE> over(myMap);
Algo::Surface::Modelisation::planeCut<PFP>(myMap, position, plan, over, true, true); Algo::Surface::Modelisation::planeCut<PFP>(myMap, position, plan, over, true, true);
std::cout << "PlaneCut Ok"<< std::endl; std::cout << "PlaneCut Ok"<< std::endl;
...@@ -224,7 +224,6 @@ void Viewer::cb_keyPress(int keycode) ...@@ -224,7 +224,6 @@ void Viewer::cb_keyPress(int keycode)
position[d]+= n; position[d]+= n;
} }
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::POINTS) ; m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::POINTS) ;
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::LINES) ; m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::LINES) ;
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::TRIANGLES) ; m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::TRIANGLES) ;
...@@ -233,7 +232,7 @@ void Viewer::cb_keyPress(int keycode) ...@@ -233,7 +232,7 @@ void Viewer::cb_keyPress(int keycode)
m_positionVBO->updateData(position) ; m_positionVBO->updateData(position) ;
m_normalVBO->updateData(normal) ; m_normalVBO->updateData(normal) ;
m_topoRender->updateData<PFP>(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ; m_topoRender->updateData(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ;
updateGL(); updateGL();
break; break;
...@@ -247,13 +246,13 @@ void Viewer::cb_keyPress(int keycode) ...@@ -247,13 +246,13 @@ void Viewer::cb_keyPress(int keycode)
Geom::Plane3D<PFP::REAL> plan(n,o); Geom::Plane3D<PFP::REAL> plan(n,o);
CellMarker<FACE> over(myMap); CellMarker<MAP, FACE> over(myMap);
Algo::Surface::Modelisation::planeCut2<PFP>(myMap, position, plan, over, true); Algo::Surface::Modelisation::planeCut2<PFP>(myMap, position, plan, over, true);
std::cout << "PlaneCut Ok"<< std::endl; std::cout << "PlaneCut Ok"<< std::endl;
n *= bb.diagSize()/20.0f; n *= bb.diagSize()/20.0f;
TraversorV<PFP::MAP> trav(myMap); TraversorV<MAP> trav(myMap);
for (Dart d=trav.begin(); d!=trav.end(); d=trav.next()) for (Dart d=trav.begin(); d!=trav.end(); d=trav.next())
{ {
if (over.isMarked(d)) if (over.isMarked(d))
...@@ -269,7 +268,7 @@ void Viewer::cb_keyPress(int keycode) ...@@ -269,7 +268,7 @@ void Viewer::cb_keyPress(int keycode)
m_positionVBO->updateData(position) ; m_positionVBO->updateData(position) ;
m_normalVBO->updateData(normal) ; m_normalVBO->updateData(normal) ;
m_topoRender->updateData<PFP>(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ; m_topoRender->updateData(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ;
updateGL(); updateGL();
break; break;
...@@ -296,10 +295,6 @@ void Viewer::cb_keyPress(int keycode) ...@@ -296,10 +295,6 @@ void Viewer::cb_keyPress(int keycode)
break; break;
} }
default: default:
break; break;
} }
...@@ -334,7 +329,7 @@ void Viewer::importMesh(std::string& filename) ...@@ -334,7 +329,7 @@ void Viewer::importMesh(std::string& filename)
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::LINES) ; m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::LINES) ;
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::TRIANGLES) ; m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::TRIANGLES) ;
m_topoRender->updateData<PFP>(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ; m_topoRender->updateData(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ;
bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ; bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
normalBaseSize = bb.diagSize() / 100.0f ; normalBaseSize = bb.diagSize() / 100.0f ;
...@@ -366,7 +361,7 @@ void Viewer::exportMesh(std::string& filename, bool askExportMode) ...@@ -366,7 +361,7 @@ void Viewer::exportMesh(std::string& filename, bool askExportMode)
if (askExportMode) if (askExportMode)
Utils::QT::inputValues(Utils::QT::VarCombo("binary mode;ascii mode",ascii,"Save in")) ; Utils::QT::inputValues(Utils::QT::VarCombo("binary mode;ascii mode",ascii,"Save in")) ;
std::vector<VertexAttribute<VEC3>*> attributes ; std::vector<VertexAttribute<VEC3, MAP_IMPL>*> attributes ;
attributes.push_back(&position) ; attributes.push_back(&position) ;
Algo::Surface::Export::exportPLYnew<PFP>(myMap, attributes, filename.c_str(), !ascii) ; Algo::Surface::Export::exportPLYnew<PFP>(myMap, attributes, filename.c_str(), !ascii) ;
} }
......
...@@ -63,6 +63,7 @@ struct PFP: public PFP_STANDARD ...@@ -63,6 +63,7 @@ struct PFP: public PFP_STANDARD
}; };
typedef PFP::MAP MAP ; typedef PFP::MAP MAP ;
typedef PFP::MAP::IMPL MAP_IMPL ;
typedef PFP::VEC3 VEC3 ; typedef PFP::VEC3 VEC3 ;
...@@ -99,11 +100,11 @@ public: ...@@ -99,11 +100,11 @@ public:
bool m_drawTopo ; bool m_drawTopo ;
bool m_drawBoundaryTopo; bool m_drawBoundaryTopo;
VertexAttribute<VEC3> position ; VertexAttribute<VEC3, MAP_IMPL> position ;
VertexAttribute<VEC3> normal ; VertexAttribute<VEC3, MAP_IMPL> normal ;
Algo::Render::GL2::MapRender* m_render ; Algo::Render::GL2::MapRender* m_render ;
Algo::Render::GL2::TopoRender* m_topoRender ; Algo::Render::GL2::TopoRenderMap<PFP>* m_topoRender ;
Utils::VBO* m_positionVBO ; Utils::VBO* m_positionVBO ;
Utils::VBO* m_normalVBO; Utils::VBO* m_normalVBO;
......
...@@ -42,7 +42,7 @@ namespace Geometry ...@@ -42,7 +42,7 @@ namespace Geometry
* @return the squared distance to tha plane * @return the squared distance to tha plane
*/ */
template <typename PFP> template <typename PFP>
typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position, const VEC3& P) ; typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VEC3& P) ;
/** /**
* compute squared distance from point to face (assuming face is convex) * compute squared distance from point to face (assuming face is convex)
...@@ -53,7 +53,7 @@ typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Dart d ...@@ -53,7 +53,7 @@ typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Dart d
* @return the squared distance * @return the squared distance
*/ */
template <typename PFP> template <typename PFP>
typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position, const VEC3& P) ; typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VEC3& P) ;
/** /**
...@@ -64,10 +64,10 @@ typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Dart d, con ...@@ -64,10 +64,10 @@ typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Dart d, con
* @return the squared distance * @return the squared distance
*/ */
template <typename PFP> template <typename PFP>
typename PFP::REAL squaredDistancePoint2Edge(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position, const VEC3& P) ; typename PFP::REAL squaredDistancePoint2Edge(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VEC3& P) ;
template <typename PFP> template <typename PFP>
bool isPlanar(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position); bool isPlanar(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position);
} // namespace Geometry } // namespace Geometry
......
...@@ -36,7 +36,7 @@ namespace Geometry ...@@ -36,7 +36,7 @@ namespace Geometry
{ {
template <typename PFP> template <typename PFP>
bool isPlanar(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position) bool isPlanar(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
{ {
if (map.phi<111>(d)==d) if (map.phi<111>(d)==d)
return true; return true;
...@@ -53,10 +53,8 @@ bool isPlanar(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP ...@@ -53,10 +53,8 @@ bool isPlanar(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP
} }
} }
template <typename PFP> template <typename PFP>
typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position, const VEC3& P) typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VEC3& P)
{ {
const typename PFP::VEC3& A = position[d]; const typename PFP::VEC3& A = position[d];
d = map.phi1(d); d = map.phi1(d);
...@@ -66,9 +64,8 @@ typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Dart d ...@@ -66,9 +64,8 @@ typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Dart d
return Geom::squaredDistancePoint2TrianglePlane(P,A,B,C); return Geom::squaredDistancePoint2TrianglePlane(P,A,B,C);
} }
template <typename PFP> template <typename PFP>
typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position, const VEC3& P) typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VEC3& P)
{ {
typedef typename PFP::REAL REAL; typedef typename PFP::REAL REAL;
const typename PFP::VEC3& A = position[d]; const typename PFP::VEC3& A = position[d];
...@@ -90,9 +87,8 @@ typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Dart d, con ...@@ -90,9 +87,8 @@ typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Dart d, con
return dist2; return dist2;
} }
template <typename PFP> template <typename PFP>
typename PFP::REAL squaredDistancePoint2Edge(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position, const VEC3& P) typename PFP::REAL squaredDistancePoint2Edge(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VEC3& P)
{ {
const typename PFP::VEC3& A = position[d]; const typename PFP::VEC3& A = position[d];
typename PFP::VEC3& AB = position[map.phi1(d)]-A; typename PFP::VEC3& AB = position[map.phi1(d)]-A;
...@@ -100,11 +96,8 @@ typename PFP::REAL squaredDistancePoint2Edge(typename PFP::MAP& map, Dart d, con ...@@ -100,11 +96,8 @@ typename PFP::REAL squaredDistancePoint2Edge(typename PFP::MAP& map, Dart d, con
return Geom::squaredDistanceSeg2Point(A,AB,AB2,P) ; return Geom::squaredDistanceSeg2Point(A,AB,AB2,P) ;
} }
} // namespace Geometry } // namespace Geometry
} // namespace Algo } // namespace Algo
} // namespace CGoGN } // namespace CGoGN
...@@ -60,9 +60,9 @@ void planeCut( ...@@ -60,9 +60,9 @@ void planeCut(
template <typename PFP> template <typename PFP>
void planeCut2( void planeCut2(
typename PFP::MAP& map, typename PFP::MAP& map,
VertexAttribute<typename PFP::VEC3>& position, VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const Geom::Plane3D<typename PFP::REAL>& plane, const Geom::Plane3D<typename PFP::REAL>& plane,
CellMarker<FACE>& cmf_over, CellMarker<typename PFP::MAP, FACE>& cmf_over,
bool with_unsew bool with_unsew
); );
...@@ -79,9 +79,9 @@ namespace Modelisation ...@@ -79,9 +79,9 @@ namespace Modelisation
template <typename PFP> template <typename PFP>
void planeCut( void planeCut(
typename PFP::MAP& map, typename PFP::MAP& map,
VertexAttribute<typename PFP::VEC3>& position, VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const Geom::Plane3D<typename PFP::REAL>& plane, const Geom::Plane3D<typename PFP::REAL>& plane,
CellMarker<FACE>& cmv_over, CellMarker<typename PFP::MAP, FACE>& cmv_over,
bool keepTetrahedra = false, bool keepTetrahedra = false,
bool with_unsew = true bool with_unsew = true
); );
......
...@@ -263,7 +263,7 @@ void planeCut2( ...@@ -263,7 +263,7 @@ void planeCut2(
typename PFP::MAP& map, typename PFP::MAP& map,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const Geom::Plane3D<typename PFP::REAL>& plane, const Geom::Plane3D<typename PFP::REAL>& plane,
CellMarker<FACE>& cmf_over, CellMarker<typename PFP::MAP, FACE>& cmf_over,
bool with_unsew) bool with_unsew)
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
...@@ -407,7 +407,7 @@ void planeCut( ...@@ -407,7 +407,7 @@ void planeCut(
typename PFP::MAP& map, typename PFP::MAP& map,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const Geom::Plane3D<typename PFP::REAL>& plane, const Geom::Plane3D<typename PFP::REAL>& plane,
CellMarker<FACE>& cmf_over, CellMarker<typename PFP::MAP, FACE>& cmf_over,
bool keepTetrahedra=false, bool keepTetrahedra=false,
bool with_unsew = true) bool with_unsew = true)
{ {
......
...@@ -104,7 +104,7 @@ void uniformOrientationCC(MAP& map, Dart faceSeed) ...@@ -104,7 +104,7 @@ void uniformOrientationCC(MAP& map, Dart faceSeed)
propag_inv.reserve(1024); propag_inv.reserve(1024);
face2invert.reserve(1024); face2invert.reserve(1024);
DartMarker cmf(map); DartMarker<MAP> cmf(map);
cmf.markOrbit<FACE>(faceSeed); cmf.markOrbit<FACE>(faceSeed);
propag.push_back(faceSeed); propag.push_back(faceSeed);
......
...@@ -198,7 +198,7 @@ public: ...@@ -198,7 +198,7 @@ public:
* @return an AttributeHandler * @return an AttributeHandler
*/ */
template <typename T, unsigned int ORBIT> template <typename T, unsigned int ORBIT>
inline AttributeHandler<T, ORBIT, MAP_IMPL> addAttribute(const std::string& nameAttr) ; inline AttributeHandler<T, ORBIT, MAP_IMPL> addAttribute(const std::string& nameAttr = "") ;
/** /**
* remove an attribute * remove an attribute
......
...@@ -95,37 +95,37 @@ public: ...@@ -95,37 +95,37 @@ public:
/** /**
* get the number of darts inserted in the given leveldart * get the number of darts inserted in the given leveldart
*/ */
unsigned int getNbInsertedDarts(unsigned int level) const; inline unsigned int getNbInsertedDarts(unsigned int level) const;
/** /**
* get the number of darts that define the map of the given leveldart * get the number of darts that define the map of the given leveldart
*/ */
unsigned int getNbDarts(unsigned int level) const; inline unsigned int getNbDarts(unsigned int level) const;
/** /**
* @return the number of darts in the map * @return the number of darts in the map
*/ */
virtual unsigned int getNbDarts() const; inline virtual unsigned int getNbDarts() const;
inline AttributeContainer& getDartContainer(); inline AttributeContainer& getDartContainer();
/** /**
* get the insertion level of a dart * get the insertion level of a dart
*/ */
unsigned int getDartLevel(Dart d) const; inline unsigned int getDartLevel(Dart d) const;
protected: protected:
/** /**
* *
*/ */
void incDartLevel(Dart d) const ; inline void incDartLevel(Dart d) const ;
/** /**
* duplicate a dart starting from current level * duplicate a dart starting from current level
*/ */
void duplicateDart(Dart d) ; inline void duplicateDart(Dart d) ;
void duplicateDartAtOneLevel(Dart d, unsigned int level) ; inline void duplicateDartAtOneLevel(Dart d, unsigned int level) ;
/**************************************** /****************************************
* RELATIONS MANAGEMENT * * RELATIONS MANAGEMENT *
......
...@@ -151,6 +151,11 @@ inline unsigned int MapMulti::getDartLevel(Dart d) const ...@@ -151,6 +151,11 @@ inline unsigned int MapMulti::getDartLevel(Dart d) const
return (*m_mrLevels)[d.index] ; return (*m_mrLevels)[d.index] ;
} }
inline AttributeContainer& MapMulti::getDartContainer()
{
return m_mrattribs;
}
inline void MapMulti::incDartLevel(Dart d) const inline void MapMulti::incDartLevel(Dart d) const
{ {
++((*m_mrLevels)[d.index]) ; ++((*m_mrLevels)[d.index]) ;
...@@ -185,11 +190,6 @@ inline void MapMulti::duplicateDartAtOneLevel(Dart d, unsigned int level) ...@@ -185,11 +190,6 @@ inline void MapMulti::duplicateDartAtOneLevel(Dart d, unsigned int level)
(*m_mrDarts[level])[d.index] = copyDartLine(dartIndex(d)) ; (*m_mrDarts[level])[d.index] = copyDartLine(dartIndex(d)) ;
} }
inline AttributeContainer& MapMulti::getDartContainer()
{
return m_mrattribs;
}
/**************************************** /****************************************
* RELATIONS MANAGEMENT * * RELATIONS MANAGEMENT *
****************************************/ ****************************************/
......
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