MRPT  2.0.4
Classes | Functions | Variables
geometry.cpp File Reference
#include "math-precomp.h"
#include <mrpt/math/CMatrixDynamic.h>
#include <mrpt/math/CMatrixFixed.h>
#include <mrpt/math/CPolygon.h>
#include <mrpt/math/CSparseMatrixTemplate.h>
#include <mrpt/math/CVectorFixed.h>
#include <mrpt/math/TLine2D.h>
#include <mrpt/math/TLine3D.h>
#include <mrpt/math/TObject2D.h>
#include <mrpt/math/TObject3D.h>
#include <mrpt/math/TPose2D.h>
#include <mrpt/math/TPose3D.h>
#include <mrpt/math/data_utils.h>
#include <mrpt/math/geometry.h>
#include <mrpt/math/ops_containers.h>
#include <Eigen/Dense>
Include dependency graph for geometry.cpp:

Go to the source code of this file.

Classes

struct  T2ListsOfSegments
 
struct  TCommonRegion
 
struct  TTempIntersection
 
struct  TSegmentWithLine
 
struct  MatchingVertex
 
class  FCreatePolygon
 
class  FUnprojectPolygon2D
 

Functions

template<class T2D , class U2D , class T3D , class U3D >
bool intersectInCommonPlane (const T3D &o1, const U3D &o2, const mrpt::math::TPlane &p, mrpt::math::TObject3D &obj)
 
bool intersectInCommonLine (const mrpt::math::TSegment3D &s1, const mrpt::math::TSegment3D &s2, const mrpt::math::TLine3D &lin, mrpt::math::TObject3D &obj)
 
bool intersectInCommonLine (const TSegment2D &s1, const TSegment2D &s2, const TLine2D &lin, TObject2D &obj)
 
void unsafeProjectPoint (const TPoint3D &point, const TPose3D &pose, TPoint2D &newPoint)
 
bool intersect (const TPolygonWithPlane &p1, const TLine3D &l2, double &d, double bestKnown)
 
bool intersect (const TPolygonWithPlane &p1, const TPolygonWithPlane &p2, TObject3D &obj)
 
void createFromPoseAndAxis (const TPose3D &p, TLine3D &r, size_t axis)
 
bool intersect (const TSegmentWithLine &s1, const TSegmentWithLine &s2, TObject2D &obj)
 
void getSegmentsWithLine (const TPolygon2D &poly, vector< TSegmentWithLine > &segs)
 
char fromObject (const TObject2D &obj)
 
bool intersectAux (const TPolygon3D &p1, const TPlane &pl1, const TPolygon3D &p2, const TPlane &pl2, TObject3D &obj)
 
bool compatibleBounds (const TPoint3D &min1, const TPoint3D &max1, const TPoint3D &min2, const TPoint3D &max2)
 
void getPlanes (const std::vector< TPolygon3D > &polys, std::vector< TPlane > &planes)
 
void getMinAndMaxBounds (const std::vector< TPolygon3D > &v1, std::vector< TPoint3D > &minP, std::vector< TPoint3D > &maxP)
 
void createPlaneFromPoseAndAxis (const TPose3D &pose, TPlane &plane, size_t axis)
 
template<class T >
size_t getIndexOfMin (const T &e1, const T &e2, const T &e3)
 
bool firstOrNonPresent (size_t i, const std::vector< MatchingVertex > &v)
 
bool depthFirstSearch (const CSparseMatrixTemplate< unsigned char > &mat, std::vector< std::vector< MatchingVertex >> &res, std::vector< bool > &used, size_t searching, unsigned char mask, std::vector< MatchingVertex > &current)
 
void depthFirstSearch (const CSparseMatrixTemplate< unsigned char > &mat, std::vector< std::vector< MatchingVertex >> &res, std::vector< bool > &used)
 
bool intersect (const TLine2D &l1, const TSegmentWithLine &s2, TObject2D &obj)
 
bool intersect (const TSegmentWithLine &s1, const TLine2D &l2, TObject2D &obj)
 

Variables

static double geometryEpsilon = 1e-5
 

Function Documentation

◆ compatibleBounds()

bool compatibleBounds ( const TPoint3D min1,
const TPoint3D max1,
const TPoint3D min2,
const TPoint3D max2 
)

