Blender  V2.93
BPy_DensityLowerThanUP1D.cpp
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
22 
23 #include "../../stroke/AdvancedPredicates1D.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 using namespace Freestyle;
30 
32 
33 //------------------------INSTANCE METHODS ----------------------------------
34 
36  "Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`DensityLowerThanUP1D`\n"
37  "\n"
38  ".. method:: __init__(threshold, sigma=2.0)\n"
39  "\n"
40  " Builds a DensityLowerThanUP1D object.\n"
41  "\n"
42  " :arg threshold: The value of the threshold density. Any Interface1D\n"
43  " having a density lower than this threshold will match.\n"
44  " :type threshold: float\n"
45  " :arg sigma: The sigma value defining the density evaluation window\n"
46  " size used in the :class:`freestyle.functions.DensityF0D` functor.\n"
47  " :type sigma: float\n"
48  "\n"
49  ".. method:: __call__(inter)\n"
50  "\n"
51  " Returns true if the density evaluated for the Interface1D is less\n"
52  " than a user-defined density value.\n"
53  "\n"
54  " :arg inter: An Interface1D object.\n"
55  " :type inter: :class:`freestyle.types.Interface1D`\n"
56  " :return: True if the density is lower than a threshold.\n"
57  " :rtype: bool\n";
58 
60  PyObject *args,
61  PyObject *kwds)
62 {
63  static const char *kwlist[] = {"threshold", "sigma", nullptr};
64  double d1, d2 = 2.0;
65 
66  if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|d", (char **)kwlist, &d1, &d2)) {
67  return -1;
68  }
69  self->py_up1D.up1D = new Predicates1D::DensityLowerThanUP1D(d1, d2);
70  return 0;
71 }
72 
73 /*-----------------------BPy_DensityLowerThanUP1D type definition ------------------------------*/
74 
75 PyTypeObject DensityLowerThanUP1D_Type = {
76  PyVarObject_HEAD_INIT(nullptr, 0) "DensityLowerThanUP1D", /* tp_name */
77  sizeof(BPy_DensityLowerThanUP1D), /* tp_basicsize */
78  0, /* tp_itemsize */
79  nullptr, /* tp_dealloc */
80  0, /* tp_vectorcall_offset */
81  nullptr, /* tp_getattr */
82  nullptr, /* tp_setattr */
83  nullptr, /* tp_reserved */
84  nullptr, /* tp_repr */
85  nullptr, /* tp_as_number */
86  nullptr, /* tp_as_sequence */
87  nullptr, /* tp_as_mapping */
88  nullptr, /* tp_hash */
89  nullptr, /* tp_call */
90  nullptr, /* tp_str */
91  nullptr, /* tp_getattro */
92  nullptr, /* tp_setattro */
93  nullptr, /* tp_as_buffer */
94  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
95  DensityLowerThanUP1D___doc__, /* tp_doc */
96  nullptr, /* tp_traverse */
97  nullptr, /* tp_clear */
98  nullptr, /* tp_richcompare */
99  0, /* tp_weaklistoffset */
100  nullptr, /* tp_iter */
101  nullptr, /* tp_iternext */
102  nullptr, /* tp_methods */
103  nullptr, /* tp_members */
104  nullptr, /* tp_getset */
105  &UnaryPredicate1D_Type, /* tp_base */
106  nullptr, /* tp_dict */
107  nullptr, /* tp_descr_get */
108  nullptr, /* tp_descr_set */
109  0, /* tp_dictoffset */
110  (initproc)DensityLowerThanUP1D___init__, /* tp_init */
111  nullptr, /* tp_alloc */
112  nullptr, /* tp_new */
113 };
114 
116 
117 #ifdef __cplusplus
118 }
119 #endif
PyTypeObject DensityLowerThanUP1D_Type
static char DensityLowerThanUP1D___doc__[]
static int DensityLowerThanUP1D___init__(BPy_DensityLowerThanUP1D *self, PyObject *args, PyObject *kwds)
PyTypeObject UnaryPredicate1D_Type
inherits from class Rep
Definition: AppCanvas.cpp:32