/usr/include/CLAM/RangeView.hxx is in libclam-dev 1.4.0-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #ifndef RangeView_hxx
#define RangeView_hxx
#include <cmath>
#include <algorithm>
#include "Assert.hxx"
namespace CLAM
{
/*
Implements the logic to navigate along a Range.
@todo out of place centering
*/
class RangeView
{
public:
static double zoomExcentricity(double low, double high, double stiked)
{
if (stiked<low) return 0.;
if (stiked>high) return 1.;
return (stiked-low)/(high-low);
}
static void zoom(double &low, double &high, double factor, double centering)
{
CLAM_ASSERT(centering>=0. && centering<=1.,
"RangeView: zooming using a centering factor not in the [0,1] interval.");
double span = high-low;
double midPoint = low + (high-low)*centering;
low = midPoint - span*factor*centering;
high = midPoint + span*factor*(1-centering);
}
static void keepWithinInterval(double & low, double & high, double lowest, double highest)
{
double span = high-low;
if (high>highest)
{
high=highest;
low=high-span;
}
if (low<lowest)
{
low=lowest;
high=std::min(highest,low+span);
}
}
};
} // namespace CLAM
#endif//RangeView_hxx
|