All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ODESphereShape.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Nate Koenig
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef _ODESPHERESHAPE_HH_
18 #define _ODESPHERESHAPE_HH_
19 
22 
23 #include "physics/PhysicsTypes.hh"
24 #include "physics/SphereShape.hh"
25 
26 namespace gazebo
27 {
28  namespace physics
29  {
33 
35  class ODESphereShape : public SphereShape
36  {
38  public: ODESphereShape(ODECollisionPtr _parent) : SphereShape(_parent) {}
39 
41  public: virtual ~ODESphereShape() {}
42 
44  public: void SetRadius(double _radius)
45  {
46  SphereShape::SetRadius(_radius);
47  ODECollisionPtr oParent;
48  oParent =
49  boost::shared_dynamic_cast<ODECollision>(this->collisionParent);
50 
51  // Create the sphere geometry
52  if (oParent->GetCollisionId() == NULL)
53  oParent->SetCollision(dCreateSphere(0, _radius), true);
54  else
55  dGeomSphereSetRadius(oParent->GetCollisionId(), _radius);
56  }
57  };
59  }
60 }
61 #endif