OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * ***** BEGIN GPL LICENSE BLOCK ***** |
| 3 * |
| 4 * This program is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU General Public License |
| 6 * as published by the Free Software Foundation; either version 2 |
| 7 * of the License, or (at your option) any later version. |
| 8 * |
| 9 * This program is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with this program; if not, write to the Free Software Foundation, |
| 16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 * |
| 18 * The Original Code is Copyright (C) 2010 Blender Foundation. |
| 19 * All rights reserved. |
| 20 * |
| 21 * The Original Code is: all of this file. |
| 22 * |
| 23 * Contributor(s): none yet. |
| 24 * |
| 25 * ***** END GPL LICENSE BLOCK ***** |
| 26 */ |
| 27 |
| 28 #ifndef __FREESTYLE_ADVANCED_PREDICATES_1D_H__ |
| 29 #define __FREESTYLE_ADVANCED_PREDICATES_1D_H__ |
| 30 |
| 31 /** \file blender/freestyle/intern/stroke/AdvancedPredicates1D.h |
| 32 * \ingroup freestyle |
| 33 * \brief Class gathering stroke creation algorithms |
| 34 * \author Stephane Grabli |
| 35 * \date 01/07/2003 |
| 36 */ |
| 37 |
| 38 #include <string> |
| 39 |
| 40 #include "AdvancedFunctions1D.h" |
| 41 #include "Predicates1D.h" |
| 42 |
| 43 #include "../view_map/Interface1D.h" |
| 44 |
| 45 // |
| 46 // Predicates definitions |
| 47 // |
| 48 /////////////////////////////////////////////////////////// |
| 49 |
| 50 namespace Predicates1D { |
| 51 |
| 52 // DensityLowerThanUP1D |
| 53 /*! Returns true if the density evaluated for the |
| 54 * Interface1D is less than a user-defined density value. |
| 55 */ |
| 56 class DensityLowerThanUP1D : public UnaryPredicate1D |
| 57 { |
| 58 public: |
| 59 /*! Builds the functor. |
| 60 * \param threshold |
| 61 * The value of the threshold density. |
| 62 * Any Interface1D having a density lower than this threshold will ma
tch. |
| 63 * \param sigma |
| 64 * The sigma value defining the density evaluation window size used i
n the DensityF0D functor. |
| 65 */ |
| 66 DensityLowerThanUP1D(double threshold, double sigma = 2) |
| 67 { |
| 68 _threshold = threshold; |
| 69 _sigma = sigma; |
| 70 } |
| 71 |
| 72 /*! Returns the string "DensityLowerThanUP1D" */ |
| 73 string getName() const |
| 74 { |
| 75 return "DensityLowerThanUP1D"; |
| 76 } |
| 77 |
| 78 /*! The () operator. */ |
| 79 int operator()(Interface1D& inter) |
| 80 { |
| 81 Functions1D::DensityF1D fun(_sigma); |
| 82 if (fun(inter) < 0) |
| 83 return -1; |
| 84 result = (fun.result < _threshold); |
| 85 return 0; |
| 86 } |
| 87 |
| 88 private: |
| 89 double _sigma; |
| 90 double _threshold; |
| 91 }; |
| 92 |
| 93 } // end of namespace Predicates1D |
| 94 |
| 95 #endif // __FREESTYLE_ADVANCED_PREDICATES_1D_H__ |
OLD | NEW |