Blender V2.61 - r43446
Defines | Functions | Variables

mathutils_noise.c File Reference

#include <Python.h>
#include "structseq.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
#include "DNA_texture_types.h"
#include "mathutils.h"
#include "mathutils_noise.h"

Go to the source code of this file.

Defines

#define N   624
#define M   397
#define MATRIX_A   0x9908b0dfUL
#define UMASK   0x80000000UL
#define LMASK   0x7fffffffUL
#define MIXBITS(u, v)   (((u) & UMASK) | ((v) & LMASK))
#define TWIST(u, v)   ((MIXBITS(u,v) >> 1) ^ ((v)&1UL ? MATRIX_A : 0UL))

Functions

static void init_genrand (unsigned long 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.\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)
 PyDoc_STRVAR (M_Noise_seed_set_doc,".. function:: seed_set(seed)\n""\n"" Sets the random seed used for random_unit_vector, random_vector and random.\n""\n"" :arg seed: Seed used for the random generator.\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=noise.types.STDPERLIN)\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 at.\n"" :type position: :class:`mathutils.Vector`\n"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in noise.types or int\n"" :return: The noise value.\n"" :rtype: float\n")
static PyObject * M_Noise_noise (PyObject *UNUSED(self), PyObject *args)
 PyDoc_STRVAR (M_Noise_noise_vector_doc,".. function:: noise_vector(position, noise_basis=noise.types.STDPERLIN)\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 at.\n"" :type position: :class:`mathutils.Vector`\n"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in noise.types or int\n"" :return: The noise vector.\n"" :rtype: :class:`mathutils.Vector`\n")
static PyObject * M_Noise_noise_vector (PyObject *UNUSED(self), PyObject *args)
 PyDoc_STRVAR (M_Noise_turbulence_doc,".. function:: turbulence(position, octaves, hard, noise_basis=noise.types.STDPERLIN, 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 at.\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"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in mathutils.noise.types or int\n"" :arg amplitude_scale: The amplitude scaling factor.\n"" :type amplitude_scale: float\n"" :arg frequency_scale: The frequency scaling factor\n"" :type frequency_scale: Value in noise.types or int\n"" :return: The turbulence value.\n"" :rtype: float\n")
static PyObject * M_Noise_turbulence (PyObject *UNUSED(self), PyObject *args)
 PyDoc_STRVAR (M_Noise_turbulence_vector_doc,".. function:: turbulence_vector(position, octaves, hard, noise_basis=noise.types.STDPERLIN, 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 at.\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"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in mathutils.noise.types or int\n"" :arg amplitude_scale: The amplitude scaling factor.\n"" :type amplitude_scale: float\n"" :arg frequency_scale: The frequency scaling factor\n"" :type frequency_scale: Value in noise.types or int\n"" :return: The turbulence vector.\n"" :rtype: :class:`mathutils.Vector`\n")
static PyObject * M_Noise_turbulence_vector (PyObject *UNUSED(self), PyObject *args)
 PyDoc_STRVAR (M_Noise_fractal_doc,".. function:: fractal(position, H, lacunarity, octaves, noise_basis=noise.types.STDPERLIN)\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 at.\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"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in noise.types or int\n"" :return: The fractal Brownian motion noise value.\n"" :rtype: float\n")
static PyObject * M_Noise_fractal (PyObject *UNUSED(self), PyObject *args)
 PyDoc_STRVAR (M_Noise_multi_fractal_doc,".. function:: multi_fractal(position, H, lacunarity, octaves, noise_basis=noise.types.STDPERLIN)\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 at.\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"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in noise.types or int\n"" :return: The multifractal noise value.\n"" :rtype: float\n")
static PyObject * M_Noise_multi_fractal (PyObject *UNUSED(self), PyObject *args)
 PyDoc_STRVAR (M_Noise_variable_lacunarity_doc,".. function:: variable_lacunarity(position, distortion, noise_type1=noise.types.STDPERLIN, noise_type2=noise.types.STDPERLIN)\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 at.\n"" :type position: :class:`mathutils.Vector`\n"" :arg distortion: The amount of distortion.\n"" :type distortion: float\n"" :arg noise_type1: The type of noise to be distorted.\n"" :type noise_type1: Value in noise.types or int\n"" :arg noise_type2: The type of noise used to distort noise_type1.\n"" :type noise_type2: Value in noise.types or int\n"" :return: The variable lacunarity noise value.\n"" :rtype: float\n")
static PyObject * M_Noise_variable_lacunarity (PyObject *UNUSED(self), PyObject *args)
 PyDoc_STRVAR (M_Noise_hetero_terrain_doc,".. function:: hetero_terrain(position, H, lacunarity, octaves, offset, noise_basis=noise.types.STDPERLIN)\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 at.\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 noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in noise.types or int\n"" :return: The heterogeneous terrain value.\n"" :rtype: float\n")
static PyObject * M_Noise_hetero_terrain (PyObject *UNUSED(self), PyObject *args)
 PyDoc_STRVAR (M_Noise_hybrid_multi_fractal_doc,".. function:: hybrid_multi_fractal(position, H, lacunarity, octaves, offset, gain, noise_basis=noise.types.STDPERLIN)\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 at.\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"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in noise.types or int\n"" :return: The hybrid multifractal value.\n"" :rtype: float\n")
static PyObject * M_Noise_hybrid_multi_fractal (PyObject *UNUSED(self), PyObject *args)
 PyDoc_STRVAR (M_Noise_ridged_multi_fractal_doc,".. function:: ridged_multi_fractal(position, H, lacunarity, octaves, offset, gain, noise_basis=noise.types.STDPERLIN)\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 at.\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"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in noise.types or int\n"" :return: The ridged multifractal value.\n"" :rtype: float\n")
static PyObject * M_Noise_ridged_multi_fractal (PyObject *UNUSED(self), PyObject *args)
 PyDoc_STRVAR (M_Noise_voronoi_doc,".. function:: voronoi(position, distance_metric=noise.distance_metrics.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 at.\n"" :type position: :class:`mathutils.Vector`\n"" :arg distance_metric: Method of measuring distance.\n"" :type distance_metric: Value in noise.distance_metrics or int\n"" :arg exponent: The exponent for Minkovsky 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`s\n")
static PyObject * M_Noise_voronoi (PyObject *UNUSED(self), PyObject *args)
 PyDoc_STRVAR (M_Noise_cell_doc,".. function:: cell(position)\n""\n"" Returns cell noise value at the specified position.\n""\n"" :arg position: The position to evaluate the selected noise function at.\n"" :type position: :class:`mathutils.Vector`\n"" :return: The cell noise value.\n"" :rtype: float\n")
static PyObject * M_Noise_cell (PyObject *UNUSED(self), PyObject *args)
 PyDoc_STRVAR (M_Noise_cell_vector_doc,".. function:: cell_vector(position)\n""\n"" Returns cell noise vector at the specified position.\n""\n"" :arg position: The position to evaluate the selected noise function at.\n"" :type position: :class:`mathutils.Vector`\n"" :return: The cell noise vector.\n"" :rtype: :class:`mathutils.Vector`\n")
static PyObject * M_Noise_cell_vector (PyObject *UNUSED(self), PyObject *args)
PyMODINIT_FUNC PyInit_mathutils_noise (void)
PyMODINIT_FUNC PyInit_mathutils_noise_types (void)
PyMODINIT_FUNC PyInit_mathutils_noise_metrics (void)

Variables

static unsigned long state [N]
static int left = 1
static int initf = 0
static unsigned long * next
static PyMethodDef M_Noise_methods []
static struct PyModuleDef M_Noise_module_def
static struct PyModuleDef M_NoiseTypes_module_def
static struct PyModuleDef M_NoiseMetrics_module_def

Detailed Description

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

Definition in file mathutils_noise.c.


Define Documentation

#define LMASK   0x7fffffffUL

Definition at line 117 of file mathutils_noise.c.

#define M   397
#define MATRIX_A   0x9908b0dfUL

Definition at line 115 of file mathutils_noise.c.

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

Definition at line 118 of file mathutils_noise.c.

#define N   624

Definition at line 113 of file mathutils_noise.c.

Referenced by init_genrand(), and next_state().

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

Definition at line 119 of file mathutils_noise.c.

Referenced by next_state().

#define UMASK   0x80000000UL

Definition at line 116 of file mathutils_noise.c.


Function Documentation

static float frand ( void  ) [static]

Definition at line 178 of file mathutils_noise.c.

References left, next, and next_state().

Referenced by M_Noise_random(), and rand_vn().

static void init_genrand ( unsigned long  s) [static]

Definition at line 127 of file mathutils_noise.c.

References initf, left, N, and state.

Referenced by next_state(), and setRndSeed().

static PyObject* M_Noise_cell ( PyObject *  UNUSEDself,
PyObject *  args 
) [static]

Definition at line 763 of file mathutils_noise.c.

References cellNoise(), mathutils_array_parse(), and NULL.

static PyObject* M_Noise_cell_vector ( PyObject *  UNUSEDself,
PyObject *  args 
) [static]
static PyObject* M_Noise_fractal ( PyObject *  UNUSEDself,
PyObject *  args 
) [static]

Definition at line 517 of file mathutils_noise.c.

References H, mathutils_array_parse(), mg_fBm(), and NULL.

static PyObject* M_Noise_hetero_terrain ( PyObject *  UNUSEDself,
PyObject *  args 
) [static]

Definition at line 619 of file mathutils_noise.c.

References H, mathutils_array_parse(), mg_HeteroTerrain(), and NULL.

static PyObject* M_Noise_hybrid_multi_fractal ( PyObject *  UNUSEDself,
PyObject *  args 
) [static]

Definition at line 657 of file mathutils_noise.c.

References H, mathutils_array_parse(), mg_HybridMultiFractal(), and NULL.

static PyObject* M_Noise_multi_fractal ( PyObject *  UNUSEDself,
PyObject *  args 
) [static]

Definition at line 551 of file mathutils_noise.c.

References H, mathutils_array_parse(), mg_MultiFractal(), and NULL.

static PyObject* M_Noise_noise ( PyObject *  UNUSEDself,
PyObject *  args 
) [static]

Definition at line 383 of file mathutils_noise.c.

References BLI_gNoise(), mathutils_array_parse(), and NULL.

static PyObject* M_Noise_noise_vector ( PyObject *  UNUSEDself,
PyObject *  args 
) [static]
static PyObject* M_Noise_random ( PyObject *  UNUSEDself) [static]

Definition at line 287 of file mathutils_noise.c.

References frand().

static PyObject* M_Noise_random_unit_vector ( PyObject *  UNUSEDself,
PyObject *  args 
) [static]

Definition at line 302 of file mathutils_noise.c.

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

static PyObject* M_Noise_ridged_multi_fractal ( PyObject *  UNUSEDself,
PyObject *  args 
) [static]

Definition at line 695 of file mathutils_noise.c.

References H, mathutils_array_parse(), mg_RidgedMultiFractal(), and NULL.

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

Definition at line 362 of file mathutils_noise.c.

References NULL, and setRndSeed().

static PyObject* M_Noise_turbulence ( PyObject *  UNUSEDself,
PyObject *  args 
) [static]

Definition at line 446 of file mathutils_noise.c.

References mathutils_array_parse(), NULL, and turb().

static PyObject* M_Noise_turbulence_vector ( PyObject *  UNUSEDself,
PyObject *  args 
) [static]

Definition at line 482 of file mathutils_noise.c.

References mathutils_array_parse(), NULL, Py_NEW, Vector_CreatePyObject(), and vTurb().

static PyObject* M_Noise_variable_lacunarity ( PyObject *  UNUSEDself,
PyObject *  args 
) [static]

Definition at line 583 of file mathutils_noise.c.

References simple_enum_gen::d, mathutils_array_parse(), mg_VLNoise(), and NULL.

static PyObject* M_Noise_voronoi ( PyObject *  UNUSEDself,
PyObject *  args 
) [static]

Definition at line 725 of file mathutils_noise.c.

References i, mathutils_array_parse(), NULL, Py_NEW, Vector_CreatePyObject(), and voronoi().

static void next_state ( void  ) [static]

Definition at line 145 of file mathutils_noise.c.

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

Referenced by frand().

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

Definition at line 208 of file mathutils_noise.c.

References BLI_gNoise().

Referenced by M_Noise_noise_vector(), and vTurb().

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.\n"" :type size: Int\n"" :return: The random unit vector.\n"" :rtype: :class:`mathutils.Vector`\n"   
)
PyDoc_STRVAR ( M_Noise_noise_vector_doc  ,
".. function:: noise_vector(position, noise_basis=noise.types.STDPERLIN)\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 at.\n"" :type position: :class:`mathutils.Vector`\n"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in noise.types or int\n"" :return: The noise vector.\n"" :rtype: :class:`mathutils.Vector`\n"   
)
PyDoc_STRVAR ( M_Noise_random_doc  ,
".. function:: random()\n""\n"" Returns a random number in the range .\n""\n"" :return: The random number.\n"" :rtype: float\n"  [0, 1] 
)
PyDoc_STRVAR ( M_Noise_turbulence_vector_doc  ,
".. function:: turbulence_vector(position, octaves, hard, noise_basis=noise.types.STDPERLIN, 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 at.\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"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in mathutils.noise.types or int\n"" :arg amplitude_scale: The amplitude scaling factor.\n"" :type amplitude_scale: float\n"" :arg frequency_scale: The frequency scaling factor\n"" :type frequency_scale: Value in noise.types or int\n"" :return: The turbulence vector.\n"" :rtype: :class:`mathutils.Vector`\n"   
)
PyDoc_STRVAR ( M_Noise_turbulence_doc  ,
".. function:: turbulence(position, octaves, hard, noise_basis=noise.types.STDPERLIN, 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 at.\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"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in mathutils.noise.types or int\n"" :arg amplitude_scale: The amplitude scaling factor.\n"" :type amplitude_scale: float\n"" :arg frequency_scale: The frequency scaling factor\n"" :type frequency_scale: Value in noise.types or int\n"" :return: The turbulence value.\n"" :rtype: float\n"   
)
PyDoc_STRVAR ( M_Noise_cell_vector_doc  ,
".. function:: cell_vector(position)\n""\n"" Returns cell noise vector at the specified position.\n""\n"" :arg position: The position to evaluate the selected noise function at.\n"" :type position: :class:`mathutils.Vector`\n"" :return: The cell noise vector.\n"" :rtype: :class:`mathutils.Vector`\n"   
)
PyDoc_STRVAR ( M_Noise_cell_doc  ,
".. function:: cell(position)\n""\n"" Returns cell noise value at the specified position.\n""\n"" :arg position: The position to evaluate the selected noise function at.\n"" :type position: :class:`mathutils.Vector`\n"" :return: The cell noise value.\n"" :rtype: float\n"   
)
PyDoc_STRVAR ( M_Noise_ridged_multi_fractal_doc  ,
".. function:: ridged_multi_fractal(position, H, lacunarity, octaves, offset, gain, noise_basis=noise.types.STDPERLIN)\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 at.\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"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in noise.types or int\n"" :return: The ridged multifractal value.\n"" :rtype: float\n"   
)
PyDoc_STRVAR ( M_Noise_noise_doc  ,
".. function:: noise(position, noise_basis=noise.types.STDPERLIN)\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 at.\n"" :type position: :class:`mathutils.Vector`\n"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in noise.types or int\n"" :return: The noise value.\n"" :rtype: float\n"   
)
PyDoc_STRVAR ( M_Noise_doc  ,
"The Blender noise module  
)
PyDoc_STRVAR ( M_Noise_hetero_terrain_doc  ,
".. function:: hetero_terrain(position, H, lacunarity, octaves, offset, noise_basis=noise.types.STDPERLIN)\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 at.\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 noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in noise.types or int\n"" :return: The heterogeneous terrain value.\n"" :rtype: float\n"   
)
PyDoc_STRVAR ( M_Noise_seed_set_doc  ,
".. function:: seed_set(seed)\n""\n"" Sets the random seed used for  random_unit_vector,
random_vector and random.\n""\n"":arg seed:Seed used for the random generator.\n"":type seed:Int\n"   
)
PyDoc_STRVAR ( M_Noise_voronoi_doc  ,
".. function:: voronoi(position, distance_metric=noise.distance_metrics.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 at.\n"" :type position: :class:`mathutils.Vector`\n"" :arg distance_metric: Method of measuring distance.\n"" :type distance_metric: Value in noise.distance_metrics or int\n"" :arg exponent: The exponent for Minkovsky 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`s\n"   
)
PyDoc_STRVAR ( M_Noise_hybrid_multi_fractal_doc  ,
".. function:: hybrid_multi_fractal(position, H, lacunarity, octaves, offset, gain, noise_basis=noise.types.STDPERLIN)\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 at.\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"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in noise.types or int\n"" :return: The hybrid multifractal value.\n"" :rtype: float\n"   
)
PyDoc_STRVAR ( M_Noise_fractal_doc  ,
".. function:: fractal(position, H, lacunarity, octaves, noise_basis=noise.types.STDPERLIN)\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 at.\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"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in noise.types or int\n"" :return: The fractal Brownian motion noise value.\n"" :rtype: float\n"   
)
PyDoc_STRVAR ( M_Noise_multi_fractal_doc  ,
".. function:: multi_fractal(position, H, lacunarity, octaves, noise_basis=noise.types.STDPERLIN)\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 at.\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"" :arg noise_basis: The type of noise to be evaluated.\n"" :type noise_basis: Value in noise.types or int\n"" :return: The multifractal noise value.\n"" :rtype: float\n"   
)
PyDoc_STRVAR ( M_Noise_variable_lacunarity_doc  ,
".. function:: variable_lacunarity(position, distortion, noise_type1=noise.types.STDPERLIN, noise_type2=noise.types.STDPERLIN)\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 at.\n"":type position::class:`mathutils.Vector`\n"":arg distortion:The amount of distortion.\n"":type distortion:float\n"":arg noise_type1:The type of noise to be distorted.\n"":type noise_type1:Value in noise.types or int\n"":arg noise_type2:The type of noise used to distort noise_type1.\n"":type noise_type2:Value in noise.types or int\n"":return:The variable lacunarity noise value.\n"":rtype:float\n"   
)
PyMODINIT_FUNC PyInit_mathutils_noise ( void  )
PyMODINIT_FUNC PyInit_mathutils_noise_metrics ( void  )
PyMODINIT_FUNC PyInit_mathutils_noise_types ( void  )
static void rand_vn ( float *  array_tar,
const int  size 
) [static]

Definition at line 200 of file mathutils_noise.c.

References frand(), i, and size().

Referenced by M_Noise_random_unit_vector().

static void setRndSeed ( int  seed) [static]

Definition at line 169 of file mathutils_noise.c.

References init_genrand(), and NULL.

Referenced by M_Noise_seed_set(), and PyInit_mathutils_noise().

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

Definition at line 217 of file mathutils_noise.c.

References BLI_gNoise(), fabsf, and i.

Referenced by InitSunSky(), M_Noise_turbulence(), magic(), and pointdensitytex().

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 241 of file mathutils_noise.c.

References fabsf, i, and noise_vector().

Referenced by M_Noise_turbulence_vector().


Variable Documentation

int initf = 0 [static]

Definition at line 123 of file mathutils_noise.c.

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

int left = 1 [static]

Definition at line 122 of file mathutils_noise.c.

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

PyMethodDef M_Noise_methods[] [static]
Initial value:
 {
    {"seed_set", (PyCFunction) M_Noise_seed_set, METH_VARARGS, M_Noise_seed_set_doc},
    {"random", (PyCFunction) M_Noise_random, METH_NOARGS, M_Noise_random_doc},
    {"random_unit_vector", (PyCFunction) M_Noise_random_unit_vector, METH_VARARGS, M_Noise_random_unit_vector_doc},
    
    {"noise", (PyCFunction) M_Noise_noise, METH_VARARGS, M_Noise_noise_doc},
    {"noise_vector", (PyCFunction) M_Noise_noise_vector, METH_VARARGS, M_Noise_noise_vector_doc},
    {"turbulence", (PyCFunction) M_Noise_turbulence, METH_VARARGS, M_Noise_turbulence_doc},
    {"turbulence_vector", (PyCFunction) M_Noise_turbulence_vector, METH_VARARGS, M_Noise_turbulence_vector_doc},
    {"fractal", (PyCFunction) M_Noise_fractal, METH_VARARGS, M_Noise_fractal_doc},
    {"multi_fractal", (PyCFunction) M_Noise_multi_fractal, METH_VARARGS, M_Noise_multi_fractal_doc},
    {"variable_lacunarity", (PyCFunction) M_Noise_variable_lacunarity, METH_VARARGS, M_Noise_variable_lacunarity_doc},
    {"hetero_terrain", (PyCFunction) M_Noise_hetero_terrain, METH_VARARGS, M_Noise_hetero_terrain_doc},
    {"hybrid_multi_fractal", (PyCFunction) M_Noise_hybrid_multi_fractal, METH_VARARGS, M_Noise_hybrid_multi_fractal_doc},
    {"ridged_multi_fractal", (PyCFunction) M_Noise_ridged_multi_fractal, METH_VARARGS, M_Noise_ridged_multi_fractal_doc},
    {"voronoi", (PyCFunction) M_Noise_voronoi, METH_VARARGS, M_Noise_voronoi_doc},
    {"cell", (PyCFunction) M_Noise_cell, METH_VARARGS, M_Noise_cell_doc},
    {"cell_vector", (PyCFunction) M_Noise_cell_vector, METH_VARARGS, M_Noise_cell_vector_doc},
    {NULL, NULL, 0, NULL}
}

Definition at line 802 of file mathutils_noise.c.

struct PyModuleDef M_Noise_module_def [static]
Initial value:
 {
    PyModuleDef_HEAD_INIT,
    "mathutils.noise",  
    M_Noise_doc,  
    0,     
    M_Noise_methods,  
    NULL,  
    NULL,  
    NULL,  
    NULL,  
}

Definition at line 823 of file mathutils_noise.c.

struct PyModuleDef M_NoiseMetrics_module_def [static]
Initial value:
 {
    PyModuleDef_HEAD_INIT,
    "mathutils.noise.distance_metrics",  
    NULL,  
    0,     
    NULL,  
    NULL,  
    NULL,  
    NULL,  
    NULL,  
}

Definition at line 886 of file mathutils_noise.c.

struct PyModuleDef M_NoiseTypes_module_def [static]
Initial value:
 {
    PyModuleDef_HEAD_INIT,
    "mathutils.noise.types",  
    NULL,  
    0,     
    NULL,  
    NULL,  
    NULL,  
    NULL,  
    NULL,  
}

Definition at line 856 of file mathutils_noise.c.

unsigned long* next [static]

Definition at line 124 of file mathutils_noise.c.

Referenced by _ehash_free(), _ehash_insert(), iTaSC::Cache::addCacheItem(), alfa_bezpart(), ANIM_keyingset_infos_exit(), animdata_filter_remove_duplis(), animdata_filter_remove_invalid(), animfilter_nla(), antialias_tagbuf(), armature_rebuild_pose(), armature_select_linked_invoke(), b_bone_spline_setup(), BLI_freelist(), BLI_freelistN(), BLI_linklist_free(), BLI_linklist_reverse(), BLI_sortlist(), blo_end_image_pointer_map(), BME_bevel_poly(), BME_JFKE(), BME_KF(), BME_loop_find_loop(), BME_MF(), BME_SFME(), buildPolygonsByDetailedMeshes(), calc_keyHandles(), calchandles_fcurve(), calchandlesNurb(), clean_fcurve(), clean_nonmanifold(), clean_tracks_exec(), iTaSC::CacheChannel::clear(), btDbvtBroadphase::collide(), convert_to_triface(), count_bridge_verts(), curve_rename_fcurves(), cut_links_exec(), delete_exec(), delete_marker_exec(), delete_metaelems_exec(), delete_track_exec(), deleteflagNurb(), direct_link_object(), draw_depth(), draw_markers(), btIDebugDraw::drawArc(), editmesh_get_vertex_cos(), elbeemSimplifyChannelFloat(), elbeemSimplifyChannelVec3(), EM_make_uv_vert_map(), gjkepa2_impl::GJK::Evaluate(), extract_proxylocal_constraints(), GHOST_TimerManager::fireTimer(), frand(), free_edgelist(), free_facelist(), free_render_qmcsampler(), free_typeinfos(), free_vertlist(), freeMetaElemlist(), freeNurblist(), freeSketch(), gen_lock_flags(), get_selected_defgroups(), GPU_material_free(), GPU_nodes_extract_dynamic_inputs(), gpu_nodes_prune(), group_move_exec(), IDP_GroupIterNext(), IMB_metadata_free(), interpolateToi(), join_tracks_exec(), keyframe_jump_exec(), lib_link_scene(), SubdMesh::link_boundary_edge(), make_uv_vert_map(), multiresbake_freejob(), next_state(), GHOST_TimerManager::nextFireTime(), nlaedit_duplicate_exec(), nlaedit_split_exec(), node_delete_exec(), node_delete_reconnect(), node_delete_reconnect_exec(), node_group_socket_move_down_exec(), node_remove_linked(), nodeRemoveAllSockets(), nodeRemoveSocket(), nodeRemSocketLinks(), nodeUnlinkNode(), ntreeFreeTree(), ntreeInitTypes(), phash_insert(), pose_grab_with_ik_clear(), pose_ik_clear_exec(), pose_select_connected_invoke(), poselib_preview_get_next(), GHOST_SystemX11::processEvents(), GHOST_SystemWin32::processEvents(), GHOST_SystemSDL::processEvents(), GHOST_SystemCarbon::processEvents(), pushdown(), RE_engines_exit(), rearrange_island_down(), REEB_freeGraph(), remove_useless(), rna_freelistN(), rna_idproperty_ui(), select_adjacent_cp(), selmap_build_bezier_less(), selmap_build_bezier_more(), sequencer_meta_make_exec(), GHOST_TimerTask::setNext(), btSimpleBroadphaseProxy::SetNextFree(), btAxisSweep3Internal< BP_FP_INT_TYPE >::Handle::SetNextFree(), sk_deleteSelectedStrokes(), sk_straightenStroke(), solveJoints(), sort_shape_fix(), split_bridge_verts(), ss_sync_from_uv(), tracks_map_merge(), txt_clear_marker_region(), txt_clear_markers(), txt_find_marker_region(), ui_block_do_align_but(), ui_layout_free(), uiBlockFlipOrder(), undo_clean_stack(), vgroup_move_exec(), view3d_draw_transp(), view3d_draw_xray(), view3d_draw_xraytransp(), weight_paint_sample_enum_itemf(), and wm_event_do_notifiers().

unsigned long state[N] [static]

Definition at line 121 of file mathutils_noise.c.

Referenced by applyModifier(), boid_brain(), boid_copy_settings(), boid_free_settings(), boid_get_current_state(), boid_new_state(), boids_precalc_rules(), BOP_intersectionBoolOp(), build_dag_object(), button_activate_state(), direct_link_particlesettings(), AUD_JackDevice::doesPlayback(), draw_controller_header(), draw_marker_texts(), draw_new_particle_system(), explodeMesh(), get_boid_state(), get_effector_data(), GHOST_WindowWin32::getClientBounds(), GHOST_WindowX11::getState(), GHOST_WindowWin32::getState(), GHOST_WindowCarbon::getState(), ghost_event_proc(), GHOST_WindowX11::GHOST_WindowX11(), gpencil_frame_addnew(), init_genrand(), kernel_path_integrate(), lib_link_particlesettings(), KX_BlenderRenderTools::MotionBlur(), GPC_RenderTools::MotionBlur(), new_particle_duplilist(), next_state(), panel_activate_state(), pointdensity_cache_psys(), precalc_guides(), GHOST_SystemWin32::processKeyEvent(), psys_prepare_physics(), rekey_particle(), rekey_particle_to_time(), render_new_particle_system(), rule_add_exec(), rule_del_exec(), rule_move_down_exec(), rule_move_up_exec(), SCA_IObject::SetState(), SCA_IController::SetState(), GPG_Application::startEmbeddedWindow(), state_add_exec(), state_del_exec(), state_move_down_exec(), state_move_up_exec(), subdivide_particle(), ui_draw_but(), UI_view2d_scrollers_draw(), unlink_object(), wm_window_fullscreen_toggle_exec(), write_particlesettings(), xml_read_file(), xml_read_include(), and xml_read_scene().