Files
test/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h
Campbell Barton e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00

72 lines
1.5 KiB
C++

/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* 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 */