Image Component Library (ICL)
LineSegment.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 : ICLCV/src/ICLCV/LineSegment.h **
10 ** Module : ICLCV **
11 ** Authors: Christof Elbrechter, Erik Weitnauer **
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 <iostream>
35 
36 namespace icl{
37  namespace cv{
38 
40 
46  int x;
47  int y;
48  int xend;
49 
52 
54  LineSegment(int x, int y, int xend):
55  x(x),y(y),xend(xend){}
56 
58  int len() const { return xend-x; }
59  };
60 
61 
63  inline std::ostream &operator<<(std::ostream &s, const LineSegment &l){
64  return s << "LineSegment(x="<<l.x<<" y="<<l.y<<" len="<<l.len()<<")";
65  }
66 
67  } // namespace cv
68 }
int len() const
computes the line segments length (xend-x)
Definition: LineSegment.h:58
undocument this line if you encounter any issues!
Definition: Any.h:37
std::ostream & operator<<(std::ostream &s, const LineSegment &l)
ostream operator for the line-segment type
Definition: LineSegment.h:63
LineSegment(int x, int y, int xend)
creates a line segment with given parameters
Definition: LineSegment.h:54
int x
first pixel of this line segment
Definition: LineSegment.h:46
int xend
first pixel AFTER this line segment
Definition: LineSegment.h:48
line segment class (e.g. used for run-length coding)
Definition: LineSegment.h:45
LineSegment()
creates an empty uninitialized line segment
Definition: LineSegment.h:51
#define ICLCV_API
Definition: CompatMacros.h:177
int y
y position in the image of this line segment
Definition: LineSegment.h:47