diff --git a/CMakeLists.txt b/CMakeLists.txt index 7019f16..faeeca6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ # top-level CMakeLists.txt # !! To be run from 'cmakeout' subdirectory !! -cmake_minimum_required (VERSION 2.4.0 FATAL_ERROR) +cmake_minimum_required (VERSION 3.1 FATAL_ERROR) set( VISILIB_LIB_NAME "visilib" ) set( VISILIB_DEMO_NAME "visilibDemo" ) @@ -59,7 +59,7 @@ if (GLUT_FOUND) include_directories(${GLUT_INCLUDE_DIRS}) link_directories(${GLUT_LIBRARY_DIRS}) add_definitions(${GLUT_DEFINITIONS}) - set (LIBS ${GLUT_LIBRARY}) + set (LIBS ${GLUT_LIBRARIES}) else() message(ERROR " GLUT not found!") endif() @@ -111,13 +111,17 @@ if(NOT WIN32) add_definitions(${OpenGL_DEFINITIONS}) - set(LIBS ${LIBS} ${OPENGL_LIBRARIES} m stdc++) + set(LIBS ${LIBS} ${OPENGL_LIBRARIES}) if(NOT OPENGL_FOUND) message(ERROR " OPENGL not found!") endif(NOT OPENGL_FOUND) endif(NOT WIN32) +set(CMAKE_CXX_STANDARD 11 CACHE STRING "The C++ standard to use") +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + ENABLE_TESTING() diff --git a/demo/demo_debug_visualisation_gl.cpp b/demo/demo_debug_visualisation_gl.cpp index 8fa33a2..84dc8e5 100644 --- a/demo/demo_debug_visualisation_gl.cpp +++ b/demo/demo_debug_visualisation_gl.cpp @@ -23,7 +23,14 @@ along with Visilib. If not, see #endif #ifdef USE_GLUT -#include "GL/gl.h" +#ifdef __APPLE__ +#define GL_SILENCE_DEPRECATION \ +#include +#include +#else +#include +#include +#endif #endif #include "demo_debug_visualisation_gl.h" #include diff --git a/demo/demo_main.cpp b/demo/demo_main.cpp index 3bd9021..e0a56d1 100644 --- a/demo/demo_main.cpp +++ b/demo/demo_main.cpp @@ -22,17 +22,23 @@ along with Visilib. If not, see #include #endif #ifdef USE_GLUT +#ifdef __APPLE__ +#define GL_SILENCE_DEPRECATION \ +#include +#include +#else #include #include #endif +#endif #include #include #include #define _USE_MATH_DEFINES #include -#include "xmmintrin.h" -#include "pmmintrin.h" +// #include "xmmintrin.h" +// #include "pmmintrin.h" #include "helper_triangle_mesh_container.h" #include "silhouette_container_embree.h" @@ -59,8 +65,8 @@ namespace visilibDemo bool init() { - _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); - _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); +// _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); +// _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); readConfig("config.txt"); forceDisplay = true; #ifdef USE_GLUT diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4177caf..bf75770 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -18,19 +18,30 @@ set(KIT visilibTest) -create_test_sourcelist(Tests ${KIT}CxxTests.cpp - src/test_math.cpp - ) +# ${KIT}CxxTests.cpp -include_directories( ../visilib/ ) +set(Tests + ./src/test_full.cpp + ./src/test_math.cpp + ./src/test_visibility.cpp + ../demo/demo_helper.cpp +) -add_executable(visilibTest src/test_math.cpp) -add_executable(visilibTest src/test_visibility.cpp) -add_executable(visilibTest src/test_full.cpp) +include_directories( ../visilib/ ) -add_executable(visilibTest ../demo/demo_helper.cpp) +add_executable(visilibTest ${Tests}) target_link_libraries(visilibTest ${LIBS}) #add_test(NAME stc_test_math COMMAND ${KIT}CxxTests stc_test_math}) add_test(NAME visilibTest COMMAND visilibTest) + +# remove the test driver source file +set (TestsToRun ${Tests}) +list ( REMOVE_ITEM TestsToRun src/test_full.cxx) + +# Add all the ADD_TEST for each test +foreach (test ${TestsToRun}) + get_filename_component (TName ${test} NAME_WE) + add_test (NAME ${TName} COMMAND test_full ${TName}) +endforeach () diff --git a/visilib/CMakeLists.txt b/visilib/CMakeLists.txt index ea64934..75454a8 100644 --- a/visilib/CMakeLists.txt +++ b/visilib/CMakeLists.txt @@ -90,7 +90,7 @@ source_group( external FILES ${ConvexHullSrc} ) source_group( include FILES ${Headers} ) source_group( src FILES ${Sources} ) -add_library( ${VISILIB_LIB_NAME} STATIC +add_library( ${VISILIB_LIB_NAME} INTERFACE ${GeometrySrc} ${GeometryHeader} ${HelperSrc} diff --git a/visilib/math_arithmetic.h b/visilib/math_arithmetic.h index 61fd165..0446ee8 100644 --- a/visilib/math_arithmetic.h +++ b/visilib/math_arithmetic.h @@ -45,7 +45,7 @@ namespace visilib } /** @brief Compute the axis aligned bounding box of a set of points.*/ - static void getMinMax(const std::vector>& aPoints, MathVector3_& aMin, MathVector3_& aMax); + static void getMinMax(const std::vector >& aPoints, MathVector3_& aMin, MathVector3_& aMax); /** @brief Compute the axis aligned bounding box of a set of points.*/ static void getMinMax(const S* aPoints, size_t pointCount, MathVector3_& aMin, MathVector3_& aMax); diff --git a/visilib/math_geometry.h b/visilib/math_geometry.h index 542c5f3..7bdda00 100644 --- a/visilib/math_geometry.h +++ b/visilib/math_geometry.h @@ -163,7 +163,7 @@ namespace visilib bool static isEdgeInsidePolytope(const MathVector3d& a, const MathVector3d& b, PluckerPolytope

