13 #include <gtest/gtest.h> 15 #include "../../include/ecl/geometry/linear_segment.hpp" 25 TEST(LinearSegment,construction) {
27 EXPECT_EQ(0.0, horizontal_segment.
A());
28 EXPECT_EQ(1.0, horizontal_segment.
B());
29 EXPECT_EQ(-1.0, horizontal_segment.
C());
31 EXPECT_EQ(1.0, vertical_segment.A());
32 EXPECT_EQ(0.0, vertical_segment.B());
33 EXPECT_EQ(2.0, vertical_segment.C());
35 EXPECT_EQ(-1.0, segment.A());
36 EXPECT_EQ(1.0, segment.B());
37 EXPECT_EQ(-1.0, segment.C());
49 EXPECT_EQ(1.0, vertical_segment.squaredDistanceFromPoint(2.0, 0.0));
50 EXPECT_EQ(1.0, vertical_segment.squaredDistanceFromPoint(1.0, 1.0));
51 EXPECT_EQ(1.0, vertical_segment.squaredDistanceFromPoint(3.0, 1.0));
52 EXPECT_EQ(1.0, vertical_segment.squaredDistanceFromPoint(1.0, 2.0));
54 EXPECT_EQ(1.0, segment.squaredDistanceFromPoint(1.0, 3.0));
55 EXPECT_EQ(0.0, segment.squaredDistanceFromPoint(0.5, 1.5));
67 int main(
int argc,
char **argv) {
69 testing::InitGoogleTest(&argc,argv);
70 return RUN_ALL_TESTS();
ecl::Parameter< double > A
int main(int argc, char **argv)
ecl::Parameter< double > C
double squaredDistanceFromPoint(const double &x, const double &y) const
Distance of a point from the segment.
ecl::Parameter< double > B
TEST(LinearSegment, construction)
ecl_geometry_PUBLIC double distance(const Pose2D &pose, const Trajectory2D &trajectory)
Shortest distance between a pose and a trajectory.