Blender  V3.3
Macros | Functions | Variables
mathutils_noise.c File Reference
#include <Python.h>
#include "BLI_math.h"
#include "BLI_noise.h"
#include "BLI_utildefines.h"
#include "DNA_texture_types.h"
#include "../generic/py_capi_utils.h"
#include "mathutils.h"
#include "mathutils_noise.h"

Go to the source code of this file.

Macros

#define N   624
 
#define M   397
 
#define MATRIX_A   0x9908b0dfUL /* constant vector a */
 
#define UMASK   0x80000000UL /* most significant w-r bits */
 
#define LMASK   0x7fffffffUL /* least significant r bits */
 
#define MIXBITS(u, v)   (((u)&UMASK) | ((v)&LMASK))
 
#define TWIST(u, v)   ((MIXBITS(u, v) >> 1) ^ ((v)&1UL ? MATRIX_A : 0UL))
 
#define BPY_NOISE_BASIS_ENUM_DOC
 
#define BPY_NOISE_METRIC_ENUM_DOC
 
#define DEFAULT_NOISE_TYPE   TEX_STDPERLIN
 
#define DEFAULT_METRIC_TYPE   TEX_DISTANCE
 

Functions

static void init_genrand (ulong s)
 
static void next_state (void)
 
static void setRndSeed (int seed)
 
static float frand (void)
 
static void rand_vn (float *array_tar, const int size)
 
static void noise_vector (float x, float y, float z, int nb, float v[3])
 
static float turb (float x, float y, float z, int oct, int hard, int nb, float ampscale, float freqscale)
 
static void vTurb (float x, float y, float z, int oct, int hard, int nb, float ampscale, float freqscale, float v[3])
 
 PyDoc_STRVAR (M_Noise_doc, "The Blender noise module")
 
 PyDoc_STRVAR (M_Noise_random_doc, ".. function:: random()\n" "\n" " Returns a random number in the range [0, 1).\n" "\n" " :return: The random number.\n" " :rtype: float\n")
 
static PyObject * M_Noise_random (PyObject *UNUSED(self))
 
 PyDoc_STRVAR (M_Noise_random_unit_vector_doc, ".. function:: random_unit_vector(size=3)\n" "\n" " Returns a unit vector with random entries.\n" "\n" " :arg size: The size of the vector to be produced, in the range [2, 4].\n" " :type size: int\n" " :return: The random unit vector.\n" " :rtype: :class:`mathutils.Vector`\n")
 
