diff --git a/wrap/gui/frustum.h b/wrap/gui/frustum.h index 3b00757c..2e0d0cc7 100644 --- a/wrap/gui/frustum.h +++ b/wrap/gui/frustum.h @@ -70,9 +70,10 @@ public: Point3 ViewPoint(); T Resolution(float dist = 1); bool IsOutside(Point3 &point); - float Remoteness(Point3 &point, T radius); + T Remoteness(Point3 &point, T radius); bool IsOutside(Point3 &point, T radius); T Distance(Point3 &point, int plane); + T range(Point3 &point, T radius, T &closest, T &farthest); protected: T resolution; @@ -103,7 +104,7 @@ template bool Frustum::IsOutside(Point3 &point) { return false; } -template float Frustum::Remoteness(Point3 &point, T radius) { +template T Frustum::Remoteness(Point3 &point, T radius) { Point3 r = Project(point); T dist = (point - view_point).Norm(); if(dist < radius) return 0; @@ -133,6 +134,13 @@ template bool Frustum::IsOutside(Point3 &point, T radius) { return false; } +template T Frustum::range(Point3 &point, T radius, T &closest, T &farthest) { + //4 near 5 far + T dist = (view_point - point).Norm(); + closest = dist - radius; + farthest = dist + radius; +} + template T Frustum::Distance(Point3 &point, int plane) { return vcg::Distance(planes[plane], point); }