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 
23 
26 #include "gazebo/util/system.hh"
27 
28 namespace gazebo
29 {
30  namespace physics
31  {
34 
36  class GZ_PHYSICS_VISIBLE ODEBoxShape : public BoxShape
37  {
40  public: explicit ODEBoxShape(ODECollisionPtr _parent)
41  : BoxShape(_parent) {}
42 
44  public: virtual ~ODEBoxShape() {}
45 
46  // Documentation inherited.
47  public: virtual void SetSize(const ignition::math::Vector3d &_size)
48  {
49  BoxShape::SetSize(_size);
50 
51  ODECollisionPtr oParent;
52  oParent = boost::dynamic_pointer_cast<ODECollision>(
53  this->collisionParent);
54 
55  if (oParent->GetCollisionId() == nullptr)
56  {
57  oParent->SetCollision(
58  dCreateBox(0, _size.X(), _size.Y(), _size.Z()), true);
59  }
60  else
61  {
62  dGeomBoxSetLengths(oParent->GetCollisionId(),
63  _size.X(), _size.Y(), _size.Z());
64  }
65  }
66  };
68  }
69 }
70 #endif
ODE Box shape.
Definition: ODEBoxShape.hh:36
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
Box geometry primitive.
Definition: BoxShape.hh:34
ODE wrapper forward declarations and typedefs.
virtual void SetSize(const ignition::math::Vector3d &_size)
Set the size of the box.
virtual ~ODEBoxShape()
Destructor.
Definition: ODEBoxShape.hh:44
ODEBoxShape(ODECollisionPtr _parent)
Constructor.
Definition: ODEBoxShape.hh:40
virtual void SetSize(const ignition::math::Vector3d &_size)
Set the size of the box.
Definition: ODEBoxShape.hh:47