// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2013 Alec Jacobson // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #ifndef IGL_COLON_H #define IGL_COLON_H #include "igl_inline.h" #include namespace igl { /// Colon operator like matlab's colon operator. Enumerates values between low /// and hi with step step. /// /// @tparam L should be a eigen matrix primitive type like int or double /// @tparam S should be a eigen matrix primitive type like int or double /// @tparam H should be a eigen matrix primitive type like int or double /// @tparam T should be a eigen matrix primitive type like int or double /// @param[in] low starting value if step is valid then this is *always* the first /// element of I /// @param[in] step step difference between sequential elements returned in I, /// remember this will be cast to template T at compile time. If lowhi then step must be negative. /// Otherwise I will be set to empty. /// @param[in] hi ending value, if (hi-low)%step is zero then this will be the last /// element in I. If step is positive there will be no elements greater /// than hi, vice versa if hi(0,n-1); /// template IGL_INLINE void colon( const L low, const S step, const H hi, Eigen::Matrix & I); /// Colon operator like matlab's colon operator. Enumerates values between low /// and hi with unit step. /// /// @tparam L should be a eigen matrix primitive type like int or double /// @tparam H should be a eigen matrix primitive type like int or double /// @tparam T should be a eigen matrix primitive type like int or double /// @param[in] low starting value if step is valid then this is *always* the first /// element of I /// @param[in] step step difference between sequential elements returned in I, /// remember this will be cast to template T at compile time. If lowhi then step must be negative. /// Otherwise I will be set to empty. /// @param[in] hi ending value, if (hi-low)%step is zero then this will be the last /// element in I. If step is positive there will be no elements greater /// than hi, vice versa if hi IGL_INLINE void colon( const L low, const H hi, Eigen::Matrix & I); /// @private /// /// Hiding this from doxygen because it's messing up the indentation. /// /// Colon operator like matlab's colon operator. Enumerates values between low /// and hi with unit step. /// /// @tparam T should be a eigen matrix primitive type like int or double /// @tparam L should be a eigen matrix primitive type like int or double /// @tparam H should be a eigen matrix primitive type like int or double /// @param[in] low starting value if step is valid then this is *always* the first /// element of I /// @param[in] step step difference between sequential elements returned in I, /// remember this will be cast to template T at compile time. If lowhi then step must be negative. /// Otherwise I will be set to empty. /// @param[in] hi ending value, if (hi-low)%step is zero then this will be the last /// element in I. If step is positive there will be no elements greater /// than hi, vice versa if hi IGL_INLINE Eigen::Matrix colon( const L low, const H hi); } #ifndef IGL_STATIC_LIBRARY # include "colon.cpp" #endif #endif