Box.hpp
Go to the documentation of this file.
1/*
2* This file is part of ArmarX.
3*
4* ArmarX is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License version 2 as
6* published by the Free Software Foundation.
7*
8* ArmarX is distributed in the hope that it will be useful, but
9* WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
12*
13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15*
16* @package ArmarX::
17* @author Valerij Wittenbeck ( valerij.wittenbeck at kit dot edu)
18* @date 2015
19* @copyLeft http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
23#include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
25
26#ifndef MEMORYX_WSO_Box_H
27#define MEMORYX_WSO_Box_H
28
29namespace memoryx
30{
31
32 struct Box
33 {
34 Box(float xCenter,
35 float yCenter,
36 float zCenter,
37 float xExtent,
38 float yExtent,
39 float zExtent)
40 {
41 Eigen::Matrix4f m = Eigen::Matrix4f::Identity();
42 m.block<3, 1>(0, 3) << xCenter, yCenter, zCenter;
43 pose = new armarx::Pose(m);
44
45 extents = new armarx::Vector3(xExtent, yExtent, zExtent);
46 }
47
50
51 inline bool
52 inside(const armarx::FramedPositionBasePtr& p) const
53 {
54 return (pose->position->x - extents->x / 2.f) <= p->x &&
55 p->x <= (pose->position->x + extents->x / 2.f) &&
56 (pose->position->y - extents->y / 2.f) <= p->y &&
57 p->y <= (pose->position->y + extents->y / 2.f) &&
58 (pose->position->z - extents->z / 2.f) <= p->z &&
59 p->z <= (pose->position->z + extents->z / 2.f);
60 }
61
62 inline void
64 const std::string& layerName,
65 const std::string& boxName,
66 const armarx::DrawColor& color) const
67 {
68 debugDrawer->setBoxVisu(layerName, boxName, pose, extents, color);
69 }
70 };
71
72} // namespace memoryx
73
74#endif
The Pose class.
Definition Pose.h:243
The Vector3 class.
Definition Pose.h:113
IceInternal::Handle< Vector3 > Vector3Ptr
Definition Pose.h:165
IceInternal::Handle< Pose > PosePtr
Definition Pose.h:306
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface > DebugDrawerInterfacePrx
VirtualRobot headers.
Box(float xCenter, float yCenter, float zCenter, float xExtent, float yExtent, float zExtent)
Definition Box.hpp:34
void drawTo(const armarx::DebugDrawerInterfacePrx &debugDrawer, const std::string &layerName, const std::string &boxName, const armarx::DrawColor &color) const
Definition Box.hpp:63
armarx::PosePtr pose
Definition Box.hpp:48
bool inside(const armarx::FramedPositionBasePtr &p) const
Definition Box.hpp:52
armarx::Vector3Ptr extents
Definition Box.hpp:49