ODEBoxShape.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 _ODEBOXSHAPE_HH_
18 #define _ODEBOXSHAPE_HH_
19 
20 #include "gazebo/math/Vector3.hh"
21 
25 
28 #include "gazebo/util/system.hh"
29 
30 namespace gazebo
31 {
32  namespace physics
33  {
36 
38  class GZ_PHYSICS_VISIBLE ODEBoxShape : public BoxShape
39  {
42  public: explicit ODEBoxShape(ODECollisionPtr _parent)
43  : BoxShape(_parent) {}
44 
46  public: virtual ~ODEBoxShape() {}
47 
48  // Documentation inherited.
49  public: virtual void SetSize(const ignition::math::Vector3d &_size)
50  {
51  BoxShape::SetSize(_size);
52 
53  ODECollisionPtr oParent;
54  oParent = boost::dynamic_pointer_cast<ODECollision>(
55  this->collisionParent);
56 
57  if (oParent->GetCollisionId() == nullptr)
58  {
59  oParent->SetCollision(
60  dCreateBox(0, _size.X(), _size.Y(), _size.Z()), true);
61  }
62  else
63  {
64  dGeomBoxSetLengths(oParent->GetCollisionId(),
65  _size.X(), _size.Y(), _size.Z());
66  }
67  }
68  };
70  }
71 }
72 #endif
Forward declarations for the common classes.
Definition: Animation.hh:33
ODE Box shape.
Definition: ODEBoxShape.hh:38
Base class for all ODE collisions.
Definition: ODECollision.hh:40
void SetCollision(dGeomID _collisionId, bool _placeable)
Set the encapsulated collision object.
boost::shared_ptr< ODECollision > ODECollisionPtr
Definition: ODETypes.hh:39
default namespace for gazebo
virtual void SetSize(const math::Vector3 &_size) GAZEBO_DEPRECATED(8.0)
Set the size of the box.
Box geometry primitive.
Definition: BoxShape.hh:34
ODE wrapper forward declarations and typedefs.
virtual ~ODEBoxShape()
Destructor.
Definition: ODEBoxShape.hh:46
ODEBoxShape(ODECollisionPtr _parent)
Constructor.
Definition: ODEBoxShape.hh:42
virtual void SetSize(const ignition::math::Vector3d &_size)
Set the size of the box.
Definition: ODEBoxShape.hh:49