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 
24 #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, float yCenter, float zCenter, float xExtent, float yExtent, float zExtent)
35  {
37  m.block<3, 1>(0, 3) << xCenter, yCenter, zCenter;
38  pose = new armarx::Pose(m);
39 
40  extents = new armarx::Vector3(xExtent, yExtent, zExtent);
41  }
42 
45 
46  inline bool inside(const armarx::FramedPositionBasePtr& p) const
47  {
48  return (pose->position->x - extents->x / 2.f) <= p->x && p->x <= (pose->position->x + extents->x / 2.f) &&
49  (pose->position->y - extents->y / 2.f) <= p->y && p->y <= (pose->position->y + extents->y / 2.f) &&
50  (pose->position->z - extents->z / 2.f) <= p->z && p->z <= (pose->position->z + extents->z / 2.f);
51  }
52 
53  inline void drawTo(const armarx::DebugDrawerInterfacePrx& debugDrawer, const std::string& layerName, const std::string& boxName, const armarx::DrawColor& color) const
54  {
55  debugDrawer->setBoxVisu(layerName, boxName, pose, extents, color);
56  }
57  };
58 
59 }
60 
61 #endif
armarx::navigation::core::Pose
Eigen::Isometry3f Pose
Definition: basic_types.h:31
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:46
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:53
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:523
FramedPose.h
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
memoryx::Box
Definition: Box.hpp:32
memoryx::Box::pose
armarx::PosePtr pose
Definition: Box.hpp:43
memoryx::KBM::Vector3
Eigen::Vector3d Vector3
Definition: kbm.h:41
IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface >
memoryx::Box::extents
armarx::Vector3Ptr extents
Definition: Box.hpp:44