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 
29 namespace 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  {
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
armarx::navigation::core::Pose
Eigen::Isometry3f Pose
Definition: basic_types.h:31
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:650
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
memoryx::Box::Box
Box(float xCenter, float yCenter, float zCenter, float xExtent, float yExtent, float zExtent)
Definition: Box.hpp:34
memoryx::Box::inside
bool inside(const armarx::FramedPositionBasePtr &p) const
Definition: Box.hpp:52
IceInternal::Handle< Pose >
memoryx::Box::drawTo
void drawTo(const armarx::DebugDrawerInterfacePrx &debugDrawer, const std::string &layerName, const std::string &boxName, const armarx::DrawColor &color) const
Definition: Box.hpp:63
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:570
FramedPose.h
memoryx::Box
Definition: Box.hpp:32
memoryx::Box::pose
armarx::PosePtr pose
Definition: Box.hpp:48
memoryx::KBM::Vector3
Eigen::Vector3d Vector3
Definition: kbm.h:43
IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface >
memoryx::Box::extents
armarx::Vector3Ptr extents
Definition: Box.hpp:49