Blender V4.3
bl_math_py_api.cc File Reference
#include <Python.h>
#include "BLI_utildefines.h"
#include "bl_math_py_api.hh"

Go to the source code of this file.

Functions

Module Doc String
 PyDoc_STRVAR (M_bl_math_doc, "Miscellaneous math utilities module")
 
Python Functions
 PyDoc_STRVAR (py_bl_math_clamp_doc, ".. function:: clamp(value, min=0, max=1)\n" "\n" " Clamps the float value between minimum and maximum. To avoid\n" " confusion, any call must use either one or all three arguments.\n" "\n" " :arg value: The value to clamp.\n" " :type value: float\n" " :arg min: The minimum value, defaults to 0.\n" " :type min: float\n" " :arg max: The maximum value, defaults to 1.\n" " :type max: float\n" " :return: The clamped value.\n" " :rtype: float\n")
 
static PyObject * py_bl_math_clamp (PyObject *, PyObject *args)
 
 PyDoc_STRVAR (py_bl_math_lerp_doc, ".. function:: lerp(from_value, to_value, factor)\n" "\n" " Linearly interpolate between two float values based on factor.\n" "\n" " :arg from_value: The value to return when factor is 0.\n" " :type from_value: float\n" " :arg to_value: The value to return when factor is 1.\n" " :type to_value: float\n" " :arg factor: The interpolation value, normally in [0.0, 1.0].\n" " :type factor: float\n" " :return: The interpolated value.\n" " :rtype: float\n")
 
static PyObject * py_bl_math_lerp (PyObject *, PyObject *args)
 
 PyDoc_STRVAR (py_bl_math_smoothstep_doc, ".. function:: smoothstep(from_value, to_value, value)\n" "\n" " Performs smooth interpolation between 0 and 1 as value changes between from and " "to values.\n" " Outside the range the function returns the same value as the nearest edge.\n" "\n" " :arg from_value: The edge value where the result is 0.\n" " :type from_value: float\n" " :arg to_value: The edge value where the result is 1.\n" " :type to_value: float\n" " :arg factor: The interpolation value.\n" " :type factor: float\n" " :return: The interpolated value in [0.0, 1.0].\n" " :rtype: float\n")
 
static PyObject * py_bl_math_smoothstep (PyObject *, PyObject *args)
 

Module Definition

static PyMethodDef M_bl_math_methods []
 
static PyModuleDef M_bl_math_module_def
 
PyMODINIT_FUNC BPyInit_bl_math ()
 

Detailed Description

This file defines the 'bl_math' module, a module for math utilities.

Definition in file bl_math_py_api.cc.

Function Documentation

◆ BPyInit_bl_math()

PyMODINIT_FUNC BPyInit_bl_math ( )

Definition at line 150 of file bl_math_py_api.cc.

References M_bl_math_module_def.

◆ py_bl_math_clamp()

static PyObject * py_bl_math_clamp ( PyObject * ,
PyObject * args )
static

Definition at line 49 of file bl_math_py_api.cc.

References CLAMP, and x.

◆ py_bl_math_lerp()

static PyObject * py_bl_math_lerp ( PyObject * ,
PyObject * args )
static

Definition at line 84 of file bl_math_py_api.cc.

References b, and x.

◆ py_bl_math_smoothstep()

static PyObject * py_bl_math_smoothstep ( PyObject * ,
PyObject * args )
static

Definition at line 111 of file bl_math_py_api.cc.

References b, CLAMP, and x.

◆ PyDoc_STRVAR() [1/4]

PyDoc_STRVAR ( M_bl_math_doc ,
"Miscellaneous math utilities module"  )

◆ PyDoc_STRVAR() [2/4]

PyDoc_STRVAR ( py_bl_math_clamp_doc ,
".. function:: clamp(value, min=0, max=1)\n" "\n" " Clamps the float value between minimum and maximum. To avoid\n" " confusion,
any call must use either one or all three arguments.\n" "\n" " :arg value:The value to clamp.\n" " :type value:float\n" " :arg min:The minimum value,
defaults to 0.\n" " :type min:float\n" " :arg max:The maximum value,
defaults to 1.\n" " :type max:float\n" " :return:The clamped value.\n" " :rtype:float\n"  )

◆ PyDoc_STRVAR() [3/4]

PyDoc_STRVAR ( py_bl_math_lerp_doc ,
".. function:: lerp(from_value, to_value, factor)\n" "\n" " Linearly interpolate between two float values based on factor.\n" "\n" " :arg from_value: The value to return when factor is 0.\n" " :type from_value: float\n" " :arg to_value: The value to return when factor is 1.\n" " :type to_value: float\n" " :arg factor: The interpolation value,
normally in .\n" " :type factor:float\n" " :return:The interpolated value.\n" " :rtype:float\n" [0.0, 1.0] )

◆ PyDoc_STRVAR() [4/4]

PyDoc_STRVAR ( py_bl_math_smoothstep_doc ,
".. function:: smoothstep(from_value, to_value, value)\n" "\n" " Performs smooth interpolation between 0 and 1 as value changes between from and " "to values.\n" " Outside the range the function returns the same value as the nearest edge.\n" "\n" " :arg from_value: The edge value where the result is 0.\n" " :type from_value: float\n" " :arg to_value: The edge value where the result is 1.\n" " :type to_value: float\n" " :arg factor: The interpolation value.\n" " :type factor: float\n" " :return: The interpolated value in .\n" " :rtype: float\n" [0.0, 1.0] )

Variable Documentation

◆ M_bl_math_methods

PyMethodDef M_bl_math_methods[]
static
Initial value:
= {
{"clamp", (PyCFunction)py_bl_math_clamp, METH_VARARGS, py_bl_math_clamp_doc},
{"lerp", (PyCFunction)py_bl_math_lerp, METH_VARARGS, py_bl_math_lerp_doc},
{"smoothstep", (PyCFunction)py_bl_math_smoothstep, METH_VARARGS, py_bl_math_smoothstep_doc},
{nullptr, nullptr, 0, nullptr},
}
static PyObject * py_bl_math_smoothstep(PyObject *, PyObject *args)
static PyObject * py_bl_math_clamp(PyObject *, PyObject *args)
static PyObject * py_bl_math_lerp(PyObject *, PyObject *args)

Definition at line 131 of file bl_math_py_api.cc.

◆ M_bl_math_module_def

PyModuleDef M_bl_math_module_def
static
Initial value:
= {
PyModuleDef_HEAD_INIT,
"bl_math",
M_bl_math_doc,
0,
nullptr,
nullptr,
nullptr,
nullptr,
}
static PyMethodDef M_bl_math_methods[]

Definition at line 138 of file bl_math_py_api.cc.

Referenced by BPyInit_bl_math().