Pathfinder
Polygon.h
Go to the documentation of this file.
1 
10 #ifndef POLYGON_H
11 #define POLYGON_H
12 
13 #include <Geometry/Vec3.h>
14 #include <MinSG/Core/Nodes/GeometryNode.h>
15 
16 namespace Pathfinder {
17 
21  struct Polygon {
22 
26  Geometry::Vec3 p1;
27 
28 
32  Geometry::Vec3 p2;
33 
34 
38  Geometry::Vec3 p3;
39 
40 
44  Geometry::Vec3 center;
45 
46 
50  Geometry::Vec3 normal;
51 
52 
56  Geometry::Vec3 min;
57 
58 
62  Geometry::Vec3 max;
63 
64 
68  MinSG::GeometryNode* geoNodePtr;
69 
70 
80  Polygon(
81  const Geometry::Vec3& p1,
82  const Geometry::Vec3& p2,
83  const Geometry::Vec3& p3,
84  MinSG::GeometryNode* geoNodePtr
85  );
86 
87 
95  Polygon(
96  const std::tuple<Geometry::Vec3, Geometry::Vec3, Geometry::Vec3>& points,
97  MinSG::GeometryNode* geoNodePtr
98  );
99 
100 
109  Geometry::Vec3
110  getVertex(
111  const short& idx
112  );
113 
114 
124  static
125  Geometry::Vec3
127  const Geometry::Vec3& p1,
128  const Geometry::Vec3& p2,
129  const Geometry::Vec3& p3
130  );
131 
132 
142  static
143  Geometry::Vec3
145  const Geometry::Vec3& p1,
146  const Geometry::Vec3& p2,
147  const Geometry::Vec3& p3
148  );
149 
150  };
151 }
152 
153 #endif
Polygon(const Geometry::Vec3 &p1, const Geometry::Vec3 &p2, const Geometry::Vec3 &p3, MinSG::GeometryNode *geoNodePtr)
A constructor that creates a poylgon out of three points.
Definition: Polygon.cpp:18
Geometry::Vec3 getVertex(const short &idx)
Return the vertex associated with the given index.
Definition: Polygon.cpp:76
Geometry::Vec3 p2
The second vertex of the polygon.
Definition: Polygon.h:32
static Geometry::Vec3 polygonCenter(const Geometry::Vec3 &p1, const Geometry::Vec3 &p2, const Geometry::Vec3 &p3)
Compute the center point of a polygon.
Definition: Polygon.cpp:87
Geometry::Vec3 p1
The first vertex of the polygon.
Definition: Polygon.h:26
Definition: AABB.cpp:21
A struct that represents a single polygon.
Definition: Polygon.h:21
Geometry::Vec3 min
The lower corner of this polygon&#39;s AABB.
Definition: Polygon.h:56
Geometry::Vec3 normal
The normal vector of the polygon.
Definition: Polygon.h:50
Geometry::Vec3 center
The center point of the polygon.
Definition: Polygon.h:44
Geometry::Vec3 p3
The third vertex of the polygon.
Definition: Polygon.h:38
MinSG::GeometryNode * geoNodePtr
A pointer to the GeometryNode from which this polygon originates.
Definition: Polygon.h:68
static Geometry::Vec3 polygonNormal(const Geometry::Vec3 &p1, const Geometry::Vec3 &p2, const Geometry::Vec3 &p3)
Compute the normal vector of a polygon.
Definition: Polygon.cpp:96
Geometry::Vec3 max
The upper corner of this polygon&#39;s AABB.
Definition: Polygon.h:62