Blender  V3.3
bmesh_py_geometry.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2012 Blender Foundation. All rights reserved. */
3 
11 #include <Python.h>
12 
13 #include "BLI_utildefines.h"
14 
15 #include "../mathutils/mathutils.h"
16 
17 #include "bmesh.h"
18 #include "bmesh_py_geometry.h" /* own include */
19 #include "bmesh_py_types.h"
20 
21 PyDoc_STRVAR(bpy_bm_geometry_intersect_face_point_doc,
22  ".. method:: intersect_face_point(face, point)\n"
23  "\n"
24  " Tests if the projection of a point is inside a face (using the face's normal).\n"
25  "\n"
26  " :arg face: The face to test.\n"
27  " :type face: :class:`bmesh.types.BMFace`\n"
28  " :arg point: The point to test.\n"
29  " :type point: float triplet\n"
30  " :return: True when the projection of the point is in the face.\n"
31  " :rtype: bool\n");
32 static PyObject *bpy_bm_geometry_intersect_face_point(BPy_BMFace *UNUSED(self), PyObject *args)
33 {
34  BPy_BMFace *py_face;
35  PyObject *py_point;
36  float point[3];
37  bool ret;
38 
39  if (!PyArg_ParseTuple(args, "O!O:intersect_face_point", &BPy_BMFace_Type, &py_face, &py_point)) {
40  return NULL;
41  }
42 
43  BPY_BM_CHECK_OBJ(py_face);
44  if (mathutils_array_parse(point, 3, 3, py_point, "intersect_face_point") == -1) {
45  return NULL;
46  }
47 
48  ret = BM_face_point_inside_test(py_face->f, point);
49 
50  return PyBool_FromLong(ret);
51 }
52 
53 static struct PyMethodDef BPy_BM_geometry_methods[] = {
54  {"intersect_face_point",
56  METH_VARARGS,
57  bpy_bm_geometry_intersect_face_point_doc},
58  {NULL, NULL, 0, NULL},
59 };
60 
61 PyDoc_STRVAR(BPy_BM_utils_doc,
62  "This module provides access to bmesh geometry evaluation functions.");
63 static struct PyModuleDef BPy_BM_geometry_module_def = {
64  PyModuleDef_HEAD_INIT,
65  "bmesh.geometry", /* m_name */
66  BPy_BM_utils_doc, /* m_doc */
67  0, /* m_size */
68  BPy_BM_geometry_methods, /* m_methods */
69  NULL, /* m_reload */
70  NULL, /* m_traverse */
71  NULL, /* m_clear */
72  NULL, /* m_free */
73 };
74 
75 PyObject *BPyInit_bmesh_geometry(void)
76 {
77  PyObject *submodule;
78 
79  submodule = PyModule_Create(&BPy_BM_geometry_module_def);
80 
81  return submodule;
82 }
#define UNUSED(x)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
bool BM_face_point_inside_test(const BMFace *f, const float co[3])
PyDoc_STRVAR(bpy_bm_geometry_intersect_face_point_doc, ".. method:: intersect_face_point(face, point)\n" "\n" " Tests if the projection of a point is inside a face (using the face's normal).\n" "\n" " :arg face: The face to test.\n" " :type face: :class:`bmesh.types.BMFace`\n" " :arg point: The point to test.\n" " :type point: float triplet\n" " :return: True when the projection of the point is in the face.\n" " :rtype: bool\n")
PyObject * BPyInit_bmesh_geometry(void)
static struct PyModuleDef BPy_BM_geometry_module_def
static PyObject * bpy_bm_geometry_intersect_face_point(BPy_BMFace *UNUSED(self), PyObject *args)
static struct PyMethodDef BPy_BM_geometry_methods[]
PyTypeObject BPy_BMFace_Type
#define BPY_BM_CHECK_OBJ(obj)
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
Definition: mathutils.c:98
return ret
struct BMFace * f