Commit e9606c65 authored by Sylvain Thery's avatar Sylvain Thery

more tests

parent 2ac35316
......@@ -14,7 +14,7 @@ IF (WIN32)
link_directories( ${CGoGN_ROOT_DIR}/bin/${CMAKE_BUILD_TYPE})
SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin/${CMAKE_BUILD_TYPE}) # Release/Debug added automatically by visual
ELSE()
link_directories( ${CGoGN_ROOT_DIR}/bin/${ConfigurationName})
link_directories( ${CGoGN_ROOT_DIR}/bin/$(ConfigurationName))
SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin/) # Release/Debug added automatically by visual
ENDIF()
ELSE()
......
......@@ -20,5 +20,5 @@ add_subdirectory(Geometry)
#add_subdirectory(Render)
#add_subdirectory(Selection)
#add_subdirectory(Simulation)
#add_subdirectory(Tiling)
#add_subdirectory(Topo)
add_subdirectory(Tiling)
add_subdirectory(Topo)
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#include "Topology/gmap/embeddedGMap2.h"
#include "Topology/map/embeddedMap3.h"
#include "Algo/Geometry/normal.h"
......@@ -19,14 +20,26 @@ template VATT1::DATA_TYPE Algo::Surface::Geometry::triangleNormal<PFP1, VATT1>(P
template VATT1::DATA_TYPE Algo::Surface::Geometry::newellNormal<PFP1, VATT1>(PFP1::MAP& map, Face f, const VATT1& position);
template VATT1::DATA_TYPE Algo::Surface::Geometry::faceNormal<PFP1, VATT1>(PFP1::MAP& map, Face f, const VATT1& position);
template VATT1::DATA_TYPE Algo::Surface::Geometry::vertexNormal<PFP1, VATT1>(PFP1::MAP& map, Vertex v, const VATT1& position);
//TODO COMPILER ERROR
// template VATT1::DATA_TYPE Algo::Surface::Geometry::vertexBorderNormal<PFP1, VATT1>(PFP1::MAP& map, Vertex v, const VATT1& position);
template void Algo::Surface::Geometry::computeNormalFaces<PFP1, VATT1, FATT1>(PFP1::MAP& map, const VATT1& position, FATT1& face_normal);
template void Algo::Surface::Geometry::computeNormalVertices<PFP1, VATT1>(PFP1::MAP& map, const VATT1& position, VATT1& normal);
template PFP1::REAL Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP1, VATT1>(PFP1::MAP& map, Edge d, const VATT1& position);
template void Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges<PFP1,VATT1,EATT1>(PFP1::MAP& map, const VATT1& position, EATT1& angles);
struct PFP11 : public PFP_STANDARD
{
typedef EmbeddedMap3 MAP;
};
typedef VertexAttribute<PFP11::VEC3, PFP11::MAP> VATT11;
typedef FaceAttribute<PFP11::VEC3, PFP11::MAP> FATT11;
typedef EdgeAttribute<PFP11::REAL, PFP11::MAP> EATT11;
template VATT11::DATA_TYPE Algo::Surface::Geometry::vertexBorderNormal<PFP11, VATT11>(PFP11::MAP& map, Vertex v, const VATT11& position);
struct PFP2 : public PFP_DOUBLE
{
typedef EmbeddedMap2 MAP;
......@@ -40,7 +53,7 @@ template VATT2::DATA_TYPE Algo::Surface::Geometry::triangleNormal<PFP2, VATT2>(P
template VATT2::DATA_TYPE Algo::Surface::Geometry::newellNormal<PFP2, VATT2>(PFP2::MAP& map, Face f, const VATT2& position);
template VATT2::DATA_TYPE Algo::Surface::Geometry::faceNormal<PFP2, VATT2>(PFP2::MAP& map, Face f, const VATT2& position);
template VATT2::DATA_TYPE Algo::Surface::Geometry::vertexNormal<PFP2, VATT2>(PFP2::MAP& map, Vertex v, const VATT2& position);
//TODO COMPILER ERROR
//TODO VOLUME INSTANTIATION
// template VATT2::DATA_TYPE Algo::Surface::Geometry::vertexBorderNormal<PFP2, VATT2>(PFP2::MAP& map, Vertex v, const VATT2& position);
template void Algo::Surface::Geometry::computeNormalFaces<PFP2, VATT2, FATT2>(PFP2::MAP& map, const VATT2& position, FATT2& face_normal);
template void Algo::Surface::Geometry::computeNormalVertices<PFP2, VATT2>(PFP2::MAP& map, const VATT2& position, VATT2& normal);
......@@ -61,7 +74,7 @@ template VATT3::DATA_TYPE Algo::Surface::Geometry::triangleNormal<PFP3, VATT3>(P
template VATT3::DATA_TYPE Algo::Surface::Geometry::newellNormal<PFP3, VATT3>(PFP3::MAP& map, Face f, const VATT3& position);
template VATT3::DATA_TYPE Algo::Surface::Geometry::faceNormal<PFP3, VATT3>(PFP3::MAP& map, Face f, const VATT3& position);
template VATT3::DATA_TYPE Algo::Surface::Geometry::vertexNormal<PFP3, VATT3>(PFP3::MAP& map, Vertex v, const VATT3& position);
//TODO COMPILER ERROR
//TODO VOLUME INSTANTIATION
// template VATT3::DATA_TYPE Algo::Surface::Geometry::vertexBorderNormal<PFP3, VATT3>(PFP3::MAP& map, Vertex v, const VATT3& position);
template void Algo::Surface::Geometry::computeNormalFaces<PFP3, VATT3, FATT3>(PFP3::MAP& map, const VATT3& position, FATT3& face_normal);
template void Algo::Surface::Geometry::computeNormalVertices<PFP3, VATT3>(PFP3::MAP& map, const VATT3& position, VATT3& normal);
......
cmake_minimum_required(VERSION 2.6)
project(testing_algo_tiling)
add_executable( test_algo_tiling
algo_tiling.cpp
Surface/hexagonal.cpp
Surface/square.cpp
Surface/triangular.cpp
Volume/cubic.cpp
)
target_link_libraries( test_algo_tiling
${CGoGN_LIBS} ${CGoGN_EXT_LIBS})
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#include "Topology/gmap/embeddedGMap2.h"
#include "Algo/Tiling/tiling.h"
#ifndef _TILING_HEXAGONAL_H_
#define _TILING_HEXAGONAL_H_
using namespace CGoGN;
#include "Algo/Tiling/Surface/hexagonal.h"
namespace CGoGN
{
namespace Algo
{
namespace Surface
{
namespace Tilings
struct PFP1 : public PFP_STANDARD
{
typedef EmbeddedMap2 MAP;
};
namespace Hexagonal
struct PFP2 : public PFP_DOUBLE
{
typedef EmbeddedMap2 MAP;
};
/*! \brief The class of regular grid square tiling
*/
template <typename PFP>
class Grid : public Tiling<PFP>
struct PFP3 : public PFP_DOUBLE
{
typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3;
public:
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):
Tiling<PFP>(map, x, y, -1)
{
grid(x, y, true);
}
/*! @name Embedding Operators
* Tiling creation
*************************************************************************/
//@{
//! 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, MAP>& position, float x, float y, float z = 0.0f);
//! 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, MAP>& 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, MAP>& 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);
//@}
typedef EmbeddedGMap2 MAP;
};
} // namespace Hexagonal
} // namespace Tilings
} // namespace Surface
// TODO implementation !!!
template Algo::Surface::Tilings::Hexagonal::Grid<PFP1>;
template Algo::Surface::Tilings::Hexagonal::Grid<PFP2>;
template Algo::Surface::Tilings::Hexagonal::Grid<PFP3>;
} // namespace Algo
} // namespace CGoGN
#include "Algo/Tiling/Surface/hexagonal.hpp"
#endif // _TILING_HEXAGONAL_H_
int test_hexagonal()
{
return 0;
}
This diff is collapsed.
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap3.h"
#include "Algo/Tiling/tiling.h"
#ifndef _TILING_CUBIC_H_
#define _TILING_CUBIC_H_
using namespace CGoGN;
#include "Algo/Tiling/Volume/cubic.h"
namespace CGoGN
{
namespace Algo
{
namespace Volume
struct PFP1 : public PFP_STANDARD
{
typedef EmbeddedMap3 MAP;
};
namespace Tilings
{
namespace Cubic
{
/*! \brief The class of regular grid square tiling
*/
template <typename PFP>
class Grid : public Algo::Surface::Tilings::Tiling<PFP>
struct PFP2 : public PFP_DOUBLE
{
typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3;
public:
Grid(MAP& map, unsigned int x, unsigned int y, unsigned int z):
Algo::Surface::Tilings::Tiling<PFP>(map, x, y, z)
{
grid3D(x, y, z);
}
/*! @name Embedding Operators
* Tiling creation
*************************************************************************/
//@{
//! 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, MAP>& position, float x, float y, float z);
//! 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, MAP>& 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, MAP>& position, float radius_min, float radius_max, float maxHeight, float nbTurn, int orient = 1);
//@}
protected:
/*! @name Topological Operators
* Tiling creation
*************************************************************************/
//@{
//! Create a 3D grid
/*! @param x nb of squares in x
* @param y nb of squares in y
* @param z nb of squares in z
*/
void grid3D(unsigned int x, unsigned int y, unsigned int z);
//! Create a 3D grid
/*! @param x nb of squares in x
* @param y nb of squares in y
*/
Dart grid2D(unsigned int x, unsigned int y);
//! Create a 3D grid
/*! @param x nb of squares in x
*/
Dart grid1D(unsigned int x);
//@}
typedef EmbeddedMap3 MAP;
};
} // namespace Cubic
} // namespace Tilings
} // namespace Volume
} // namespace Algo
template Algo::Volume::Tilings::Cubic::Grid<PFP1>;
template Algo::Volume::Tilings::Cubic::Grid<PFP2>;
} // namespace CGoGN
#include "Algo/Tiling/Volume/cubic.hpp"
#endif // _TILING_CUBIC_H_
int test_cubic()
{
return 0;
}
#include <iostream>
extern int test_square();
extern int test_triangular();
extern int test_hexagonal();
extern int test_cubic();
int main()
{
test_square();
test_triangular();
test_hexagonal();
test_cubic();
return 0;
}
cmake_minimum_required(VERSION 2.6)
project(testing_algo_topo)
add_executable( test_algo_topo
algo_topo.cpp
basic.cpp
embedding.cpp
simplex.cpp
Map2/uniformOrientation.cpp
)
target_link_libraries( test_algo_topo
${CGoGN_LIBS} ${CGoGN_EXT_LIBS})
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#include "Topology/gmap/embeddedGMap2.h"
#include "Algo/Topo/Map2/uniformOrientation.h"
#ifndef __UNIFORM_ORIENTATION__
#define __UNIFORM_ORIENTATION__
using namespace CGoGN;
namespace CGoGN
{
namespace Algo
{
namespace Topo
{
template void Algo::Topo::uniformOrientationCC<EmbeddedMap2>(EmbeddedMap2& map, Dart faceSeed);
/**
* @brief Restore an uniform orientation on a mesh that has been imported from set of triangle with non uniform orientation
* @param map a Map2 or inherited
* @param faceSeed a dart of a face of the CC to process.
*/
template <typename MAP>
void uniformOrientationCC(MAP& map, Dart faceSeed);
// do not work but do not need !
//template void Algo::Topo::uniformOrientationCC<EmbeddedGMap2>(EmbeddedGMap2& map, Dart faceSeed);
} // namespace Topo
} // namespace Algo
} // namespace CGoGN
#include "Algo/Topo/Map2/uniformOrientation.hpp"
#endif
int test_uniformOrientation()
{
return 0;
}
#include <iostream>
extern int test_basic();
extern int test_embedding();
extern int test_simplex();
extern int test_uniformOrientation();
int main()
{
test_basic();
test_embedding();
test_simplex();
test_uniformOrientation();
return 0;
}
This diff is collapsed.
This diff is collapsed.
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#include "Topology/gmap/embeddedGMap2.h"
#include "Topology/map/embeddedMap3.h"
#include "Algo/Topo/simplex.h"
#ifndef __SIMPLEX__
#define __SIMPLEX__
using namespace CGoGN;
#include "Topology/generic/cells.h"
template bool Algo::Topo::isSimplex<VERTEX, EmbeddedMap2>(const EmbeddedMap2& map, Dart d);
template bool Algo::Topo::isSimplex<EDGE, EmbeddedMap2>(const EmbeddedMap2& map, Dart d);
template bool Algo::Topo::isSimplex<FACE, EmbeddedMap2>(const EmbeddedMap2& map, Dart d);
template bool Algo::Topo::isSimplex<VOLUME, EmbeddedMap2>(const EmbeddedMap2& map, Dart d);
namespace CGoGN
{
namespace Algo
{
namespace Topo
{
template bool Algo::Topo::isSimplex<VERTEX, EmbeddedMap3>(const EmbeddedMap3& map, Dart d);
template bool Algo::Topo::isSimplex<EDGE, EmbeddedMap3>(const EmbeddedMap3& map, Dart d);
template bool Algo::Topo::isSimplex<FACE, EmbeddedMap3>(const EmbeddedMap3& map, Dart d);
template bool Algo::Topo::isSimplex<VOLUME, EmbeddedMap3>(const EmbeddedMap3& map, Dart d);
template <typename MAP, unsigned int ORBIT>
bool isSimplex(const MAP& map, Dart d)
int test_simplex()
{
if (ORBIT==VOLUME)
{
Dart d1 = map.phi2(d);
Dart e = map.phi1(d);
Dart d2 = map.phi2(e);
e = map.phi1(e);
Dart d3 = map.phi2(d);
if (map.phi1(e) != d) // check that face of d is a triangle
return false;
if (map.phi_1(d1) != map.template phi<12>(d2))
return false;
if (map.phi_1(d2) != map.template phi<12>(d3))
return false;
if (map.phi_1(d3) != map.template phi<12>(d1))
return false;
if (! map.isCycleTriangle(d1))
return false;
if (! map.isCycleTriangle(d2))
return false;
if (! map.isCycleTriangle(d3))
return false;
return true;
}
if (ORBIT==FACE)
{
return map.isCycleTriangle(d);
}
return true;
return 0;
}
} // namespace Topo
} // namespace Algo
} // namespace CGoGN
#endif
......@@ -45,7 +45,7 @@ file(
IF(WIN32)
add_custom_target(shader_target ${CGoGN_ROOT_DIR}/ThirdParty/bin/Release/shader_to_h ${shaders_src}
add_custom_target(shader_target ${CGoGN_ROOT_DIR}/ThirdParty/bin/$(ConfigurationName)/shader_to_h ${shaders_src}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
SOURCES ${shaders_src} )
ELSE()
......@@ -103,7 +103,7 @@ file( GLOB_RECURSE
${CGoGN_ROOT_DIR}/ThirdParty/include/*.hpp
)
link_directories( ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE} )
#link_directories( ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE} )
IF (CGoGN_ONELIB)
IF(CGoGN_WITH_QT)
......
......@@ -290,7 +290,7 @@ void EdgeSelector_Length<PFP>::updateEdgeInfo(Dart d, bool recompute)
template <typename PFP>
void EdgeSelector_Length<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
{
VEC3 vec = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->m_map, d, position) ;
VEC3 vec = Algo::Geometry::vectorOutOfDart<PFP>(this->m_map, d, position) ;
einfo.it = edges.insert(std::make_pair(vec.norm2(), d)) ;
einfo.valid = true ;
}
......@@ -939,7 +939,7 @@ void EdgeSelector_NormalArea<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
template <typename PFP>
void EdgeSelector_NormalArea<PFP>::computeEdgeMatrix(Dart d)
{
const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->m_map, d, m_position) ;
const VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->m_map, d, m_position) ;
edgeMatrix[d].identity();
edgeMatrix[d] *= e.norm2();
edgeMatrix[d] -= Geom::transposed_vectors_mult(e,e) ;
......
......@@ -135,7 +135,8 @@ typename V_ATT::DATA_TYPE vertexBorderNormal(typename PFP::MAP& map, Vertex v, c
for(std::vector<Dart>::iterator it = faces.begin() ; it != faces.end() ; ++it)
{
if(!f.isMarked(*it) && map.isBoundaryIncidentFace(*it))
// if(!f.isMarked(*it) && map.isBoundaryIncidentFace(*it))
if (!f.isMarked(*it) && (map.isBoundaryMarked<3>(map.phi3(*it))))
{
f.mark(*it);
VEC3 n = faceNormal<PFP>(map, *it, position);
......
......@@ -57,7 +57,8 @@ public :
virtual void setSeeds_fromVector (const std::vector<Dart>&);
virtual void setSeeds_random (unsigned int nbseeds);
const std::vector<Dart>& getBorder () { return border; }
void setCost (const EdgeAttribute<REAL,MAP>& c);
// void setCost (const EdgeAttribute<REAL,MAP>& c); // impossible to reaffect a ref TODO pointer ?
Dart computeDiagram ();
virtual void computeDiagram_incremental (unsigned int nbseeds);
......@@ -108,7 +109,7 @@ public :
// move each seed along one edge according to the energy gradient + check that the energy decreases
unsigned int moveSeedsToMedioid(); // returns the number of seeds that did move
// move each seed to the medioid of its region
REAL getGlobalEnergy() { return globalEnergy; }
REAL getGlobalEnergy() { return REAL(globalEnergy); }
protected :
void clear();
......
......@@ -50,7 +50,7 @@ template <typename PFP>
void VoronoiDiagram<PFP>::setSeeds_random (unsigned int nseeds)
{
seeds.clear();
srand ( time(NULL) );
srand ( (unsigned int)(time(NULL)) );
const unsigned int nbv = map.getNbCells(VERTEX);
std::set<unsigned int> myVertices ;
......@@ -101,11 +101,11 @@ void VoronoiDiagram<PFP>::initFrontWithSeeds ()
}
}
template <typename PFP>
void VoronoiDiagram<PFP>::setCost (const EdgeAttribute<typename PFP::REAL,typename PFP::MAP>& c)
{
edgeCost = c;
}
//template <typename PFP>
//void VoronoiDiagram<PFP>::setCost (const EdgeAttribute<typename PFP::REAL,typename PFP::MAP>& c)
//{
// edgeCost = c;
//}
template <typename PFP>
void VoronoiDiagram<PFP>::collectVertexFromFront(Dart e)
......@@ -416,13 +416,14 @@ typename PFP::REAL CentroidalVoronoiDiagram<PFP>::cumulateEnergyFromRoot(Dart e)
template <typename PFP>
void CentroidalVoronoiDiagram<PFP>::cumulateEnergyAndGradientFromSeed(unsigned int numSeed)
{
typedef typename PFP::REAL REAL;
// precondition : energyGrad.size() > numSeed
Dart e = this->seeds[numSeed];
std::vector<Dart> v;
v.reserve(8);