ODERayShape.hh
00001 /*
00002  * Copyright 2011 Nate Koenig & Andrew Howard
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  *
00016 */
00017 /* Desc: A ray
00018  * Author: Nate Keonig, Andrew Howard
00019  * Date: 14 Oct 2009
00020  * SVN: $Id:$
00021  */
00022 
00023 #ifndef ODERAYSHAPE_HH
00024 #define ODERAYSHAPE_HH
00025 
00026 #include "physics/RayShape.hh"
00027 #include "physics/Shape.hh"
00028 
00029 namespace gazebo
00030 {
00031     namespace physics
00032   {
00035     
00038 
00040     class ODERayShape : public RayShape
00041     {
00043       public: ODERayShape(PhysicsEnginePtr _physicsEngine);
00044 
00049       public: ODERayShape( CollisionPtr collision, bool displayRays );
00050     
00052       public: virtual ~ODERayShape();
00053   
00055       public: virtual void Update();
00056    
00058       public: virtual void GetIntersection(double &_dist,
00059                                            std::string &_entity);
00060 
00065       public: virtual void SetPoints(const math::Vector3 &posStart, 
00066                                      const math::Vector3 &posEnd);
00067 
00068       private: static void UpdateCallback(void *data, dGeomID o1, dGeomID o2);
00069 
00070       private: dGeomID geomId;
00071       private: ODEPhysicsPtr physicsEngine;
00072 
00073       private: class Intersection
00074                {
00075                  public: double depth;
00076                  public: std::string name;
00077                };
00078     };
00081   }
00082 }
00083 #endif