ODECylinderShape.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Open Source Robotics Foundation
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 _ODECYLINDERSHAPE_HH_
18 #define _ODECYLINDERSHAPE_HH_
19 
22 #include "gazebo/util/system.hh"
23 
24 namespace gazebo
25 {
26  namespace physics
27  {
30 
32  class GZ_PHYSICS_VISIBLE ODECylinderShape : public CylinderShape
33  {
36  public: explicit ODECylinderShape(CollisionPtr _parent)
37  : CylinderShape(_parent) {}
38 
40  public: virtual ~ODECylinderShape() {}
41 
42  // Documentation inerited.
43  public: void SetSize(double _radius, double _length)
44  {
45  CylinderShape::SetSize(_radius, _length);
46  ODECollisionPtr oParent;
47  oParent =
48  boost::dynamic_pointer_cast<ODECollision>(this->collisionParent);
49 
50  if (oParent->GetCollisionId() == nullptr)
51  oParent->SetCollision(dCreateCylinder(0, _radius, _length), true);
52  else
53  dGeomCylinderSetParams(oParent->GetCollisionId(), _radius, _length);
54  }
55  };
57  }
58 }
59 #endif
Base class for all ODE collisions.
Definition: ODECollision.hh:40
Cylinder collision.
Definition: CylinderShape.hh:38
void SetCollision(dGeomID _collisionId, bool _placeable)
Set the encapsulated collision object.
boost::shared_ptr< ODECollision > ODECollisionPtr
Definition: ODETypes.hh:39
ODE cylinder shape.
Definition: ODECylinderShape.hh:32
virtual ~ODECylinderShape()
Destructor.
Definition: ODECylinderShape.hh:40
void SetSize(double _radius, double _length)
Set the size of the cylinder.
Definition: ODECylinderShape.hh:43
virtual void SetSize(double _radius, double _length)
Set the size of the cylinder.
ODECylinderShape(CollisionPtr _parent)
Constructor.
Definition: ODECylinderShape.hh:36
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:113