mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-18 14:34:17 +08:00
Add examples for hnormalized and homogenous (fix bug #846)
This commit is contained in:
parent
eb39296028
commit
305aa1f9c5
@ -120,7 +120,7 @@ template<typename MatrixType,int _Direction> class Homogeneous
|
||||
* Example: \include MatrixBase_homogeneous.cpp
|
||||
* Output: \verbinclude MatrixBase_homogeneous.out
|
||||
*
|
||||
* \sa class Homogeneous
|
||||
* \sa VectorwiseOp::homogeneous(), class Homogeneous
|
||||
*/
|
||||
template<typename Derived>
|
||||
inline typename MatrixBase<Derived>::HomogeneousReturnType
|
||||
@ -137,7 +137,7 @@ MatrixBase<Derived>::homogeneous() const
|
||||
* Example: \include VectorwiseOp_homogeneous.cpp
|
||||
* Output: \verbinclude VectorwiseOp_homogeneous.out
|
||||
*
|
||||
* \sa MatrixBase::homogeneous() */
|
||||
* \sa MatrixBase::homogeneous(), class Homogeneous */
|
||||
template<typename ExpressionType, int Direction>
|
||||
inline Homogeneous<ExpressionType,Direction>
|
||||
VectorwiseOp<ExpressionType,Direction>::homogeneous() const
|
||||
|
7
doc/snippets/DirectionWise_hnormalized.cpp
Normal file
7
doc/snippets/DirectionWise_hnormalized.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
typedef Matrix<double,4,Dynamic> Matrix4Xd;
|
||||
Matrix4Xd M = Matrix4Xd::Random(4,5);
|
||||
Projective3d P(Matrix4d::Random());
|
||||
cout << "The matrix M is:" << endl << M << endl << endl;
|
||||
cout << "M.colwise().hnormalized():" << endl << M.colwise().hnormalized() << endl << endl;
|
||||
cout << "P*M:" << endl << P*M << endl << endl;
|
||||
cout << "(P*M).colwise().hnormalized():" << endl << (P*M).colwise().hnormalized() << endl << endl;
|
6
doc/snippets/MatrixBase_hnormalized.cpp
Normal file
6
doc/snippets/MatrixBase_hnormalized.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
Vector4d v = Vector4d::Random();
|
||||
Projective3d P(Matrix4d::Random());
|
||||
cout << "v = " << v.transpose() << "]^T" << endl;
|
||||
cout << "v.hnormalized() = " << v.hnormalized().transpose() << "]^T" << endl;
|
||||
cout << "P*v = " << (P*v).transpose() << "]^T" << endl;
|
||||
cout << "(P*v).hnormalized() = " << (P*v).hnormalized().transpose() << "]^T" << endl;
|
6
doc/snippets/MatrixBase_homogeneous.cpp
Normal file
6
doc/snippets/MatrixBase_homogeneous.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
Vector3d v = Vector3d::Random(), w;
|
||||
Projective3d P(Matrix4d::Random());
|
||||
cout << "v = [" << v.transpose() << "]^T" << endl;
|
||||
cout << "h.homogeneous() = [" << v.homogeneous().transpose() << "]^T" << endl;
|
||||
cout << "(P * v.homogeneous()) = [" << (P * v.homogeneous()).transpose() << "]^T" << endl;
|
||||
cout << "(P * v.homogeneous()).hnormalized() = [" << (P * v.homogeneous()).eval().hnormalized().transpose() << "]^T" << endl;
|
7
doc/snippets/VectorwiseOp_homogeneous.cpp
Normal file
7
doc/snippets/VectorwiseOp_homogeneous.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
typedef Matrix<double,3,Dynamic> Matrix3Xd;
|
||||
Matrix3Xd M = Matrix3Xd::Random(3,5);
|
||||
Projective3d P(Matrix4d::Random());
|
||||
cout << "The matrix M is:" << endl << M << endl << endl;
|
||||
cout << "M.colwise().homogeneous():" << endl << M.colwise().homogeneous() << endl << endl;
|
||||
cout << "P * M.colwise().homogeneous():" << endl << P * M.colwise().homogeneous() << endl << endl;
|
||||
cout << "P * M.colwise().homogeneous().hnormalized(): " << endl << (P * M.colwise().homogeneous()).colwise().hnormalized() << endl << endl;
|
Loading…
Reference in New Issue
Block a user