Tulip  5.2.1 Large graphs analysis and drawing
Plane.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
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 #ifndef _TLP_PLANE_H_
22 #define _TLP_PLANE_H_
23
24 #include <tulip/Coord.h>
25
26 namespace tlp {
27 /** \brief Class used to describe a plane
28  *
29  * This class is used to represent a plane with it's coordinates.
30  * it follows the basic plane equation aX + bY + cZ + d = 0
31  */
32 class TLP_SCOPE Plane {
33 public:
34  float a, b, c, d;
35
36  /**
37  * Constructs a Plane
38  * \attention a = b = c = d = 1.0f
39  */
40  Plane();
41
42  /**
43  * Constructs a plane with given coordinates
44  */
45  Plane(float a, float b, float c, float d);
46
47  /**
48  * Destructs a plane
49  */
50  ~Plane();
51
52  /**
53  * Static function used to determine the last coordinate of a point in order to have it on the
54  * plane
55  * It follows the equation : Z = (aX + bY + d) / c
56  */
57  static float planeValue(float a, float b, float c, float d, float x, float y);
58
59  /**
60  * Computes a quad from the plane
61  */
62  bool computePlane(Coord &p1, Coord &p2, Coord &p3, Coord &p4);
63
64  /**
65  * Given a point, this function returns aX + bY + cZ + d.
66  * This is mainly used to determine if a point is above or under the plane.
67  */
68  float planePointValue(const Coord &pos);
69 };
70 } // namespace tlp
71 #endif
72
73 ///@endcond