libigl v2.5.0
Loading...
Searching...
No Matches
LinSpaced.h
Go to the documentation of this file.
1#ifndef IGL_LINSPACED_H
2#define IGL_LINSPACED_H
3#include <Eigen/Core>
31namespace igl
32{
40 template <typename Derived>
41 //inline typename Eigen::DenseBase< Derived >::RandomAccessLinSpacedReturnType
42 inline Derived LinSpaced(
43 typename Derived::Index size,
44 const typename Derived::Scalar & low,
45 const typename Derived::Scalar & high);
46}
47
48// Implementation
49
50template <typename Derived>
51//inline typename Eigen::DenseBase< Derived >::RandomAccessLinSpacedReturnType
52inline Derived
54 typename Derived::Index size,
55 const typename Derived::Scalar & low,
56 const typename Derived::Scalar & high)
57{
58 if(size == 0)
59 {
60 // Force empty vector with correct "RandomAccessLinSpacedReturnType" type.
61 return Derived::LinSpaced(0,0,1);
62 }else if(high < low)
63 {
64 return low-Derived::LinSpaced(size,low-low,low-high).array();
65 }else{
66 return Derived::LinSpaced(size,low,high);
67 }
68}
69
70#endif
Definition AABB.h:17
Derived LinSpaced(typename Derived::Index size, const typename Derived::Scalar &low, const typename Derived::Scalar &high)
Replacement for Eigen::DenseBase::LinSpaced.
Definition LinSpaced.h:53