ODEBoxShape.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 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  {
39  public: explicit ODEBoxShape(ODECollisionPtr _parent)
40  : BoxShape(_parent) {}
41 
43  public: virtual ~ODEBoxShape() {}
44 
45  // Documentation inherited.
46  public: virtual void SetSize(const math::Vector3 &_size)
47  {
48  BoxShape::SetSize(_size);
49 
50  ODECollisionPtr oParent;
51  oParent = boost::dynamic_pointer_cast<ODECollision>(
52  this->collisionParent);
53 
54  if (oParent->GetCollisionId() == NULL)
55  oParent->SetCollision(dCreateBox(0, _size.x, _size.y, _size.z), true);
56  else
57  dGeomBoxSetLengths(oParent->GetCollisionId(),
58  _size.x, _size.y, _size.z);
59  }
60  };
61  }
62 }
63 #endif
ODEBoxShape(ODECollisionPtr _parent)
Constructor.
Definition: ODEBoxShape.hh:39
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
ODE Box shape.
Definition: ODEBoxShape.hh:35
Base class for all ODE collisions.
Definition: ODECollision.hh:39
virtual void SetSize(const math::Vector3 &_size)
Set the size of the box.
double x
X location.
Definition: Vector3.hh:302
double z
Z location.
Definition: Vector3.hh:308
default namespace for gazebo
Box geometry primitive.
Definition: BoxShape.hh:37
void SetCollision(dGeomID _collisionId, bool _placeable)
Set the encapsulated collsion object.
virtual void SetSize(const math::Vector3 &_size)
Set the size of the box.
Definition: ODEBoxShape.hh:46
#define NULL
Definition: CommonTypes.hh:30
ODE wrapper forward declarations and typedefs.
virtual ~ODEBoxShape()
Destructor.
Definition: ODEBoxShape.hh:43
boost::shared_ptr< ODECollision > ODECollisionPtr
Definition: ODETypes.hh:36
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48
double y
Y location.
Definition: Vector3.hh:305