00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef EIGEN_BLOCK2_H
00012 #define EIGEN_BLOCK2_H
00013
00014 namespace Eigen {
00015
00032 template<typename Derived>
00033 inline Block<Derived> DenseBase<Derived>
00034 ::corner(CornerType type, Index cRows, Index cCols)
00035 {
00036 switch(type)
00037 {
00038 default:
00039 eigen_assert(false && "Bad corner type.");
00040 case TopLeft:
00041 return Block<Derived>(derived(), 0, 0, cRows, cCols);
00042 case TopRight:
00043 return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
00044 case BottomLeft:
00045 return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
00046 case BottomRight:
00047 return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00048 }
00049 }
00050
00052 template<typename Derived>
00053 inline const Block<Derived>
00054 DenseBase<Derived>::corner(CornerType type, Index cRows, Index cCols) const
00055 {
00056 switch(type)
00057 {
00058 default:
00059 eigen_assert(false && "Bad corner type.");
00060 case TopLeft:
00061 return Block<Derived>(derived(), 0, 0, cRows, cCols);
00062 case TopRight:
00063 return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
00064 case BottomLeft:
00065 return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
00066 case BottomRight:
00067 return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00068 }
00069 }
00070
00083 template<typename Derived>
00084 template<int CRows, int CCols>
00085 inline Block<Derived, CRows, CCols>
00086 DenseBase<Derived>::corner(CornerType type)
00087 {
00088 switch(type)
00089 {
00090 default:
00091 eigen_assert(false && "Bad corner type.");
00092 case TopLeft:
00093 return Block<Derived, CRows, CCols>(derived(), 0, 0);
00094 case TopRight:
00095 return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
00096 case BottomLeft:
00097 return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
00098 case BottomRight:
00099 return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
00100 }
00101 }
00102
00104 template<typename Derived>
00105 template<int CRows, int CCols>
00106 inline const Block<Derived, CRows, CCols>
00107 DenseBase<Derived>::corner(CornerType type) const
00108 {
00109 switch(type)
00110 {
00111 default:
00112 eigen_assert(false && "Bad corner type.");
00113 case TopLeft:
00114 return Block<Derived, CRows, CCols>(derived(), 0, 0);
00115 case TopRight:
00116 return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
00117 case BottomLeft:
00118 return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
00119 case BottomRight:
00120 return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
00121 }
00122 }
00123
00124 }
00125
00126 #endif // EIGEN_BLOCK2_H