Blender  V3.3
BPy_DensityLowerThanUP1D.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
8 
9 #include "../../stroke/AdvancedPredicates1D.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 using namespace Freestyle;
16 
18 
19 //------------------------INSTANCE METHODS ----------------------------------
20 
22  "Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`DensityLowerThanUP1D`\n"
23  "\n"
24  ".. method:: __init__(threshold, sigma=2.0)\n"
25  "\n"
26  " Builds a DensityLowerThanUP1D object.\n"
27  "\n"
28  " :arg threshold: The value of the threshold density. Any Interface1D\n"
29  " having a density lower than this threshold will match.\n"
30  " :type threshold: float\n"
31  " :arg sigma: The sigma value defining the density evaluation window\n"
32  " size used in the :class:`freestyle.functions.DensityF0D` functor.\n"
33  " :type sigma: float\n"
34  "\n"
35  ".. method:: __call__(inter)\n"
36  "\n"
37  " Returns true if the density evaluated for the Interface1D is less\n"
38  " than a user-defined density value.\n"
39  "\n"
40  " :arg inter: An Interface1D object.\n"
41  " :type inter: :class:`freestyle.types.Interface1D`\n"
42  " :return: True if the density is lower than a threshold.\n"
43  " :rtype: bool\n";
44 
46  PyObject *args,
47  PyObject *kwds)
48 {
49  static const char *kwlist[] = {"threshold", "sigma", nullptr};
50  double d1, d2 = 2.0;
51 
52  if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|d", (char **)kwlist, &d1, &d2)) {
53  return -1;
54  }
55  self->py_up1D.up1D = new Predicates1D::DensityLowerThanUP1D(d1, d2);
56  return 0;
57 }
58 
59 /*-----------------------BPy_DensityLowerThanUP1D type definition ------------------------------*/
60 
61 PyTypeObject DensityLowerThanUP1D_Type = {
62  PyVarObject_HEAD_INIT(nullptr, 0) "DensityLowerThanUP1D", /* tp_name */
63  sizeof(BPy_DensityLowerThanUP1D), /* tp_basicsize */
64  0, /* tp_itemsize */
65  nullptr, /* tp_dealloc */
66  0, /* tp_vectorcall_offset */
67  nullptr, /* tp_getattr */
68  nullptr, /* tp_setattr */
69  nullptr, /* tp_reserved */
70  nullptr, /* tp_repr */
71  nullptr, /* tp_as_number */
72  nullptr, /* tp_as_sequence */
73  nullptr, /* tp_as_mapping */
74  nullptr, /* tp_hash */
75  nullptr, /* tp_call */
76  nullptr, /* tp_str */
77  nullptr, /* tp_getattro */
78  nullptr, /* tp_setattro */
79  nullptr, /* tp_as_buffer */
80  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
81  DensityLowerThanUP1D___doc__, /* tp_doc */
82  nullptr, /* tp_traverse */
83  nullptr, /* tp_clear */
84  nullptr, /* tp_richcompare */
85  0, /* tp_weaklistoffset */
86  nullptr, /* tp_iter */
87  nullptr, /* tp_iternext */
88  nullptr, /* tp_methods */
89  nullptr, /* tp_members */
90  nullptr, /* tp_getset */
91  &UnaryPredicate1D_Type, /* tp_base */
92  nullptr, /* tp_dict */
93  nullptr, /* tp_descr_get */
94  nullptr, /* tp_descr_set */
95  0, /* tp_dictoffset */
96  (initproc)DensityLowerThanUP1D___init__, /* tp_init */
97  nullptr, /* tp_alloc */
98  nullptr, /* tp_new */
99 };
100 
102 
103 #ifdef __cplusplus
104 }
105 #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:18