RobWorkProject  23.9.11-
Public Types | Public Member Functions | List of all members
TriMeshSurfaceSampler Class Reference

random sampling of points and orientations close to the surface of a geometry. More...

#include <TriMeshSurfaceSampler.hpp>

Public Types

typedef rw::core::Ptr< TriMeshSurfaceSamplerPtr
 

Public Member Functions

 TriMeshSurfaceSampler ()
 constructor
 
 TriMeshSurfaceSampler (rw::geometry::Geometry::Ptr geom)
 constructor More...
 
 TriMeshSurfaceSampler (const std::vector< rw::geometry::Geometry::Ptr > &geoms)
 constructor More...
 
virtual ~TriMeshSurfaceSampler ()
 destructor
 
void add (rw::geometry::Geometry::Ptr geom)
 add surface representing geometry to this sampler More...
 
void add (rw::geometry::TriMesh::Ptr mesh)
 add surface mesh. More...
 
rw::math::Transform3D sample ()
 sample a pose on the surface of the object. More...
 
rw::math::Vector3D< double > samplePoint ()
 sample point on surface of object
 
void setBoundsD (double minD, double maxD)
 set the bounds to which the random position around the sampled surface point will be generated. See setRandomPositionEnabled More...
 
void setRandomRotationEnabled (bool enabled)
 enable the generation of a random rotation instead of a rotation with the z-axis pointing in the surface normal direction. More...
 
void setRandomPositionEnabled (bool enabled)
 enables generation of a random position within the sampled surface position. The local point will be generated within a min and max distance from the sampled surface point. See setBoundsD More...
 
void setZAxisDirectionEnabled (bool enabled)
 enable z-axis direction filtering. See setZAxisDirection for information on setting the direction. More...
 
void setZAxisDirection (const rw::math::Vector3D< double > &dir)
 sets the direction that the z-axis must point into. this is equal to testing if the z-axis of the generated pose lies on the right side of the plane defined by the plane normal dir and (0,0,0). More...
 
rw::geometry::TriMesh::Ptr getMesh ()
 return the mesh that is being sampled More...
 

Detailed Description

random sampling of points and orientations close to the surface of a geometry.

A point p on the surface is randomly choosen.
A rotation rot is randomly generated.
A random distance d in the interval [minD, maxD] is generated
The position pos is calculated as \( pos = p - rot*(0,0,d)^T \)
The random pose X is thus \( X = (pos, rot) \) Optionally a random rotation of X can be generated such that z-axis of rot is not allways pointing toward the surface.

Constructor & Destructor Documentation

◆ TriMeshSurfaceSampler() [1/2]

constructor

Parameters
geom[in] geometry representing the surface that should be sampled.

◆ TriMeshSurfaceSampler() [2/2]

TriMeshSurfaceSampler ( const std::vector< rw::geometry::Geometry::Ptr > &  geoms)

constructor

Parameters
geoms[in] list of geometries representing the surface that should be sampled.

Member Function Documentation

◆ add() [1/2]

void add ( rw::geometry::Geometry::Ptr  geom)

add surface representing geometry to this sampler

Parameters
geom[in] geometry representing surface to be sampled

◆ add() [2/2]

void add ( rw::geometry::TriMesh::Ptr  mesh)

add surface mesh.

Parameters
mesh[in] mesh to add to sampler.

◆ getMesh()

return the mesh that is being sampled

Returns
mesh

◆ sample()

sample a pose on the surface of the object.

Returns
transform3d of the sampled pose

◆ setBoundsD()

void setBoundsD ( double  minD,
double  maxD 
)

set the bounds to which the random position around the sampled surface point will be generated. See setRandomPositionEnabled

Parameters
minD[in] minimum distance
maxD[in] maximum distance.

◆ setRandomPositionEnabled()

void setRandomPositionEnabled ( bool  enabled)

enables generation of a random position within the sampled surface position. The local point will be generated within a min and max distance from the sampled surface point. See setBoundsD

Parameters
enabled[in] true to enable local random generation around sampled surface point. False otherwise.

◆ setRandomRotationEnabled()

void setRandomRotationEnabled ( bool  enabled)

enable the generation of a random rotation instead of a rotation with the z-axis pointing in the surface normal direction.

Parameters
enabled[in]

◆ setZAxisDirection()

void setZAxisDirection ( const rw::math::Vector3D< double > &  dir)

sets the direction that the z-axis must point into. this is equal to testing if the z-axis of the generated pose lies on the right side of the plane defined by the plane normal dir and (0,0,0).

Setting this also sets setZAxisDirectionEnabled( true )

Parameters
dir[in]

◆ setZAxisDirectionEnabled()

void setZAxisDirectionEnabled ( bool  enabled)

enable z-axis direction filtering. See setZAxisDirection for information on setting the direction.

Parameters
enabled

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