ODEBoxShape.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 _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 math::Vector3 &_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() == NULL)
58  oParent->SetCollision(dCreateBox(0, _size.x, _size.y, _size.z), true);
59  else
60  dGeomBoxSetLengths(oParent->GetCollisionId(),
61  _size.x, _size.y, _size.z);
62  }
63  };
65  }
66 }
67 #endif
double x
X location.
Definition: Vector3.hh:311
double y
Y location.
Definition: Vector3.hh:314
Forward declarations for the common classes.
Definition: Animation.hh:33
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
ODE Box shape.
Definition: ODEBoxShape.hh:38
Base class for all ODE collisions.
Definition: ODECollision.hh:42
void SetCollision(dGeomID _collisionId, bool _placeable)
Set the encapsulated collsion object.
boost::shared_ptr< ODECollision > ODECollisionPtr
Definition: ODETypes.hh:39
virtual void SetSize(const math::Vector3 &_size)
Set the size of the box.
Definition: ODEBoxShape.hh:49
default namespace for gazebo
double z
Z location.
Definition: Vector3.hh:317
Box geometry primitive.
Definition: BoxShape.hh:37
#define NULL
Definition: CommonTypes.hh:31
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 math::Vector3 &_size)
Set the size of the box.