00001 // ======================================================================================== 00002 // ApproxMVBB 00003 // Copyright (C) 2014 by Gabriel Nützi <nuetzig (at) imes (d0t) mavt (d0t) ethz (døt) ch> 00004 // 00005 // This Source Code Form is subject to the terms of the Mozilla Public 00006 // License, v. 2.0. If a copy of the MPL was not distributed with this 00007 // file, You can obtain one at http://mozilla.org/MPL/2.0/. 00008 // ======================================================================================== 00009 00010 #ifndef ApproxMVBB_ConvexHull2D_hpp 00011 #define ApproxMVBB_ConvexHull2D_hpp 00012 00013 #include <vector> 00014 00015 #include "ApproxMVBB/Config/Config.hpp" 00016 00017 #include ApproxMVBB_TypeDefs_INCLUDE_FILE 00018 #include "ApproxMVBB/TypeDefsPoints.hpp" 00019 #include ApproxMVBB_AssertionDebug_INCLUDE_FILE 00020 00021 #include "ApproxMVBB/PointFunctions.hpp" 00022 #include "ApproxMVBB/ContainerFunctions.hpp" 00023 00024 namespace ApproxMVBB{ 00029 class APPROXMVBB_EXPORT ConvexHull2D { 00030 public: 00031 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00032 ApproxMVBB_DEFINE_MATRIX_TYPES 00033 ApproxMVBB_DEFINE_POINTS_CONFIG_TYPES 00034 00038 template<typename Derived> 00039 ConvexHull2D(const MatrixBase<Derived> & points) :m_p(points) { 00040 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived,2, Eigen::Dynamic) 00041 ApproxMVBB_ASSERTMSG( m_p.data() == points.derived().data() ," You store a temporary in a Ref<> which works here, but do you really want this?") 00042 } 00043 00044 void compute(); 00045 00046 void computeMonotonChain(); 00047 00048 00049 bool verifyHull(); 00050 00051 inline std::vector<unsigned int> & getIndices() { 00052 return m_indicesCH; 00053 } 00054 00055 00056 00057 private: 00058 00059 void chainHull(); 00060 00061 std::vector<unsigned int> m_indicesCH; 00062 const MatrixRef< const Matrix2Dyn > m_p; 00063 }; 00064 } 00065 #endif