All Classes Namespaces Files Functions Variables Typedefs Macros Pages
roboptim::capsule Namespace Reference

Classes

class  DistanceCapsulePoint
 Distance to point RobOptim function. More...
 
class  Fitter
 Capsule fitter class. More...
 
struct  Capsule
 Structure containing Capsule data (start point, end point and. More...
 
class  Volume
 Capsule volume function. More...
 

Typedefs

typedef
roboptim::Function::value_type 
value_type
 Import types from roboptim Function. More...
 
typedef
roboptim::Function::size_type 
size_type
 
typedef
roboptim::Function::argument_t 
argument_t
 
typedef
roboptim::Function::vector_t 
vector_t
 
typedef
roboptim::Function::matrix_t 
matrix_t
 
typedef roboptim::Solver
< roboptim::DifferentiableFunction,
boost::mpl::vector
< roboptim::LinearFunction,
roboptim::DifferentiableFunction > > 
solver_t
 Import solver type. More...
 
typedef Eigen::Matrix
< value_type, 3, 1 > 
point_t
 Define geometry types. More...
 
typedef Eigen::Matrix
< value_type, 3, 1 > 
vector3_t
 
typedef std::vector< point_tpolyhedron_t
 
typedef std::vector< polyhedron_tpolyhedrons_t
 

Functions

std::ostream & operator<< (std::ostream &os, const Fitter &fitter)
 Print fitter after optimal capsule has been computed. More...
 
polyhedron_t convexHullFromPoints (const std::vector< point_t > &points)
 Creates a convex hull from a set of points. More...
 
value_type distancePointToSegment (const point_t &p, const point_t &a, const point_t &b)
 Compute the distance from point p to segment [a,b]. More...
 
point_t projectionOnSegment (const point_t &p, const point_t &a, const point_t &b)
 Compute the project of point p on segment [a,b]. More...
 
value_type distancePointToLine (const point_t &point, const point_t &linePoint, const vector3_t &dir)
 Distance from a point to a line described as a point and a. More...
 
Eigen::Matrix3d covarianceMatrix (const std::vector< point_t > &points)
 Compute the covariance matrix of a set of points. More...
 
void extremePointsAlongDirection (vector3_t dir, const std::vector< point_t > &points, int &imin, int &imax)
 
Capsule capsuleFromPoints (const std::vector< point_t > &points)
 Computes a capsule from a set of points. More...
 
void convertCapsuleToSolverParam (argument_t &dst, const point_t &endPoint1, const point_t &endPoint2, const value_type &radius)
 Convert Capsule parameters to RobOptim solver parameters vector. More...
 
void convertSolverParamToCapsule (point_t &endPoint1, point_t &endPoint2, value_type &radius, const argument_t src)
 Convert RobOptim solver parameters vector to Capsule parameters. More...
 
void convertPolyhedronVectorToPolyhedron (polyhedron_t &polyhedron, const polyhedrons_t &polyhedrons)
 Convert a polyhedron vector to a single polyhedron. More...
 
void computeBoundingCapsulePolyhedron (const polyhedrons_t &polyhedrons, point_t &endPoint1, point_t &endPoint2, value_type &radius)
 Compute bounding capsule of a vector of polyhedrons. More...
 
void computeConvexPolyhedron (const polyhedrons_t &polyhedrons, polyhedrons_t &convexPolyhedrons)
 Compute the convex polyhedron over a vector of polyhedrons. More...
 

Typedef Documentation

typedef roboptim::Function::argument_t roboptim::capsule::argument_t
typedef roboptim::Function::matrix_t roboptim::capsule::matrix_t
typedef Eigen::Matrix<value_type,3,1> roboptim::capsule::point_t

Define geometry types.

typedef roboptim::Function::size_type roboptim::capsule::size_type
typedef roboptim::Solver< roboptim::DifferentiableFunction, boost::mpl::vector< roboptim::LinearFunction, roboptim::DifferentiableFunction> > roboptim::capsule::solver_t

Import solver type.

typedef roboptim::Function::value_type roboptim::capsule::value_type

Import types from roboptim Function.

typedef Eigen::Matrix<value_type,3,1> roboptim::capsule::vector3_t
typedef roboptim::Function::vector_t roboptim::capsule::vector_t

Function Documentation

Capsule roboptim::capsule::capsuleFromPoints ( const std::vector< point_t > &  points)

Computes a capsule from a set of points.

The algorithm currently used relies on the search of the largest spread direction (PCA). TODO: Optimize computation speed. Spheres on both ends do not contain any point yet, cylinder length could be shortened to have a better fit.

References covarianceMatrix(), distancePointToLine(), extremePointsAlongDirection(), roboptim::capsule::Capsule::P0, roboptim::capsule::Capsule::P1, and roboptim::capsule::Capsule::radius.

Referenced by computeBoundingCapsulePolyhedron().

void roboptim::capsule::computeBoundingCapsulePolyhedron ( const polyhedrons_t &  polyhedrons,
point_t &  endPoint1,
point_t &  endPoint2,
value_type &  radius 
)

Compute bounding capsule of a vector of polyhedrons.

Compute axis of capsule segment using least-squares fit. Radius is maximum distance from points to axis. Hemispherical caps are chosen as close together as possible.

Parameters
polyhedronsvector of polyhedrons that contain the points
Returns
endPoint1 bounding capsule segment first end point
endPoint2 bounding capsule segment second end point
radius bounding capsule radius

References capsuleFromPoints(), roboptim::capsule::Capsule::P0, roboptim::capsule::Capsule::P1, and roboptim::capsule::Capsule::radius.

Referenced by main().

void roboptim::capsule::computeConvexPolyhedron ( const polyhedrons_t &  polyhedrons,
polyhedrons_t &  convexPolyhedrons 
)

Compute the convex polyhedron over a vector of polyhedrons.

Compute the polygon representing the convex hull of the union of all polyhedrons in a vector, and store it in a one-element vector.

Parameters
polyhedronsvector of polyhedrons that contain the points
Returns
convexPolyhedron vector of polyhedrons containing one element, i.e. the convex hull.

References convertPolyhedronVectorToPolyhedron(), and convexHullFromPoints().

Referenced by main().

void roboptim::capsule::convertCapsuleToSolverParam ( argument_t &  dst,
const point_t &  endPoint1,
const point_t &  endPoint2,
const value_type &  radius 
)

Convert Capsule parameters to RobOptim solver parameters vector.

Parameters
endPoint1capsule axis first end point
endPoint2capsule axis second end point
radiuscapsule radius
Returns
dst parameters vector containing, in this order, the capsule axis first end point coordinates, the capsule axis second end point coordinates and the radius.

Referenced by main().

void roboptim::capsule::convertPolyhedronVectorToPolyhedron ( polyhedron_t &  polyhedron,
const polyhedrons_t &  polyhedrons 
)

Convert a polyhedron vector to a single polyhedron.

Result polyhedron is the union of all polyhedrons.

Parameters
polyhedronspolyhedron vector containing all polyhedrons.
Returns
polyhedron union polyhedron

Referenced by computeConvexPolyhedron().

void roboptim::capsule::convertSolverParamToCapsule ( point_t &  endPoint1,
point_t &  endPoint2,
value_type &  radius,
const argument_t  src 
)

Convert RobOptim solver parameters vector to Capsule parameters.

Parameters
srcparameters vector containing, in this order, the capsule axis first end point coordinates, the capsule axis second end point coordinates and the radius.
Returns
endPoint1 capsule axis first end point
endPoint2 capsule axis second end point
radius capsule radius
polyhedron_t roboptim::capsule::convexHullFromPoints ( const std::vector< point_t > &  points)

Creates a convex hull from a set of points.

HAVE_QHULL

HAVE_QHULL

Referenced by computeConvexPolyhedron().

Eigen::Matrix3d roboptim::capsule::covarianceMatrix ( const std::vector< point_t > &  points)

Compute the covariance matrix of a set of points.

Referenced by capsuleFromPoints().

value_type roboptim::capsule::distancePointToLine ( const point_t &  point,
const point_t &  linePoint,
const vector3_t &  dir 
)

Distance from a point to a line described as a point and a.

Referenced by capsuleFromPoints().

value_type roboptim::capsule::distancePointToSegment ( const point_t &  p,
const point_t &  a,
const point_t &  b 
)

Compute the distance from point p to segment [a,b].

Parameters
ppoint.
astart point of segment.
bend point of segment.
Returns
distance from p to the segment.

References projectionOnSegment().

Referenced by roboptim::capsule::DistanceCapsulePoint::impl_compute().

void roboptim::capsule::extremePointsAlongDirection ( vector3_t  dir,
const std::vector< point_t > &  points,
int &  imin,
int &  imax 
)

Referenced by capsuleFromPoints().

std::ostream& roboptim::capsule::operator<< ( std::ostream &  os,
const Fitter &  fitter 
)
inline

Print fitter after optimal capsule has been computed.

Initial parameters and volume are printed, then solution parameters and volume are printed.

References roboptim::capsule::Fitter::initParam(), roboptim::capsule::Fitter::initVolume(), roboptim::capsule::Fitter::solutionParam(), and roboptim::capsule::Fitter::solutionVolume().

point_t roboptim::capsule::projectionOnSegment ( const point_t &  p,
const point_t &  a,
const point_t &  b 
)

Compute the project of point p on segment [a,b].

Parameters
ppoint.
astart point of segment.
bend point of segment.
Returns
projection of p on [a,b].

Referenced by distancePointToSegment(), and roboptim::capsule::DistanceCapsulePoint::impl_gradient().