44#ifndef _INCLUDED_Field3D_Resample_H_
45#define _INCLUDED_Field3D_Resample_H_
79template <
typename Field_T,
typename FilterOp_T>
91 typedef boost::shared_ptr<Filter>
Ptr;
92 typedef boost::shared_ptr<const Filter>
CPtr;
97 virtual float eval(
const float t)
const = 0;
116 typedef boost::shared_ptr<BoxFilter>
Ptr;
117 typedef boost::shared_ptr<const BoxFilter>
CPtr;
129 virtual float eval(
const float x)
const
142 template <
typename Value_T>
156 typedef boost::shared_ptr<MinFilter>
Ptr;
157 typedef boost::shared_ptr<const MinFilter>
CPtr;
169 virtual float eval(
const float x)
const
184 return std::numeric_limits<float>::max();
187 template <
typename T>
195 template <
typename Value_T>
212 typedef boost::shared_ptr<MaxFilter>
Ptr;
213 typedef boost::shared_ptr<const MaxFilter>
CPtr;
225 virtual float eval(
const float x)
const
240 return -std::numeric_limits<float>::max();
244 template <
typename T>
252 template <
typename Value_T>
269 typedef boost::shared_ptr<TriangleFilter>
Ptr;
270 typedef boost::shared_ptr<const TriangleFilter>
CPtr;
282 virtual float eval(
const float x)
const
294 template <
typename Value_T>
308 typedef boost::shared_ptr<GaussianFilter>
Ptr;
309 typedef boost::shared_ptr<const GaussianFilter>
CPtr;
320 virtual float eval(
const float t)
const
323 return std::max(0.0f, std::exp(-
m_alpha * x * x) -
m_exp);
329 template <
typename Value_T>
343 typedef boost::shared_ptr<MitchellFilter>
Ptr;
344 typedef boost::shared_ptr<const MitchellFilter>
CPtr;
350 const float B = 1.0 / 3.0,
const float C = 1.0 / 3.0)
354 virtual float eval(
const float x)
const
360 }
else if ((
ax >= 1) && (
ax < 2)) {
372 template <
typename Value_T>
409 template <
typename Field_T,
typename FilterOp_T,
bool IsAnalytic_T>
413 typedef typename Field_T::value_type T;
422 const float support =
filterOp.support();
510 template <
typename Field_T,
typename FilterOp_T>
516 typedef typename Field_T::value_type T;
518 if (!
src.dataWindow().hasVolume()) {
522 if (
src.dataWindow().min !=
V3i(0)) {
544 tgt.attribute =
src.attribute;
545 tgt.setMapping(
src.mapping());
559template <
typename Field_T,
typename FilterOp_T>
Contains the DenseField class.
double discToCont(int discCoord)
Goes from discrete coordinates to continuous coordinates See Graphics Gems - What is a pixel.
static int filter(std::string &name, const char *suffix)
FIELD3D_NAMESPACE_OPEN bool resample(const Field_T &src, Field_T &tgt, const V3i &newRes, const FilterOp_T &filter)
Resamples the source field into the target field, such that the new data window is @dataWindow.
Contains the SparseField class.
Box3i srcSupportBBox(const V3f &tgtP, const float support, const V3i &doUpres, const V3f &srcSize, const V3f &tgtSize)
V3f getDist(const V3i &doUpres, const V3f &srcP, const V3f &tgtP, const V3f &srcSize, const V3f &tgtSize)
void separable(const Field_T &src, Field_T &tgt, const V3i &newRes, const FilterOp_T &filterOp, const size_t dim)
bool separableResample(const Field_T &src, Field_T &tgt, const V3i &newRes, const FilterOp_T &filterOp)
Resamples the source field into the target field, using separable execution, which is faster than res...
#define FIELD3D_NAMESPACE_HEADER_CLOSE
static const bool isAnalytic
virtual float support() const
Radial width of the filter (half of diameter)
boost::shared_ptr< const BoxFilter > CPtr
virtual float eval(const float x) const
Evaluates the filter at coordinate 't'.
static void op(Value_T &accumValue, const Value_T value)
boost::shared_ptr< BoxFilter > Ptr
BoxFilter(const float width)
boost::shared_ptr< const Filter > CPtr
virtual float eval(const float t) const =0
Evaluates the filter at coordinate 't'.
boost::shared_ptr< Filter > Ptr
virtual float support() const =0
Radial width of the filter (half of diameter)
virtual float initialValue() const
Initial value (zero by default, but need to be different for min/max)
static const bool isAnalytic
boost::shared_ptr< const GaussianFilter > CPtr
boost::shared_ptr< GaussianFilter > Ptr
virtual float eval(const float t) const
Evaluates the filter at coordinate 't'.
GaussianFilter(const float alpha=2.0, const float width=2.0)
virtual float support() const
Radial width of the filter (half of diameter)
static void op(Value_T &accumValue, const Value_T value)
static void op(Value_T &accumValue, const Value_T value)
static const bool isAnalytic
boost::shared_ptr< MaxFilter > Ptr
static void op(Imath::Vec3< T > &accumValue, const Imath::Vec3< T > value)
boost::shared_ptr< const MaxFilter > CPtr
virtual float support() const
Radial width of the filter (half of diameter)
MaxFilter(const float width)
virtual float initialValue() const
Initial value (zero by default, but need to be different for min/max)
virtual float eval(const float x) const
Evaluates the filter at coordinate 't'.
virtual float support() const
Radial width of the filter (half of diameter)
MinFilter(const float width)
static void op(Value_T &accumValue, const Value_T value)
virtual float initialValue() const
Initial value (zero by default, but need to be different for min/max)
static const bool isAnalytic
virtual float eval(const float x) const
Evaluates the filter at coordinate 't'.
static void op(Imath::Vec3< T > &accumValue, const Imath::Vec3< T > value)
boost::shared_ptr< MinFilter > Ptr
boost::shared_ptr< const MinFilter > CPtr
virtual float support() const
Radial width of the filter (half of diameter)
boost::shared_ptr< MitchellFilter > Ptr
MitchellFilter(const float width=1.0, const float B=1.0/3.0, const float C=1.0/3.0)
static void op(Value_T &accumValue, const Value_T value)
boost::shared_ptr< const MitchellFilter > CPtr
virtual float eval(const float x) const
Evaluates the filter at coordinate 't'.
static const bool isAnalytic
boost::shared_ptr< TriangleFilter > Ptr
virtual float eval(const float x) const
Evaluates the filter at coordinate 't'.
static const bool isAnalytic
TriangleFilter(const float width)
static void op(Value_T &, const Value_T)
boost::shared_ptr< const TriangleFilter > CPtr
virtual float support() const
Radial width of the filter (half of diameter)