diff --git a/geom/cylinder.cpp b/geom/cylinder.cpp index 36091041..b4c3cf5f 100644 --- a/geom/cylinder.cpp +++ b/geom/cylinder.cpp @@ -22,16 +22,16 @@ using util::geom::cylinder; /////////////////////////////////////////////////////////////////////////////// template bool -cylinder::includes (util::point p) const +cylinder::includes (util::point p_) const { - auto ab = b - a; - auto pa = p - a; + auto p10 = p1 - p0; + auto p_0 = p_ - p0; - auto l = dot (ab, pa); - if (l < 0 || l > ab.magnitude2 ()) + auto l = dot (p10, p_0); + if (l < 0 || l > p10.magnitude2 ()) return false; - auto d = dot (pa, pa) - l * l * ab.magnitude2 (); + auto d = dot (p10, p10) - l * l * p10.magnitude2 (); if (d > radius * radius) return false; diff --git a/geom/cylinder.hpp b/geom/cylinder.hpp index d3d71b03..778d5394 100644 --- a/geom/cylinder.hpp +++ b/geom/cylinder.hpp @@ -23,7 +23,7 @@ namespace util { namespace geom { /////////////////////////////////////////////////////////////////////////// template struct cylinder { - util::point a, b; + util::point p0, p1; T radius; float distance (util::point) const;