RobWorkProject
Public Member Functions | List of all members
QHullND< N > Class Template Reference

calculates the convex hull of a set of 3d points. More...

#include <QHullND.hpp>

Inherits ConvexHullND< N >.

Public Member Functions

 QHullND ()
 constructor
 
virtual ~QHullND ()
 destructor
 
void rebuild (const std::vector< rw::math::VectorND< N > > &vertices)
 rebuilts the hull More...
 
virtual bool isInside (const rw::math::VectorND< N > &vertex)
 Check if a point is inside the hull. More...
 
virtual double getMinDistOutside (const rw::math::VectorND< N > &vertex)
 Calculates the minimum distance to the hull. More...
 
virtual bool getDistOutside (const rw::math::VectorND< N > &vertex, double &min, double &max)
 Calculates the distance from a vertex to the points on the hull that are the closest and farthest. More...
 
virtual double getMinDistInside (const rw::math::VectorND< N > &vertex)
 Calculates the minimum distance to the hull. WARNING: Read full description. More...
 
virtual double getAvgDistInside (const rw::math::VectorND< N > &vertex)
 
virtual rw::math::VectorND< N > getCentroid ()
 Return centroid of the convex hull. More...
 
virtual rw::math::VectorND< N > getClosestPoint (const rw::math::VectorND< N > &vertex)
 if negative then point is outside hull More...
 
virtual double getVolume () const
 Calculates the volume of the hull. More...
 
const std::vector< rw::math::VectorND< N > > & getHullVertices ()
 Returns the list hull vertices. More...
 
const std::vector< int > & getFaceIndices ()
 Returns the list with face indices. More...
 
const std::vector< rw::math::VectorND< N > > & getFaceNormals ()
 Returns the face normals. More...
 
const std::vector< double > & getFaceOffsets ()
 Returns the offsets (distance from origin to surface in direction of the normal) of the faces. More...
 

Additional Inherited Members

- Public Types inherited from ConvexHullND< N >
typedef rw::common::Ptr< ConvexHullND< N > > Ptr
 smart pointer type of this class
 

Detailed Description

template<std::size_t N>
class rw::geometry::QHullND< N >

calculates the convex hull of a set of 3d points.

The GirftWrap convex hull algorithm is used, hence the class name.

Note
It is important that there are not multiple vertices at the same coordinates. Filter these away before using this convex hull calculation.

Member Function Documentation

◆ getAvgDistInside()

virtual double getAvgDistInside ( const rw::math::VectorND< N > &  vertex)
inlinevirtual

Implements ConvexHullND< N >.

◆ getCentroid()

virtual rw::math::VectorND<N> getCentroid ( )
inlinevirtual

Return centroid of the convex hull.

Centroid is calculated as an average of face centroids weighted by face area.

Implements ConvexHullND< N >.

◆ getClosestPoint()

virtual rw::math::VectorND<N> getClosestPoint ( const rw::math::VectorND< N > &  vertex)
inlinevirtual

if negative then point is outside hull

Returns the point on the convex hull closest to the vertex .

Parameters
vertex[in] the vertex.
Returns
the closest point.

Implements ConvexHullND< N >.

◆ getDistOutside()

virtual bool getDistOutside ( const rw::math::VectorND< N > &  vertex,
double &  min,
double &  max 
)
inlinevirtual

Calculates the distance from a vertex to the points on the hull that are the closest and farthest.

Parameters
vertex[in] vertex to calculate distances for.
min[out] the minimum distance to the hull when vertex is outside the hull, zero otherwise.
max[out] the maximum distance to the hull when vertex is outside the hull, zero otherwise.
Returns
true if vertex is outside, false otherwise.

◆ getFaceIndices()

const std::vector<int>& getFaceIndices ( )
inline

Returns the list with face indices.

Returns
Reference to the internal vector with face normals

◆ getFaceNormals()

const std::vector<rw::math::VectorND<N> >& getFaceNormals ( )
inline

Returns the face normals.

Returns
Reference to the internal vector with face normals

◆ getFaceOffsets()

const std::vector<double>& getFaceOffsets ( )
inline

Returns the offsets (distance from origin to surface in direction of the normal) of the faces.

Returns
Reference to the internal list face offsets

◆ getHullVertices()

const std::vector<rw::math::VectorND<N> >& getHullVertices ( )
inline

Returns the list hull vertices.

Returns
Reference to the internal vector with hull vertices

◆ getMinDistInside()

virtual double getMinDistInside ( const rw::math::VectorND< N > &  vertex)
inlinevirtual

Calculates the minimum distance to the hull. WARNING: Read full description.

Warning
This function will NOT currently return 0 for the case where vertex is outside the hull. This might be changed in the future.
Parameters
vertex[in] vertex to calculate distance for.
Returns
the minimum distance if vertex is inside the hull (as a positive value). Currently, the maximum distance is returned if vertex is outside the hull (as a negative value). This is subject to change, so do not rely on this behaviour.

Implements ConvexHullND< N >.

◆ getMinDistOutside()

virtual double getMinDistOutside ( const rw::math::VectorND< N > &  vertex)
inlinevirtual

Calculates the minimum distance to the hull.

Parameters
vertex[in] vertex to calculate minimum distance for.
Returns
the minimum distance to the hull if vertex is outside, otherwise zero is returned.

Implements ConvexHullND< N >.

◆ getVolume()

virtual double getVolume ( ) const
inlinevirtual

Calculates the volume of the hull.

Returns
The volume of the QHull.

◆ isInside()

virtual bool isInside ( const rw::math::VectorND< N > &  vertex)
inlinevirtual

Check if a point is inside the hull.

Parameters
vertex[in] the vertex to check.
Returns
true if vertex lies on hull or inside, false otherwise.

Implements ConvexHullND< N >.

◆ rebuild()

void rebuild ( const std::vector< rw::math::VectorND< N > > &  vertices)
inlinevirtual

rebuilts the hull

Parameters
vertices

Implements ConvexHullND< N >.


The documentation for this class was generated from the following file: