Fixed template definition

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@454 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Jan Möbius
2011-11-09 08:47:25 +00:00
parent e2ea9c00f6
commit 9995294d23
2 changed files with 19 additions and 21 deletions

View File

@@ -64,18 +64,18 @@ namespace Decimater {
//== IMPLEMENTATION ==========================================================
template <class Vec>
typename Vec::value_type
distPointTriangleSquared( const Vec& _p,
const Vec& _v0,
const Vec& _v1,
const Vec& _v2,
Vec& _nearestPoint )
template <class DecimaterT>
typename ModHausdorffT<DecimaterT>::Scalar
ModHausdorffT<DecimaterT>::
distPointTriangleSquared( const Point& _p,
const Point& _v0,
const Point& _v1,
const Point& _v2,
Point& _nearestPoint )
{
Vec v0v1 = _v1 - _v0;
Vec v0v2 = _v2 - _v0;
Vec n = v0v1 % v0v2; // not normalized !
Point v0v1 = _v1 - _v0;
Point v0v2 = _v2 - _v0;
Point n = v0v1 % v0v2; // not normalized !
double d = n.sqrnorm();
@@ -89,14 +89,14 @@ distPointTriangleSquared( const Vec& _p,
// these are not needed for every point, should still perform
// better with many points against one triangle
Vec v1v2 = _v2 - _v1;
Point v1v2 = _v2 - _v1;
double inv_v0v2_2 = 1.0 / v0v2.sqrnorm();
double inv_v0v1_2 = 1.0 / v0v1.sqrnorm();
double inv_v1v2_2 = 1.0 / v1v2.sqrnorm();
Vec v0p = _p - _v0;
Vec t = v0p % n;
Point v0p = _p - _v0;
Point t = v0p % n;
double s01, s02, s12;
double a = (t | v0v2) * -invD;
double b = (t | v0v1) * invD;