11 #include <Eigen/Geometry> 29 VectorType
v0 = VectorType::Random(),
30 ones = VectorType::Ones();
32 HVectorType hv0 = HVectorType::Random();
34 MatrixType m0 = MatrixType::Random();
36 HMatrixType hm0 = HMatrixType::Random();
46 hm0 << m0,
ones.transpose();
49 hm0.row(Size-1).setRandom();
50 for(
int j=0;
j<Size; ++
j)
51 m0.col(
j) = hm0.col(
j).head(Size) / hm0(Size,
j);
54 T1MatrixType t1 = T1MatrixType::Random();
56 VERIFY_IS_APPROX(t1 * (m0.colwise().homogeneous().eval()), t1 * m0.colwise().homogeneous());
58 T2MatrixType t2 = T2MatrixType::Random();
60 VERIFY_IS_APPROX(t2 * (m0.colwise().homogeneous().eval()), t2 * m0.colwise().homogeneous());
61 VERIFY_IS_APPROX(t2 * (v0.homogeneous().asDiagonal()), t2 * hv0.asDiagonal());
62 VERIFY_IS_APPROX((v0.homogeneous().asDiagonal()) * t2, hv0.asDiagonal() * t2);
65 v0.transpose().rowwise().homogeneous() * t2);
67 m0.transpose().rowwise().homogeneous() * t2);
69 T3MatrixType t3 = T3MatrixType::Random();
71 v0.transpose().rowwise().homogeneous() * t3);
73 m0.transpose().rowwise().homogeneous() * t3);
84 pts.
setRandom(Size,internal::random<int>(1,20));
86 pts1 = pts.colwise().homogeneous();
87 VERIFY_IS_APPROX(aff * pts.colwise().homogeneous(), (aff * pts1).colwise().hnormalized());
88 VERIFY_IS_APPROX(caff * pts.colwise().homogeneous(), (caff * pts1).colwise().hnormalized());
96 VERIFY_IS_APPROX((aff * pts2).colwise().hnormalized(), aff * pts2.colwise().hnormalized());
97 VERIFY_IS_APPROX((caff * pts2).colwise().hnormalized(), caff * pts2.colwise().hnormalized());
98 VERIFY_IS_APPROX((proj * pts2).colwise().hnormalized(), (proj * pts2.colwise().hnormalized().colwise().homogeneous()).colwise().hnormalized());
103 (t2.template topLeftCorner<Size,Size>() * v0 + t2.template topRightCorner<Size,1>())
104 / ((t2.template bottomLeftCorner<1,Size>()*
v0).
value() + t2(Size,Size)) );
106 VERIFY_IS_APPROX( (t2 * pts.colwise().homogeneous()).colwise().hnormalized(),
109 VERIFY_IS_APPROX( (t2 .lazyProduct( v0.homogeneous() )).hnormalized(), (t2 * v0.homogeneous()).hnormalized() );
110 VERIFY_IS_APPROX( (t2 .lazyProduct ( pts.colwise().homogeneous() )).colwise().hnormalized(), (t2 * pts1).colwise().hnormalized() );
112 VERIFY_IS_APPROX( (v0.transpose().homogeneous() .lazyProduct( t2 )).hnormalized(), (v0.transpose().homogeneous()*t2).hnormalized() );
113 VERIFY_IS_APPROX( (pts.transpose().rowwise().homogeneous() .lazyProduct( t2 )).rowwise().hnormalized(), (pts1.transpose()*t2).rowwise().hnormalized() );
121 CALL_SUBTEST_1(( homogeneous<float,1>() ));
122 CALL_SUBTEST_2(( homogeneous<double,3>() ));
123 CALL_SUBTEST_3(( homogeneous<double,8>() ));
#define VERIFY_IS_APPROX(a, b)
A triangularView< Lower >().adjoint().solveInPlace(B)
void test_geo_homogeneous()
internal::nested_eval< T, 1 >::type eval(const T &xpr)
The matrix class, also used for vectors and row-vectors.
Derived & setRandom(Index size)