2
* ***** BEGIN GPL LICENSE BLOCK *****
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.
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.
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.
18
* ***** END GPL LICENSE BLOCK *****
21
/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp
25
#include "BPy_PolygonalizationShader.h"
27
#include "../../stroke/BasicStrokeShaders.h"
33
///////////////////////////////////////////////////////////////////////////////////////////
35
//------------------------INSTANCE METHODS ----------------------------------
37
static char PolygonalizationShader___doc__[] =
38
"Class hierarchy: :class:`StrokeShader` > :class:`PolygonalizationShader`\n"
42
".. method:: __init__(error)\n"
44
" Builds a PolygonalizationShader object.\n"
46
" :arg error: The error we want our polygonal approximation to have\n"
47
" with respect to the original geometry. The smaller, the closer\n"
48
" the new stroke is to the orinal one. This error corresponds to\n"
49
" the maximum distance between the new stroke and the old one.\n"
50
" :type error: float\n"
52
".. method:: shade(stroke)\n"
54
" Modifies the Stroke geometry so that it looks more \"polygonal\".\n"
55
" The basic idea is to start from the minimal stroke approximation\n"
56
" consisting in a line joining the first vertex to the last one and\n"
57
" to subdivide using the original stroke vertices until a certain\n"
58
" error is reached.\n"
60
" :arg stroke: A Stroke object.\n"
61
" :type stroke: :class:`Stroke`\n";
63
static int PolygonalizationShader___init__(BPy_PolygonalizationShader *self, PyObject *args, PyObject *kwds)
65
static const char *kwlist[] = {"error", NULL};
68
if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f))
70
self->py_ss.ss = new StrokeShaders::PolygonalizationShader(f);
74
/*-----------------------BPy_PolygonalizationShader type definition ------------------------------*/
76
PyTypeObject PolygonalizationShader_Type = {
77
PyVarObject_HEAD_INIT(NULL, 0)
78
"PolygonalizationShader", /* tp_name */
79
sizeof(BPy_PolygonalizationShader), /* tp_basicsize */
88
0, /* tp_as_sequence */
89
0, /* tp_as_mapping */
96
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
97
PolygonalizationShader___doc__, /* tp_doc */
100
0, /* tp_richcompare */
101
0, /* tp_weaklistoffset */
107
&StrokeShader_Type, /* tp_base */
109
0, /* tp_descr_get */
110
0, /* tp_descr_set */
111
0, /* tp_dictoffset */
112
(initproc)PolygonalizationShader___init__, /* tp_init */
117
///////////////////////////////////////////////////////////////////////////////////////////