00001 // Wild Magic Source Code 00002 // David Eberly 00003 // http://www.geometrictools.com 00004 // Copyright (c) 1998-2007 00005 // 00006 // This library is free software; you can redistribute it and/or modify it 00007 // under the terms of the GNU Lesser General Public License as published by 00008 // the Free Software Foundation; either version 2.1 of the License, or (at 00009 // your option) any later version. The license is available for reading at 00010 // either of the locations: 00011 // http://www.gnu.org/copyleft/lgpl.html 00012 // http://www.geometrictools.com/License/WildMagicLicense.pdf 00013 // The license applies to versions 0 through 4 of Wild Magic. 00014 // 00015 // Version: 4.0.0 (2006/06/28) 00016 00017 #ifndef WM4TRIANGLE2_H 00018 #define WM4TRIANGLE2_H 00019 00020 #include "Wm4FoundationLIB.h" 00021 #include "Wm4Vector2.h" 00022 00023 namespace Wm4 00024 { 00025 00026 template <class Real> 00027 class Triangle2 00028 { 00029 public: 00030 // The triangle is represented as an array of three vertices, V0, V1, 00031 // and V2. 00032 00033 // construction 00034 Triangle2 (); // uninitialized 00035 Triangle2 (const Vector2<Real>& rkV0, const Vector2<Real>& rkV1, 00036 const Vector2<Real>& rkV2); 00037 Triangle2 (const Vector2<Real> akV[3]); 00038 00039 // distance from the point Q to the triangle 00040 Real DistanceTo (const Vector2<Real>& rkQ) const; 00041 00042 Vector2<Real> V[3]; 00043 }; 00044 00045 } 00046 00047 #include "Wm4Triangle2.inl" 00048 00049 namespace Wm4 00050 { 00051 typedef Triangle2<float> Triangle2f; 00052 typedef Triangle2<double> Triangle2d; 00053 00054 } 00055 00056 #endif