Image Component Library (ICL)
Size32f.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLUtils/src/ICLUtils/Size32f.h **
10 ** Module : ICLUtils **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLUtils/Size.h>
35 #include <iostream>
36 
37 namespace icl{
38  namespace utils{
41 
42  public:
43  // width variable
44  float width;
45 
46  // height variable
47  float height;
48 
50  static const Size32f null;
51 
53  inline Size32f(){ this->width = 0; this->height = 0; }
54 
56  inline Size32f(const Size32f &s){ this->width = s.width;this->height = s.height; }
57 
59  inline Size32f(float width,float height){ this->width = width; this->height = height; }
60 
62  inline Size32f(const Size &other):width(other.width),height(other.height){}
63 
65  bool isNull() const { return (*this)==null; }
66 
68  bool operator==(const Size32f &s) const {return width==s.width && height==s.height;}
69 
71  bool operator!=(const Size32f &s) const {return width!=s.width || height!=s.height;}
72 
74  Size32f operator+(const Size32f &s) const {return Size32f(width+s.width,height+s.height);}
75 
77  Size32f operator-(const Size32f &s) const {return Size32f(width-s.width,height-s.height);}
78 
80  Size32f operator*(double d) const { return Size32f(d*width,d*height);}
81 
83  Size32f operator/(double d) const { return (*this)*(1.0/d); }
84 
86  Size32f& operator+=(const Size32f &s){width+=s.width; height+=s.height; return *this;}
87 
89  Size32f& operator-=(const Size32f &s){width-=s.width; height-=s.height; return *this;}
90 
92  Size32f& operator*=(double d) {width*=d; height*=d; return *this; }
93 
95  Size32f& operator/=(double d) { return (*this)*=(1.0/d); }
96 
98  float getDim() const {return width*height;}
99  };
100 
102  ICLUtils_API std::ostream &operator<<(std::ostream &os, const Size32f &s);
103 
105  ICLUtils_API std::istream &operator>>(std::istream &is, Size32f &s);
106 
107  } // namespace utils
108 }// namespace icl
109 
undocument this line if you encounter any issues!
Definition: Any.h:37
#define ICLUtils_API
this macros are important for creating dll's
Definition: CompatMacros.h:171
bool isNull() const
checks wether the object instance is null, i.e. all elements are zero
Definition: Size32f.h:65
Size32f()
default constructor
Definition: Size32f.h:53
Size32f operator+(const Size32f &s) const
add a size to another size
Definition: Size32f.h:74
FixedMatrix< T, V_COLS, M_ROWS_AND_COLS > & operator *=(FixedMatrix< T, V_COLS, M_ROWS_AND_COLS > &v, const FixedMatrix< T, M_ROWS_AND_COLS, M_ROWS_AND_COLS > &m)
Matrix multiplication (inplace)
Definition: FixedMatrix.h:959
Size32f(const Size32f &s)
deep copy of another Size32f
Definition: Size32f.h:56
bool operator!=(const Size32f &s) const
checks if two size are not equal
Definition: Size32f.h:71
Size class of the ICL.
Definition: Size.h:61
ICLUtils_API std::ostream & operator<<(std::ostream &s, const ConfigFile &cf)
Default ostream operator to put a ConfigFile into a stream.
ICLUtils_API std::istream & operator>>(std::istream &s, Point &p)
istream operator
Size32f operator/(double d) const
scales the size by a scalar value
Definition: Size32f.h:83
float getDim() const
reutrns width*height
Definition: Size32f.h:98
ICLQt_API ImgQ operator *(const ImgQ &a, const ImgQ &b)
multiplies two images pixel-wise
Size32f(float width, float height)
creates a specified size
Definition: Size32f.h:59
Size32f & operator/=(double d)
scales the size parameters inplace by a scalar
Definition: Size32f.h:95
Size32f operator-(const Size32f &s) const
substracts a size from another size
Definition: Size32f.h:77
float height
Definition: Size32f.h:47
bool operator==(const Size32f &s) const
checks if two sizes are equal
Definition: Size32f.h:68
Size32f class of the ICL (float valued)
Definition: Size32f.h:40
float width
Definition: Size32f.h:44
Size32f & operator+=(const Size32f &s)
adds another size inplace
Definition: Size32f.h:86
Size32f(const Size &other)
creates a float-size from given int size
Definition: Size32f.h:62
Size32f & operator-=(const Size32f &s)
substracst another size inplace
Definition: Size32f.h:89