本文整理汇总了C++中Transform3D::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ Transform3D::reset方法的具体用法?C++ Transform3D::reset怎么用?C++ Transform3D::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform3D
的用法示例。
在下文中一共展示了Transform3D::reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unit_test_EstimateSimilarityTransformation3D
//.........这里部分代码省略.........
source_points1.push_back(source_point4);
target_points1.clear();
target_points1.push_back(target_point1);
target_points1.push_back(target_point2);
target_points1.push_back(target_point3);
target_points1.push_back(target_point4);
estimateSimilarityTransformation.setSourcePoints(source_points1);
estimateSimilarityTransformation.setTargetPoints(target_points1);
STOP_TEST
START_TEST
estimateSimilarityTransformation.compute();
STOP_TEST
SUBHEADING(getTransformationMatrix())
START_TEST
assert(estimateSimilarityTransformation.getTransformationMatrix().isApprox(transform.getTransformationMatrix()));
STOP_TEST
SUBHEADING(getRotationMatrix())
START_TEST
assert(estimateSimilarityTransformation.getRotationMatrix().isApprox(transform.getTransformationMatrix().block(0, 0, 3, 3)));
STOP_TEST
SUBHEADING(getTranslationVector())
START_TEST
assert(estimateSimilarityTransformation.getTranslationVector().isApprox(transform.getTransformationMatrix().block(0, 3, 3, 1)));
STOP_TEST
SUBHEADING(getRMS())
START_TEST
assert(estimateSimilarityTransformation.getRMS() < 1e-10);
STOP_TEST
SUBHEADING(getScalingFactor())
START_TEST
assert(isEqual(estimateSimilarityTransformation.getScalingFactor(), 2.0));
STOP_TEST
SUBHEADING(Handedness)
START_TEST
transform.reset().rotateZ(1.0).rotateY(2.0).scale(2, 2, 2).translate(1, 2, 3); // arbitrary rotation in 3D
// generate some test points
vector<Coordinate<double> > source_points;
source_points.push_back(Coordinate<double>( 1, 1, 0));
source_points.push_back(Coordinate<double>(-1, -1, 0));
source_points.push_back(Coordinate<double>( 2, 0, 0));
vector<Coordinate<double> > target_points;
target_points.push_back(transform * Coordinate<double>( 1, 1, 0));
target_points.push_back(transform * Coordinate<double>(-1, -1, 0));
target_points.push_back(transform * Coordinate<double>( 2, 0, 0) + Coordinate<double>(0, 0, 1e-15)); // leads to a left-handed coordinate system
// estimate the transformation
EstimateSimilarityTransformation estimator(source_points, target_points);
estimator.compute();
assert(estimator.getTransformationMatrix().determinant() > 0); // right-handed coordinate system?
// second test for right-handness (generate new points along the z-axis and ...)
Coordinate<double> s1 = Coordinate<double>( 2, 5, 1);
Coordinate<double> s2 = Coordinate<double>(-3, 2, 1);
Coordinate<double> t1 = transform * Coordinate<double>( 2, 5, 1);
Coordinate<double> t2 = transform * Coordinate<double>(-3, 2, 1);
Transform3D<double> transformator(estimator.getTransformationMatrix());
double residual = (transformator * s1 - t1).squaredNorm() + (transformator * s2 - t2).squaredNorm();
assert(residual < 1e-15);
STOP_TEST
}