MitchellFilter.cpp
Go to the documentation of this file.00001 /**<!--------------------------------------------------------------------> 00002 @file MitchellFilter.cpp 00003 @author Travis Fischer (fisch0920@gmail.com) 00004 @author Matthew Jacobs (jacobs.mh@gmail.com) 00005 @date Fall 2008 00006 00007 @brief 00008 2D symmetric Mitchell filter which is parameterized to tradeoff between 00009 'ringing' and 'blurring' that other filters tend towards in difficult 00010 reconstruction cases 00011 00012 @note 00013 Mitchell Filter taken from PBRT (Pharr, Humphreys) 00014 http://www.pbrt.org 00015 <!-------------------------------------------------------------------->**/ 00016 00017 #include "MitchellFilter.h" 00018 00019 void MitchellFilter::init() { 00020 KernelFilter::init(); 00021 00022 m_B = getValue<real_t>("B", m_B); 00023 m_C = getValue<real_t>("C", m_C); 00024 } 00025 00026 real_t MitchellFilter::evaluate(const Vector2 &pt) { 00027 return _evaluate(pt[0]) * _evaluate(pt[1]); 00028 } 00029 00030 real_t MitchellFilter::_evaluate(real_t x) const { 00031 x = ABS(2.0 * x / m_support); 00032 00033 if (x > 1.0) { 00034 return 00035 (((-m_B / 6.0 - m_C) * x + (m_B + 5.0 * m_C)) * x + 00036 (-2.0 * m_B - 8.0 * m_C)) * x + (4.0 / 3.0 * m_B + 4.0 * m_C); 00037 } else { 00038 return 00039 x * x * ((2.0 - 1.5 * m_B - m_C) * x + (-3.0 + 2.0 * m_B + m_C)) + 00040 (1.0 - m_B / 3.0); 00041 } 00042 } 00043
Generated on 28 Feb 2009 for Milton by
1.5.6