Definition at line 1529 of file geometry.cpp.

Referenced by mrpt::math::intersect().

Here is the caller graph for this function:

◆ createFromPoseAndAxis()

void createFromPoseAndAxis ( const TPose3D p,
TLine3D r,
size_t  axis 
)

Definition at line 905 of file geometry.cpp.

References mrpt::math::TLine3D::director, mrpt::math::TPose3D::getHomogeneousMatrix(), and mrpt::math::TLine3D::pBase.

Referenced by mrpt::math::createFromPoseX(), mrpt::math::createFromPoseY(), and mrpt::math::createFromPoseZ().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createPlaneFromPoseAndAxis()

void createPlaneFromPoseAndAxis ( const TPose3D pose,
TPlane plane,
size_t  axis 
)

Definition at line 1952 of file geometry.cpp.

References mrpt::math::TPlane::coefs, and mrpt::math::TPose3D::getHomogeneousMatrix().

Referenced by mrpt::math::createPlaneFromPoseXY(), mrpt::math::createPlaneFromPoseXZ(), and mrpt::math::createPlaneFromPoseYZ().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ depthFirstSearch() [1/2]

bool depthFirstSearch ( const CSparseMatrixTemplate< unsigned char > &  mat,
std::vector< std::vector< MatchingVertex >> &  res,
std::vector< bool > &  used,
size_t  searching,
unsigned char  mask,
std::vector< MatchingVertex > &  current 
)

Definition at line 2131 of file geometry.cpp.

References mrpt::math::CSparseMatrixTemplate< T >::cols(), firstOrNonPresent(), and mrpt::math::CSparseMatrixTemplate< T >::isNotNull().

Referenced by mrpt::math::assemblePolygons(), and depthFirstSearch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ depthFirstSearch() [2/2]

void depthFirstSearch ( const CSparseMatrixTemplate< unsigned char > &  mat,
std::vector< std::vector< MatchingVertex >> &  res,
std::vector< bool > &  used 
)

Definition at line 2175 of file geometry.cpp.

References depthFirstSearch().

Here is the call graph for this function:

◆ firstOrNonPresent()

bool firstOrNonPresent ( size_t  i,
const std::vector< MatchingVertex > &  v 
)
inline

Definition at line 2124 of file geometry.cpp.

Referenced by depthFirstSearch().

Here is the caller graph for this function:

◆ fromObject()

char fromObject ( const TObject2D obj)
inline

Definition at line 1364 of file geometry.cpp.

References mrpt::math::GEOMETRIC_TYPE_LINE, mrpt::math::GEOMETRIC_TYPE_POINT, mrpt::math::GEOMETRIC_TYPE_POLYGON, mrpt::math::GEOMETRIC_TYPE_SEGMENT, and mrpt::math::TObject2D::getType().

Referenced by mrpt::math::intersect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIndexOfMin()

template<class T >
size_t getIndexOfMin ( const T &  e1,
const T &  e2,
const T &  e3 
)
inline

Definition at line 2040 of file geometry.cpp.

◆ getMinAndMaxBounds()

void getMinAndMaxBounds ( const std::vector< TPolygon3D > &  v1,
std::vector< TPoint3D > &  minP,
std::vector< TPoint3D > &  maxP 
)

Definition at line 1561 of file geometry.cpp.

References mrpt::math::getPrismBounds().

Referenced by mrpt::math::intersect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPlanes()

void getPlanes ( const std::vector< TPolygon3D > &  polys,
std::vector< TPlane > &  planes 
)
inline

Definition at line 1552 of file geometry.cpp.

References mrpt::math::getRegressionPlane().

Referenced by mrpt::math::intersect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSegmentsWithLine()

void getSegmentsWithLine ( const TPolygon2D poly,
vector< TSegmentWithLine > &  segs 
)

Definition at line 1355 of file geometry.cpp.

Referenced by mrpt::math::intersect().

Here is the caller graph for this function:

◆ intersect() [1/5]

bool intersect ( const TPolygonWithPlane p1,
const TLine3D l2,
double &  d,
double  bestKnown 
)

Definition at line 539 of file geometry.cpp.

