From cc2a07f13d5f6613dabcd454790b088c9c273cbf Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 3 Jan 2010 20:23:00 +0100 Subject: Removed unused methods --- src/Collision.cpp | 27 --------------------------- src/Collision.h | 3 --- 2 files changed, 30 deletions(-) diff --git a/src/Collision.cpp b/src/Collision.cpp index 91bfc95..ea69b39 100644 --- a/src/Collision.cpp +++ b/src/Collision.cpp @@ -23,33 +23,6 @@ namespace Zoom { -vmml::vec3f Collision::projectToEdge(const vmml::vec3f& p, const vmml::vec3f& v1, const vmml::vec3f& v2) { - vmml::vec3f pVec = p - v1; - vmml::vec3f edge = v2 - v1; - - float lengthSq = edge.squared_length(); - float edgeProj = vmml::dot(edge, pVec); - - if(edgeProj < 0) return v1; - if(edgeProj > lengthSq) return v2; - - return v1 + (edgeProj/lengthSq)*edge; -} - -vmml::vec3f Collision::projectToNearestEdge(const vmml::vec3f& p, const Triangle &t) { - vmml::vec3f p1 = projectToEdge(p, t.getVertex(0), t.getVertex(1)); - vmml::vec3f p2 = projectToEdge(p, t.getVertex(1), t.getVertex(2)); - vmml::vec3f p3 = projectToEdge(p, t.getVertex(2), t.getVertex(0)); - - if(p.squared_distance(p1) < p.squared_distance(p2) && p.squared_distance(p1) < p.squared_distance(p3)) - return p1; - else if(p.squared_distance(p2) < p.squared_distance(p3)) - return p2; - else - return p3; -} - - bool Collision::test(const Triangle &t, const MathUtil::Ray &ray, float *distance) { vmml::vec3f edge1 = t.getVertex(1) - t.getVertex(0); vmml::vec3f edge2 = t.getVertex(2) - t.getVertex(0); diff --git a/src/Collision.h b/src/Collision.h index df69289..ba987b9 100644 --- a/src/Collision.h +++ b/src/Collision.h @@ -34,9 +34,6 @@ class Collision { static bool testEdge(const vmml::vec3f &v1, const vmml::vec3f &v2, const vmml::vec3f &m, float r, const vmml::vec3f &move, float *distance); static bool testVertex(const vmml::vec3f &v, const vmml::vec3f &m, float r, const vmml::vec3f &move, float *distance); - - static vmml::vec3f projectToEdge(const vmml::vec3f& p, const vmml::vec3f& v1, const vmml::vec3f& v2); - static vmml::vec3f projectToNearestEdge(const vmml::vec3f& p, const Triangle &t); }; } -- cgit v1.2.3