|
|
01fbb64 |
diff -up ./code/PolyTools.h.gcc47 ./code/PolyTools.h
|
|
|
01fbb64 |
--- ./code/PolyTools.h.gcc47 2012-04-12 00:03:17.653420693 -0400
|
|
|
01fbb64 |
+++ ./code/PolyTools.h 2012-04-12 00:13:22.410132366 -0400
|
|
|
01fbb64 |
@@ -44,6 +44,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
01fbb64 |
#define AI_POLYTOOLS_H_INCLUDED
|
|
|
01fbb64 |
|
|
|
01fbb64 |
namespace Assimp {
|
|
|
01fbb64 |
+// -------------------------------------------------------------------------------
|
|
|
01fbb64 |
+/** Compute the signed area of a triangle.
|
|
|
01fbb64 |
+ * The function accepts an unconstrained template parameter for use with
|
|
|
01fbb64 |
+ * both aiVector3D and aiVector2D, but generally ignores the third coordinate.*/
|
|
|
01fbb64 |
+template <typename T>
|
|
|
01fbb64 |
+inline double GetArea2D(const T& v1, const T& v2, const T& v3)
|
|
|
01fbb64 |
+{
|
|
|
01fbb64 |
+ return 0.5 * (v1.x * ((double)v3.y - v2.y) + v2.x * ((double)v1.y - v3.y) + v3.x * ((double)v2.y - v1.y));
|
|
|
01fbb64 |
+}
|
|
|
01fbb64 |
+
|
|
|
01fbb64 |
|
|
|
01fbb64 |
// -------------------------------------------------------------------------------
|
|
|
01fbb64 |
/** Test if a given point p2 is on the left side of the line formed by p0-p1.
|
|
|
01fbb64 |
@@ -55,6 +65,7 @@ inline bool OnLeftSideOfLine2D(const T&
|
|
|
01fbb64 |
return GetArea2D(p0,p2,p1) > 0;
|
|
|
01fbb64 |
}
|
|
|
01fbb64 |
|
|
|
01fbb64 |
+
|
|
|
01fbb64 |
// -------------------------------------------------------------------------------
|
|
|
01fbb64 |
/** Test if a given point is inside a given triangle in R2.
|
|
|
01fbb64 |
* The function accepts an unconstrained template parameter for use with
|
|
|
01fbb64 |
@@ -81,17 +92,6 @@ inline bool PointInTriangle2D(const T& p
|
|
|
01fbb64 |
}
|
|
|
01fbb64 |
|
|
|
01fbb64 |
|
|
|
01fbb64 |
-// -------------------------------------------------------------------------------
|
|
|
01fbb64 |
-/** Compute the signed area of a triangle.
|
|
|
01fbb64 |
- * The function accepts an unconstrained template parameter for use with
|
|
|
01fbb64 |
- * both aiVector3D and aiVector2D, but generally ignores the third coordinate.*/
|
|
|
01fbb64 |
-template <typename T>
|
|
|
01fbb64 |
-inline double GetArea2D(const T& v1, const T& v2, const T& v3)
|
|
|
01fbb64 |
-{
|
|
|
01fbb64 |
- return 0.5 * (v1.x * ((double)v3.y - v2.y) + v2.x * ((double)v1.y - v3.y) + v3.x * ((double)v2.y - v1.y));
|
|
|
01fbb64 |
-}
|
|
|
01fbb64 |
-
|
|
|
01fbb64 |
-
|
|
|
01fbb64 |
// -------------------------------------------------------------------------------
|
|
|
01fbb64 |
/** Check whether the winding order of a given polygon is counter-clockwise.
|
|
|
01fbb64 |
* The function accepts an unconstrained template parameter, but is intended
|