Image Component Library (ICL)
StraightLine2D.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 : ICLMath/src/ICLMath/StraightLine2D.h **
10 ** Module : ICLMath **
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/Exception.h>
36 #include <ICLMath/FixedVector.h>
37 
38 namespace icl{
39  namespace math{
40 
42 
51 
54 
56  StraightLine2D(float angle, float distance);
57 
59  StraightLine2D(const Pos &o=Pos(0,0), const Pos &v=Pos(0,0));
60 
63 
65  Pos o;
66 
68  Pos v;
69 
71  float distance(const Pos &p) const;
72 
74  /* result is positive if p is left of this->v
75  and negative otherwise */
76  float signedDistance(const Pos &p) const;
77 
79  inline float distance(const utils::Point32f &p) const {
80  return distance(Pos(p.x,p.y));
81  }
82 
84  /* result is positive if p is left of this->v
85  and negative otherwise */
86  float signedDistance(const utils::Point32f &p) const {
87  return signedDistance(Pos(p.x,p.y));
88  }
89 
91 
92  Pos intersect(const StraightLine2D &o) const;
93 
95  PointPolar getAngleAndDistance() const;
96 
98  Pos getClosestPoint(const Pos &p) const;
99  };
100  } // namespace math
101 }
102 
undocument this line if you encounter any issues!
Definition: Any.h:37
#define ICLMath_API
Definition: CompatMacros.h:173
float y
y position of this point
Definition: Point32f.h:48
float signedDistance(const utils::Point32f &p) const
computes closest distance to given 2D point
Definition: StraightLine2D.h:86
FixedColVector< float, 2 > PointPolar
internal typedef
Definition: StraightLine2D.h:50
Pos o
2D offset vector
Definition: StraightLine2D.h:65
Pos v
2D direction vector
Definition: StraightLine2D.h:68
Single precission 3D Vectors Point class of the ICL.
Definition: Point32f.h:41
float x
x position of this point
Definition: Point32f.h:45
A straight line is parameterized in offset/direction form.
Definition: StraightLine2D.h:48
float distance(const utils::Point32f &p) const
computes closest distance to given 2D point
Definition: StraightLine2D.h:79
FixedColVector< float, 2 > Pos
internal typedef for 2D points
Definition: StraightLine2D.h:53