static PyObject * M_Noise_random_unit_vector (PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (M_Noise_random_vector_doc, ".. function:: random_vector(size=3)\n" "\n" " Returns a vector with random entries in the range (-1, 1).\n" "\n" " :arg size: The size of the vector to be produced.\n" " :type size: int\n" " :return: The random vector.\n" " :rtype: :class:`mathutils.Vector`\n")
 
static PyObject * M_Noise_random_vector (PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (M_Noise_seed_set_doc, ".. function:: seed_set(seed)\n" "\n" " Sets the random seed used for random_unit_vector, and random.\n" "\n" " :arg seed: Seed used for the random generator.\n" " When seed is zero, the current time will be used instead.\n" " :type seed: int\n")
 
static PyObject * M_Noise_seed_set (PyObject *UNUSED(self), PyObject *args)
 
 PyDoc_STRVAR (M_Noise_noise_doc, ".. function:: noise(position, noise_basis='PERLIN_ORIGINAL')\n" "\n" " Returns noise value from the noise basis at the position specified.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" BPY_NOISE_BASIS_ENUM_DOC " :return: The noise value.\n" " :rtype: float\n")
 
static PyObject * M_Noise_noise (PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (M_Noise_noise_vector_doc, ".. function:: noise_vector(position, noise_basis='PERLIN_ORIGINAL')\n" "\n" " Returns the noise vector from the noise basis at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" BPY_NOISE_BASIS_ENUM_DOC " :return: The noise vector.\n" " :rtype: :class:`mathutils.Vector`\n")
 
static PyObject * M_Noise_noise_vector (PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (M_Noise_turbulence_doc, ".. function:: turbulence(position, octaves, hard, noise_basis='PERLIN_ORIGINAL', " "amplitude_scale=0.5, frequency_scale=2.0)\n" "\n" " Returns the turbulence value from the noise basis at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg octaves: The number of different noise frequencies used.\n" " :type octaves: int\n" " :arg hard: Specifies whether returned turbulence is hard (sharp transitions) or " "soft (smooth transitions).\n" " :type hard: boolean\n" BPY_NOISE_BASIS_ENUM_DOC " :arg amplitude_scale: The amplitude scaling factor.\n" " :type amplitude_scale: float\n" " :arg frequency_scale: The frequency scaling factor\n" " :type frequency_scale: float\n" " :return: The turbulence value.\n" " :rtype: float\n")
 
static PyObject * M_Noise_turbulence (PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (M_Noise_turbulence_vector_doc, ".. function:: turbulence_vector(position, octaves, hard, " "noise_basis='PERLIN_ORIGINAL', amplitude_scale=0.5, frequency_scale=2.0)\n" "\n" " Returns the turbulence vector from the noise basis at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg octaves: The number of different noise frequencies used.\n" " :type octaves: int\n" " :arg hard: Specifies whether returned turbulence is hard (sharp transitions) or " "soft (smooth transitions).\n" " :type hard: boolean\n" BPY_NOISE_BASIS_ENUM_DOC " :arg amplitude_scale: The amplitude scaling factor.\n" " :type amplitude_scale: float\n" " :arg frequency_scale: The frequency scaling factor\n" " :type frequency_scale: float\n" " :return: The turbulence vector.\n" " :rtype: :class:`mathutils.Vector`\n")
 
static PyObject * M_Noise_turbulence_vector (PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (M_Noise_fractal_doc, ".. function:: fractal(position, H, lacunarity, octaves, noise_basis='PERLIN_ORIGINAL')\n" "\n" " Returns the fractal Brownian motion (fBm) noise value from the noise basis at the " "specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg H: The fractal increment factor.\n" " :type H: float\n" " :arg lacunarity: The gap between successive frequencies.\n" " :type lacunarity: float\n" " :arg octaves: The number of different noise frequencies used.\n" " :type octaves: int\n" BPY_NOISE_BASIS_ENUM_DOC " :return: The fractal Brownian motion noise value.\n" " :rtype: float\n")
 
static PyObject * M_Noise_fractal (PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (M_Noise_multi_fractal_doc, ".. function:: multi_fractal(position, H, lacunarity, octaves, " "noise_basis='PERLIN_ORIGINAL')\n" "\n" " Returns multifractal noise value from the noise basis at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg H: The fractal increment factor.\n" " :type H: float\n" " :arg lacunarity: The gap between successive frequencies.\n" " :type lacunarity: float\n" " :arg octaves: The number of different noise frequencies used.\n" " :type octaves: int\n" BPY_NOISE_BASIS_ENUM_DOC " :return: The multifractal noise value.\n" " :rtype: float\n")
 
static PyObject * M_Noise_multi_fractal (PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (M_Noise_variable_lacunarity_doc, ".. function:: variable_lacunarity(position, distortion, " "noise_type1='PERLIN_ORIGINAL', noise_type2='PERLIN_ORIGINAL')\n" "\n" " Returns variable lacunarity noise value, a distorted variety of noise, from " "noise type 1 distorted by noise type 2 at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg distortion: The amount of distortion.\n" " :type distortion: float\n" " :arg noise_type1: Enumerator in ['BLENDER', 'PERLIN_ORIGINAL', 'PERLIN_NEW', " "'VORONOI_F1', 'VORONOI_F2', " "'VORONOI_F3', 'VORONOI_F4', 'VORONOI_F2F1', 'VORONOI_CRACKLE', " "'CELLNOISE'].\n" " :type noise_type1: string\n" " :arg noise_type2: Enumerator in ['BLENDER', 'PERLIN_ORIGINAL', 'PERLIN_NEW', " "'VORONOI_F1', 'VORONOI_F2', " "'VORONOI_F3', 'VORONOI_F4', 'VORONOI_F2F1', 'VORONOI_CRACKLE', " "'CELLNOISE'].\n" " :type noise_type2: string\n" " :return: The variable lacunarity noise value.\n" " :rtype: float\n")
 
static PyObject * M_Noise_variable_lacunarity (PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (M_Noise_hetero_terrain_doc, ".. function:: hetero_terrain(position, H, lacunarity, octaves, offset, " "noise_basis='PERLIN_ORIGINAL')\n" "\n" " Returns the heterogeneous terrain value from the noise basis at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg H: The fractal dimension of the roughest areas.\n" " :type H: float\n" " :arg lacunarity: The gap between successive frequencies.\n" " :type lacunarity: float\n" " :arg octaves: The number of different noise frequencies used.\n" " :type octaves: int\n" " :arg offset: The height of the terrain above 'sea level'.\n" " :type offset: float\n" BPY_NOISE_BASIS_ENUM_DOC " :return: The heterogeneous terrain value.\n" " :rtype: float\n")
 
static PyObject * M_Noise_hetero_terrain (PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (M_Noise_hybrid_multi_fractal_doc, ".. function:: hybrid_multi_fractal(position, H, lacunarity, octaves, offset, gain, " "noise_basis='PERLIN_ORIGINAL')\n" "\n" " Returns hybrid multifractal value from the noise basis at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg H: The fractal dimension of the roughest areas.\n" " :type H: float\n" " :arg lacunarity: The gap between successive frequencies.\n" " :type lacunarity: float\n" " :arg octaves: The number of different noise frequencies used.\n" " :type octaves: int\n" " :arg offset: The height of the terrain above 'sea level'.\n" " :type offset: float\n" " :arg gain: Scaling applied to the values.\n" " :type gain: float\n" BPY_NOISE_BASIS_ENUM_DOC " :return: The hybrid multifractal value.\n" " :rtype: float\n")
 
static PyObject * M_Noise_hybrid_multi_fractal (PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (M_Noise_ridged_multi_fractal_doc, ".. function:: ridged_multi_fractal(position, H, lacunarity, octaves, offset, gain, " "noise_basis='PERLIN_ORIGINAL')\n" "\n" " Returns ridged multifractal value from the noise basis at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg H: The fractal dimension of the roughest areas.\n" " :type H: float\n" " :arg lacunarity: The gap between successive frequencies.\n" " :type lacunarity: float\n" " :arg octaves: The number of different noise frequencies used.\n" " :type octaves: int\n" " :arg offset: The height of the terrain above 'sea level'.\n" " :type offset: float\n" " :arg gain: Scaling applied to the values.\n" " :type gain: float\n" BPY_NOISE_BASIS_ENUM_DOC " :return: The ridged multifractal value.\n" " :rtype: float\n")
 
static PyObject * M_Noise_ridged_multi_fractal (PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (M_Noise_voronoi_doc, ".. function:: voronoi(position, distance_metric='DISTANCE', exponent=2.5)\n" "\n" " Returns a list of distances to the four closest features and their locations.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" BPY_NOISE_METRIC_ENUM_DOC " :arg exponent: The exponent for Minkowski distance metric.\n" " :type exponent: float\n" " :return: A list of distances to the four closest features and their locations.\n" " :rtype: list of four floats, list of four :class:`mathutils.Vector` types\n")
 
static PyObject * M_Noise_voronoi (PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 

Variables

static ulong state [N]
 
static int left = 1
 
static int initf = 0
 
static ulongnext
 
static float state_offset_vector [3 *3]
 
static PyC_FlagSet bpy_noise_types []
 
static PyC_FlagSet bpy_noise_metrics []
 

Detailed Description

This file defines the 'noise' module, a general purpose module to access blenders noise functions.

Definition in file mathutils_noise.c.

Macro Definition Documentation

◆ BPY_NOISE_BASIS_ENUM_DOC

#define BPY_NOISE_BASIS_ENUM_DOC
Value:
" :arg noise_basis: Enumerator in ['BLENDER', 'PERLIN_ORIGINAL', 'PERLIN_NEW', " \
"'VORONOI_F1', 'VORONOI_F2', " \
"'VORONOI_F3', 'VORONOI_F4', 'VORONOI_F2F1', 'VORONOI_CRACKLE', " \
"'CELLNOISE'].\n" \
" :type noise_basis: string\n"

Definition at line 146 of file mathutils_noise.c.

◆ BPY_NOISE_METRIC_ENUM_DOC

#define BPY_NOISE_METRIC_ENUM_DOC
Value:
" :arg distance_metric: Enumerator in ['DISTANCE', 'DISTANCE_SQUARED', 'MANHATTAN', " \
"'CHEBYCHEV', " \
"'MINKOVSKY', 'MINKOVSKY_HALF', 'MINKOVSKY_FOUR'].\n" \
" :type distance_metric: string\n"

Definition at line 153 of file mathutils_noise.c.

◆ DEFAULT_METRIC_TYPE

#define DEFAULT_METRIC_TYPE   TEX_DISTANCE

Definition at line 177 of file mathutils_noise.c.

◆ DEFAULT_NOISE_TYPE

#define DEFAULT_NOISE_TYPE   TEX_STDPERLIN

Definition at line 160 of file mathutils_noise.c.

◆ LMASK

#define LMASK   0x7fffffffUL /* least significant r bits */

Definition at line 50 of file mathutils_noise.c.

◆ M

#define M   397

Definition at line 47 of file mathutils_noise.c.

◆ MATRIX_A

#define MATRIX_A   0x9908b0dfUL /* constant vector a */

Definition at line 48 of file mathutils_noise.c.

◆ MIXBITS

#define MIXBITS (   u,
  v 
)    (((u)&UMASK) | ((v)&LMASK))

Definition at line 51 of file mathutils_noise.c.

◆ N

#define N   624

Definition at line 46 of file mathutils_noise.c.

◆ TWIST

#define TWIST (   u,
  v 
)    ((MIXBITS(u, v) >> 1) ^ ((v)&1UL ? MATRIX_A : 0UL))

Definition at line 52 of file mathutils_noise.c.

◆ UMASK

#define UMASK   0x80000000UL /* most significant w-r bits */

Definition at line 49 of file mathutils_noise.c.

Function Documentation

◆ frand()

static float frand ( void  )
static

Definition at line 124 of file mathutils_noise.c.

References left, next, next_state(), and y.

Referenced by M_Noise_random(), and rand_vn().

◆ init_genrand()

static void init_genrand ( ulong  s)
static

Definition at line 61 of file mathutils_noise.c.

References ARRAY_SIZE, float(), initf, left, N, state, and state_offset_vector.

Referenced by next_state(), and setRndSeed().

◆ M_Noise_fractal()

static PyObject* M_Noise_fractal ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ M_Noise_hetero_terrain()

static PyObject* M_Noise_hetero_terrain ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ M_Noise_hybrid_multi_fractal()

static PyObject* M_Noise_hybrid_multi_fractal ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ M_Noise_multi_fractal()

static PyObject* M_Noise_multi_fractal ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ M_Noise_noise()

static PyObject* M_Noise_noise ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ M_Noise_noise_vector()

static PyObject* M_Noise_noise_vector ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ M_Noise_random()

static PyObject* M_Noise_random ( PyObject *  UNUSEDself)
static

Definition at line 289 of file mathutils_noise.c.

References frand().

◆ M_Noise_random_unit_vector()

static PyObject* M_Noise_random_unit_vector ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

Definition at line 303 of file mathutils_noise.c.

References norm(), normalize_vn(), NULL, rand_vn(), and Vector_CreatePyObject().

◆ M_Noise_random_vector()

static PyObject* M_Noise_random_vector ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

Definition at line 337 of file mathutils_noise.c.

References NULL, rand_vn(), and Vector_CreatePyObject_alloc().

◆ M_Noise_ridged_multi_fractal()

static PyObject* M_Noise_ridged_multi_fractal ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ M_Noise_seed_set()

static PyObject* M_Noise_seed_set ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 367 of file mathutils_noise.c.

References NULL, and setRndSeed().

◆ M_Noise_turbulence()

static PyObject* M_Noise_turbulence ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ M_Noise_turbulence_vector()

static PyObject* M_Noise_turbulence_vector ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ M_Noise_variable_lacunarity()

static PyObject* M_Noise_variable_lacunarity ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ M_Noise_voronoi()

static PyObject* M_Noise_voronoi ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ next_state()

static void next_state ( void  )
static

Definition at line 87 of file mathutils_noise.c.

References init_genrand(), initf, left, M, N, next, state, and TWIST.

Referenced by frand().

◆ noise_vector()

static void noise_vector ( float  x,
float  y,
float  z,
int  nb,
float  v[3] 
)
static

Definition at line 201 of file mathutils_noise.c.

References BLI_noise_generic_noise(), state_offset_vector, v, x, y, and z.

Referenced by M_Noise_noise_vector(), and vTurb().

◆ PyDoc_STRVAR() [1/16]

PyDoc_STRVAR ( M_Noise_doc  ,
"The Blender noise module  
)

◆ PyDoc_STRVAR() [2/16]

PyDoc_STRVAR ( M_Noise_fractal_doc  ,
".. function:: fractal(position, H, lacunarity, octaves, noise_basis='PERLIN_ORIGINAL')\n" "\n" " Returns the fractal Brownian motion (fBm) noise value from the noise basis at the " "specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg H: The fractal increment factor.\n" " :type H: float\n" " :arg lacunarity: The gap between successive frequencies.\n" " :type lacunarity: float\n" " :arg octaves: The number of different noise frequencies used.\n" " :type octaves: int\n" BPY_NOISE_BASIS_ENUM_DOC " :return: The fractal Brownian motion noise value.\n" " :rtype: float\n"   
)

◆ PyDoc_STRVAR() [3/16]

PyDoc_STRVAR ( M_Noise_hetero_terrain_doc  ,
".. function:: hetero_terrain(position, H, lacunarity, octaves, offset, " "noise_basis='PERLIN_ORIGINAL')\n" "\n" " Returns the heterogeneous terrain value from the noise basis at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg H: The fractal dimension of the roughest areas.\n" " :type H: float\n" " :arg lacunarity: The gap between successive frequencies.\n" " :type lacunarity: float\n" " :arg octaves: The number of different noise frequencies used.\n" " :type octaves: int\n" " :arg offset: The height of the terrain above 'sea level'.\n" " :type offset: float\n" BPY_NOISE_BASIS_ENUM_DOC " :return: The heterogeneous terrain value.\n" " :rtype: float\n"   
)

◆ PyDoc_STRVAR() [4/16]

PyDoc_STRVAR ( M_Noise_hybrid_multi_fractal_doc  ,
".. function:: hybrid_multi_fractal(position, H, lacunarity, octaves, offset, gain, " "noise_basis='PERLIN_ORIGINAL')\n" "\n" " Returns hybrid multifractal value from the noise basis at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg H: The fractal dimension of the roughest areas.\n" " :type H: float\n" " :arg lacunarity: The gap between successive frequencies.\n" " :type lacunarity: float\n" " :arg octaves: The number of different noise frequencies used.\n" " :type octaves: int\n" " :arg offset: The height of the terrain above 'sea level'.\n" " :type offset: float\n" " :arg gain: Scaling applied to the values.\n" " :type gain: float\n" BPY_NOISE_BASIS_ENUM_DOC " :return: The hybrid multifractal value.\n" " :rtype: float\n"   
)

◆ PyDoc_STRVAR() [5/16]

PyDoc_STRVAR ( M_Noise_multi_fractal_doc  ,
".. function:: multi_fractal(position, H, lacunarity, octaves, " "noise_basis='PERLIN_ORIGINAL')\n" "\n" " Returns multifractal noise value from the noise basis at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg H: The fractal increment factor.\n" " :type H: float\n" " :arg lacunarity: The gap between successive frequencies.\n" " :type lacunarity: float\n" " :arg octaves: The number of different noise frequencies used.\n" " :type octaves: int\n" BPY_NOISE_BASIS_ENUM_DOC " :return: The multifractal noise value.\n" " :rtype: float\n"   
)

◆ PyDoc_STRVAR() [6/16]

PyDoc_STRVAR ( M_Noise_noise_doc  ,
".. function:: noise(position, noise_basis='PERLIN_ORIGINAL')\n" "\n" " Returns noise value from the noise basis at the position specified.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" BPY_NOISE_BASIS_ENUM_DOC " :return: The noise value.\n" " :rtype: float\n"   
)

◆ PyDoc_STRVAR() [7/16]

PyDoc_STRVAR ( M_Noise_noise_vector_doc  ,
".. function:: noise_vector(position, noise_basis='PERLIN_ORIGINAL')\n" "\n" " Returns the noise vector from the noise basis at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" BPY_NOISE_BASIS_ENUM_DOC " :return: The noise vector.\n" " :rtype: :class:`mathutils.Vector`\n"   
)

◆ PyDoc_STRVAR() [8/16]

PyDoc_STRVAR ( M_Noise_random_doc  ,
".. function:: random()\n" "\n" " Returns a random number in the range [  0,
 
)

◆ PyDoc_STRVAR() [9/16]

PyDoc_STRVAR ( M_Noise_random_unit_vector_doc  ,
".. function:: random_unit_vector(size=3)\n" "\n" " Returns a unit vector with random entries.\n" "\n" " :arg size: The size of the vector to be  produced,
in the range .\n" " :type size:int\n" " :return:The random unit vector.\n" " :rtype::class:`mathutils.Vector`\n"  [2, 4] 
)

◆ PyDoc_STRVAR() [10/16]

PyDoc_STRVAR ( M_Noise_random_vector_doc  ,
".. function:: random_vector(size=3)\n" "\n" " Returns a vector with random entries in the range (-1, 1).\n" "\n" " :arg size: The size of the vector to be produced.\n" " :type size: int\n" " :return: The random vector.\n" " :rtype: :class:`mathutils.Vector`\n"   
)

◆ PyDoc_STRVAR() [11/16]

PyDoc_STRVAR ( M_Noise_ridged_multi_fractal_doc  ,
".. function:: ridged_multi_fractal(position, H, lacunarity, octaves, offset, gain, " "noise_basis='PERLIN_ORIGINAL')\n" "\n" " Returns ridged multifractal value from the noise basis at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg H: The fractal dimension of the roughest areas.\n" " :type H: float\n" " :arg lacunarity: The gap between successive frequencies.\n" " :type lacunarity: float\n" " :arg octaves: The number of different noise frequencies used.\n" " :type octaves: int\n" " :arg offset: The height of the terrain above 'sea level'.\n" " :type offset: float\n" " :arg gain: Scaling applied to the values.\n" " :type gain: float\n" BPY_NOISE_BASIS_ENUM_DOC " :return: The ridged multifractal value.\n" " :rtype: float\n"   
)

◆ PyDoc_STRVAR() [12/16]

PyDoc_STRVAR ( M_Noise_seed_set_doc  ,
".. function:: seed_set(seed)\n" "\n" " Sets the random seed used for  random_unit_vector,
and random.\n" "\n" " :arg seed:Seed used for the random generator.\n" " When seed is  zero,
the current time will be used instead.\n" " :type seed:int\n"   
)

◆ PyDoc_STRVAR() [13/16]

PyDoc_STRVAR ( M_Noise_turbulence_doc  ,
".. function:: turbulence(position, octaves, hard, noise_basis='PERLIN_ORIGINAL', " "amplitude_scale=0.5, frequency_scale=2.0)\n" "\n" " Returns the turbulence value from the noise basis at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg octaves: The number of different noise frequencies used.\n" " :type octaves: int\n" " :arg hard: Specifies whether returned turbulence is hard (sharp transitions) or " "soft (smooth transitions).\n" " :type hard: boolean\n" BPY_NOISE_BASIS_ENUM_DOC " :arg amplitude_scale: The amplitude scaling factor.\n" " :type amplitude_scale: float\n" " :arg frequency_scale: The frequency scaling factor\n" " :type frequency_scale: float\n" " :return: The turbulence value.\n" " :rtype: float\n"   
)

◆ PyDoc_STRVAR() [14/16]

PyDoc_STRVAR ( M_Noise_turbulence_vector_doc  ,
".. function:: turbulence_vector(position, octaves, hard, " "noise_basis='PERLIN_ORIGINAL', amplitude_scale=0.5, frequency_scale=2.0)\n" "\n" " Returns the turbulence vector from the noise basis at the specified position.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" " :arg octaves: The number of different noise frequencies used.\n" " :type octaves: int\n" " :arg hard: Specifies whether returned turbulence is hard (sharp transitions) or " "soft (smooth transitions).\n" " :type hard: boolean\n" BPY_NOISE_BASIS_ENUM_DOC " :arg amplitude_scale: The amplitude scaling factor.\n" " :type amplitude_scale: float\n" " :arg frequency_scale: The frequency scaling factor\n" " :type frequency_scale: float\n" " :return: The turbulence vector.\n" " :rtype: :class:`mathutils.Vector`\n"   
)

◆ PyDoc_STRVAR() [15/16]

PyDoc_STRVAR ( M_Noise_variable_lacunarity_doc  ,
".. function:: variable_lacunarity(position, distortion, " "noise_type1='PERLIN_ORIGINAL', noise_type2='PERLIN_ORIGINAL')\n" "\n" " Returns variable lacunarity noise  value,
a distorted variety of  noise,
from " "noise type 1 distorted by noise type 2 at the specified position.\n" "\n" " :arg position:The position to evaluate the selected noise function.\n" " :type position::class:`mathutils.Vector`\n" " :arg distortion:The amount of distortion.\n" " :type distortion:float\n" " :arg noise_type1:Enumerator in .\n" " :type noise_type1:string\n" " :arg noise_type2:Enumerator in .\n" " :type noise_type2:string\n" " :return:The variable lacunarity noise value.\n" " :rtype:float\n"  [ 'BLENDER', 'PERLIN_ORIGINAL', 'PERLIN_NEW', " " 'VORONOI_F1', 'VORONOI_F2', " " 'VORONOI_F3', 'VORONOI_F4', 'VORONOI_F2F1', 'VORONOI_CRACKLE', " " 'CELLNOISE'][ 'BLENDER', 'PERLIN_ORIGINAL', 'PERLIN_NEW', " " 'VORONOI_F1', 'VORONOI_F2', " " 'VORONOI_F3', 'VORONOI_F4', 'VORONOI_F2F1', 'VORONOI_CRACKLE', " " 'CELLNOISE'] 
)

◆ PyDoc_STRVAR() [16/16]

PyDoc_STRVAR ( M_Noise_voronoi_doc  ,
".. function:: voronoi(position, distance_metric='DISTANCE', exponent=2.5)\n" "\n" " Returns a list of distances to the four closest features and their locations.\n" "\n" " :arg position: The position to evaluate the selected noise function.\n" " :type position: :class:`mathutils.Vector`\n" BPY_NOISE_METRIC_ENUM_DOC " :arg exponent: The exponent for Minkowski distance metric.\n" " :type exponent: float\n" " :return: A list of distances to the four closest features and their locations.\n" " :rtype: list of four  floats,
list of four :class:`mathutils.Vector` types\n"   
)

◆ rand_vn()

static void rand_vn ( float array_tar,
const int  size 
)
static

Definition at line 191 of file mathutils_noise.c.

References frand(), and size().

Referenced by M_Noise_random_unit_vector(), and M_Noise_random_vector().

◆ setRndSeed()

static void setRndSeed ( int  seed)
static

Definition at line 113 of file mathutils_noise.c.

References init_genrand(), NULL, seed, and time.

Referenced by M_Noise_seed_set().

◆ turb()

static float turb ( float  x,
float  y,
float  z,
int  oct,
int  hard,
int  nb,
float  ampscale,
float  freqscale 
)
static

Definition at line 213 of file mathutils_noise.c.

References BLI_noise_generic_noise(), fabsf, float(), usdtokens::out(), t, x, y, and z.

Referenced by M_Noise_turbulence(), magic(), and pointdensity().

◆ vTurb()

static void vTurb ( float  x,
float  y,
float  z,
int  oct,
int  hard,
int  nb,
float  ampscale,
float  freqscale,
float  v[3] 
)
static

Definition at line 239 of file mathutils_noise.c.

References fabsf, noise_vector(), t, v, x, y, and z.

Referenced by M_Noise_turbulence_vector().

Variable Documentation

◆ bpy_noise_metrics

PyC_FlagSet bpy_noise_metrics[]
static
Initial value:
= {
{TEX_DISTANCE, "DISTANCE"},
{TEX_DISTANCE_SQUARED, "DISTANCE_SQUARED"},
{TEX_MANHATTAN, "MANHATTAN"},
{TEX_CHEBYCHEV, "CHEBYCHEV"},
{TEX_MINKOVSKY, "MINKOVSKY"},
{TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF"},
{TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR"},
{0, NULL},
}
#define TEX_MINKOVSKY_FOUR
#define TEX_DISTANCE_SQUARED
#define TEX_MINKOVSKY_HALF
#define TEX_MINKOVSKY
#define TEX_DISTANCE
#define TEX_MANHATTAN
#define TEX_CHEBYCHEV

Definition at line 179 of file mathutils_noise.c.

Referenced by M_Noise_voronoi().

◆ bpy_noise_types

PyC_FlagSet bpy_noise_types[]
static
Initial value:
= {
{TEX_BLENDER, "BLENDER"},
{TEX_STDPERLIN, "PERLIN_ORIGINAL"},
{TEX_NEWPERLIN, "PERLIN_NEW"},
{TEX_VORONOI_F1, "VORONOI_F1"},
{TEX_VORONOI_F2, "VORONOI_F2"},
{TEX_VORONOI_F3, "VORONOI_F3"},
{TEX_VORONOI_F4, "VORONOI_F4"},
{TEX_VORONOI_F2F1, "VORONOI_F2F1"},
{TEX_VORONOI_CRACKLE, "VORONOI_CRACKLE"},
{TEX_CELLNOISE, "CELLNOISE"},
{0, NULL},
}
#define TEX_BLENDER
#define TEX_STDPERLIN
#define TEX_VORONOI_CRACKLE
#define TEX_VORONOI_F2F1
#define TEX_VORONOI_F4
#define TEX_VORONOI_F3
#define TEX_NEWPERLIN
#define TEX_CELLNOISE
#define TEX_VORONOI_F1
#define TEX_VORONOI_F2

Definition at line 162 of file mathutils_noise.c.

Referenced by M_Noise_fractal(), M_Noise_hetero_terrain(), M_Noise_hybrid_multi_fractal(), M_Noise_multi_fractal(), M_Noise_noise(), M_Noise_noise_vector(), M_Noise_ridged_multi_fractal(), M_Noise_turbulence(), M_Noise_turbulence_vector(), and M_Noise_variable_lacunarity().

◆ initf

int initf = 0
static

Definition at line 56 of file mathutils_noise.c.

Referenced by init_genrand(), next_state(), and window_main_loop().

◆ left

int left = 1
static

Definition at line 55 of file mathutils_noise.c.

Referenced by MD5Hash::append(), BKE_colorband_evaluate(), BKE_tracking_get_projection_matrix(), BLI_split_name_num(), BLI_uniquename_cb(), BVHBuild::build_node(), bvh_reference_sort_threaded(), blender::bke::curves::bezier::calculate_point_handles(), GHOST_SystemNULL::createWindow(), GHOST_SystemWayland::createWindow(), GHOST_SystemWin32::createWindow(), GHOST_SystemX11::createWindow(), GHOST_SystemCocoa::createWindow(), do_version_select_mouse(), draw_frustum_boundbox_calc(), blender::compositor::SMAABlendingWeightCalculationOperation::execute_pixel(), blender::compositor::SMAANeighborhoodBlendingOperation::execute_pixel(), frand(), GHOST_CreateWindow(), GHOST_WindowCocoa::GHOST_WindowCocoa(), GHOST_WindowSDL::GHOST_WindowSDL(), GHOST_WindowWin32::GHOST_WindowWin32(), GHOST_WindowX11::GHOST_WindowX11(), GPU_matrix_frustum_set(), GPU_matrix_ortho_2d_set(), GPU_matrix_ortho_set(), graph_bezt_get_transform_selection(), libmv::HorizontalStack(), libmv::HStack(), immDrawPixelsTexTiled_scaling_clipping(), init_genrand(), kdtree_balance(), blender::nodes::node_geo_curve_trim_cc::lookup_control_point_position(), mat4_frustum_set(), mat4_ortho_set(), next_state(), Freestyle::NodePerspectiveCamera::NodePerspectiveCamera(), offset_in_plane(), orthographic_m4(), perspective_m4(), planes_from_projmat(), blender::deg::BuilderStack::print_backtrace(), quad_crosses_symmetry_plane(), query_qual(), sb_cf_threads_run(), sb_sfesf_threads_run(), screen_areas_align(), blender::bke::curves::bezier::segment_is_vector(), blender::nodes::node_geo_curve_handle_type_selection_cc::select_by_handle_type(), seq_snap_source_points_build(), SEQ_transform_fix_single_image_seq_offsets(), SeqTransInfo(), sequencer_image_crop_init(), BVHSpatialSplit::split(), BVHMixedSplit::split(), BVHObjectSplit::split(), BVHSpatialSplit::split_reference(), StereoProjection(), txt_split_curline(), ui_but_is_row_alignment_group(), UI_icon_alert_imbuf_get(), ui_popup_block_position(), blender::compositor::SMAABlendingWeightCalculationOperation::update_memory_buffer_partial(), blender::compositor::SMAANeighborhoodBlendingOperation::update_memory_buffer_partial(), View(), voronoi_getXOfEdge(), voronoiEdge_new(), and voronoiParabola_setLeft().

◆ next

ulong* next
static

Definition at line 57 of file mathutils_noise.c.

Referenced by Freestyle::__recursiveSplit(), iTaSC::Cache::addCacheItem(), BMeshFairingContext::adjacents_coords_from_loop(), adjacet_vertices_index_from_adjacent_edge(), ANIM_keyingset_infos_exit(), animdata_filter_remove_duplis(), animdata_filter_remove_invalid(), animfilter_nla(), blender::compositor::antialias_tagbuf(), base_callback(), blender::eevee::VelocityModule::bind_resources(), BKE_fcurve_bezt_subdivide_handles(), BKE_fcurve_handles_recalc_ex(), BKE_gpencil_stroke_subdivide(), BKE_mask_spline_feather_collapse_inner_loops(), BKE_mesh_uv_vert_map_create(), BKE_nurb_handle_calc(), BKE_nurb_handle_calc_ex(), BKE_nurb_handle_calc_simple(), BKE_pchan_bbone_spline_params_get(), BKE_sculpt_mask_layers_ensure(), BLI_freelist(), BLI_freelistN(), BLI_linklist_free(), BLI_linklist_free_pool(), BLI_linklist_freeN(), BLI_linklist_pop(), BLI_linklist_pop_pool(), BLI_linklist_reverse(), BLI_listbase_from_link(), BLI_listbase_reverse(), bm_decim_triangulate_begin(), bm_edgering_pair_interpolate(), bm_face_split_by_concave(), BM_face_split_edgenet_connect_islands(), bm_face_triangulate_mapping(), BM_log_entry_add(), BM_mesh_triangulate(), bm_uv_edge_select_build_islands(), BM_uv_element_map_create(), BM_uv_vert_map_create(), bmesh_loop_validate(), blender::deg::DepsgraphRelationBuilder::build_rig(), C_BVHTree_FromPolygons(), calc_keyHandles(), calchandle_curvemap(), calchandleNurb_intern(), calchandlesNurb_intern(), ccg_ehash_free(), ccg_ehash_insert(), blender::compositor::check_corners(), clean_fcurve(), iTaSC::CacheChannel::clear(), btDbvtBroadphase::collide(), blender::fn::MFProcedureDotExport::create_edges(), Freestyle::createStroke(), dc_tri(), delete_metaelems_exec(), direction_bisect(), blender::bke::curves::poly::direction_bisect(), btIDebugDraw::drawArc(), drw_debug_draw_lines(), drw_debug_draw_spheres(), drw_registered_engines_free(), dynamicPaint_createUVSurface(), ebone_spline_preview(), ED_workspace_delete(), edbm_fill_grid_prepare(), BezierSpline::ensure_auto_handles(), GJK< btConvexTemplate >::Evaluate(), gjkepa2_impl::GJK::Evaluate(), face_map_move_exec(), GHOST_TimerManager::fireTimer(), frand(), generate_geometry(), get_line_pos_wrapped(), blender::fn::MFProcedureDotExport::get_next_instruction_in_block(), get_shortest_pattern_side(), Freestyle::Functions0D::getFEdges(), btConvexHullComputer::Edge::getNextEdgeOfVertex(), gpencil_interpolate_update_points(), gpencil_stroke_perimeter_ex(), gpencil_stroke_subdivide(), gpencil_subdivide_stroke(), gpu_node_graph_prune_unused(), GPU_pass_cache_free(), GPU_pass_cache_garbage_collect(), hair_spring_next(), Freestyle::WVertex::incoming_edge_iterator::increment(), Freestyle::Stroke::InsertVertex(), keyframe_jump_exec(), layerInterp_mdeformvert(), lineart_triangle_intersect_math(), list_sort_do(), marker_jump_exec(), minter_v3_v3v3v3_ref(), MOD_solidify_nonmanifold_modifyMesh(), multiresbake_freejob(), next_state(), GHOST_TimerManager::nextFireTime(), nlaedit_duplicate_exec(), nlaedit_split_exec(), blender::ed::space_node::node_link_insert_offset_ntree(), blender::ed::space_node::node_remove_linked(), blender::nodes::node_geo_curve_fillet_cc::node_update(), blender::nodes::node_geo_curve_primitive_arc_cc::node_update(), blender::nodes::node_geo_curve_primitive_circle_cc::node_update(), blender::nodes::node_geo_curve_primitive_line_cc::node_update(), blender::nodes::node_geo_curve_resample_cc::node_update(), blender::nodes::node_geo_curve_sample_cc::node_update(), blender::nodes::node_geo_curve_to_points_cc::node_update(), blender::nodes::node_geo_curve_trim_cc::node_update(), blender::nodes::node_geo_string_to_curves_cc::node_update(), object_blend_read_data(), Freestyle::Functions0D::VertexOrientation2DF0D::operator()(), Freestyle::Functions0D::VertexOrientation3DF0D::operator()(), Freestyle::Functions0D::Curvature2DAngleF0D::operator()(), phash_insert(), point_calculate_handle(), pose_grab_with_ik_clear(), pose_ik_clear_exec(), pose_select_connected_invoke(), pose_select_linked_exec(), poselib_preview_get_next(), GHOST_SystemCocoa::processEvents(), GHOST_SystemSDL::processEvents(), GHOST_SystemWin32::processEvents(), GHOST_SystemX11::processEvents(), RE_engines_exit(), rearrange_island_down(), recalcData_nla(), remove_tagged_functions(), Freestyle::Stroke::Resample(), RNA_def_property_collection_funcs(), rna_freelistN(), sample_fcurve(), select_adjacent_cp(), selmap_build_bezier_less(), selmap_build_bezier_more(), seq_cache_recycle_linked(), seq_cache_set_temp_cache_linked(), sequencer_strip_jump_exec(), GHOST_TimerTask::setNext(), btAxisSweep3Internal< BP_FP_INT_TYPE >::Handle::SetNextFree(), btSimpleBroadphaseProxy::SetNextFree(), slide_check_corners(), ss_sync_from_uv(), subdivide_nonauto_handles(), Freestyle::ViewEdgeInternal::SVertexIterator::SVertexIterator(), target_callback(), TEST(), testsort_listbase_sort_is_stable(), tilt_bezpart(), tracking_get_keyframed_marker(), tracks_map_merge(), ui_multibut_free(), unescape(), weight_paint_sample_enum_itemf(), and blender::ed::space_node::WIDGETGROUP_node_corner_pin_refresh().

◆ state

ulong state[N]
static

Definition at line 54 of file mathutils_noise.c.

Referenced by init_genrand(), and next_state().

◆ state_offset_vector

float state_offset_vector[3 *3]
static

Definition at line 58 of file mathutils_noise.c.

Referenced by init_genrand(), and noise_vector().