Robot Simulator of the Robotics Group for Self-Organization of Control: boundingshape.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

- File List
- File Members

# boundingshape.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  *   Copyright (C) 2005 by Robot Group Leipzig                             *
    00003  *    martius@informatik.uni-leipzig.de                                    *
    00004  *    fhesse@informatik.uni-leipzig.de                                     *
    00005  *    der@informatik.uni-leipzig.de                                        *
    00006  *    frankguettler@gmx.de                                                 *
    00007  *                                                                         *
    00008  *   This program is free software; you can redistribute it and/or modify  *
    00009  *   it under the terms of the GNU General Public License as published by  *
    00010  *   the Free Software Foundation; either version 2 of the License, or     *
    00011  *   (at your option) any later version.                                   *
    00012  *                                                                         *
    00013  *   This program is distributed in the hope that it will be useful,       *
    00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
    00016  *   GNU General Public License for more details.                          *
    00017  *                                                                         *
    00018  *   You should have received a copy of the GNU General Public License     *
    00019  *   along with this program; if not, write to the                         *
    00020  *   Free Software Foundation, Inc.,                                       *
    00021  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
    00022  ***************************************************************************
    00023  *                                                                         *
    00024  *  DESCRIPTION                                                            *
    00025  *                                                                         *
    00026  *   $Log: boundingshape.h,v $
    00027  *   Revision 1.3  2006/08/11 15:41:40  martius
    00028  *   osgDB used to find path
    00029  *
    00030  *   Revision 1.2  2006/07/14 12:23:33  martius
    00031  *   selforg becomes HEAD
    00032  *
    00033  *   Revision 1.1.2.8  2006/06/29 16:35:56  robot3
    00034  *   includes cleared up
    00035  *
    00036  *   Revision 1.1.2.7  2006/06/27 14:14:29  robot3
    00037  *   -optimized mesh and boundingshape code
    00038  *   -other changes
    00039  *
    00040  *   Revision 1.1.2.6  2006/06/26 21:52:58  robot3
    00041  *   Mesh works now with bbox file
    00042  *
    00043  *   Revision 1.1.2.5  2006/06/23 08:54:40  robot3
    00044  *   made some changes on primitive Mesh (including boundingshape)
    00045  *
    00046  *   Revision 1.1.2.4  2006/06/22 11:33:43  robot3
    00047  *   moved boundingshape implementation to .cpp-file
    00048  *
    00049  *   Revision 1.1.2.3  2006/05/29 22:22:07  martius
    00050  *   added std includes
    00051  *
    00052  *   Revision 1.1.2.2  2006/03/29 15:03:19  martius
    00053  *   format documented
    00054  *
    00055  *   Revision 1.1.2.1  2006/03/29 14:51:45  martius
    00056  *   class for reading bounding shape description files and creates the appropriate geoms
    00057  *
    00058  *   Revision 1.1.2.1  2005/12/06 17:38:21  martius
    00059  *   *** empty log message ***
    00060  *
    00061  *                                                                         *
    00062  ***************************************************************************/
    00063 #ifndef __BOUNDINGSHAPE_H
    00064 #define __BOUNDINGSHAPE_H
    00065
    00066 #include "primitive.h"
    00067
    00068 #include <list>
    00069 #include <string>
    00070
    00071
    00072 namespace lpzrobots {
    00073
    00074   /**
    00075      class for reading bounding shape description files (.bbox) and to create appropriate geoms
    00076
    00077      File Format: Lines wise, every line stands for one primitive.
    00078
    00079      Possible lines are:
    00080      - sphere radius (x,y,z)
    00081      - cylinder radius height (x,y,z) (alpha, beta, gamma)
    00082      - capsule radius height (x,y,z) (alpha, beta, gamma)
    00083      - box length width height (x,y,z) (alpha, beta, gamma)
    00084
    00085      (x,y,z) is the position vector and (alpha, beta, gamma) are
    00086      the rotation angles about x,y,z axis respectively
    00087
    00088      Example:
    00089      \code
    00090 cylinder 6.5 50 (0,0,25) (0,0,0)
    00091 cylinder 50 15 (0,0,28) (0,0,0)
    00092 cylinder 40 30 (0,0,50) (0,0,0)
    00093 cylinder 30 20 (0,0,75) (0,0,0)
    00094 cylinder 20 30 (0,0,100) (0,0,0)
    00095 cylinder 13 30 (0,0,125) (0,0,0)
    00096 cylinder 8 30 (0,0,150) (0,0,0)
    00097 cylinder 5 30 (0,0,175) (0,0,0)
    00098      \endcode
    00099   */
    00100
    00101   class BoundingShape{
    00102
    00103   public:
    00104     /**
    00105        @param filename path and name of bbox file. It is located using OsgDB search path
    00106        @param parent primitive to which the bbox is assoziated
    00107     */
    00108     BoundingShape(const std::string& filename, Primitive* parent);
    00109
    00110     virtual ~BoundingShape();
    00111
    00112     /// tries to open the bbox file and greates all geoms
    00113     virtual bool init(const OdeHandle& odeHandle, const OsgHandle& osgHandle,
    00114                       double scale, char mode);
    00115
    00116     virtual bool isActive();
    00117
    00118   private:
    00119     bool readBBoxFile(std::string& filename, const OdeHandle& odeHandle, const OsgHandle& osgHandle,
    00120                       double scale, char mode);
    00121
    00122   private:
    00123     std::string filename;
    00124     bool active;
    00125     Primitive* parent;
    00126   };
    00127
    00128 }
    00129
    00130 #endif