ODECylinderShape.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 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  {
33  public: explicit ODECylinderShape(CollisionPtr _parent)
34  : CylinderShape(_parent) {}
35 
37  public: virtual ~ODECylinderShape() {}
38 
39  // Documentation inerited.
40  public: void SetSize(double _radius, double _length)
41  {
42  CylinderShape::SetSize(_radius, _length);
43  ODECollisionPtr oParent;
44  oParent =
45  boost::dynamic_pointer_cast<ODECollision>(this->collisionParent);
46 
47  if (oParent->GetCollisionId() == NULL)
48  oParent->SetCollision(dCreateCylinder(0, _radius, _length), true);
49  else
50  dGeomCylinderSetParams(oParent->GetCollisionId(), _radius, _length);
51  }
52  };
53  }
54 }
55 #endif
#define GZ_PHYSICS_VISIBLE
Definition: system.hh:259
ODECylinderShape(CollisionPtr _parent)
Constructor.
Definition: ODECylinderShape.hh:33
Base class for all ODE collisions.
Definition: ODECollision.hh:39
virtual ~ODECylinderShape()
Destructor.
Definition: ODECylinderShape.hh:37
Cylinder collision.
Definition: CylinderShape.hh:43
virtual void SetSize(double _radius, double _length)
Set the size of the cylinder.
ODE cylinder shape.
Definition: ODECylinderShape.hh:29
void SetSize(double _radius, double _length)
Set the size of the cylinder.
Definition: ODECylinderShape.hh:40
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:104
void SetCollision(dGeomID _collisionId, bool _placeable)
Set the encapsulated collsion object.
#define NULL
Definition: CommonTypes.hh:31
boost::shared_ptr< ODECollision > ODECollisionPtr
Definition: ODETypes.hh:36