Choreonoid  1.5
Public Types | Public Member Functions | Friends | List of all members
cnoid::ColdetModel Class Reference

#include <ColdetModel.h>

Public Types

enum  PrimitiveType {
  SP_MESH, SP_BOX, SP_CYLINDER, SP_CONE,
  SP_SPHERE, SP_PLANE
}
 

Public Member Functions

 ColdetModel ()
 constructor More...
 
 ColdetModel (const ColdetModel &org)
 copy constructor More...
 
virtual ~ColdetModel ()
 destructor More...
 
virtual ColdetModelPtr clone () const
 
void cloneInternalModel ()
 
void setName (const std::string &name)
 set name of this model More...
 
const std::string & name () const
 get name of this model More...
 
void setNumVertices (int n)
 set the number of vertices More...
 
int getNumVertices () const
 get the number of vertices More...
 
void setNumTriangles (int n)
 set the number of triangles More...
 
int getNumTriangles () const
 
void setVertex (int index, float x, float y, float z)
 add a vertex More...
 
void addVertex (float x, float y, float z)
 
void getVertex (int index, float &out_x, float &out_y, float &out_z) const
 get a vertex More...
 
void setTriangle (int index, int v1, int v2, int v3)
 add a triangle More...
 
void addTriangle (int v1, int v2, int v3)
 
void getTriangle (int index, int &out_v1, int &out_v2, int &out_v3) const
 
void build ()
 build tree of bounding boxes to accelerate collision check More...
 
bool isValid () const
 check if build() is already called or not More...
 
void setPosition (const Position &T)
 
void setPosition (const double *R, const double *p)
 set position and orientation of this model More...
 
void setPrimitiveType (PrimitiveType ptype)
 set primitive type More...
 
PrimitiveType getPrimitiveType () const
 get primitive type More...
 
void setNumPrimitiveParams (unsigned int nparam)
 set the number of parameters of primitive More...
 
bool setPrimitiveParam (unsigned int index, float value)
 set a parameter of primitive More...
 
bool getPrimitiveParam (unsigned int index, float &value) const
 get a parameter of primitive More...
 
void setPrimitivePosition (const double *R, const double *p)
 set position and orientation of primitive More...
 
double computeDistanceWithRay (const double *point, const double *dir)
 compute distance between a point and this mesh along ray More...
 
bool checkCollisionWithPointCloud (const std::vector< Vector3 > &i_cloud, double i_radius)
 check collision between this triangle mesh and a point cloud More...
 
void getBoundingBoxData (const int depth, std::vector< Vector3 > &out_boxes)
 
int getAABBTreeDepth ()
 
int getAABBmaxNum ()
 
int numofBBtoDepth (int minNumofBB)
 

Friends

class ColdetModelPair
 

Member Enumeration Documentation

Enumerator
SP_MESH 
SP_BOX 
SP_CYLINDER 
SP_CONE 
SP_SPHERE 
SP_PLANE 

Constructor & Destructor Documentation

ColdetModel::ColdetModel ( )

constructor

ColdetModel::ColdetModel ( const ColdetModel org)

copy constructor

Shape information stored in dataSet is shared with org

ColdetModel::~ColdetModel ( )
virtual

destructor

Member Function Documentation

void ColdetModel::addTriangle ( int  v1,
int  v2,
int  v3 
)

add a triangle to the end of the vector

void ColdetModel::addVertex ( float  x,
float  y,
float  z 
)

add a vertex to the end of the vector

void ColdetModel::build ( )

build tree of bounding boxes to accelerate collision check

This method must be called before doing collision check

bool ColdetModel::checkCollisionWithPointCloud ( const std::vector< Vector3 > &  i_cloud,
double  i_radius 
)

check collision between this triangle mesh and a point cloud

Parameters
i_cloudpoints
i_radiusradius of spheres assigned to the points
Returns
true if colliding, false otherwise
ColdetModelPtr ColdetModel::clone ( ) const
virtual
void ColdetModel::cloneInternalModel ( )
double ColdetModel::computeDistanceWithRay ( const double *  point,
const double *  dir 
)

compute distance between a point and this mesh along ray

Parameters
pointa point
dirdirection of ray
Returns
distance if ray collides with this mesh, FLT_MAX otherwise
int ColdetModel::getAABBmaxNum ( )
int ColdetModel::getAABBTreeDepth ( )
void ColdetModel::getBoundingBoxData ( const int  depth,
std::vector< Vector3 > &  out_boxes 
)
int ColdetModel::getNumTriangles ( ) const
int ColdetModel::getNumVertices ( ) const

get the number of vertices

Returns
the number of vertices
bool ColdetModel::getPrimitiveParam ( unsigned int  index,
float &  value 
) const

get a parameter of primitive

Parameters
indexindex of the parameter
valuevalue of the parameter
Returns
true if the parameter is gotten successfully, false otherwise
ColdetModel::PrimitiveType ColdetModel::getPrimitiveType ( ) const

get primitive type

Returns
primitive type
void ColdetModel::getTriangle ( int  index,
int &  out_v1,
int &  out_v2,
int &  out_v3 
) const
void ColdetModel::getVertex ( int  index,
float &  out_x,
float &  out_y,
float &  out_z 
) const

get a vertex

Parameters
indexindex of the vertex
out_xx position of the vertex
out_yy position of the vertex
out_zz position of the vertex
bool cnoid::ColdetModel::isValid ( ) const
inline

check if build() is already called or not

Returns
true if build() is already called, false otherwise
const std::string& cnoid::ColdetModel::name ( ) const
inline

get name of this model

Returns
name name of this model
int ColdetModel::numofBBtoDepth ( int  minNumofBB)
void cnoid::ColdetModel::setName ( const std::string &  name)
inline

set name of this model

Parameters
namename of this model
void ColdetModel::setNumPrimitiveParams ( unsigned int  nparam)

set the number of parameters of primitive

Parameters
nparamthe number of parameters of primitive
void ColdetModel::setNumTriangles ( int  n)

set the number of triangles

Parameters
nthe number of triangles
void ColdetModel::setNumVertices ( int  n)

set the number of vertices

Parameters
nthe number of vertices
void ColdetModel::setPosition ( const Position T)
void ColdetModel::setPosition ( const double *  R,
const double *  p 
)

set position and orientation of this model

Parameters
Rnew orientation (row-major, length = 9)
pnew position (length = 3)
bool ColdetModel::setPrimitiveParam ( unsigned int  index,
float  value 
)

set a parameter of primitive

Parameters
indexindex of the parameter
valuevalue of the parameter
Returns
true if the parameter is set successfully, false otherwise
void ColdetModel::setPrimitivePosition ( const double *  R,
const double *  p 
)

set position and orientation of primitive

Parameters
Rorientation relative to link (length = 9)
pposition relative to link (length = 3)
void ColdetModel::setPrimitiveType ( PrimitiveType  ptype)

set primitive type

Parameters
ptypeprimitive type
void ColdetModel::setTriangle ( int  index,
int  v1,
int  v2,
int  v3 
)

add a triangle

Parameters
indexindex of the triangle
v1index of the first vertex
v2index of the second vertex
v3index of the third vertex
void ColdetModel::setVertex ( int  index,
float  x,
float  y,
float  z 
)

add a vertex

Parameters
indexindex of the vertex
xx position of the vertex
yy position of the vertex
zz position of the vertex

Friends And Related Function Documentation

friend class ColdetModelPair
friend

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