517b07f5c7f889e019fa5a008793b797a3ca553b
[blender.git] / source / blender / freestyle / intern / python / UnaryFunction1D / UnaryFunction1D_double / BPy_GetDirectionalViewMapDensityF1D.cpp
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * ***** END GPL LICENSE BLOCK *****
19  */
20
21 /** \file source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp
22  *  \ingroup freestyle
23  */
24
25 #include "BPy_GetDirectionalViewMapDensityF1D.h"
26
27 #include "../../../stroke/AdvancedFunctions1D.h"
28 #include "../../BPy_Convert.h"
29 #include "../../BPy_IntegrationType.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 ///////////////////////////////////////////////////////////////////////////////////////////
36
37 //------------------------INSTANCE METHODS ----------------------------------
38
39 static char GetDirectionalViewMapDensityF1D___doc__[] =
40 "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` "
41 "> :class:`GetDirectionalViewMapDensityF1D`\n"
42 "\n"
43 ".. method:: __init__(orientation, level, integration_type=IntegrationType.MEAN, sampling=2.0)\n"
44 "\n"
45 "   Builds a GetDirectionalViewMapDensityF1D object.\n"
46 "\n"
47 "   :arg orientation: The number of the directional map we must work\n"
48 "      with.\n"
49 "   :type orientation: int\n"
50 "   :arg level: The level of the pyramid from which the pixel must be\n"
51 "      read.\n"
52 "   :type level: int\n"
53 "   :arg integration_type: The integration method used to compute a single value\n"
54 "      from a set of values.\n"
55 "   :type integration_type: :class:`freestyle.types.IntegrationType`\n"
56 "   :arg sampling: The resolution used to sample the chain: the\n"
57 "      corresponding 0D function is evaluated at each sample point and\n"
58 "      the result is obtained by combining the resulting values into a\n"
59 "      single one, following the method specified by integration_type.\n"
60 "   :type sampling: float\n"
61 "\n"
62 ".. method:: __call__(inter)\n"
63 "\n"
64 "   Returns the density evaluated for an Interface1D in of the steerable\n"
65 "   viewmaps image.  The direction telling which Directional map to choose\n"
66 "   is explicitely specified by the user.  The density is evaluated for a\n"
67 "   set of points along the Interface1D (using the\n"
68 "   :class:`freestyle.functions.ReadSteerableViewMapPixelF0D` functor) and\n"
69 "   then integrated into a single value using a user-defined integration\n"
70 "   method.\n"
71 "\n"
72 "   :arg inter: An Interface1D object.\n"
73 "   :type inter: :class:`freestyle.types.Interface1D`\n"
74 "   :return: the density evaluated for an Interface1D in of the\n"
75 "      steerable viewmaps image.\n"
76 "   :rtype: float\n";
77
78 static int GetDirectionalViewMapDensityF1D___init__(BPy_GetDirectionalViewMapDensityF1D *self,
79                                                     PyObject *args, PyObject *kwds)
80 {
81         static const char *kwlist[] = {"orientation", "level", "integration_type", "sampling", NULL};
82         PyObject *obj = 0;
83         unsigned int u1, u2;
84         float f = 2.0;
85
86         if (!PyArg_ParseTupleAndKeywords(args, kwds, "II|O!f", (char **)kwlist, &u1, &u2, &IntegrationType_Type, &obj, &f))
87                 return -1;
88         IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
89         self->py_uf1D_double.uf1D_double = new Functions1D::GetDirectionalViewMapDensityF1D(u1, u2, t, f);
90         return 0;
91 }
92
93 /*-----------------------BPy_GetDirectionalViewMapDensityF1D type definition ------------------------------*/
94
95 PyTypeObject GetDirectionalViewMapDensityF1D_Type = {
96         PyVarObject_HEAD_INIT(NULL, 0)
97         "GetDirectionalViewMapDensityF1D", /* tp_name */
98         sizeof(BPy_GetDirectionalViewMapDensityF1D), /* tp_basicsize */
99         0,                              /* tp_itemsize */
100         0,                              /* tp_dealloc */
101         0,                              /* tp_print */
102         0,                              /* tp_getattr */
103         0,                              /* tp_setattr */
104         0,                              /* tp_reserved */
105         0,                              /* tp_repr */
106         0,                              /* tp_as_number */
107         0,                              /* tp_as_sequence */
108         0,                              /* tp_as_mapping */
109         0,                              /* tp_hash  */
110         0,                              /* tp_call */
111         0,                              /* tp_str */
112         0,                              /* tp_getattro */
113         0,                              /* tp_setattro */
114         0,                              /* tp_as_buffer */
115         Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
116         GetDirectionalViewMapDensityF1D___doc__, /* tp_doc */
117         0,                              /* tp_traverse */
118         0,                              /* tp_clear */
119         0,                              /* tp_richcompare */
120         0,                              /* tp_weaklistoffset */
121         0,                              /* tp_iter */
122         0,                              /* tp_iternext */
123         0,                              /* tp_methods */
124         0,                              /* tp_members */
125         0,                              /* tp_getset */
126         &UnaryFunction1DDouble_Type,    /* tp_base */
127         0,                              /* tp_dict */
128         0,                              /* tp_descr_get */
129         0,                              /* tp_descr_set */
130         0,                              /* tp_dictoffset */
131         (initproc)GetDirectionalViewMapDensityF1D___init__, /* tp_init */
132         0,                              /* tp_alloc */
133         0,                              /* tp_new */
134 };
135
136 ///////////////////////////////////////////////////////////////////////////////////////////
137
138 #ifdef __cplusplus
139 }
140 #endif