00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef EIGEN_BLOCK2_H
00027 #define EIGEN_BLOCK2_H
00028
00045 template<typename Derived>
00046 inline Block<Derived> DenseBase<Derived>
00047 ::corner(CornerType type, Index cRows, Index cCols)
00048 {
00049 switch(type)
00050 {
00051 default:
00052 eigen_assert(false && "Bad corner type.");
00053 case TopLeft:
00054 return Block<Derived>(derived(), 0, 0, cRows, cCols);
00055 case TopRight:
00056 return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
00057 case BottomLeft:
00058 return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
00059 case BottomRight:
00060 return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00061 }
00062 }
00063
00065 template<typename Derived>
00066 inline const Block<Derived>
00067 DenseBase<Derived>::corner(CornerType type, Index cRows, Index cCols) const
00068 {
00069 switch(type)
00070 {
00071 default:
00072 eigen_assert(false && "Bad corner type.");
00073 case TopLeft:
00074 return Block<Derived>(derived(), 0, 0, cRows, cCols);
00075 case TopRight:
00076 return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
00077 case BottomLeft:
00078 return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
00079 case BottomRight:
00080 return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00081 }
00082 }
00083
00096 template<typename Derived>
00097 template<int CRows, int CCols>
00098 inline Block<Derived, CRows, CCols>
00099 DenseBase<Derived>::corner(CornerType type)
00100 {
00101 switch(type)
00102 {
00103 default:
00104 eigen_assert(false && "Bad corner type.");
00105 case TopLeft:
00106 return Block<Derived, CRows, CCols>(derived(), 0, 0);
00107 case TopRight:
00108 return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
00109 case BottomLeft:
00110 return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
00111 case BottomRight:
00112 return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
00113 }
00114 }
00115
00117 template<typename Derived>
00118 template<int CRows, int CCols>
00119 inline const Block<Derived, CRows, CCols>
00120 DenseBase<Derived>::corner(CornerType type) const
00121 {
00122 switch(type)
00123 {
00124 default:
00125 eigen_assert(false && "Bad corner type.");
00126 case TopLeft:
00127 return Block<Derived, CRows, CCols>(derived(), 0, 0);
00128 case TopRight:
00129 return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
00130 case BottomLeft:
00131 return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
00132 case BottomRight:
00133 return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
00134 }
00135 }
00136
00137 #endif // EIGEN_BLOCK2_H