Tulip  5.0.0
Large graphs analysis and drawing
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
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 
35  float a, b, c, d;
36 
37  /**
38  * Constructs a Plane
39  * \attention a = b = c = d = 1.0f
40  */
41  Plane();
42 
43  /**
44  * Constructs a plane with given coordinates
45  */
46  Plane(float a, float b, float c, float d);
47 
48  /**
49  * Destructs a plane
50  */
51  ~Plane();
52 
53  /**
54  * Static function used to determine the last coordinate of a point in order to have it on the 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 
71 }
72 #endif
73 
74 ///@endcond