create_aabb.h
Go to the documentation of this file.
1 // Copyright 2017 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef VISION_MSGS_BUILD_BBOX_H_
16 #define VISION_MSGS_BUILD_BBOX_H_
17 
18 #include "vision_msgs/BoundingBox2D.h"
19 #include "vision_msgs/BoundingBox3D.h"
20 
21 namespace vision_msgs
22 {
28  static inline BoundingBox2D createAABB2D(uint32_t left,
29  uint32_t top,
30  uint32_t width,
31  uint32_t height)
32  {
33  BoundingBox2D bbox;
34 
35  bbox.center.x = left + width/2.0;
36  bbox.center.y = top + height/2.0;
37  bbox.size_x = width;
38  bbox.size_y = height;
39 
40  return bbox;
41  }
42 
48  static inline BoundingBox3D createAABB3D(uint32_t min_x,
49  uint32_t min_y,
50  uint32_t min_z,
51  uint32_t size_x,
52  uint32_t size_y,
53  uint32_t size_z)
54  {
55  BoundingBox3D bbox;
56 
57  bbox.center.position.x = min_x + size_x/2.0;
58  bbox.center.position.y = min_y + size_y/2.0;
59  bbox.center.position.z = min_z + size_z/2.0;
60  bbox.center.orientation.w = 1;
61  bbox.size.x = size_x;
62  bbox.size.y = size_y;
63  bbox.size.z = size_z;
64 
65  return bbox;
66  }
67 }
68 
69 #endif
static BoundingBox3D createAABB3D(uint32_t min_x, uint32_t min_y, uint32_t min_z, uint32_t size_x, uint32_t size_y, uint32_t size_z)
Definition: create_aabb.h:48
static BoundingBox2D createAABB2D(uint32_t left, uint32_t top, uint32_t width, uint32_t height)
Definition: create_aabb.h:28


vision_msgs
Author(s): Adam Allevato
autogenerated on Thu Jun 6 2019 19:45:15