Tulip  4.4.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
Plane.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 
22 #ifndef DOXYGEN_NOTFOR_DEVEL
23 #ifndef _TLP_PLANE_H_
24 #define _TLP_PLANE_H_
25 
26 #include <tulip/Coord.h>
27 
28 namespace tlp {
29 /** \brief Class used to describe a plane
30  *
31  * This class is used to represent a plane with it's coordinates.
32  * it follows the basic plane equation aX + bY + cZ + d = 0
33  *
34  * \author Delorme Maxime
35  * \date 23/07/2005
36  * \version 1.0
37  */
38 class TLP_SCOPE Plane {
39 public:
40 
41  float a, b, c, d;
42 
43  /**
44  * Constructs a Plane
45  * \attention a = b = c = d = 1.0f
46  */
47  Plane();
48 
49  /**
50  * Constructs a plane with given coordinates
51  */
52  Plane(float a, float b, float c, float d);
53 
54  /**
55  * Destructs a plane
56  */
57  ~Plane();
58 
59  /**
60  * Static function used to determine the last coordinate of a point in order to have it on the plane
61  * It follows the equation : Z = (aX + bY + d) / c
62  */
63  static float planeValue(float a, float b, float c, float d, float x, float y);
64 
65  /**
66  * Computes a quad from the plane
67  */
68  bool computePlane(Coord &p1, Coord &p2, Coord &p3, Coord &p4);
69 
70  /**
71  * Given a point, this function returns aX + bY + cZ + d.
72  * This is mainly used to determine if a point is above or under the plane.
73  */
74  float planePointValue(const Coord &pos);
75 };
76 
77 }
78 #endif
79 #endif //DOXYGEN_NOTFOR_DEVEL
80 ///@endcond