26 "Class hierarchy: :class:`Interface0D` > :class:`SVertex`\n"
28 "Class to define a vertex of the embedding.\n"
30 ".. method:: __init__()\n"
31 " __init__(brother)\n"
32 " __init__(point_3d, id)\n"
34 " Builds a :class:`SVertex` using the default constructor,\n"
35 " copy constructor or the overloaded constructor which builds"
36 " a :class:`SVertex` from 3D coordinates and an Id.\n"
38 " :arg brother: A SVertex object.\n"
39 " :type brother: :class:`SVertex`\n"
40 " :arg point_3d: A three-dimensional vector.\n"
41 " :type point_3d: :class:`mathutils.Vector`\n"
42 " :arg id: An Id object.\n"
43 " :type id: :class:`Id`\n");
46 static const char *kwlist_1[] = {
"brother",
nullptr};
47 static const char *kwlist_2[] = {
"point_3d",
"id",
nullptr};
48 PyObject *obj =
nullptr;
51 if (PyArg_ParseTupleAndKeywords(args, kwds,
"|O!", (
char **)kwlist_1, &
SVertex_Type, &obj)) {
59 else if ((
void)PyErr_Clear(),
60 PyArg_ParseTupleAndKeywords(
67 PyErr_SetString(PyExc_TypeError,
"invalid argument(s)");
71 self->py_if0D.borrowed =
false;
77 SVertex_add_normal_doc,
78 ".. method:: add_normal(normal)\n"
80 " Adds a normal to the SVertex's set of normals. If the same normal\n"
81 " is already in the set, nothing changes.\n"
83 " :arg normal: A three-dimensional vector.\n"
84 " :type normal: :class:`mathutils.Vector` | tuple[float, float, float] | list[float]\n");
87 static const char *kwlist[] = {
"normal",
nullptr};
91 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O", (
char **)kwlist, &py_normal)) {
95 PyErr_SetString(PyExc_TypeError,
96 "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
99 self->sv->AddNormal(n);
105 SVertex_add_fedge_doc,
106 ".. method:: add_fedge(fedge)\n"
108 " Add an FEdge to the list of edges emanating from this SVertex.\n"
110 " :arg fedge: An FEdge.\n"
111 " :type fedge: :class:`FEdge`\n");
114 static const char *kwlist[] = {
"fedge",
nullptr};
117 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist, &
FEdge_Type, &py_fe)) {
128# pragma clang diagnostic push
129# pragma clang diagnostic ignored "-Wcast-function-type"
131# pragma GCC diagnostic push
132# pragma GCC diagnostic ignored "-Wcast-function-type"
139 METH_VARARGS | METH_KEYWORDS,
140 SVertex_add_normal_doc},
143 METH_VARARGS | METH_KEYWORDS,
144 SVertex_add_fedge_doc},
145 {
nullptr,
nullptr, 0,
nullptr},
150# pragma clang diagnostic pop
152# pragma GCC diagnostic pop
159#define MATHUTILS_SUBTYPE_POINT3D 1
160#define MATHUTILS_SUBTYPE_POINT2D 2
175 bmo->data[0] =
self->sv->getX();
176 bmo->data[1] =
self->sv->getY();
177 bmo->data[2] =
self->sv->getZ();
180 bmo->data[0] =
self->sv->getProjectedX();
181 bmo->data[1] =
self->sv->getProjectedY();
182 bmo->data[2] =
self->sv->getProjectedZ();
195 Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
196 self->sv->setPoint3D(p);
200 Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
201 self->sv->setPoint2D(p);
217 bmo->data[0] =
self->sv->getX();
220 bmo->data[1] =
self->sv->getY();
223 bmo->data[2] =
self->sv->getZ();
232 bmo->data[0] =
self->sv->getProjectedX();
235 bmo->data[1] =
self->sv->getProjectedY();
238 bmo->data[2] =
self->sv->getProjectedZ();
256 p[index] = bmo->data[index];
257 self->sv->setPoint3D(p);
262 p[index] = bmo->data[index];
263 self->sv->setPoint2D(p);
291 SVertex_point_3d_doc,
292 "The 3D coordinates of the SVertex.\n"
294 ":type: :class:`mathutils.Vector`\n");
308 self->sv->setPoint3D(p);
314 SVertex_point_2d_doc,
315 "The projected 3D coordinates of the SVertex.\n"
317 ":type: :class:`mathutils.Vector`\n");
331 self->sv->setPoint2D(p);
338 "The Id of this SVertex.\n"
340 ":type: :class:`Id`\n");
350 PyErr_SetString(PyExc_TypeError,
"value must be an Id");
360 "The normals for this Vertex as a list. In a sharp surface, an SVertex\n"
361 "has exactly one normal. In a smooth surface, an SVertex can have any\n"
362 "number of normals.\n"
364 ":type: list of :class:`mathutils.Vector`\n");
367 PyObject *py_normals;
369 set<Vec3r>::iterator it;
370 py_normals = PyList_New(
normals.size());
382 SVertex_normals_size_doc,
383 "The number of different normals for this SVertex.\n"
388 return PyLong_FromLong(
self->sv->normalsSize());
393 SVertex_viewvertex_doc,
394 "If this SVertex is also a ViewVertex, this property refers to the\n"
395 "ViewVertex, and None otherwise.\n"
397 ":type: :class:`ViewVertex`\n");
409 SVertex_curvatures_doc,
410 "Curvature information expressed in the form of a seven-element tuple\n"
411 "(K1, e1, K2, e2, Kr, er, dKr), where K1 and K2 are scalar values\n"
412 "representing the first (maximum) and second (minimum) principal\n"
413 "curvatures at this SVertex, respectively; e1 and e2 are\n"
414 "three-dimensional vectors representing the first and second principal\n"
415 "directions, i.e. the directions of the normal plane where the\n"
416 "curvature takes its maximum and minimum values, respectively; and Kr,\n"
417 "er and dKr are the radial curvature, radial direction, and the\n"
418 "derivative of the radial curvature at this SVertex, respectively.\n"
430 PyObject *retval = PyTuple_New(7);
432 PyFloat_FromDouble(info->
K1),
433 PyFloat_FromDouble(info->
K2),
436 PyFloat_FromDouble(info->
Kr),
438 PyFloat_FromDouble(info->
dKr));
446 SVertex_point_3d_doc,
451 SVertex_point_2d_doc,
458 SVertex_normals_size_doc,
463 SVertex_viewvertex_doc,
468 SVertex_curvatures_doc,
470 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
476 PyVarObject_HEAD_INIT(
nullptr, 0)
495 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
PyObject * Vector_from_Vec3r(Vec3r &vec)
PyObject * BPy_Id_from_Id(Id &id)
PyObject * Any_BPy_ViewVertex_from_ViewVertex(ViewVertex &vv)
int convert_v3(PyObject *obj, void *v)
bool Vec3r_ptr_from_PyObject(PyObject *obj, Vec3r &vec)
PyTypeObject Interface0D_Type
static PyObject * SVertex_point_3d_get(BPy_SVertex *self, void *)
static int SVertex_point_3d_set(BPy_SVertex *self, PyObject *value, void *)
static int SVertex_point_2d_set(BPy_SVertex *self, PyObject *value, void *)
static PyObject * SVertex_add_normal(BPy_SVertex *self, PyObject *args, PyObject *kwds)
#define MATHUTILS_SUBTYPE_POINT3D
PyDoc_STRVAR(SVertex_doc, "Class hierarchy: :class:`Interface0D` > :class:`SVertex`\n" "\n" "Class to define a vertex of the embedding.\n" "\n" ".. method:: __init__()\n" " __init__(brother)\n" " __init__(point_3d, id)\n" "\n" " Builds a :class:`SVertex` using the default constructor,\n" " copy constructor or the overloaded constructor which builds" " a :class:`SVertex` from 3D coordinates and an Id.\n" "\n" " :arg brother: A SVertex object.\n" " :type brother: :class:`SVertex`\n" " :arg point_3d: A three-dimensional vector.\n" " :type point_3d: :class:`mathutils.Vector`\n" " :arg id: An Id object.\n" " :type id: :class:`Id`\n")
#define MATHUTILS_SUBTYPE_POINT2D
void SVertex_mathutils_register_callback()
static PyObject * SVertex_viewvertex_get(BPy_SVertex *self, void *)
static PyObject * SVertex_point_2d_get(BPy_SVertex *self, void *)
static uchar SVertex_mathutils_cb_index
PyTypeObject SVertex_Type
static int SVertex_mathutils_set_index(BaseMathObject *bmo, int subtype, int index)
static PyMethodDef BPy_SVertex_methods[]
static int SVertex_init(BPy_SVertex *self, PyObject *args, PyObject *kwds)
static PyObject * SVertex_curvatures_get(BPy_SVertex *self, void *)
static PyObject * SVertex_normals_size_get(BPy_SVertex *self, void *)
static Mathutils_Callback SVertex_mathutils_cb
static PyObject * SVertex_normals_get(BPy_SVertex *self, void *)
static int SVertex_mathutils_get(BaseMathObject *bmo, int subtype)
static PyObject * SVertex_add_fedge(BPy_SVertex *self, PyObject *args, PyObject *kwds)
static int SVertex_mathutils_set(BaseMathObject *bmo, int subtype)
static int SVertex_id_set(BPy_SVertex *self, PyObject *value, void *)
static PyObject * SVertex_id_get(BPy_SVertex *self, void *)
static int SVertex_mathutils_get_index(BaseMathObject *bmo, int subtype, int index)
static int SVertex_mathutils_check(BaseMathObject *bmo)
static PyGetSetDef BPy_SVertex_getseters[]
#define BPy_SVertex_Check(v)
ATTR_WARN_UNUSED_RESULT const BMVert * v
static float normals[][3]
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
uchar Mathutils_RegisterCallback(Mathutils_Callback *cb)
PyObject * Vector_CreatePyObject_cb(PyObject *cb_user, int vec_num, uchar cb_type, uchar cb_subtype)
VecMat::Vec3< real > Vec3r
#define PyTuple_SET_ITEMS(op_arg,...)