#ifndef IGL_COLON_H #define IGL_COLON_H #include "igl_inline.h" #include namespace igl { // Note: // This should be potentially replaced with eigen's LinSpaced() function // Colon operator like matlab's colon operator. Enumerats values between low // and hi with step step. // Templates: // L should be a eigen matrix primitive type like int or double // S should be a eigen matrix primitive type like int or double // H should be a eigen matrix primitive type like int or double // T should be a eigen matrix primitive type like int or double // Inputs: // low starting value if step is valid then this is *always* the first // element of I // 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. // 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 S step, const H hi, Eigen::Matrix & I); // Same as above but step == (T)1 template IGL_INLINE void colon( const L low, const H hi, Eigen::Matrix & I); // Return output rather than set in reference template IGL_INLINE Eigen::Matrix colon( const L low, const H hi); } #ifdef IGL_HEADER_ONLY # include "colon.cpp" #endif #endif