Image Component Library (ICL)
Line32f.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 : ICLCore/src/ICLCore/Line32f.h **
10 ** Module : ICLCore **
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/Point32f.h>
35 #include <ICLUtils/Rect.h>
36 #include <vector>
37 
38 namespace icl{
39  namespace core{
40 
42  class Line;
45 
49  public:
51  static const Line32f null;
52 
54 
59  start(start),end(end){}
60 
62 
66  Line32f(utils::Point32f start, float angle, float length);
67 
69 
70  Line32f(const Line &l);
71 
73 
76  Line32f operator+(const utils::Point32f &p) const { return Line32f(start+p,end+p); }
77 
79 
82  Line32f operator-(const utils::Point32f &p) const { return Line32f(start-p,end-p); }
83 
85 
86  float length() const;
87 
89  float getAngle() const;
90 
92  utils::Point32f getCenter() const;
93 
95 
100  bool intersects(const core::Line32f &other, utils::Point32f *p=0,
101  float *dstr=0, float *dsts=0) const;
102 
104 
110  std::vector<utils::Point> sample(const utils::Rect &limits=utils::Rect::null ) const;
111 
113 
119  void sample(std::vector<int> &xs,std::vector<int> &ys, const utils::Rect &limits=utils::Rect::null ) const;
120 
122  void swap() { utils::Point32f x=start; start=end; end=x; }
123 
126 
129  };
130 
132  ICLCore_API std::ostream &operator<<(std::ostream &s, const Line32f &l);
133 
135  ICLCore_API std::istream &operator>>(std::istream &s, Line32f &l);
136 
137  } // namespace core
138 }
139 
utils::Point32f end
end point of this line
Definition: Line32f.h:128
undocument this line if you encounter any issues!
Definition: Any.h:37
void swap()
swaps the lines start and end point internally
Definition: Line32f.h:122
ICLCore_API std::istream & operator>>(std::istream &s, format &f)
puts a string representation of format into the given stream
ICLCore_API std::ostream & operator<<(std::ostream &s, const format &f)
puts a string representation of format into the given stream
Line32f operator+(const utils::Point32f &p) const
translates a line by a given vector
Definition: Line32f.h:76
static const Rect null
null Rect is w=0, h=0, x=0, y=0
Definition: Rect.h:99
The ICLs abstract line class describing a line from Point "start" to Point "end".
Definition: Line.h:48
Line32f operator-(const utils::Point32f &p) const
translates a line by a given vector (negative direction)
Definition: Line32f.h:82
Single precission 3D Vectors Point class of the ICL.
Definition: Point32f.h:41
The ICLs abstract line class describing a line from Point "start" to Point "end".
Definition: Line32f.h:48
Line32f(utils::Point32f start=utils::Point::null, utils::Point32f end=utils::Point::null)
Creates a new line from point "start" to point "end".
Definition: Line32f.h:57
static const Point null
null Point is x=0, y=0
Definition: Point.h:61
Rectangle class of the ICL used e.g. for the Images ROI-rect.
Definition: Rect.h:95
#define ICLCore_API
Definition: CompatMacros.h:174
utils::Point32f start
start point of this line
Definition: Line32f.h:125