From 13053760609f4bb6d874318b0974702908c2177d Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Mon, 5 Sep 2011 13:13:30 +0000 Subject: [PATCH] # PolyTools.h, fix point of declaration for GetArea2D, thanks to Joe Hermaszewski to point it out. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1077 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/PolyTools.h | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/code/PolyTools.h b/code/PolyTools.h index 792d5d4cc..4f807eb90 100644 --- a/code/PolyTools.h +++ b/code/PolyTools.h @@ -45,6 +45,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { +// ------------------------------------------------------------------------------- +/** Compute the signed area of a triangle. + * The function accepts an unconstrained template parameter for use with + * both aiVector3D and aiVector2D, but generally ignores the third coordinate.*/ +template +inline double GetArea2D(const T& v1, const T& v2, const T& v3) +{ + return 0.5 * (v1.x * ((double)v3.y - v2.y) + v2.x * ((double)v1.y - v3.y) + v3.x * ((double)v2.y - v1.y)); +} + // ------------------------------------------------------------------------------- /** Test if a given point p2 is on the left side of the line formed by p0-p1. * The function accepts an unconstrained template parameter for use with @@ -81,17 +91,6 @@ inline bool PointInTriangle2D(const T& p0, const T& p1,const T& p2, const T& pp) } -// ------------------------------------------------------------------------------- -/** Compute the signed area of a triangle. - * The function accepts an unconstrained template parameter for use with - * both aiVector3D and aiVector2D, but generally ignores the third coordinate.*/ -template -inline double GetArea2D(const T& v1, const T& v2, const T& v3) -{ - return 0.5 * (v1.x * ((double)v3.y - v2.y) + v2.x * ((double)v1.y - v3.y) + v3.x * ((double)v2.y - v1.y)); -} - - // ------------------------------------------------------------------------------- /** Check whether the winding order of a given polygon is counter-clockwise. * The function accepts an unconstrained template parameter, but is intended