adds tests for OrientedPlane3 derivatives
parent
a8288746b4
commit
376683b808
|
@ -34,19 +34,34 @@ GTSAM_CONCEPT_MANIFOLD_INST(OrientedPlane3)
|
||||||
//*******************************************************************************
|
//*******************************************************************************
|
||||||
TEST(OrientedPlane3, getMethods) {
|
TEST(OrientedPlane3, getMethods) {
|
||||||
Vector4 c;
|
Vector4 c;
|
||||||
|
Matrix23 H_normal, expected_H_normal;
|
||||||
|
Matrix13 H_distance, expected_H_distance;
|
||||||
|
|
||||||
c << -1, 0, 0, 5;
|
c << -1, 0, 0, 5;
|
||||||
|
expected_H_normal << 1,0,0,
|
||||||
|
0,1,0;
|
||||||
|
expected_H_distance << 0,0,1;
|
||||||
|
|
||||||
OrientedPlane3 plane1(c);
|
OrientedPlane3 plane1(c);
|
||||||
OrientedPlane3 plane2(c[0], c[1], c[2], c[3]);
|
OrientedPlane3 plane2(c[0], c[1], c[2], c[3]);
|
||||||
|
|
||||||
Vector4 coefficient1 = plane1.planeCoefficients();
|
Vector4 coefficient1 = plane1.planeCoefficients();
|
||||||
double distance1 = plane1.distance();
|
double distance1 = plane1.distance(H_distance);
|
||||||
|
Unit3 normal1 = plane1.normal(H_normal);
|
||||||
|
EXPECT(assert_equal(expected_H_normal, H_normal, 1e-5));
|
||||||
|
EXPECT(assert_equal(expected_H_distance, H_distance, 1e-5));
|
||||||
EXPECT(assert_equal(coefficient1, c, 1e-8));
|
EXPECT(assert_equal(coefficient1, c, 1e-8));
|
||||||
EXPECT(assert_equal(Unit3(-1,0,0).unitVector(), plane1.normal().unitVector()));
|
EXPECT(assert_equal(Unit3(-1,0,0).unitVector(), normal1.unitVector()));
|
||||||
EXPECT_DOUBLES_EQUAL(distance1, 5, 1e-8);
|
EXPECT_DOUBLES_EQUAL(distance1, 5, 1e-8);
|
||||||
|
|
||||||
Vector4 coefficient2 = plane2.planeCoefficients();
|
Vector4 coefficient2 = plane2.planeCoefficients();
|
||||||
double distance2 = plane2.distance();
|
double distance2 = plane2.distance(H_distance);
|
||||||
|
Unit3 normal2 = plane2.normal(H_normal);
|
||||||
EXPECT(assert_equal(coefficient2, c, 1e-8));
|
EXPECT(assert_equal(coefficient2, c, 1e-8));
|
||||||
|
EXPECT(assert_equal(expected_H_normal, H_normal, 1e-5));
|
||||||
|
EXPECT(assert_equal(expected_H_distance, H_distance, 1e-5));
|
||||||
EXPECT_DOUBLES_EQUAL(distance2, 5, 1e-8);
|
EXPECT_DOUBLES_EQUAL(distance2, 5, 1e-8);
|
||||||
EXPECT(assert_equal(Unit3(-1,0,0).unitVector(), plane2.normal().unitVector()));
|
EXPECT(assert_equal(Unit3(-1,0,0).unitVector(), normal2.unitVector()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,7 @@ inline Point2_ transformTo(const Pose2_& x, const Point2_& p) {
|
||||||
return Point2_(x, &Pose2::transformTo, p);
|
return Point2_(x, &Pose2::transformTo, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Double_ range(const Point2_& p, const Point2_& q)
|
inline Double_ range(const Point2_& p, const Point2_& q) {
|
||||||
{
|
|
||||||
return Double_(Range<Point2, Point2>(), p, q);
|
return Double_(Range<Point2, Point2>(), p, q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue