1 // 2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved. 3 // SPDX-License-Identifier: MIT 4 // 5 6 #pragma once 7 8 namespace od 9 { 10 /** 11 * @brief Class used to store and receive bounding box location and size information 12 * 13 */ 14 class BoundingBox 15 { 16 public: 17 /** 18 * @brief Default constructor 19 */ 20 BoundingBox(); 21 22 /** 23 * @brief Constructor with parameters to configure the bounding box dimensions 24 * @param[in] x int value representing the x coordinate. 25 * @param[in] y int value representing the y coordinate. 26 * @param[in] width unsigned int value representing the width value. 27 * @param[in] height unsigned int value representing the height value. 28 */ 29 BoundingBox(int x, int y, unsigned int width, unsigned int height); 30 31 /** 32 * @brief Constructor with a BoundingBox type parameter to copy from. 33 * @param[in] other Bounding box to copy. 34 */ 35 BoundingBox(const BoundingBox& other); 36 37 ~BoundingBox() = default; 38 39 /** 40 * @brief Function to retrieve the X coordinate. 41 */ 42 int GetX() const; 43 44 /** 45 * @brief Function to retrieve the Y coordinate. 46 */ 47 int GetY() const; 48 49 /** 50 * @brief Function to retrieve the width. 51 */ 52 unsigned int GetWidth() const; 53 54 /** 55 * @brief Function to retrieve the height. 56 */ 57 unsigned int GetHeight() const; 58 59 /** 60 * @brief Function to set the X coordinate. 61 * @param[in] x int value representing x coordinate 62 */ 63 void SetX(int x); 64 65 /** 66 * @brief Function to set the Y coordinate. 67 * @param[in] y int value representing y coordinate 68 */ 69 void SetY(int y); 70 71 /** 72 * @brief Function to set the width of the BoundingBox. 73 * @param[in] width int value representing the width 74 */ 75 void SetWidth(unsigned int width); 76 77 /** 78 * @brief Function to set the height of the BoundingBox. 79 * @param[in] height int value representing the height 80 */ 81 void SetHeight(unsigned int height); 82 83 /** 84 * @brief Function to check equality with another BoundingBox 85 * @param[in] other BoundingBox to compare with 86 */ 87 BoundingBox& operator=(const BoundingBox& other); 88 89 private: 90 int m_X; 91 int m_Y; 92 unsigned int m_Width; 93 unsigned int m_Height; 94 }; 95 96 /* 97 * @brief: Get a bounding box within the limits of another bounding box 98 * 99 * @param[in] boxIn Input bounding box 100 * @param[out] boxOut Output bounding box 101 * @param[in] boxLimits Bounding box defining the limits which the output 102 * needs to conform to. 103 * @return none 104 */ 105 void GetValidBoundingBox(const BoundingBox& boxIn, BoundingBox& boxOut, 106 const BoundingBox& boxLimits); 107 108 }// namespace od