ViSP  2.8.0
vpTriangle.h
1 /****************************************************************************
2  *
3  * $Id: vpTriangle.h 4056 2013-01-05 13:04:42Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Defines a 2D triangle.
36  *
37  * Author:
38  * Amaury Dame
39  * Nicolas Melchior
40  *
41  *****************************************************************************/
42 
43 #ifndef vpTriangle_h
44 #define vpTriangle_h
45 
55 #include <visp/vpImagePoint.h>
56 #include <visp/vpMatrix.h>
57 
58 class VISP_EXPORT vpTriangle
59 {
60  private:
61  bool goodTriange;
62  vpImagePoint S1;
63  double uvinv00;
64  double uvinv01;
65  double uvinv10;
66  double uvinv11;
67  double ptempo0;
68  double ptempo1;
69  double area;
70  vpImagePoint apex1;
71  vpImagePoint apex2;
72  vpImagePoint apex3;
73 
74  public:
75  vpTriangle();
76  vpTriangle(const vpTriangle &tri);
77  virtual ~vpTriangle();
78 
79  vpTriangle &operator=(const vpTriangle& tri);
80 
81  vpTriangle(const vpImagePoint &iP1, const vpImagePoint &iP2, const vpImagePoint &iP3);
82 
83  void buildFrom(const vpImagePoint &iP1, const vpImagePoint &iP2, const vpImagePoint &iP3);
84 
85  bool inTriangle(const vpImagePoint &iP, double threshold = 0.00001);
86 
95  iP1 = apex1;
96  iP2 = apex2;
97  iP3 = apex3;}
98 
99 
106  inline double getArea() const{
107  return this->area;
108  }
109 
110  private:
111  void init(const vpImagePoint &iP1, const vpImagePoint &iP2, const vpImagePoint &iP3);
112 
113 };
114 
115 #endif
116 
double getArea() const
Definition: vpTriangle.h:106
Defines a 2D triangle.
Definition: vpTriangle.h:58
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:92
void getTriangleApexes(vpImagePoint &iP1, vpImagePoint &iP2, vpImagePoint &iP3) const
Definition: vpTriangle.h:94