* aPolytope, const MathVector3d& approximateNormal, PluckerPolyhedron

* polyhedron, S tolerance); template - static bool isBoxInsideConvexHull(const MathVector3_& AABBMin, const MathVector3_& AABBMax, const std::vector>& convexHullPlanes); + static bool isBoxInsideConvexHull(const MathVector3_& AABBMin, const MathVector3_& AABBMax, const std::vector >& convexHullPlanes); }; inline bool MathGeometry::isPointInsidePolygon(const GeometryConvexPolygon& aPolygon, const MathVector3d& aPoint, double tolerance) @@ -351,26 +351,26 @@ namespace visilib } template<> - inline bool MathGeometry::findPluckerEdgeWithQuadricIntersection, float>(const MathPlucker6 & v1, const MathPlucker6 & v2, GeometryPositionType p1, GeometryPositionType p2, std::vector> & result, float tolerance) + inline bool MathGeometry::findPluckerEdgeWithQuadricIntersection, float>(const MathPlucker6 & v1, const MathPlucker6 & v2, GeometryPositionType p1, GeometryPositionType p2, std::vector > & result, float tolerance) { return findPluckerEdgeWithQuadricIntersection, float>(v1, v2, p1, p2, result, true, tolerance); } template<> - inline bool MathGeometry::findPluckerEdgeWithQuadricIntersection, double>(const MathPlucker6 & v1, const MathPlucker6 & v2, GeometryPositionType p1, GeometryPositionType p2, std::vector> & result, double tolerance) + inline bool MathGeometry::findPluckerEdgeWithQuadricIntersection, double>(const MathPlucker6 & v1, const MathPlucker6 & v2, GeometryPositionType p1, GeometryPositionType p2, std::vector > & result, double tolerance) { return findPluckerEdgeWithQuadricIntersection, double>(v1, v2, p1, p2, result, true, tolerance); } template<> - inline bool MathGeometry::findPluckerEdgeWithQuadricIntersection, double>(const MathPlucker2 & v1, const MathPlucker2 & v2, GeometryPositionType p1, GeometryPositionType p2, std::vector> & result, double tolerance) + inline bool MathGeometry::findPluckerEdgeWithQuadricIntersection, double>(const MathPlucker2 & v1, const MathPlucker2 & v2, GeometryPositionType p1, GeometryPositionType p2, std::vector > & result, double tolerance) { return findPluckerEdgeWithQuadricIntersection, double>(v1, v2, p1, p2, result, true, tolerance); } #ifdef EXACT_ARITHMETIC template<> - inline bool MathGeometry::findPluckerEdgeWithQuadricIntersection, exact>(const MathPlucker6 & v1, const MathPlucker6 & v2, GeometryPositionType p1, GeometryPositionType p2, std::vector> & result, exact tolerance) + inline bool MathGeometry::findPluckerEdgeWithQuadricIntersection, exact>(const MathPlucker6 & v1, const MathPlucker6 & v2, GeometryPositionType p1, GeometryPositionType p2, std::vector > & result, exact tolerance) { return findPluckerEdgeWithQuadricIntersection, exact>(v1, v2, p1, p2, result, false, tolerance); } @@ -764,9 +764,9 @@ namespace visilib template inline bool MathGeometry::hitsTriangle(const GeometryRay & ray, const MathVector3_ & v0, const MathVector3_ & v1, const MathVector3_ & v2) { - MathVector3_ A = v0 - convert>(ray.getStart()); - MathVector3_ B = v1 - convert>(ray.getStart()); - MathVector3_ C = v2 - convert>(ray.getStart()); + MathVector3_ A = v0 - convert >(ray.getStart()); + MathVector3_ B = v1 - convert >(ray.getStart()); + MathVector3_ C = v2 - convert >(ray.getStart()); S Sx; S Sy; S Sz; int kx; int ky; int kz; @@ -1007,7 +1007,7 @@ namespace visilib } template - inline bool isBoxInsideConvexHull(const MathVector3_& AABBMin, const MathVector3_& AABBMax, const std::vector>& convexHullPlanes) + inline bool isBoxInsideConvexHull(const MathVector3_& AABBMin, const MathVector3_& AABBMax, const std::vector >& convexHullPlanes) { for (const auto& plane: convexHullPlanes) { diff --git a/visilib/math_plucker_6.h b/visilib/math_plucker_6.h index 1f1050e..e621a70 100644 --- a/visilib/math_plucker_6.h +++ b/visilib/math_plucker_6.h @@ -64,8 +64,8 @@ namespace visilib /**@brief Construct a plucker point from a 3D line defined by two points*/ MathPlucker6(const MathVector3d& aBegin, const MathVector3d& anEnd) { - MathVector3_ myBegin = convert>(aBegin); - MathVector3_ myEnd = convert>(anEnd); + MathVector3_ myBegin = convert >(aBegin); + MathVector3_ myEnd = convert >(anEnd); mDirection = myEnd - myBegin; mLocation = MathVector3_::cross(myBegin, myEnd); diff --git a/visilib/plucker_polyhedron.h b/visilib/plucker_polyhedron.h index d6fc7bc..c6b5ad7 100644 --- a/visilib/plucker_polyhedron.h +++ b/visilib/plucker_polyhedron.h @@ -133,7 +133,7 @@ namespace visilib std::vector

