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

#include <ColdetModel.h>

Inheritance diagram for cnoid::ColdetModel:
cnoid::Referenced

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 ColdetModelclone () 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 Isometry3 &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)
 
- Public Member Functions inherited from cnoid::Referenced
virtual ~Referenced ()
 

Friends

class ColdetModelPair
 

Additional Inherited Members

- Protected Member Functions inherited from cnoid::Referenced
 Referenced ()
 
 Referenced (const Referenced &)
 
int refCount () const
 

Member Enumeration Documentation

◆ PrimitiveType

Enumerator
SP_MESH 
SP_BOX 
SP_CYLINDER 
SP_CONE 
SP_SPHERE 
SP_PLANE 

Constructor & Destructor Documentation

◆ ColdetModel() [1/2]

ColdetModel::ColdetModel ( )

constructor

◆ ColdetModel() [2/2]

ColdetModel::ColdetModel ( const ColdetModel org)

copy constructor

Shape information stored in dataSet is shared with org

◆ ~ColdetModel()

ColdetModel::~ColdetModel ( )
virtual

destructor

Member Function Documentation

◆ addTriangle()

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

add a triangle to the end of the vector

◆ addVertex()

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

add a vertex to the end of the vector

◆ build()

void ColdetModel::build ( )

build tree of bounding boxes to accelerate collision check

This method must be called before doing collision check

◆ checkCollisionWithPointCloud()

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

◆ clone()

ColdetModel * ColdetModel::clone ( ) const
virtual

◆ cloneInternalModel()

void ColdetModel::cloneInternalModel ( )

◆ computeDistanceWithRay()

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

◆ getAABBmaxNum()

int ColdetModel::getAABBmaxNum ( )

◆ getAABBTreeDepth()

int ColdetModel::getAABBTreeDepth ( )

◆ getBoundingBoxData()

void ColdetModel::getBoundingBoxData ( const int  depth,
std::vector< Vector3 > &  out_boxes 
)

◆ getNumTriangles()

int ColdetModel::getNumTriangles ( ) const

◆ getNumVertices()

int ColdetModel::getNumVertices ( ) const

get the number of vertices

Returns
the number of vertices

◆ getPrimitiveParam()

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

◆ getPrimitiveType()

ColdetModel::PrimitiveType ColdetModel::getPrimitiveType ( ) const

get primitive type

Returns
primitive type

◆ getTriangle()

void ColdetModel::getTriangle ( int  index,
int &  out_v1,
int &  out_v2,
int &  out_v3 
) const

◆ getVertex()

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

◆ isValid()

bool cnoid::ColdetModel::isValid ( ) const
inline

check if build() is already called or not

Returns
true if build() is already called, false otherwise

◆ name()

const std::string& cnoid::ColdetModel::name ( ) const
inline

get name of this model

Returns
name name of this model

◆ numofBBtoDepth()

int ColdetModel::numofBBtoDepth ( int  minNumofBB)

◆ setName()

void cnoid::ColdetModel::setName ( const std::string &  name)
inline

set name of this model

Parameters
namename of this model

◆ setNumPrimitiveParams()

void ColdetModel::setNumPrimitiveParams ( unsigned int  nparam)

set the number of parameters of primitive

Parameters
nparamthe number of parameters of primitive

◆ setNumTriangles()

void ColdetModel::setNumTriangles ( int  n)

set the number of triangles

Parameters
nthe number of triangles

◆ setNumVertices()

void ColdetModel::setNumVertices ( int  n)

set the number of vertices

Parameters
nthe number of vertices

◆ setPosition() [1/2]

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)

◆ setPosition() [2/2]

void ColdetModel::setPosition ( const Isometry3 T)

◆ setPrimitiveParam()

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

◆ setPrimitivePosition()

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)

◆ setPrimitiveType()

void ColdetModel::setPrimitiveType ( PrimitiveType  ptype)

set primitive type

Parameters
ptypeprimitive type

◆ setTriangle()

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

◆ setVertex()

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

◆ ColdetModelPair

friend class ColdetModelPair
friend

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