Blender  V2.93
BPy_DensityF0D.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 
21 #include "BPy_DensityF0D.h"
22 
23 #include "../../../stroke/AdvancedFunctions0D.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 using namespace Freestyle;
30 
32 
33 //------------------------INSTANCE METHODS ----------------------------------
34 
35 static char DensityF0D___doc__[] =
36  "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > "
37  ":class:`freestyle.types.UnaryFunction0DDouble` > :class:`DensityF0D`\n"
38  "\n"
39  ".. method:: __init__(sigma=2.0)\n"
40  "\n"
41  " Builds a DensityF0D object.\n"
42  "\n"
43  " :arg sigma: The gaussian sigma value indicating the X value for\n"
44  " which the gaussian function is 0.5. It leads to the window size\n"
45  " value (the larger, the smoother).\n"
46  " :type sigma: float\n"
47  "\n"
48  ".. method:: __call__(it)\n"
49  "\n"
50  " Returns the density of the (result) image evaluated at the\n"
51  " :class:`freestyle.types.Interface0D` pointed by the\n"
52  " Interface0DIterator. This density is evaluated using a pixels square\n"
53  " window around the evaluation point and integrating these values using\n"
54  " a gaussian.\n"
55  "\n"
56  " :arg it: An Interface0DIterator object.\n"
57  " :type it: :class:`freestyle.types.Interface0DIterator`\n"
58  " :return: The density of the image evaluated at the pointed\n"
59  " Interface0D.\n"
60  " :rtype: float\n";
61 
62 static int DensityF0D___init__(BPy_DensityF0D *self, PyObject *args, PyObject *kwds)
63 {
64  static const char *kwlist[] = {"sigma", nullptr};
65  double d = 2;
66 
67  if (!PyArg_ParseTupleAndKeywords(args, kwds, "|d", (char **)kwlist, &d)) {
68  return -1;
69  }
70  self->py_uf0D_double.uf0D_double = new Functions0D::DensityF0D(d);
71  self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self;
72  return 0;
73 }
74 
75 /*-----------------------BPy_DensityF0D type definition ------------------------------*/
76 
77 PyTypeObject DensityF0D_Type = {
78  PyVarObject_HEAD_INIT(nullptr, 0) "DensityF0D", /* tp_name */
79  sizeof(BPy_DensityF0D), /* tp_basicsize */
80  0, /* tp_itemsize */
81  nullptr, /* tp_dealloc */
82  0, /* tp_vectorcall_offset */
83  nullptr, /* tp_getattr */
84  nullptr, /* tp_setattr */
85  nullptr, /* tp_reserved */
86  nullptr, /* tp_repr */
87  nullptr, /* tp_as_number */
88  nullptr, /* tp_as_sequence */
89  nullptr, /* tp_as_mapping */
90  nullptr, /* tp_hash */
91  nullptr, /* tp_call */
92  nullptr, /* tp_str */
93  nullptr, /* tp_getattro */
94  nullptr, /* tp_setattro */
95  nullptr, /* tp_as_buffer */
96  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
97  DensityF0D___doc__, /* tp_doc */
98  nullptr, /* tp_traverse */
99  nullptr, /* tp_clear */
100  nullptr, /* tp_richcompare */
101  0, /* tp_weaklistoffset */
102  nullptr, /* tp_iter */
103  nullptr, /* tp_iternext */
104  nullptr, /* tp_methods */
105  nullptr, /* tp_members */
106  nullptr, /* tp_getset */
107  &UnaryFunction0DDouble_Type, /* tp_base */
108  nullptr, /* tp_dict */
109  nullptr, /* tp_descr_get */
110  nullptr, /* tp_descr_set */
111  0, /* tp_dictoffset */
112  (initproc)DensityF0D___init__, /* tp_init */
113  nullptr, /* tp_alloc */
114  nullptr, /* tp_new */
115 };
116 
118 
119 #ifdef __cplusplus
120 }
121 #endif
static char DensityF0D___doc__[]
static int DensityF0D___init__(BPy_DensityF0D *self, PyObject *args, PyObject *kwds)
PyTypeObject DensityF0D_Type
PyTypeObject UnaryFunction0DDouble_Type
inherits from class Rep
Definition: AppCanvas.cpp:32