mLines; /** < @brief The list of Plucker points (Plucker vertices and hyperplanes). */ std::vector mQuadricRelativePositions; /** < @brief The relative position of the Plucker point relative to the Plucker quadric*/ std::vector mNormalizations; /** < @brief The normalization status of each Plucker point*/ - std::vector> mFacetsDescription; /** < @brief The facet description (list of all the hyperplanes intersecting at that point) of each Plucker point mLines*/ + std::vector > mFacetsDescription; /** < @brief The facet description (list of all the hyperplanes intersecting at that point) of each Plucker point mLines*/ }; template diff --git a/visilib/plucker_polytope.h b/visilib/plucker_polytope.h index e89809d..a5c421c 100644 --- a/visilib/plucker_polytope.h +++ b/visilib/plucker_polytope.h @@ -92,7 +92,7 @@ namespace visilib @return: a set containing all the edges joining the vertices i and j with an intersection with the Plucker Quadric */ - const std::set>& getEdgesIntersectingQuadric() + const std::set >& getEdgesIntersectingQuadric() { return mEdgesIntersectingQuadric; } @@ -143,7 +143,7 @@ namespace visilib @param aPlane1: first plane that will be intersected by each stabbing lines to define the first point of the extremal line in 3D @param aPlane2: second plane that will be intersected by each stabbing lines to define the second point of the extremal line in 3D */ - void getExtremalStabbingLinesBackTo3D(std::vector>& aStabbingLines, const MathPlane3d& aPlane1, const MathPlane3d& aPlane2); + void getExtremalStabbingLinesBackTo3D(std::vector >& aStabbingLines, const MathPlane3d& aPlane1, const MathPlane3d& aPlane2); /** @brief Add an extremal stabbing line to the polytope. @@ -193,13 +193,13 @@ namespace visilib private: - std::set> mEdges; /** < @brief The edges of the polytope, each edge is defined by the indices of the two vertices supporting it*/ - std::set> mEdgesProcessed; + std::set > mEdges; /** < @brief The edges of the polytope, each edge is defined by the indices of the two vertices supporting it*/ + std::set > mEdgesProcessed; std::vector

mExtremalStabbingLines; /** < @brief The ESL of the polytope, at the intersection of an edge and the Plucker Quadric*/ - std::set> mEdgesIntersectingQuadric; /** < @brief The edges containing an intersection with the Plucker Quadric.*/ + std::set > mEdgesIntersectingQuadric; /** < @brief The edges containing an intersection with the Plucker Quadric.*/ std::unordered_set mSilhouettes; /** < @brief The set of silhouettes associated to the polytope*/ std::unordered_set mVertices; /** < @brief The indices of the vertices of the polytope*/ - std::vector> mExtremalStabbingLinesFacets; + std::vector > mExtremalStabbingLinesFacets; double mRadius; P mRepresentativeLine; }; diff --git a/visilib/visibility_solver.h b/visilib/visibility_solver.h index 8b2e964..c751b0d 100644 --- a/visilib/visibility_solver.h +++ b/visilib/visibility_solver.h @@ -41,6 +41,8 @@ namespace visilib { } + virtual ~VisibilitySolver() = default; + virtual VisibilityResult resolve() = 0; void attachVisualisationDebugger(HelperVisualDebugger* aDebugger) { mDebugger = aDebugger; }