13 #include <gtest/gtest.h>    22 TEST(Geometry, Line2DIntersect)
    31         EXPECT_TRUE(do_inter);
    36         EXPECT_NEAR(i.x, 0.5, 1e-9);
    37         EXPECT_NEAR(i.y, 0.5, 1e-9);
    40 TEST(Geometry, Segment2DIntersect)
    50                 EXPECT_TRUE(do_inter);
    55                 EXPECT_NEAR(i.x, 0.5, 1e-9);
    56                 EXPECT_NEAR(i.y, 0.5, 1e-9);
    67                 EXPECT_FALSE(do_inter);
   102 TEST(Geometry, PolygonConvexContainsPoint)
   105         std::vector<TPoint2D> vs;
   112         std::reverse(vs.begin(),vs.end());
   117                 p.AddVertex(0, -0.322);
   118                 p.AddVertex(-0.644, -0.322);
   119                 p.AddVertex(-0.210377, -0.324673);
   120                 p.AddVertex(0.433623, -0.324673);
   122                 EXPECT_FALSE (
p.contains(
TPoint2D(0.73175, -0.325796)));
   126 TEST(Geometry, PolygonConcaveContainsPoint)
   129         std::vector<TPoint2D> vs;
   142         std::reverse(vs.begin(),vs.end());
 bool getPoint(TPoint2D &p) const
Gets the content as a point, returning false if the type is inadequate. 
 
void myTestPolygonContainsPoint(std::vector< TPoint2D > &vs, bool convex)
 
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL. 
 
unsigned char getType() const
Gets content type. 
 
const unsigned char GEOMETRIC_TYPE_POINT
Object type identifier for TPoint2D or TPoint3D. 
 
Standard type for storing any lightweight 2D type. 
 
A wrapper of a TPolygon2D class, implementing CSerializable. 
 
TEST(Geometry, Line2DIntersect)
 
This base provides a set of functions for maths stuff. 
 
2D segment, consisting of two points. 
 
const unsigned char GEOMETRIC_TYPE_SEGMENT
Object type identifier for TSegment2D or TSegment3D. 
 
bool isConvex() const
Checks whether is convex. 
 
bool contains(const TPoint2D &point) const
Check whether a point is inside (or within geometryEpsilon of a polygon edge). This works for concave...
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
bool BASE_IMPEXP intersect(const TSegment3D &s1, const TSegment3D &s2, TObject3D &obj)
Gets the intersection between two 3D segments. 
 
2D polygon, inheriting from std::vector<TPoint2D>. 
 
2D line without bounds, represented by its equation .