1 #include <gtest/gtest.h> 13 TEST(testPoint, constructDestroy) {
16 p =
Point3d(-1, 1, 2, 3, {{
"key",
"value"}});
17 EXPECT_EQ(-1, p.
id());
24 EXPECT_EQ(-1, p2.id());
32 Point3d p(-1, 1, 2, 3, {{
"key",
"value"}});
39 EXPECT_EQ(3, p2d.y());
40 EXPECT_EQ(3, cp2d.y());
41 EXPECT_EQ(3, cp3d.y());
45 EXPECT_EQ(3, bp2.y());
46 EXPECT_EQ(3, bp3.y());
49 EXPECT_EQ(3, newCp3d.z());
52 EXPECT_TRUE(!
isTwod(newCp3d.basicPoint()));
53 EXPECT_FALSE(
isTwod(
p.basicPoint()));
56 TEST(testPoint2d, twoDthreeD) {
60 EXPECT_EQ(1, cp2d.basicPoint2d().x());
61 EXPECT_EQ(2, cp2d.basicPoint2d().y());
63 EXPECT_EQ(3, cp2d.basicPoint2d().x());
66 TEST(testPoint3d, assign) {
72 TEST(testPoint2d, assign) {
81 Point3d p1(-1, 1, 2, 3, {{
"key",
"value"}});
82 Point3d p2(-1, 0, 2, 2, {{
"key",
"value"}});
88 TEST(testPoint2d, stream) {
89 Point2d p1(-1, 1, 2, 3, {{
"key",
"value"}});
90 std::string expect2d =
"[id: -1 x: 1 y: 2]";
94 EXPECT_EQ(expect2d, ss.str());
97 ss << ConstPoint2d(
p1);
98 EXPECT_EQ(expect2d, ss.str());
102 Point3d p1(-1, 1, 2, 3, {{
"key",
"value"}});
103 std::string expect3d =
"[id: -1 x: 1 y: 2 z: 3]";
104 std::stringstream ss;
106 EXPECT_EQ(expect3d, ss.str());
110 EXPECT_EQ(expect3d, ss.str());
Id id() const noexcept
get the unique id of this primitive
double & y() noexcept
gets a mutable reference to the y coordinate
auto basicPoint() noexcept
get a mutable reference to the 2d point data
double & z() noexcept
gets a mutable reference to the z coordinate
Eigen::Vector3d BasicPoint3d
a simple 3d-point
const std::string & value() const
gets the value of this attribute
const Attribute & attribute(const std::string &name) const
retrieve an attribute
double & x() noexcept
gets a mutable reference to the x coordinate
SharedPtrs in lanelet2 must never point to null. If this is violated, this exception is thrown (usual...
double & x() noexcept
gets a mutable reference to the x coordinate
Optional< double > distance
BasicPoint & basicPoint() noexcept
Get a mutable reference to the internal 3d point.
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > BasicPoint2d
a simple 2d-point
TEST(testPoint, constructDestroy)
BoundingBox2d to2D(const BoundingBox3d &primitive)
constexpr bool isTwod(const BasicPoint2d &)