References mrpt::math::TPolygon2D::contains(), mrpt::math::TLine3D::director, geometryEpsilon, mrpt::math::TObject3D::getPoint(), mrpt::math::TPolygonWithPlane::inversePose, mrpt::math::TLine3D::pBase, mrpt::math::TPolygonWithPlane::plane, mrpt::math::TPolygonWithPlane::poly, unsafeProjectPoint(), and mrpt::math::internal::unsafeProjectPolygon().

Referenced by mrpt::math::getAngleBisector(), mrpt::math::intersect(), intersect(), intersectAux(), intersectInCommonPlane(), mrpt::math::splitInConvexComponents(), and mrpt::math::traceRay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intersect() [2/5]

bool intersect ( const TPolygonWithPlane p1,
const TPolygonWithPlane p2,
TObject3D obj 
)

◆ intersect() [3/5]

bool intersect ( const TSegmentWithLine s1,
const TSegmentWithLine s2,
TObject2D obj 
)

Definition at line 1345 of file geometry.cpp.

References mrpt::math::TSegment2D::contains(), mrpt::math::TObject2D::getPoint(), intersect(), intersectInCommonLine(), mrpt::math::TObject2D::isLine(), TSegmentWithLine::line, and TSegmentWithLine::segment.

Here is the call graph for this function:

◆ intersect() [4/5]

bool intersect ( const TLine2D l1,
const TSegmentWithLine s2,
TObject2D obj 
)

Definition at line 2265 of file geometry.cpp.

References mrpt::math::TSegment2D::contains(), mrpt::math::TObject2D::getPoint(), intersect(), mrpt::math::TObject2D::isLine(), TSegmentWithLine::line, and TSegmentWithLine::segment.

Here is the call graph for this function:

◆ intersect() [5/5]

bool intersect ( const TSegmentWithLine s1,
const TLine2D l2,
TObject2D obj 
)
inline

Definition at line 2285 of file geometry.cpp.

References intersect().

Here is the call graph for this function:

◆ intersectAux()

bool intersectAux ( const TPolygon3D p1,
const TPlane pl1,
const TPolygon3D p2,
const TPlane pl2,
TObject3D obj 
)

Definition at line 1498 of file geometry.cpp.

References mrpt::math::TObject3D::getLine(), mrpt::math::TObject3D::getPoint(), mrpt::math::TObject3D::getSegment(), intersect(), intersectInCommonLine(), and mrpt::math::TObject3D::isPlane().

Referenced by mrpt::math::intersect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intersectInCommonLine() [1/2]

bool intersectInCommonLine ( const mrpt::math::TSegment3D s1,
const mrpt::math::TSegment3D s2,
const mrpt::math::TLine3D lin,
mrpt::math::TObject3D obj 
)

Definition at line 476 of file geometry.cpp.

References mrpt::math::TLine3D::director, and geometryEpsilon.

Referenced by mrpt::math::intersect(), intersect(), and intersectAux().

Here is the caller graph for this function:

◆ intersectInCommonLine() [2/2]

bool intersectInCommonLine ( const TSegment2D s1,
const TSegment2D s2,
const TLine2D lin,
TObject2D obj 
)

Definition at line 500 of file geometry.cpp.

References mrpt::math::TLine2D::coefs, and geometryEpsilon.

◆ intersectInCommonPlane()

template<class T2D , class U2D , class T3D , class U3D >
bool intersectInCommonPlane ( const T3D &  o1,
const U3D &  o2,
const mrpt::math::TPlane p,
mrpt::math::TObject3D obj 
)

Definition at line 447 of file geometry.cpp.

References mrpt::math::TObject2D::generate3DObject(), mrpt::math::TPlane::getAsPose3D(), intersect(), and mrpt::math::project3D().

Here is the call graph for this function:

◆ unsafeProjectPoint()

void unsafeProjectPoint ( const TPoint3D point,
const TPose3D pose,
TPoint2D newPoint 
)
inline

Definition at line 523 of file geometry.cpp.

References mrpt::math::TPose3D::composePoint(), mrpt::math::TPoint2D_data< T >::x, mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint2D_data< T >::y, and mrpt::math::TPoint3D_data< T >::y.

Referenced by intersect(), and mrpt::math::internal::unsafeProjectPolygon().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ geometryEpsilon

double geometryEpsilon = 1e-5
static



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020