Files
test2/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h
Sergey Sharybin c1bc70b711 Cleanup: Add a copyright notice to files and use SPDX format
A lot of files were missing copyright field in the header and
the Blender Foundation contributed to them in a sense of bug
fixing and general maintenance.

This change makes it explicit that those files are at least
partially copyrighted by the Blender Foundation.

Note that this does not make it so the Blender Foundation is
the only holder of the copyright in those files, and developers
who do not have a signed contract with the foundation still
hold the copyright as well.

Another aspect of this change is using SPDX format for the
header. We already used it for the license specification,
and now we state it for the copyright as well, following the
FAQ:

    https://reuse.software/faq/
2023-05-31 16:19:06 +02:00

72 lines
1.5 KiB
C++

/* SPDX-FileCopyrightText: 2023 Blender Foundation
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/** \file
* \ingroup freestyle
* \brief Class gathering stroke creation algorithms
*/
#include <string>
#include "AdvancedFunctions1D.h"
#include "Predicates1D.h"
#include "../view_map/Interface1D.h"
//
// Predicates definitions
//
///////////////////////////////////////////////////////////
namespace Freestyle {
namespace Predicates1D {
// DensityLowerThanUP1D
/** Returns true if the density evaluated for the
* Interface1D is less than a user-defined density value.
*/
class DensityLowerThanUP1D : public UnaryPredicate1D {
public:
/** Builds the functor.
* \param threshold:
* The value of the threshold density.
* Any Interface1D having a density lower than this threshold will match.
* \param sigma:
* The sigma value defining the density evaluation window size used in the DensityF0D functor.
*/
DensityLowerThanUP1D(double threshold, double sigma = 2)
{
_threshold = threshold;
_sigma = sigma;
}
/** Returns the string "DensityLowerThanUP1D" */
string getName() const
{
return "DensityLowerThanUP1D";
}
/** The () operator. */
int operator()(Interface1D &inter)
{
Functions1D::DensityF1D fun(_sigma);
if (fun(inter) < 0) {
return -1;
}
result = (fun.result < _threshold);
return 0;
}
private:
double _sigma;
double _threshold;
};
} // end of namespace Predicates1D
} /* namespace Freestyle */