ColdetBody.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
00003  * All rights reserved. This program is made available under the terms of the
00004  * Eclipse Public License v1.0 which accompanies this distribution, and is
00005  * available at http://www.eclipse.org/legal/epl-v10.html
00006  * Contributors:
00007  * National Institute of Advanced Industrial Science and Technology (AIST)
00008  * General Robotix Inc. 
00009  */
00014 #ifndef OPENHRP_COLLISION_DETECTOR_COLDET_BODY_H_INCLUDED
00015 #define OPENHRP_COLLISION_DETECTOR_COLDET_BODY_H_INCLUDED
00016 
00017 #include <map>
00018 #include <vector>
00019 #include <string>
00020 #include <hrpUtil/Referenced.h>
00021 #include <hrpUtil/Eigen4d.h>
00022 #include <hrpCorba/ModelLoader.hh>
00023 #include <hrpCollision/ColdetModel.h>
00024 
00025 using namespace std;
00026 using namespace boost;
00027 using namespace hrp;
00028 using namespace OpenHRP;
00029 
00030 
00031 class ColdetBody : public hrp::Referenced
00032 {
00033 public:
00034     ColdetBody(BodyInfo_ptr bodyInfo);
00035 
00039     ColdetBody(const ColdetBody& org);
00040 
00041     void setName(const char* name) { name_ = name; }
00042     const char* name() { return name_.c_str(); }
00043     
00044     unsigned int numLinks() const {
00045         return linkColdetModels.size();
00046     }
00047     ColdetModelPtr linkColdetModel(int linkIndex) {
00048         return linkColdetModels[linkIndex];
00049     }
00050 
00051     ColdetModelPtr linkColdetModel(const string& linkName){
00052         map<string, ColdetModelPtr>::iterator p = linkNameToColdetModelMap.find(linkName);
00053         return (p == linkNameToColdetModelMap.end()) ? ColdetModelPtr() : p->second;
00054     }
00055 
00056     void setLinkPositions(const LinkPositionSequence& linkPositions);
00057 
00058   private:
00059     void addLinkPrimitiveInfo(ColdetModelPtr& coldetModel, 
00060                               const double *R, const double *p,
00061                               const ShapeInfo& shapeInfo);
00062     void addLinkVerticesAndTriangles
00063         (ColdetModelPtr& coldetModel, LinkInfo& linkInfo, ShapeInfoSequence_var& shapes);
00064     void addLinkVerticesAndTriangles
00065         (ColdetModelPtr& coldetModel, const TransformedShapeIndex& tsi, const Matrix44& Tparent, ShapeInfoSequence_var& shapes, int& vertexIndex, int& triangleIndex);
00066     
00067     vector<ColdetModelPtr> linkColdetModels;
00068     map<string, ColdetModelPtr> linkNameToColdetModelMap;
00069     string name_;
00070 };
00071 
00072 typedef boost::intrusive_ptr<ColdetBody> ColdetBodyPtr;
00073 
00074 #endif


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sun Apr 2 2017 03:43:53