diff --git a/CHANGELOG.md b/CHANGELOG.md index ae45ed2641..dec9626646 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ## Version 2.1.3 +- Python: Add ExprUtils class that adds helpers for FBM and Perlin noise (taken from Walt Disney Animation SeExpr library) - Gui: sliders have a cleaner look with less ticks and a round handle 231c7f7 - fix bug where the OFX plugin cache could be wrong if OpenGL was disabled 32c1532 - fix dynamic kOfxSupportsTiles handling diff --git a/Documentation/source/devel/PythonReference/NatronEngine/ExprUtils.rst b/Documentation/source/devel/PythonReference/NatronEngine/ExprUtils.rst new file mode 100644 index 0000000000..fe6a1c790d --- /dev/null +++ b/Documentation/source/devel/PythonReference/NatronEngine/ExprUtils.rst @@ -0,0 +1,368 @@ +.. module:: NatronEngine +.. _ExprUtils: + +ExprUtils +************* + +**Inherits** :doc:`Double2DParam` + +Synopsis +-------- + +Various functions useful for expressions. Most noise functions have been taken from the +Walt Disney Animation Studio SeExpr library. + +Functions +^^^^^^^^^ + +* def :meth:`boxstep` (x,a) +* def :meth:`linearstep` (x,a,b) +* def :meth:`smoothstep` (x,a,b) +* def :meth:`gaussstep` (x,a,b) +* def :meth:`remap` (x,source,range,falloff,interp) +* def :meth:`mix` (x,y,alpha) +* def :meth:`hash` (args) +* def :meth:`noise` (x) +* def :meth:`noise` (p) +* def :meth:`noise` (p) +* def :meth:`noise` (p) +* def :meth:`snoise` (p) +* def :meth:`vnoise` (p) +* def :meth:`cnoise` (p) +* def :meth:`snoise4` (p) +* def :meth:`vnoise4` (p) +* def :meth:`cnoise4` (p) +* def :meth:`turbulence` (p[,ocaves=6, lacunarity=2, gain=0.5]) +* def :meth:`vturbulence` (p[,ocaves=6, lacunarity=2, gain=0.5]) +* def :meth:`cturbulence` (p[,ocaves=6, lacunarity=2, gain=0.5]) +* def :meth:`fbm` (p[,ocaves=6, lacunarity=2, gain=0.5]) +* def :meth:`vfbm` (p[,ocaves=6, lacunarity=2, gain=0.5]) +* def :meth:`fbm4` (p[,ocaves=6, lacunarity=2, gain=0.5]) +* def :meth:`vfbm4` (p[,ocaves=6, lacunarity=2, gain=0.5]) +* def :meth:`cfbm` (p[,ocaves=6, lacunarity=2, gain=0.5]) +* def :meth:`cfbm4` (p[,ocaves=6, lacunarity=2, gain=0.5]) +* def :meth:`cellnoise` (p) +* def :meth:`ccellnoise` (p) +* def :meth:`pnoise` (p, period) + + + +Member functions description +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. method:: NatronEngine.Double3DParam.get() + + :rtype: :class:`Double3DTuple` + +Returns a :doc:`Double3DTuple` with the [x,y,z] values for this parameter at the current +timeline's time. + +.. method:: NatronEngine.ExprUtils.boxstep (x,a) + + :param x: :class:`float` + :param a: :class:`float` + :rtype: :class:`float` + + if x < a then 0 otherwise 1 + +.. method:: NatronEngine.ExprUtils.linearstep (x,a,b) + + :param x: :class:`float` + :param a: :class:`float` + :param b: :class:`float` + :rtype: :class:`float` + + Transitions linearly when a < x < b + +.. method:: NatronEngine.ExprUtils.boxstep (x,a,b) + + :param x: :class:`float` + :param a: :class:`float` + :param b: :class:`float` + :rtype: :class:`float` + + + Transitions smoothly (cubic) when a < x < b + + +.. method:: NatronEngine.ExprUtils.gaussstep (x,a,b) + + :param x: :class:`float` + :param a: :class:`float` + :param b: :class:`float` + :rtype: :class:`float` + + Transitions smoothly (exponentially) when a < x < b + +.. method:: NatronEngine.ExprUtils.remap (x,source,range,falloff,interp) + + :param x: :class:`float` + :param source: :class:`float` + :param range: :class:`float` + :param falloff: :class:`float` + :param interp: :class:`float` + :rtype: :class:`float` + + General remapping function. + When **x** is within +/- **range** of **source**, the result is 1. + The result falls to 0 beyond that range over **falloff** distance. + The falloff shape is controlled by **interp**: + linear = 0 + smooth = 1 + gaussian = 2 + +.. method:: NatronEngine.ExprUtils.mix (x,y,alpha) + + :param x: :class:`float` + :param y: :class:`float` + :param alpha: :class:`float` + :rtype: :class:`float` + + Linear interpolation of a and b according to alpha + +.. method:: NatronEngine.ExprUtils.hash (args) + + :param args: :class:`Sequence` + :rtype: :class:`float` + + Like random, but with no internal seeds. Any number of seeds may be given + and the result will be a random function based on all the seeds. + +.. method:: NatronEngine.ExprUtils.noise (x) + + :param x: :class:`float` + :rtype: :class:`float` + + Original perlin noise at location (C2 interpolant) + +.. method:: NatronEngine.ExprUtils.noise (p) + + :param p: :class:`Double2DTuple` + :rtype: :class:`float` + + Original perlin noise at location (C2 interpolant) + +.. method:: NatronEngine.ExprUtils.noise (p) + + :param p: :class:`Double3DTuple` + :rtype: :class:`float` + + Original perlin noise at location (C2 interpolant) + + +.. method:: NatronEngine.ExprUtils.noise (p) + + :param p: :class:`ColorTuple` + :rtype: :class:`float` + + Original perlin noise at location (C2 interpolant) + + +.. method:: NatronEngine.ExprUtils.snoise (p) + + :param p: :class:`Double3DTuple` + :rtype: :class:`float` + + + Signed noise w/ range -1 to 1 formed with original perlin noise at location (C2 interpolant) + + +.. method:: NatronEngine.ExprUtils.vnoise (p) + + :param p: :class:`Double3DTuple` + :rtype: :class:`Double3DTuple` + + Vector noise formed with original perlin noise at location (C2 interpolant) + +.. method:: NatronEngine.ExprUtils.cnoise (p) + + :param p: :class:`Double3DTuple` + :rtype: :class:`Double3DTuple` + + Color noise formed with original perlin noise at location (C2 interpolant) + +.. method:: NatronEngine.ExprUtils.snoise4 (p) + + :param p: :class:`ColorTuple` + :rtype: :class:`float` + + 4D signed noise w/ range -1 to 1 formed with original perlin noise at location (C2 interpolant) + +.. method:: NatronEngine.ExprUtils.vnoise4 (p) + + :param p: :class:`ColorTuple` + :rtype: :class:`Double3DTuple` + + 4D vector noise formed with original perlin noise at location (C2 interpolant) + +.. method:: NatronEngine.ExprUtils.cnoise4 (p) + + :param p: :class:`ColorTuple` + :rtype: :class:`Double3DTuple` + + 4D color noise formed with original perlin noise at location (C2 interpolant)" + + +.. method:: NatronEngine.ExprUtils.turbulence (p[,ocaves=6, lacunarity=2, gain=0.5]) + + :param p: :class:`Double3DTuple` + :param octaves: :class:`int` + :param lacunarity: :class:`float` + :param gain: :class:`float` + :rtype: :class:`float` + + FBM (Fractal Brownian Motion) is a multi-frequency noise function. + The base frequency is the same as the noise function. The total + number of frequencies is controlled by **octaves**. The **lacunarity** is the + spacing between the frequencies - A value of 2 means each octave is + twice the previous frequency. The **gain** controls how much each + frequency is scaled relative to the previous frequency. + +.. method:: NatronEngine.ExprUtils.vturbulence (p[,ocaves=6, lacunarity=2, gain=0.5]) + + :param p: :class:`Double3DTuple` + :param octaves: :class:`int` + :param lacunarity: :class:`float` + :param gain: :class:`float` + :rtype: :class:`Double3DTuple` + + FBM (Fractal Brownian Motion) is a multi-frequency noise function. + The base frequency is the same as the noise function. The total + number of frequencies is controlled by **octaves**. The **lacunarity** is the + spacing between the frequencies - A value of 2 means each octave is + twice the previous frequency. The **gain** controls how much each + frequency is scaled relative to the previous frequency. + +.. method:: NatronEngine.ExprUtils.cturbulence (p[,ocaves=6, lacunarity=2, gain=0.5]) + + :param p: :class:`Double3DTuple` + :param octaves: :class:`int` + :param lacunarity: :class:`float` + :param gain: :class:`float` + :rtype: :class:`Double3DTuple` + + FBM (Fractal Brownian Motion) is a multi-frequency noise function. + The base frequency is the same as the noise function. The total + number of frequencies is controlled by **octaves**. The **lacunarity** is the + spacing between the frequencies - A value of 2 means each octave is + twice the previous frequency. The **gain** controls how much each + frequency is scaled relative to the previous frequency. + +.. method:: NatronEngine.ExprUtils.fbm (p[,ocaves=6, lacunarity=2, gain=0.5]) + + :param p: :class:`Double3DTuple` + :param octaves: :class:`int` + :param lacunarity: :class:`float` + :param gain: :class:`float` + :rtype: :class:`float` + + FBM (Fractal Brownian Motion) is a multi-frequency noise function. + The base frequency is the same as the noise function. The total + number of frequencies is controlled by **octaves**. The **lacunarity** is the + spacing between the frequencies - A value of 2 means each octave is + twice the previous frequency. The **gain** controls how much each + frequency is scaled relative to the previous frequency. + +.. method:: NatronEngine.ExprUtils.vfbm (p[,ocaves=6, lacunarity=2, gain=0.5]) + + :param p: :class:`Double3DTuple` + :param octaves: :class:`int` + :param lacunarity: :class:`float` + :param gain: :class:`float` + :rtype: :class:`Double3DTuple` + + FBM (Fractal Brownian Motion) is a multi-frequency noise function. + The base frequency is the same as the noise function. The total + number of frequencies is controlled by **octaves**. The **lacunarity** is the + spacing between the frequencies - A value of 2 means each octave is + twice the previous frequency. The **gain** controls how much each + frequency is scaled relative to the previous frequency. + +.. method:: NatronEngine.ExprUtils.fbm4 (p[,ocaves=6, lacunarity=2, gain=0.5]) + + :param p: :class:`Double3DTuple` + :param octaves: :class:`int` + :param lacunarity: :class:`float` + :param gain: :class:`float` + :rtype: :class:`float` + + FBM (Fractal Brownian Motion) is a multi-frequency noise function. + The base frequency is the same as the noise function. The total + number of frequencies is controlled by **octaves**. The **lacunarity** is the + spacing between the frequencies - A value of 2 means each octave is + twice the previous frequency. The **gain** controls how much each + frequency is scaled relative to the previous frequency. + +.. method:: NatronEngine.ExprUtils.vfbm4 (p[,ocaves=6, lacunarity=2, gain=0.5]) + + :param p: :class:`Double3DTuple` + :param octaves: :class:`int` + :param lacunarity: :class:`float` + :param gain: :class:`float` + :rtype: :class:`Double3DTuple` + + FBM (Fractal Brownian Motion) is a multi-frequency noise function. + The base frequency is the same as the noise function. The total + number of frequencies is controlled by **octaves**. The **lacunarity** is the + spacing between the frequencies - A value of 2 means each octave is + twice the previous frequency. The **gain** controls how much each + frequency is scaled relative to the previous frequency. + +.. method:: NatronEngine.ExprUtils.cfbm (p[,ocaves=6, lacunarity=2, gain=0.5]) + + :param p: :class:`Double3DTuple` + :param octaves: :class:`int` + :param lacunarity: :class:`float` + :param gain: :class:`float` + :rtype: :class:`Double3DTuple` + + FBM (Fractal Brownian Motion) is a multi-frequency noise function. + The base frequency is the same as the noise function. The total + number of frequencies is controlled by **octaves**. The **lacunarity** is the + spacing between the frequencies - A value of 2 means each octave is + twice the previous frequency. The **gain** controls how much each + frequency is scaled relative to the previous frequency. + +.. method:: NatronEngine.ExprUtils.cfbm4 (p[,ocaves=6, lacunarity=2, gain=0.5]) + + :param p: :class:`Double3DTuple` + :param octaves: :class:`int` + :param lacunarity: :class:`float` + :param gain: :class:`float` + :rtype: :class:`Double3DTuple` + + FBM (Fractal Brownian Motion) is a multi-frequency noise function. + The base frequency is the same as the noise function. The total + number of frequencies is controlled by **octaves**. The **lacunarity** is the + spacing between the frequencies - A value of 2 means each octave is + twice the previous frequency. The **gain** controls how much each + frequency is scaled relative to the previous frequency. + + +.. method:: NatronEngine.ExprUtils.cellnoise (p) + + :param p: :class:`Double3DTuple` + :rtype: :class:`float` + + cellnoise generates a field of constant colored cubes based on the integer location + This is the same as the prman cellnoise function + +.. method:: NatronEngine.ExprUtils.ccellnoise (p) + + :param p: :class:`Double3DTuple` + :rtype: :class:`Double3DTuple` + + cellnoise generates a field of constant colored cubes based on the integer location + This is the same as the prman cellnoise function + + +.. method:: NatronEngine.ExprUtils.pnoise (p, period) + + + :param p: :class:`Double3DTuple` + :param period: :class:`Double3DTuple` + :rtype: :class:`float` + + Periodic noise + + diff --git a/Documentation/source/devel/PythonReference/NatronEngine/index.rst b/Documentation/source/devel/PythonReference/NatronEngine/index.rst index a545d8285a..beb70c8814 100644 --- a/Documentation/source/devel/PythonReference/NatronEngine/index.rst +++ b/Documentation/source/devel/PythonReference/NatronEngine/index.rst @@ -29,6 +29,7 @@ without importing anything. Double3DTuple DoubleParam Effect + ExprUtils FileParam Group GroupParam diff --git a/Documentation/source/devel/paramExpressions.rst b/Documentation/source/devel/paramExpressions.rst index dbff6834a7..932fe496fd 100644 --- a/Documentation/source/devel/paramExpressions.rst +++ b/Documentation/source/devel/paramExpressions.rst @@ -248,6 +248,12 @@ For integers, use the :func:`randomInt(min,max)<>` function instead:: #Using the randomInt function with a given seed seed = 5 randomInt(seed) + +Advanced expressions: +---------------------- + +To write more advanced expressions based on fractal noise or perlin noise you may use +the functions available in the :ref:`ExprUtils` class. Expressions persistence diff --git a/Engine/Engine.pro b/Engine/Engine.pro index 0883a151ce..5c9ab50056 100644 --- a/Engine/Engine.pro +++ b/Engine/Engine.pro @@ -132,6 +132,7 @@ SOURCES += \ NodeSerialization.cpp \ NodeGroupSerialization.cpp \ NoOpBase.cpp \ + Noise.cpp \ OSGLContext.cpp \ OSGLContext_mac.cpp \ OSGLContext_win.cpp \ @@ -157,6 +158,7 @@ SOURCES += \ PyAppInstance.cpp \ PyNodeGroup.cpp \ PyNode.cpp \ + PyExprUtils.cpp \ PyParameter.cpp \ PyRoto.cpp \ PySideCompat.cpp \ @@ -245,7 +247,8 @@ SOURCES += \ NatronEngine/floatnodecreationproperty_wrapper.cpp \ NatronEngine/intnodecreationproperty_wrapper.cpp \ NatronEngine/nodecreationproperty_wrapper.cpp \ - NatronEngine/stringnodecreationproperty_wrapper.cpp + NatronEngine/stringnodecreationproperty_wrapper.cpp \ + NatronEngine/exprutils_wrapper.cpp HEADERS += \ @@ -328,6 +331,8 @@ HEADERS += \ MemoryFile.h \ MergingEnum.h \ Node.h \ + Noise.h \ + NoiseTables.h \ NodeGroup.h \ NodeGroupSerialization.h \ NodeGraphI.h \ @@ -366,6 +371,7 @@ HEADERS += \ PyGlobalFunctions.h \ PyNodeGroup.h \ PyNode.h \ + PyExprUtils.h \ PyParameter.h \ PyRoto.h \ PyTracker.h \ @@ -504,7 +510,9 @@ HEADERS += \ NatronEngine/floatnodecreationproperty_wrapper.h \ NatronEngine/intnodecreationproperty_wrapper.h \ NatronEngine/nodecreationproperty_wrapper.h \ - NatronEngine/stringnodecreationproperty_wrapper.h + NatronEngine/stringnodecreationproperty_wrapper.h \ + NatronEngine/exprutils_wrapper.h + diff --git a/Engine/NatronEngine/exprutils_wrapper.cpp b/Engine/NatronEngine/exprutils_wrapper.cpp new file mode 100644 index 0000000000..83a9a5cf74 --- /dev/null +++ b/Engine/NatronEngine/exprutils_wrapper.cpp @@ -0,0 +1,2018 @@ + +// default includes +#include "Global/Macros.h" +CLANG_DIAG_OFF(mismatched-tags) +GCC_DIAG_OFF(unused-parameter) +GCC_DIAG_OFF(missing-field-initializers) +GCC_DIAG_OFF(missing-declarations) +GCC_DIAG_OFF(uninitialized) +GCC_DIAG_UNUSED_LOCAL_TYPEDEFS_OFF +#include // produces many warnings +#include +#include +#include +#include +#include +#include "natronengine_python.h" + +#include "exprutils_wrapper.h" + +// Extra includes +NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING +#include +#include + + + +// Target --------------------------------------------------------- + +extern "C" { +static int +Sbk_ExprUtils_Init(PyObject* self, PyObject* args, PyObject* kwds) +{ + SbkObject* sbkSelf = reinterpret_cast(self); + if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType< ::ExprUtils >())) + return -1; + + ::ExprUtils* cptr = 0; + + // Call function/method + { + + if (!PyErr_Occurred()) { + // ExprUtils() + cptr = new ::ExprUtils(); + } + } + + if (PyErr_Occurred() || !Shiboken::Object::setCppPointer(sbkSelf, Shiboken::SbkType< ::ExprUtils >(), cptr)) { + delete cptr; + return -1; + } + Shiboken::Object::setValidCpp(sbkSelf, true); + Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr); + + + return 1; +} + +static PyObject* Sbk_ExprUtilsFunc_boxstep(PyObject* self, PyObject* args) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0}; + + // invalid argument lengths + + + if (!PyArg_UnpackTuple(args, "boxstep", 2, 2, &(pyArgs[0]), &(pyArgs[1]))) + return 0; + + + // Overloaded function decisor + // 0: boxstep(double,double) + if (numArgs == 2 + && (pythonToCpp[0] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[0]))) + && (pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) { + overloadId = 0; // boxstep(double,double) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_boxstep_TypeError; + + // Call function/method + { + double cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + double cppArg1; + pythonToCpp[1](pyArgs[1], &cppArg1); + + if (!PyErr_Occurred()) { + // boxstep(double,double) + double cppResult = ::ExprUtils::boxstep(cppArg0, cppArg1); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_boxstep_TypeError: + const char* overloads[] = {"float, float", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.boxstep", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_ccellnoise(PyObject* self, PyObject* pyArg) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp; + SBK_UNUSED(pythonToCpp) + + // Overloaded function decisor + // 0: ccellnoise(Double3DTuple) + if ((pythonToCpp = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], (pyArg)))) { + overloadId = 0; // ccellnoise(Double3DTuple) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_ccellnoise_TypeError; + + // Call function/method + { + if (!Shiboken::Object::isValid(pyArg)) + return 0; + ::Double3DTuple* cppArg0; + pythonToCpp(pyArg, &cppArg0); + + if (!PyErr_Occurred()) { + // ccellnoise(Double3DTuple) + Double3DTuple* cppResult = new Double3DTuple(::ExprUtils::ccellnoise(*cppArg0)); + pyResult = Shiboken::Object::newObject((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], cppResult, true, true); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_ccellnoise_TypeError: + const char* overloads[] = {"NatronEngine.Double3DTuple", 0}; + Shiboken::setErrorAboutWrongArguments(pyArg, "NatronEngine.ExprUtils.ccellnoise", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_cellnoise(PyObject* self, PyObject* pyArg) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp; + SBK_UNUSED(pythonToCpp) + + // Overloaded function decisor + // 0: cellnoise(Double3DTuple) + if ((pythonToCpp = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], (pyArg)))) { + overloadId = 0; // cellnoise(Double3DTuple) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_cellnoise_TypeError; + + // Call function/method + { + if (!Shiboken::Object::isValid(pyArg)) + return 0; + ::Double3DTuple* cppArg0; + pythonToCpp(pyArg, &cppArg0); + + if (!PyErr_Occurred()) { + // cellnoise(Double3DTuple) + double cppResult = ::ExprUtils::cellnoise(*cppArg0); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_cellnoise_TypeError: + const char* overloads[] = {"NatronEngine.Double3DTuple", 0}; + Shiboken::setErrorAboutWrongArguments(pyArg, "NatronEngine.ExprUtils.cellnoise", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_cfbm(PyObject* self, PyObject* args, PyObject* kwds) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0, 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numNamedArgs = (kwds ? PyDict_Size(kwds) : 0); + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0, 0, 0}; + + // invalid argument lengths + if (numArgs + numNamedArgs > 4) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cfbm(): too many arguments"); + return 0; + } else if (numArgs < 1) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cfbm(): not enough arguments"); + return 0; + } + + if (!PyArg_ParseTuple(args, "|OOOO:cfbm", &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]), &(pyArgs[3]))) + return 0; + + + // Overloaded function decisor + // 0: cfbm(Double3DTuple,int,double,double) + if ((pythonToCpp[0] = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], (pyArgs[0])))) { + if (numArgs == 1) { + overloadId = 0; // cfbm(Double3DTuple,int,double,double) + } else if ((pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) { + if (numArgs == 2) { + overloadId = 0; // cfbm(Double3DTuple,int,double,double) + } else if ((pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) { + if (numArgs == 3) { + overloadId = 0; // cfbm(Double3DTuple,int,double,double) + } else if ((pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) { + overloadId = 0; // cfbm(Double3DTuple,int,double,double) + } + } + } + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_cfbm_TypeError; + + // Call function/method + { + if (kwds) { + PyObject* value = PyDict_GetItemString(kwds, "octaves"); + if (value && pyArgs[1]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cfbm(): got multiple values for keyword argument 'octaves'."); + return 0; + } else if (value) { + pyArgs[1] = value; + if (!(pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) + goto Sbk_ExprUtilsFunc_cfbm_TypeError; + } + value = PyDict_GetItemString(kwds, "lacunarity"); + if (value && pyArgs[2]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cfbm(): got multiple values for keyword argument 'lacunarity'."); + return 0; + } else if (value) { + pyArgs[2] = value; + if (!(pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) + goto Sbk_ExprUtilsFunc_cfbm_TypeError; + } + value = PyDict_GetItemString(kwds, "gain"); + if (value && pyArgs[3]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cfbm(): got multiple values for keyword argument 'gain'."); + return 0; + } else if (value) { + pyArgs[3] = value; + if (!(pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) + goto Sbk_ExprUtilsFunc_cfbm_TypeError; + } + } + if (!Shiboken::Object::isValid(pyArgs[0])) + return 0; + ::Double3DTuple* cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + int cppArg1 = 6; + if (pythonToCpp[1]) pythonToCpp[1](pyArgs[1], &cppArg1); + double cppArg2 = 2.; + if (pythonToCpp[2]) pythonToCpp[2](pyArgs[2], &cppArg2); + double cppArg3 = 0.5; + if (pythonToCpp[3]) pythonToCpp[3](pyArgs[3], &cppArg3); + + if (!PyErr_Occurred()) { + // cfbm(Double3DTuple,int,double,double) + Double3DTuple* cppResult = new Double3DTuple(::ExprUtils::cfbm(*cppArg0, cppArg1, cppArg2, cppArg3)); + pyResult = Shiboken::Object::newObject((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], cppResult, true, true); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_cfbm_TypeError: + const char* overloads[] = {"NatronEngine.Double3DTuple, int = 6, float = 2., float = 0.5", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.cfbm", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_cfbm4(PyObject* self, PyObject* args, PyObject* kwds) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0, 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numNamedArgs = (kwds ? PyDict_Size(kwds) : 0); + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0, 0, 0}; + + // invalid argument lengths + if (numArgs + numNamedArgs > 4) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cfbm4(): too many arguments"); + return 0; + } else if (numArgs < 1) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cfbm4(): not enough arguments"); + return 0; + } + + if (!PyArg_ParseTuple(args, "|OOOO:cfbm4", &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]), &(pyArgs[3]))) + return 0; + + + // Overloaded function decisor + // 0: cfbm4(ColorTuple,int,double,double) + if ((pythonToCpp[0] = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_COLORTUPLE_IDX], (pyArgs[0])))) { + if (numArgs == 1) { + overloadId = 0; // cfbm4(ColorTuple,int,double,double) + } else if ((pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) { + if (numArgs == 2) { + overloadId = 0; // cfbm4(ColorTuple,int,double,double) + } else if ((pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) { + if (numArgs == 3) { + overloadId = 0; // cfbm4(ColorTuple,int,double,double) + } else if ((pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) { + overloadId = 0; // cfbm4(ColorTuple,int,double,double) + } + } + } + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_cfbm4_TypeError; + + // Call function/method + { + if (kwds) { + PyObject* value = PyDict_GetItemString(kwds, "octaves"); + if (value && pyArgs[1]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cfbm4(): got multiple values for keyword argument 'octaves'."); + return 0; + } else if (value) { + pyArgs[1] = value; + if (!(pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) + goto Sbk_ExprUtilsFunc_cfbm4_TypeError; + } + value = PyDict_GetItemString(kwds, "lacunarity"); + if (value && pyArgs[2]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cfbm4(): got multiple values for keyword argument 'lacunarity'."); + return 0; + } else if (value) { + pyArgs[2] = value; + if (!(pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) + goto Sbk_ExprUtilsFunc_cfbm4_TypeError; + } + value = PyDict_GetItemString(kwds, "gain"); + if (value && pyArgs[3]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cfbm4(): got multiple values for keyword argument 'gain'."); + return 0; + } else if (value) { + pyArgs[3] = value; + if (!(pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) + goto Sbk_ExprUtilsFunc_cfbm4_TypeError; + } + } + if (!Shiboken::Object::isValid(pyArgs[0])) + return 0; + ::ColorTuple* cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + int cppArg1 = 6; + if (pythonToCpp[1]) pythonToCpp[1](pyArgs[1], &cppArg1); + double cppArg2 = 2.; + if (pythonToCpp[2]) pythonToCpp[2](pyArgs[2], &cppArg2); + double cppArg3 = 0.5; + if (pythonToCpp[3]) pythonToCpp[3](pyArgs[3], &cppArg3); + + if (!PyErr_Occurred()) { + // cfbm4(ColorTuple,int,double,double) + Double3DTuple* cppResult = new Double3DTuple(::ExprUtils::cfbm4(*cppArg0, cppArg1, cppArg2, cppArg3)); + pyResult = Shiboken::Object::newObject((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], cppResult, true, true); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_cfbm4_TypeError: + const char* overloads[] = {"NatronEngine.ColorTuple, int = 6, float = 2., float = 0.5", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.cfbm4", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_cnoise(PyObject* self, PyObject* pyArg) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp; + SBK_UNUSED(pythonToCpp) + + // Overloaded function decisor + // 0: cnoise(Double3DTuple) + if ((pythonToCpp = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], (pyArg)))) { + overloadId = 0; // cnoise(Double3DTuple) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_cnoise_TypeError; + + // Call function/method + { + if (!Shiboken::Object::isValid(pyArg)) + return 0; + ::Double3DTuple* cppArg0; + pythonToCpp(pyArg, &cppArg0); + + if (!PyErr_Occurred()) { + // cnoise(Double3DTuple) + Double3DTuple* cppResult = new Double3DTuple(::ExprUtils::cnoise(*cppArg0)); + pyResult = Shiboken::Object::newObject((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], cppResult, true, true); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_cnoise_TypeError: + const char* overloads[] = {"NatronEngine.Double3DTuple", 0}; + Shiboken::setErrorAboutWrongArguments(pyArg, "NatronEngine.ExprUtils.cnoise", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_cnoise4(PyObject* self, PyObject* pyArg) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp; + SBK_UNUSED(pythonToCpp) + + // Overloaded function decisor + // 0: cnoise4(ColorTuple) + if ((pythonToCpp = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_COLORTUPLE_IDX], (pyArg)))) { + overloadId = 0; // cnoise4(ColorTuple) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_cnoise4_TypeError; + + // Call function/method + { + if (!Shiboken::Object::isValid(pyArg)) + return 0; + ::ColorTuple* cppArg0; + pythonToCpp(pyArg, &cppArg0); + + if (!PyErr_Occurred()) { + // cnoise4(ColorTuple) + Double3DTuple* cppResult = new Double3DTuple(::ExprUtils::cnoise4(*cppArg0)); + pyResult = Shiboken::Object::newObject((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], cppResult, true, true); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_cnoise4_TypeError: + const char* overloads[] = {"NatronEngine.ColorTuple", 0}; + Shiboken::setErrorAboutWrongArguments(pyArg, "NatronEngine.ExprUtils.cnoise4", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_cturbulence(PyObject* self, PyObject* args, PyObject* kwds) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0, 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numNamedArgs = (kwds ? PyDict_Size(kwds) : 0); + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0, 0, 0}; + + // invalid argument lengths + if (numArgs + numNamedArgs > 4) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cturbulence(): too many arguments"); + return 0; + } else if (numArgs < 1) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cturbulence(): not enough arguments"); + return 0; + } + + if (!PyArg_ParseTuple(args, "|OOOO:cturbulence", &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]), &(pyArgs[3]))) + return 0; + + + // Overloaded function decisor + // 0: cturbulence(Double3DTuple,int,double,double) + if ((pythonToCpp[0] = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], (pyArgs[0])))) { + if (numArgs == 1) { + overloadId = 0; // cturbulence(Double3DTuple,int,double,double) + } else if ((pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) { + if (numArgs == 2) { + overloadId = 0; // cturbulence(Double3DTuple,int,double,double) + } else if ((pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) { + if (numArgs == 3) { + overloadId = 0; // cturbulence(Double3DTuple,int,double,double) + } else if ((pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) { + overloadId = 0; // cturbulence(Double3DTuple,int,double,double) + } + } + } + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_cturbulence_TypeError; + + // Call function/method + { + if (kwds) { + PyObject* value = PyDict_GetItemString(kwds, "octaves"); + if (value && pyArgs[1]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cturbulence(): got multiple values for keyword argument 'octaves'."); + return 0; + } else if (value) { + pyArgs[1] = value; + if (!(pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) + goto Sbk_ExprUtilsFunc_cturbulence_TypeError; + } + value = PyDict_GetItemString(kwds, "lacunarity"); + if (value && pyArgs[2]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cturbulence(): got multiple values for keyword argument 'lacunarity'."); + return 0; + } else if (value) { + pyArgs[2] = value; + if (!(pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) + goto Sbk_ExprUtilsFunc_cturbulence_TypeError; + } + value = PyDict_GetItemString(kwds, "gain"); + if (value && pyArgs[3]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.cturbulence(): got multiple values for keyword argument 'gain'."); + return 0; + } else if (value) { + pyArgs[3] = value; + if (!(pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) + goto Sbk_ExprUtilsFunc_cturbulence_TypeError; + } + } + if (!Shiboken::Object::isValid(pyArgs[0])) + return 0; + ::Double3DTuple* cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + int cppArg1 = 6; + if (pythonToCpp[1]) pythonToCpp[1](pyArgs[1], &cppArg1); + double cppArg2 = 2.; + if (pythonToCpp[2]) pythonToCpp[2](pyArgs[2], &cppArg2); + double cppArg3 = 0.5; + if (pythonToCpp[3]) pythonToCpp[3](pyArgs[3], &cppArg3); + + if (!PyErr_Occurred()) { + // cturbulence(Double3DTuple,int,double,double) + Double3DTuple* cppResult = new Double3DTuple(::ExprUtils::cturbulence(*cppArg0, cppArg1, cppArg2, cppArg3)); + pyResult = Shiboken::Object::newObject((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], cppResult, true, true); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_cturbulence_TypeError: + const char* overloads[] = {"NatronEngine.Double3DTuple, int = 6, float = 2., float = 0.5", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.cturbulence", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_fbm(PyObject* self, PyObject* args, PyObject* kwds) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0, 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numNamedArgs = (kwds ? PyDict_Size(kwds) : 0); + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0, 0, 0}; + + // invalid argument lengths + if (numArgs + numNamedArgs > 4) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.fbm(): too many arguments"); + return 0; + } else if (numArgs < 1) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.fbm(): not enough arguments"); + return 0; + } + + if (!PyArg_ParseTuple(args, "|OOOO:fbm", &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]), &(pyArgs[3]))) + return 0; + + + // Overloaded function decisor + // 0: fbm(Double3DTuple,int,double,double) + if ((pythonToCpp[0] = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], (pyArgs[0])))) { + if (numArgs == 1) { + overloadId = 0; // fbm(Double3DTuple,int,double,double) + } else if ((pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) { + if (numArgs == 2) { + overloadId = 0; // fbm(Double3DTuple,int,double,double) + } else if ((pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) { + if (numArgs == 3) { + overloadId = 0; // fbm(Double3DTuple,int,double,double) + } else if ((pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) { + overloadId = 0; // fbm(Double3DTuple,int,double,double) + } + } + } + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_fbm_TypeError; + + // Call function/method + { + if (kwds) { + PyObject* value = PyDict_GetItemString(kwds, "octaves"); + if (value && pyArgs[1]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.fbm(): got multiple values for keyword argument 'octaves'."); + return 0; + } else if (value) { + pyArgs[1] = value; + if (!(pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) + goto Sbk_ExprUtilsFunc_fbm_TypeError; + } + value = PyDict_GetItemString(kwds, "lacunarity"); + if (value && pyArgs[2]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.fbm(): got multiple values for keyword argument 'lacunarity'."); + return 0; + } else if (value) { + pyArgs[2] = value; + if (!(pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) + goto Sbk_ExprUtilsFunc_fbm_TypeError; + } + value = PyDict_GetItemString(kwds, "gain"); + if (value && pyArgs[3]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.fbm(): got multiple values for keyword argument 'gain'."); + return 0; + } else if (value) { + pyArgs[3] = value; + if (!(pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) + goto Sbk_ExprUtilsFunc_fbm_TypeError; + } + } + if (!Shiboken::Object::isValid(pyArgs[0])) + return 0; + ::Double3DTuple* cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + int cppArg1 = 6; + if (pythonToCpp[1]) pythonToCpp[1](pyArgs[1], &cppArg1); + double cppArg2 = 2.; + if (pythonToCpp[2]) pythonToCpp[2](pyArgs[2], &cppArg2); + double cppArg3 = 0.5; + if (pythonToCpp[3]) pythonToCpp[3](pyArgs[3], &cppArg3); + + if (!PyErr_Occurred()) { + // fbm(Double3DTuple,int,double,double) + double cppResult = ::ExprUtils::fbm(*cppArg0, cppArg1, cppArg2, cppArg3); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_fbm_TypeError: + const char* overloads[] = {"NatronEngine.Double3DTuple, int = 6, float = 2., float = 0.5", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.fbm", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_fbm4(PyObject* self, PyObject* args, PyObject* kwds) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0, 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numNamedArgs = (kwds ? PyDict_Size(kwds) : 0); + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0, 0, 0}; + + // invalid argument lengths + if (numArgs + numNamedArgs > 4) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.fbm4(): too many arguments"); + return 0; + } else if (numArgs < 1) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.fbm4(): not enough arguments"); + return 0; + } + + if (!PyArg_ParseTuple(args, "|OOOO:fbm4", &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]), &(pyArgs[3]))) + return 0; + + + // Overloaded function decisor + // 0: fbm4(ColorTuple,int,double,double) + if ((pythonToCpp[0] = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_COLORTUPLE_IDX], (pyArgs[0])))) { + if (numArgs == 1) { + overloadId = 0; // fbm4(ColorTuple,int,double,double) + } else if ((pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) { + if (numArgs == 2) { + overloadId = 0; // fbm4(ColorTuple,int,double,double) + } else if ((pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) { + if (numArgs == 3) { + overloadId = 0; // fbm4(ColorTuple,int,double,double) + } else if ((pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) { + overloadId = 0; // fbm4(ColorTuple,int,double,double) + } + } + } + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_fbm4_TypeError; + + // Call function/method + { + if (kwds) { + PyObject* value = PyDict_GetItemString(kwds, "octaves"); + if (value && pyArgs[1]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.fbm4(): got multiple values for keyword argument 'octaves'."); + return 0; + } else if (value) { + pyArgs[1] = value; + if (!(pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) + goto Sbk_ExprUtilsFunc_fbm4_TypeError; + } + value = PyDict_GetItemString(kwds, "lacunarity"); + if (value && pyArgs[2]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.fbm4(): got multiple values for keyword argument 'lacunarity'."); + return 0; + } else if (value) { + pyArgs[2] = value; + if (!(pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) + goto Sbk_ExprUtilsFunc_fbm4_TypeError; + } + value = PyDict_GetItemString(kwds, "gain"); + if (value && pyArgs[3]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.fbm4(): got multiple values for keyword argument 'gain'."); + return 0; + } else if (value) { + pyArgs[3] = value; + if (!(pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) + goto Sbk_ExprUtilsFunc_fbm4_TypeError; + } + } + if (!Shiboken::Object::isValid(pyArgs[0])) + return 0; + ::ColorTuple* cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + int cppArg1 = 6; + if (pythonToCpp[1]) pythonToCpp[1](pyArgs[1], &cppArg1); + double cppArg2 = 2.; + if (pythonToCpp[2]) pythonToCpp[2](pyArgs[2], &cppArg2); + double cppArg3 = 0.5; + if (pythonToCpp[3]) pythonToCpp[3](pyArgs[3], &cppArg3); + + if (!PyErr_Occurred()) { + // fbm4(ColorTuple,int,double,double) + double cppResult = ::ExprUtils::fbm4(*cppArg0, cppArg1, cppArg2, cppArg3); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_fbm4_TypeError: + const char* overloads[] = {"NatronEngine.ColorTuple, int = 6, float = 2., float = 0.5", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.fbm4", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_gaussstep(PyObject* self, PyObject* args) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0, 0}; + + // invalid argument lengths + + + if (!PyArg_UnpackTuple(args, "gaussstep", 3, 3, &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]))) + return 0; + + + // Overloaded function decisor + // 0: gaussstep(double,double,double) + if (numArgs == 3 + && (pythonToCpp[0] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[0]))) + && (pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1]))) + && (pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) { + overloadId = 0; // gaussstep(double,double,double) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_gaussstep_TypeError; + + // Call function/method + { + double cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + double cppArg1; + pythonToCpp[1](pyArgs[1], &cppArg1); + double cppArg2; + pythonToCpp[2](pyArgs[2], &cppArg2); + + if (!PyErr_Occurred()) { + // gaussstep(double,double,double) + double cppResult = ::ExprUtils::gaussstep(cppArg0, cppArg1, cppArg2); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_gaussstep_TypeError: + const char* overloads[] = {"float, float, float", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.gaussstep", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_hash(PyObject* self, PyObject* pyArg) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp; + SBK_UNUSED(pythonToCpp) + + // Overloaded function decisor + // 0: hash(std::vector) + if ((pythonToCpp = Shiboken::Conversions::isPythonToCppConvertible(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_VECTOR_DOUBLE_IDX], (pyArg)))) { + overloadId = 0; // hash(std::vector) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_hash_TypeError; + + // Call function/method + { + ::std::vector cppArg0; + pythonToCpp(pyArg, &cppArg0); + + if (!PyErr_Occurred()) { + // hash(std::vector) + double cppResult = ::ExprUtils::hash(cppArg0); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_hash_TypeError: + const char* overloads[] = {"list", 0}; + Shiboken::setErrorAboutWrongArguments(pyArg, "NatronEngine.ExprUtils.hash", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_linearstep(PyObject* self, PyObject* args) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0, 0}; + + // invalid argument lengths + + + if (!PyArg_UnpackTuple(args, "linearstep", 3, 3, &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]))) + return 0; + + + // Overloaded function decisor + // 0: linearstep(double,double,double) + if (numArgs == 3 + && (pythonToCpp[0] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[0]))) + && (pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1]))) + && (pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) { + overloadId = 0; // linearstep(double,double,double) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_linearstep_TypeError; + + // Call function/method + { + double cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + double cppArg1; + pythonToCpp[1](pyArgs[1], &cppArg1); + double cppArg2; + pythonToCpp[2](pyArgs[2], &cppArg2); + + if (!PyErr_Occurred()) { + // linearstep(double,double,double) + double cppResult = ::ExprUtils::linearstep(cppArg0, cppArg1, cppArg2); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_linearstep_TypeError: + const char* overloads[] = {"float, float, float", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.linearstep", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_mix(PyObject* self, PyObject* args) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0, 0}; + + // invalid argument lengths + + + if (!PyArg_UnpackTuple(args, "mix", 3, 3, &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]))) + return 0; + + + // Overloaded function decisor + // 0: mix(double,double,double) + if (numArgs == 3 + && (pythonToCpp[0] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[0]))) + && (pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1]))) + && (pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) { + overloadId = 0; // mix(double,double,double) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_mix_TypeError; + + // Call function/method + { + double cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + double cppArg1; + pythonToCpp[1](pyArgs[1], &cppArg1); + double cppArg2; + pythonToCpp[2](pyArgs[2], &cppArg2); + + if (!PyErr_Occurred()) { + // mix(double,double,double) + double cppResult = ::ExprUtils::mix(cppArg0, cppArg1, cppArg2); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_mix_TypeError: + const char* overloads[] = {"float, float, float", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.mix", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_noise(PyObject* self, PyObject* pyArg) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp; + SBK_UNUSED(pythonToCpp) + + // Overloaded function decisor + // 0: noise(ColorTuple) + // 1: noise(Double2DTuple) + // 2: noise(Double3DTuple) + // 3: noise(double) + if ((pythonToCpp = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArg)))) { + overloadId = 3; // noise(double) + } else if ((pythonToCpp = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], (pyArg)))) { + overloadId = 2; // noise(Double3DTuple) + } else if ((pythonToCpp = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE2DTUPLE_IDX], (pyArg)))) { + overloadId = 1; // noise(Double2DTuple) + } else if ((pythonToCpp = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_COLORTUPLE_IDX], (pyArg)))) { + overloadId = 0; // noise(ColorTuple) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_noise_TypeError; + + // Call function/method + switch (overloadId) { + case 0: // noise(const ColorTuple & p) + { + if (!Shiboken::Object::isValid(pyArg)) + return 0; + ::ColorTuple* cppArg0; + pythonToCpp(pyArg, &cppArg0); + + if (!PyErr_Occurred()) { + // noise(ColorTuple) + double cppResult = ::ExprUtils::noise(*cppArg0); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + break; + } + case 1: // noise(const Double2DTuple & p) + { + if (!Shiboken::Object::isValid(pyArg)) + return 0; + ::Double2DTuple* cppArg0; + pythonToCpp(pyArg, &cppArg0); + + if (!PyErr_Occurred()) { + // noise(Double2DTuple) + double cppResult = ::ExprUtils::noise(*cppArg0); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + break; + } + case 2: // noise(const Double3DTuple & p) + { + if (!Shiboken::Object::isValid(pyArg)) + return 0; + ::Double3DTuple* cppArg0; + pythonToCpp(pyArg, &cppArg0); + + if (!PyErr_Occurred()) { + // noise(Double3DTuple) + double cppResult = ::ExprUtils::noise(*cppArg0); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + break; + } + case 3: // noise(double x) + { + double cppArg0; + pythonToCpp(pyArg, &cppArg0); + + if (!PyErr_Occurred()) { + // noise(double) + double cppResult = ::ExprUtils::noise(cppArg0); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + break; + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_noise_TypeError: + const char* overloads[] = {"NatronEngine.ColorTuple", "NatronEngine.Double2DTuple", "NatronEngine.Double3DTuple", "float", 0}; + Shiboken::setErrorAboutWrongArguments(pyArg, "NatronEngine.ExprUtils.noise", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_pnoise(PyObject* self, PyObject* args) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0}; + + // invalid argument lengths + + + if (!PyArg_UnpackTuple(args, "pnoise", 2, 2, &(pyArgs[0]), &(pyArgs[1]))) + return 0; + + + // Overloaded function decisor + // 0: pnoise(Double3DTuple,Double3DTuple) + if (numArgs == 2 + && (pythonToCpp[0] = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], (pyArgs[0]))) + && (pythonToCpp[1] = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], (pyArgs[1])))) { + overloadId = 0; // pnoise(Double3DTuple,Double3DTuple) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_pnoise_TypeError; + + // Call function/method + { + if (!Shiboken::Object::isValid(pyArgs[0])) + return 0; + ::Double3DTuple* cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + if (!Shiboken::Object::isValid(pyArgs[1])) + return 0; + ::Double3DTuple* cppArg1; + pythonToCpp[1](pyArgs[1], &cppArg1); + + if (!PyErr_Occurred()) { + // pnoise(Double3DTuple,Double3DTuple) + double cppResult = ::ExprUtils::pnoise(*cppArg0, *cppArg1); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_pnoise_TypeError: + const char* overloads[] = {"NatronEngine.Double3DTuple, NatronEngine.Double3DTuple", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.pnoise", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_remap(PyObject* self, PyObject* args) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0, 0, 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0, 0, 0, 0}; + + // invalid argument lengths + + + if (!PyArg_UnpackTuple(args, "remap", 5, 5, &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]), &(pyArgs[3]), &(pyArgs[4]))) + return 0; + + + // Overloaded function decisor + // 0: remap(double,double,double,double,double) + if (numArgs == 5 + && (pythonToCpp[0] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[0]))) + && (pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1]))) + && (pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2]))) + && (pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3]))) + && (pythonToCpp[4] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[4])))) { + overloadId = 0; // remap(double,double,double,double,double) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_remap_TypeError; + + // Call function/method + { + double cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + double cppArg1; + pythonToCpp[1](pyArgs[1], &cppArg1); + double cppArg2; + pythonToCpp[2](pyArgs[2], &cppArg2); + double cppArg3; + pythonToCpp[3](pyArgs[3], &cppArg3); + double cppArg4; + pythonToCpp[4](pyArgs[4], &cppArg4); + + if (!PyErr_Occurred()) { + // remap(double,double,double,double,double) + double cppResult = ::ExprUtils::remap(cppArg0, cppArg1, cppArg2, cppArg3, cppArg4); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_remap_TypeError: + const char* overloads[] = {"float, float, float, float, float", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.remap", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_smoothstep(PyObject* self, PyObject* args) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0, 0}; + + // invalid argument lengths + + + if (!PyArg_UnpackTuple(args, "smoothstep", 3, 3, &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]))) + return 0; + + + // Overloaded function decisor + // 0: smoothstep(double,double,double) + if (numArgs == 3 + && (pythonToCpp[0] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[0]))) + && (pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1]))) + && (pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) { + overloadId = 0; // smoothstep(double,double,double) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_smoothstep_TypeError; + + // Call function/method + { + double cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + double cppArg1; + pythonToCpp[1](pyArgs[1], &cppArg1); + double cppArg2; + pythonToCpp[2](pyArgs[2], &cppArg2); + + if (!PyErr_Occurred()) { + // smoothstep(double,double,double) + double cppResult = ::ExprUtils::smoothstep(cppArg0, cppArg1, cppArg2); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_smoothstep_TypeError: + const char* overloads[] = {"float, float, float", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.smoothstep", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_snoise(PyObject* self, PyObject* pyArg) +{ + ::ExprUtils* cppSelf = 0; + SBK_UNUSED(cppSelf) + if (!Shiboken::Object::isValid(self)) + return 0; + cppSelf = ((::ExprUtils*)Shiboken::Conversions::cppPointer(SbkNatronEngineTypes[SBK_EXPRUTILS_IDX], (SbkObject*)self)); + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp; + SBK_UNUSED(pythonToCpp) + + // Overloaded function decisor + // 0: snoise(Double3DTuple) + if ((pythonToCpp = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], (pyArg)))) { + overloadId = 0; // snoise(Double3DTuple) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_snoise_TypeError; + + // Call function/method + { + if (!Shiboken::Object::isValid(pyArg)) + return 0; + ::Double3DTuple* cppArg0; + pythonToCpp(pyArg, &cppArg0); + + if (!PyErr_Occurred()) { + // snoise(Double3DTuple) + double cppResult = cppSelf->snoise(*cppArg0); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_snoise_TypeError: + const char* overloads[] = {"NatronEngine.Double3DTuple", 0}; + Shiboken::setErrorAboutWrongArguments(pyArg, "NatronEngine.ExprUtils.snoise", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_snoise4(PyObject* self, PyObject* pyArg) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp; + SBK_UNUSED(pythonToCpp) + + // Overloaded function decisor + // 0: snoise4(ColorTuple) + if ((pythonToCpp = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_COLORTUPLE_IDX], (pyArg)))) { + overloadId = 0; // snoise4(ColorTuple) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_snoise4_TypeError; + + // Call function/method + { + if (!Shiboken::Object::isValid(pyArg)) + return 0; + ::ColorTuple* cppArg0; + pythonToCpp(pyArg, &cppArg0); + + if (!PyErr_Occurred()) { + // snoise4(ColorTuple) + double cppResult = ::ExprUtils::snoise4(*cppArg0); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_snoise4_TypeError: + const char* overloads[] = {"NatronEngine.ColorTuple", 0}; + Shiboken::setErrorAboutWrongArguments(pyArg, "NatronEngine.ExprUtils.snoise4", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_turbulence(PyObject* self, PyObject* args, PyObject* kwds) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0, 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numNamedArgs = (kwds ? PyDict_Size(kwds) : 0); + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0, 0, 0}; + + // invalid argument lengths + if (numArgs + numNamedArgs > 4) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.turbulence(): too many arguments"); + return 0; + } else if (numArgs < 1) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.turbulence(): not enough arguments"); + return 0; + } + + if (!PyArg_ParseTuple(args, "|OOOO:turbulence", &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]), &(pyArgs[3]))) + return 0; + + + // Overloaded function decisor + // 0: turbulence(Double3DTuple,int,double,double) + if ((pythonToCpp[0] = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], (pyArgs[0])))) { + if (numArgs == 1) { + overloadId = 0; // turbulence(Double3DTuple,int,double,double) + } else if ((pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) { + if (numArgs == 2) { + overloadId = 0; // turbulence(Double3DTuple,int,double,double) + } else if ((pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) { + if (numArgs == 3) { + overloadId = 0; // turbulence(Double3DTuple,int,double,double) + } else if ((pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) { + overloadId = 0; // turbulence(Double3DTuple,int,double,double) + } + } + } + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_turbulence_TypeError; + + // Call function/method + { + if (kwds) { + PyObject* value = PyDict_GetItemString(kwds, "octaves"); + if (value && pyArgs[1]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.turbulence(): got multiple values for keyword argument 'octaves'."); + return 0; + } else if (value) { + pyArgs[1] = value; + if (!(pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) + goto Sbk_ExprUtilsFunc_turbulence_TypeError; + } + value = PyDict_GetItemString(kwds, "lacunarity"); + if (value && pyArgs[2]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.turbulence(): got multiple values for keyword argument 'lacunarity'."); + return 0; + } else if (value) { + pyArgs[2] = value; + if (!(pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) + goto Sbk_ExprUtilsFunc_turbulence_TypeError; + } + value = PyDict_GetItemString(kwds, "gain"); + if (value && pyArgs[3]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.turbulence(): got multiple values for keyword argument 'gain'."); + return 0; + } else if (value) { + pyArgs[3] = value; + if (!(pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) + goto Sbk_ExprUtilsFunc_turbulence_TypeError; + } + } + if (!Shiboken::Object::isValid(pyArgs[0])) + return 0; + ::Double3DTuple* cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + int cppArg1 = 6; + if (pythonToCpp[1]) pythonToCpp[1](pyArgs[1], &cppArg1); + double cppArg2 = 2.; + if (pythonToCpp[2]) pythonToCpp[2](pyArgs[2], &cppArg2); + double cppArg3 = 0.5; + if (pythonToCpp[3]) pythonToCpp[3](pyArgs[3], &cppArg3); + + if (!PyErr_Occurred()) { + // turbulence(Double3DTuple,int,double,double) + double cppResult = ::ExprUtils::turbulence(*cppArg0, cppArg1, cppArg2, cppArg3); + pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter(), &cppResult); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_turbulence_TypeError: + const char* overloads[] = {"NatronEngine.Double3DTuple, int = 6, float = 2., float = 0.5", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.turbulence", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_vfbm(PyObject* self, PyObject* args, PyObject* kwds) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0, 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numNamedArgs = (kwds ? PyDict_Size(kwds) : 0); + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0, 0, 0}; + + // invalid argument lengths + if (numArgs + numNamedArgs > 4) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vfbm(): too many arguments"); + return 0; + } else if (numArgs < 1) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vfbm(): not enough arguments"); + return 0; + } + + if (!PyArg_ParseTuple(args, "|OOOO:vfbm", &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]), &(pyArgs[3]))) + return 0; + + + // Overloaded function decisor + // 0: vfbm(Double3DTuple,int,double,double) + if ((pythonToCpp[0] = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], (pyArgs[0])))) { + if (numArgs == 1) { + overloadId = 0; // vfbm(Double3DTuple,int,double,double) + } else if ((pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) { + if (numArgs == 2) { + overloadId = 0; // vfbm(Double3DTuple,int,double,double) + } else if ((pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) { + if (numArgs == 3) { + overloadId = 0; // vfbm(Double3DTuple,int,double,double) + } else if ((pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) { + overloadId = 0; // vfbm(Double3DTuple,int,double,double) + } + } + } + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_vfbm_TypeError; + + // Call function/method + { + if (kwds) { + PyObject* value = PyDict_GetItemString(kwds, "octaves"); + if (value && pyArgs[1]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vfbm(): got multiple values for keyword argument 'octaves'."); + return 0; + } else if (value) { + pyArgs[1] = value; + if (!(pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) + goto Sbk_ExprUtilsFunc_vfbm_TypeError; + } + value = PyDict_GetItemString(kwds, "lacunarity"); + if (value && pyArgs[2]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vfbm(): got multiple values for keyword argument 'lacunarity'."); + return 0; + } else if (value) { + pyArgs[2] = value; + if (!(pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) + goto Sbk_ExprUtilsFunc_vfbm_TypeError; + } + value = PyDict_GetItemString(kwds, "gain"); + if (value && pyArgs[3]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vfbm(): got multiple values for keyword argument 'gain'."); + return 0; + } else if (value) { + pyArgs[3] = value; + if (!(pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) + goto Sbk_ExprUtilsFunc_vfbm_TypeError; + } + } + if (!Shiboken::Object::isValid(pyArgs[0])) + return 0; + ::Double3DTuple* cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + int cppArg1 = 6; + if (pythonToCpp[1]) pythonToCpp[1](pyArgs[1], &cppArg1); + double cppArg2 = 2.; + if (pythonToCpp[2]) pythonToCpp[2](pyArgs[2], &cppArg2); + double cppArg3 = 0.5; + if (pythonToCpp[3]) pythonToCpp[3](pyArgs[3], &cppArg3); + + if (!PyErr_Occurred()) { + // vfbm(Double3DTuple,int,double,double) + Double3DTuple* cppResult = new Double3DTuple(::ExprUtils::vfbm(*cppArg0, cppArg1, cppArg2, cppArg3)); + pyResult = Shiboken::Object::newObject((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], cppResult, true, true); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_vfbm_TypeError: + const char* overloads[] = {"NatronEngine.Double3DTuple, int = 6, float = 2., float = 0.5", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.vfbm", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_vfbm4(PyObject* self, PyObject* args, PyObject* kwds) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0, 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numNamedArgs = (kwds ? PyDict_Size(kwds) : 0); + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0, 0, 0}; + + // invalid argument lengths + if (numArgs + numNamedArgs > 4) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vfbm4(): too many arguments"); + return 0; + } else if (numArgs < 1) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vfbm4(): not enough arguments"); + return 0; + } + + if (!PyArg_ParseTuple(args, "|OOOO:vfbm4", &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]), &(pyArgs[3]))) + return 0; + + + // Overloaded function decisor + // 0: vfbm4(ColorTuple,int,double,double) + if ((pythonToCpp[0] = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_COLORTUPLE_IDX], (pyArgs[0])))) { + if (numArgs == 1) { + overloadId = 0; // vfbm4(ColorTuple,int,double,double) + } else if ((pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) { + if (numArgs == 2) { + overloadId = 0; // vfbm4(ColorTuple,int,double,double) + } else if ((pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) { + if (numArgs == 3) { + overloadId = 0; // vfbm4(ColorTuple,int,double,double) + } else if ((pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) { + overloadId = 0; // vfbm4(ColorTuple,int,double,double) + } + } + } + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_vfbm4_TypeError; + + // Call function/method + { + if (kwds) { + PyObject* value = PyDict_GetItemString(kwds, "octaves"); + if (value && pyArgs[1]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vfbm4(): got multiple values for keyword argument 'octaves'."); + return 0; + } else if (value) { + pyArgs[1] = value; + if (!(pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) + goto Sbk_ExprUtilsFunc_vfbm4_TypeError; + } + value = PyDict_GetItemString(kwds, "lacunarity"); + if (value && pyArgs[2]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vfbm4(): got multiple values for keyword argument 'lacunarity'."); + return 0; + } else if (value) { + pyArgs[2] = value; + if (!(pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) + goto Sbk_ExprUtilsFunc_vfbm4_TypeError; + } + value = PyDict_GetItemString(kwds, "gain"); + if (value && pyArgs[3]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vfbm4(): got multiple values for keyword argument 'gain'."); + return 0; + } else if (value) { + pyArgs[3] = value; + if (!(pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) + goto Sbk_ExprUtilsFunc_vfbm4_TypeError; + } + } + if (!Shiboken::Object::isValid(pyArgs[0])) + return 0; + ::ColorTuple* cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + int cppArg1 = 6; + if (pythonToCpp[1]) pythonToCpp[1](pyArgs[1], &cppArg1); + double cppArg2 = 2.; + if (pythonToCpp[2]) pythonToCpp[2](pyArgs[2], &cppArg2); + double cppArg3 = 0.5; + if (pythonToCpp[3]) pythonToCpp[3](pyArgs[3], &cppArg3); + + if (!PyErr_Occurred()) { + // vfbm4(ColorTuple,int,double,double) + Double3DTuple* cppResult = new Double3DTuple(::ExprUtils::vfbm4(*cppArg0, cppArg1, cppArg2, cppArg3)); + pyResult = Shiboken::Object::newObject((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], cppResult, true, true); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_vfbm4_TypeError: + const char* overloads[] = {"NatronEngine.ColorTuple, int = 6, float = 2., float = 0.5", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.vfbm4", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_vnoise(PyObject* self, PyObject* pyArg) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp; + SBK_UNUSED(pythonToCpp) + + // Overloaded function decisor + // 0: vnoise(Double3DTuple) + if ((pythonToCpp = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], (pyArg)))) { + overloadId = 0; // vnoise(Double3DTuple) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_vnoise_TypeError; + + // Call function/method + { + if (!Shiboken::Object::isValid(pyArg)) + return 0; + ::Double3DTuple* cppArg0; + pythonToCpp(pyArg, &cppArg0); + + if (!PyErr_Occurred()) { + // vnoise(Double3DTuple) + Double3DTuple* cppResult = new Double3DTuple(::ExprUtils::vnoise(*cppArg0)); + pyResult = Shiboken::Object::newObject((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], cppResult, true, true); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_vnoise_TypeError: + const char* overloads[] = {"NatronEngine.Double3DTuple", 0}; + Shiboken::setErrorAboutWrongArguments(pyArg, "NatronEngine.ExprUtils.vnoise", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_vnoise4(PyObject* self, PyObject* pyArg) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp; + SBK_UNUSED(pythonToCpp) + + // Overloaded function decisor + // 0: vnoise4(ColorTuple) + if ((pythonToCpp = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_COLORTUPLE_IDX], (pyArg)))) { + overloadId = 0; // vnoise4(ColorTuple) + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_vnoise4_TypeError; + + // Call function/method + { + if (!Shiboken::Object::isValid(pyArg)) + return 0; + ::ColorTuple* cppArg0; + pythonToCpp(pyArg, &cppArg0); + + if (!PyErr_Occurred()) { + // vnoise4(ColorTuple) + Double3DTuple* cppResult = new Double3DTuple(::ExprUtils::vnoise4(*cppArg0)); + pyResult = Shiboken::Object::newObject((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], cppResult, true, true); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_vnoise4_TypeError: + const char* overloads[] = {"NatronEngine.ColorTuple", 0}; + Shiboken::setErrorAboutWrongArguments(pyArg, "NatronEngine.ExprUtils.vnoise4", overloads); + return 0; +} + +static PyObject* Sbk_ExprUtilsFunc_vturbulence(PyObject* self, PyObject* args, PyObject* kwds) +{ + PyObject* pyResult = 0; + int overloadId = -1; + PythonToCppFunc pythonToCpp[] = { 0, 0, 0, 0 }; + SBK_UNUSED(pythonToCpp) + int numNamedArgs = (kwds ? PyDict_Size(kwds) : 0); + int numArgs = PyTuple_GET_SIZE(args); + PyObject* pyArgs[] = {0, 0, 0, 0}; + + // invalid argument lengths + if (numArgs + numNamedArgs > 4) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vturbulence(): too many arguments"); + return 0; + } else if (numArgs < 1) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vturbulence(): not enough arguments"); + return 0; + } + + if (!PyArg_ParseTuple(args, "|OOOO:vturbulence", &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]), &(pyArgs[3]))) + return 0; + + + // Overloaded function decisor + // 0: vturbulence(Double3DTuple,int,double,double) + if ((pythonToCpp[0] = Shiboken::Conversions::isPythonToCppReferenceConvertible((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], (pyArgs[0])))) { + if (numArgs == 1) { + overloadId = 0; // vturbulence(Double3DTuple,int,double,double) + } else if ((pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) { + if (numArgs == 2) { + overloadId = 0; // vturbulence(Double3DTuple,int,double,double) + } else if ((pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) { + if (numArgs == 3) { + overloadId = 0; // vturbulence(Double3DTuple,int,double,double) + } else if ((pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) { + overloadId = 0; // vturbulence(Double3DTuple,int,double,double) + } + } + } + } + + // Function signature not found. + if (overloadId == -1) goto Sbk_ExprUtilsFunc_vturbulence_TypeError; + + // Call function/method + { + if (kwds) { + PyObject* value = PyDict_GetItemString(kwds, "octaves"); + if (value && pyArgs[1]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vturbulence(): got multiple values for keyword argument 'octaves'."); + return 0; + } else if (value) { + pyArgs[1] = value; + if (!(pythonToCpp[1] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[1])))) + goto Sbk_ExprUtilsFunc_vturbulence_TypeError; + } + value = PyDict_GetItemString(kwds, "lacunarity"); + if (value && pyArgs[2]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vturbulence(): got multiple values for keyword argument 'lacunarity'."); + return 0; + } else if (value) { + pyArgs[2] = value; + if (!(pythonToCpp[2] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[2])))) + goto Sbk_ExprUtilsFunc_vturbulence_TypeError; + } + value = PyDict_GetItemString(kwds, "gain"); + if (value && pyArgs[3]) { + PyErr_SetString(PyExc_TypeError, "NatronEngine.ExprUtils.vturbulence(): got multiple values for keyword argument 'gain'."); + return 0; + } else if (value) { + pyArgs[3] = value; + if (!(pythonToCpp[3] = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArgs[3])))) + goto Sbk_ExprUtilsFunc_vturbulence_TypeError; + } + } + if (!Shiboken::Object::isValid(pyArgs[0])) + return 0; + ::Double3DTuple* cppArg0; + pythonToCpp[0](pyArgs[0], &cppArg0); + int cppArg1 = 6; + if (pythonToCpp[1]) pythonToCpp[1](pyArgs[1], &cppArg1); + double cppArg2 = 2.; + if (pythonToCpp[2]) pythonToCpp[2](pyArgs[2], &cppArg2); + double cppArg3 = 0.5; + if (pythonToCpp[3]) pythonToCpp[3](pyArgs[3], &cppArg3); + + if (!PyErr_Occurred()) { + // vturbulence(Double3DTuple,int,double,double) + Double3DTuple* cppResult = new Double3DTuple(::ExprUtils::vturbulence(*cppArg0, cppArg1, cppArg2, cppArg3)); + pyResult = Shiboken::Object::newObject((SbkObjectType*)SbkNatronEngineTypes[SBK_DOUBLE3DTUPLE_IDX], cppResult, true, true); + } + } + + if (PyErr_Occurred() || !pyResult) { + Py_XDECREF(pyResult); + return 0; + } + return pyResult; + + Sbk_ExprUtilsFunc_vturbulence_TypeError: + const char* overloads[] = {"NatronEngine.Double3DTuple, int = 6, float = 2., float = 0.5", 0}; + Shiboken::setErrorAboutWrongArguments(args, "NatronEngine.ExprUtils.vturbulence", overloads); + return 0; +} + +static PyMethodDef Sbk_ExprUtils_methods[] = { + {"boxstep", (PyCFunction)Sbk_ExprUtilsFunc_boxstep, METH_VARARGS|METH_STATIC}, + {"ccellnoise", (PyCFunction)Sbk_ExprUtilsFunc_ccellnoise, METH_O|METH_STATIC}, + {"cellnoise", (PyCFunction)Sbk_ExprUtilsFunc_cellnoise, METH_O|METH_STATIC}, + {"cfbm", (PyCFunction)Sbk_ExprUtilsFunc_cfbm, METH_VARARGS|METH_KEYWORDS|METH_STATIC}, + {"cfbm4", (PyCFunction)Sbk_ExprUtilsFunc_cfbm4, METH_VARARGS|METH_KEYWORDS|METH_STATIC}, + {"cnoise", (PyCFunction)Sbk_ExprUtilsFunc_cnoise, METH_O|METH_STATIC}, + {"cnoise4", (PyCFunction)Sbk_ExprUtilsFunc_cnoise4, METH_O|METH_STATIC}, + {"cturbulence", (PyCFunction)Sbk_ExprUtilsFunc_cturbulence, METH_VARARGS|METH_KEYWORDS|METH_STATIC}, + {"fbm", (PyCFunction)Sbk_ExprUtilsFunc_fbm, METH_VARARGS|METH_KEYWORDS|METH_STATIC}, + {"fbm4", (PyCFunction)Sbk_ExprUtilsFunc_fbm4, METH_VARARGS|METH_KEYWORDS|METH_STATIC}, + {"gaussstep", (PyCFunction)Sbk_ExprUtilsFunc_gaussstep, METH_VARARGS|METH_STATIC}, + {"hash", (PyCFunction)Sbk_ExprUtilsFunc_hash, METH_O|METH_STATIC}, + {"linearstep", (PyCFunction)Sbk_ExprUtilsFunc_linearstep, METH_VARARGS|METH_STATIC}, + {"mix", (PyCFunction)Sbk_ExprUtilsFunc_mix, METH_VARARGS|METH_STATIC}, + {"noise", (PyCFunction)Sbk_ExprUtilsFunc_noise, METH_O|METH_STATIC}, + {"pnoise", (PyCFunction)Sbk_ExprUtilsFunc_pnoise, METH_VARARGS|METH_STATIC}, + {"remap", (PyCFunction)Sbk_ExprUtilsFunc_remap, METH_VARARGS|METH_STATIC}, + {"smoothstep", (PyCFunction)Sbk_ExprUtilsFunc_smoothstep, METH_VARARGS|METH_STATIC}, + {"snoise", (PyCFunction)Sbk_ExprUtilsFunc_snoise, METH_O}, + {"snoise4", (PyCFunction)Sbk_ExprUtilsFunc_snoise4, METH_O|METH_STATIC}, + {"turbulence", (PyCFunction)Sbk_ExprUtilsFunc_turbulence, METH_VARARGS|METH_KEYWORDS|METH_STATIC}, + {"vfbm", (PyCFunction)Sbk_ExprUtilsFunc_vfbm, METH_VARARGS|METH_KEYWORDS|METH_STATIC}, + {"vfbm4", (PyCFunction)Sbk_ExprUtilsFunc_vfbm4, METH_VARARGS|METH_KEYWORDS|METH_STATIC}, + {"vnoise", (PyCFunction)Sbk_ExprUtilsFunc_vnoise, METH_O|METH_STATIC}, + {"vnoise4", (PyCFunction)Sbk_ExprUtilsFunc_vnoise4, METH_O|METH_STATIC}, + {"vturbulence", (PyCFunction)Sbk_ExprUtilsFunc_vturbulence, METH_VARARGS|METH_KEYWORDS|METH_STATIC}, + + {0} // Sentinel +}; + +} // extern "C" + +static int Sbk_ExprUtils_traverse(PyObject* self, visitproc visit, void* arg) +{ + return reinterpret_cast(&SbkObject_Type)->tp_traverse(self, visit, arg); +} +static int Sbk_ExprUtils_clear(PyObject* self) +{ + return reinterpret_cast(&SbkObject_Type)->tp_clear(self); +} +// Class Definition ----------------------------------------------- +extern "C" { +static SbkObjectType Sbk_ExprUtils_Type = { { { + PyVarObject_HEAD_INIT(&SbkObjectType_Type, 0) + /*tp_name*/ "NatronEngine.ExprUtils", + /*tp_basicsize*/ sizeof(SbkObject), + /*tp_itemsize*/ 0, + /*tp_dealloc*/ &SbkDeallocWrapper, + /*tp_print*/ 0, + /*tp_getattr*/ 0, + /*tp_setattr*/ 0, + /*tp_compare*/ 0, + /*tp_repr*/ 0, + /*tp_as_number*/ 0, + /*tp_as_sequence*/ 0, + /*tp_as_mapping*/ 0, + /*tp_hash*/ 0, + /*tp_call*/ 0, + /*tp_str*/ 0, + /*tp_getattro*/ 0, + /*tp_setattro*/ 0, + /*tp_as_buffer*/ 0, + /*tp_flags*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_GC, + /*tp_doc*/ 0, + /*tp_traverse*/ Sbk_ExprUtils_traverse, + /*tp_clear*/ Sbk_ExprUtils_clear, + /*tp_richcompare*/ 0, + /*tp_weaklistoffset*/ 0, + /*tp_iter*/ 0, + /*tp_iternext*/ 0, + /*tp_methods*/ Sbk_ExprUtils_methods, + /*tp_members*/ 0, + /*tp_getset*/ 0, + /*tp_base*/ reinterpret_cast(&SbkObject_Type), + /*tp_dict*/ 0, + /*tp_descr_get*/ 0, + /*tp_descr_set*/ 0, + /*tp_dictoffset*/ 0, + /*tp_init*/ Sbk_ExprUtils_Init, + /*tp_alloc*/ 0, + /*tp_new*/ SbkObjectTpNew, + /*tp_free*/ 0, + /*tp_is_gc*/ 0, + /*tp_bases*/ 0, + /*tp_mro*/ 0, + /*tp_cache*/ 0, + /*tp_subclasses*/ 0, + /*tp_weaklist*/ 0 +}, }, + /*priv_data*/ 0 +}; +} //extern + + +// Type conversion functions. + +// Python to C++ pointer conversion - returns the C++ object of the Python wrapper (keeps object identity). +static void ExprUtils_PythonToCpp_ExprUtils_PTR(PyObject* pyIn, void* cppOut) { + Shiboken::Conversions::pythonToCppPointer(&Sbk_ExprUtils_Type, pyIn, cppOut); +} +static PythonToCppFunc is_ExprUtils_PythonToCpp_ExprUtils_PTR_Convertible(PyObject* pyIn) { + if (pyIn == Py_None) + return Shiboken::Conversions::nonePythonToCppNullPtr; + if (PyObject_TypeCheck(pyIn, (PyTypeObject*)&Sbk_ExprUtils_Type)) + return ExprUtils_PythonToCpp_ExprUtils_PTR; + return 0; +} + +// C++ to Python pointer conversion - tries to find the Python wrapper for the C++ object (keeps object identity). +static PyObject* ExprUtils_PTR_CppToPython_ExprUtils(const void* cppIn) { + PyObject* pyOut = (PyObject*)Shiboken::BindingManager::instance().retrieveWrapper(cppIn); + if (pyOut) { + Py_INCREF(pyOut); + return pyOut; + } + const char* typeName = typeid(*((::ExprUtils*)cppIn)).name(); + return Shiboken::Object::newObject(&Sbk_ExprUtils_Type, const_cast(cppIn), false, false, typeName); +} + +void init_ExprUtils(PyObject* module) +{ + SbkNatronEngineTypes[SBK_EXPRUTILS_IDX] = reinterpret_cast(&Sbk_ExprUtils_Type); + + if (!Shiboken::ObjectType::introduceWrapperType(module, "ExprUtils", "ExprUtils*", + &Sbk_ExprUtils_Type, &Shiboken::callCppDestructor< ::ExprUtils >)) { + return; + } + + // Register Converter + SbkConverter* converter = Shiboken::Conversions::createConverter(&Sbk_ExprUtils_Type, + ExprUtils_PythonToCpp_ExprUtils_PTR, + is_ExprUtils_PythonToCpp_ExprUtils_PTR_Convertible, + ExprUtils_PTR_CppToPython_ExprUtils); + + Shiboken::Conversions::registerConverterName(converter, "ExprUtils"); + Shiboken::Conversions::registerConverterName(converter, "ExprUtils*"); + Shiboken::Conversions::registerConverterName(converter, "ExprUtils&"); + Shiboken::Conversions::registerConverterName(converter, typeid(::ExprUtils).name()); + + + +} diff --git a/Engine/NatronEngine/exprutils_wrapper.h b/Engine/NatronEngine/exprutils_wrapper.h new file mode 100644 index 0000000000..cf8b36f56d --- /dev/null +++ b/Engine/NatronEngine/exprutils_wrapper.h @@ -0,0 +1,9 @@ +#ifndef SBK_EXPRUTILS_H +#define SBK_EXPRUTILS_H + +#include + +#include + +#endif // SBK_EXPRUTILS_H + diff --git a/Engine/NatronEngine/natronengine_module_wrapper.cpp b/Engine/NatronEngine/natronengine_module_wrapper.cpp index a9e40b95fc..07fde8af49 100644 --- a/Engine/NatronEngine/natronengine_module_wrapper.cpp +++ b/Engine/NatronEngine/natronengine_module_wrapper.cpp @@ -35,6 +35,7 @@ static PyMethodDef NatronEngine_methods[] = { }; // Classes initialization functions ------------------------------------------------------------ +void init_ExprUtils(PyObject* module); void init_PyCoreApplication(PyObject* module); void init_Group(PyObject* module); void init_App(PyObject* module); @@ -55,6 +56,11 @@ void init_UserParamHolder(PyObject* module); void init_Effect(PyObject* module); void init_Param(PyObject* module); void init_AnimatedParam(PyObject* module); +void init_StringParamBase(PyObject* module); +void init_PathParam(PyObject* module); +void init_StringParam(PyObject* module); +void init_FileParam(PyObject* module); +void init_OutputFileParam(PyObject* module); void init_IntParam(PyObject* module); void init_Int2DParam(PyObject* module); void init_Int3DParam(PyObject* module); @@ -64,16 +70,11 @@ void init_Double3DParam(PyObject* module); void init_ColorParam(PyObject* module); void init_ChoiceParam(PyObject* module); void init_BooleanParam(PyObject* module); -void init_StringParamBase(PyObject* module); -void init_StringParam(PyObject* module); -void init_FileParam(PyObject* module); -void init_OutputFileParam(PyObject* module); -void init_PathParam(PyObject* module); +void init_PageParam(PyObject* module); void init_ButtonParam(PyObject* module); void init_ParametricParam(PyObject* module); void init_SeparatorParam(PyObject* module); void init_GroupParam(PyObject* module); -void init_PageParam(PyObject* module); void init_Int2DTuple(PyObject* module); void init_Int3DTuple(PyObject* module); void init_Double2DTuple(PyObject* module); @@ -520,6 +521,49 @@ static PythonToCppFunc is_std_list_EffectPTR__PythonToCpp_std_list_EffectPTR__Co return 0; } +// C++ to Python conversion for type 'std::map'. +static PyObject* std_map_ImageLayer_EffectPTR__CppToPython_std_map_ImageLayer_EffectPTR_(const void* cppIn) { + ::std::map& cppInRef = *((::std::map*)cppIn); + + // TEMPLATE - stdMapToPyDict - START + PyObject* pyOut = PyDict_New(); + ::std::map::const_iterator it = cppInRef.begin(); + for (; it != cppInRef.end(); ++it) { + ::ImageLayer key = it->first; + ::Effect* value = it->second; + PyObject* pyKey = Shiboken::Conversions::copyToPython((SbkObjectType*)SbkNatronEngineTypes[SBK_IMAGELAYER_IDX], &key); + PyObject* pyValue = Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkNatronEngineTypes[SBK_EFFECT_IDX], value); + PyDict_SetItem(pyOut, pyKey, pyValue); + Py_DECREF(pyKey); + Py_DECREF(pyValue); + } + return pyOut; + // TEMPLATE - stdMapToPyDict - END + +} +static void std_map_ImageLayer_EffectPTR__PythonToCpp_std_map_ImageLayer_EffectPTR_(PyObject* pyIn, void* cppOut) { + ::std::map& cppOutRef = *((::std::map*)cppOut); + + // TEMPLATE - pyDictToStdMap - START + PyObject* key; + PyObject* value; + Py_ssize_t pos = 0; + while (PyDict_Next(pyIn, &pos, &key, &value)) { + ::ImageLayer cppKey = ::ImageLayer(::QString(), ::QString(), ::QStringList()); + Shiboken::Conversions::pythonToCppCopy((SbkObjectType*)SbkNatronEngineTypes[SBK_IMAGELAYER_IDX], key, &(cppKey)); + ::Effect* cppValue = ((::Effect*)0); + Shiboken::Conversions::pythonToCppPointer((SbkObjectType*)SbkNatronEngineTypes[SBK_EFFECT_IDX], value, &(cppValue)); + cppOutRef.insert(std::make_pair(cppKey, cppValue)); + } + // TEMPLATE - pyDictToStdMap - END + +} +static PythonToCppFunc is_std_map_ImageLayer_EffectPTR__PythonToCpp_std_map_ImageLayer_EffectPTR__Convertible(PyObject* pyIn) { + if (Shiboken::Conversions::convertibleDictTypes(SBK_CONVERTER(SbkNatronEngineTypes[SBK_IMAGELAYER_IDX]), false, SBK_CONVERTER(SbkNatronEngineTypes[SBK_EFFECT_IDX]), true, pyIn)) + return std_map_ImageLayer_EffectPTR__PythonToCpp_std_map_ImageLayer_EffectPTR_; + return 0; +} + // C++ to Python conversion for type 'const std::map &'. static PyObject* conststd_map_QString_NodeCreationPropertyPTR_REF_CppToPython_conststd_map_QString_NodeCreationPropertyPTR_REF(const void* cppIn) { ::std::map& cppInRef = *((::std::map*)cppIn); @@ -631,49 +675,6 @@ static PythonToCppFunc is_conststd_list_int_REF_PythonToCpp_conststd_list_int_RE return 0; } -// C++ to Python conversion for type 'std::map'. -static PyObject* std_map_ImageLayer_EffectPTR__CppToPython_std_map_ImageLayer_EffectPTR_(const void* cppIn) { - ::std::map& cppInRef = *((::std::map*)cppIn); - - // TEMPLATE - stdMapToPyDict - START - PyObject* pyOut = PyDict_New(); - ::std::map::const_iterator it = cppInRef.begin(); - for (; it != cppInRef.end(); ++it) { - ::ImageLayer key = it->first; - ::Effect* value = it->second; - PyObject* pyKey = Shiboken::Conversions::copyToPython((SbkObjectType*)SbkNatronEngineTypes[SBK_IMAGELAYER_IDX], &key); - PyObject* pyValue = Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkNatronEngineTypes[SBK_EFFECT_IDX], value); - PyDict_SetItem(pyOut, pyKey, pyValue); - Py_DECREF(pyKey); - Py_DECREF(pyValue); - } - return pyOut; - // TEMPLATE - stdMapToPyDict - END - -} -static void std_map_ImageLayer_EffectPTR__PythonToCpp_std_map_ImageLayer_EffectPTR_(PyObject* pyIn, void* cppOut) { - ::std::map& cppOutRef = *((::std::map*)cppOut); - - // TEMPLATE - pyDictToStdMap - START - PyObject* key; - PyObject* value; - Py_ssize_t pos = 0; - while (PyDict_Next(pyIn, &pos, &key, &value)) { - ::ImageLayer cppKey = ::ImageLayer(::QString(), ::QString(), ::QStringList()); - Shiboken::Conversions::pythonToCppCopy((SbkObjectType*)SbkNatronEngineTypes[SBK_IMAGELAYER_IDX], key, &(cppKey)); - ::Effect* cppValue = ((::Effect*)0); - Shiboken::Conversions::pythonToCppPointer((SbkObjectType*)SbkNatronEngineTypes[SBK_EFFECT_IDX], value, &(cppValue)); - cppOutRef.insert(std::make_pair(cppKey, cppValue)); - } - // TEMPLATE - pyDictToStdMap - END - -} -static PythonToCppFunc is_std_map_ImageLayer_EffectPTR__PythonToCpp_std_map_ImageLayer_EffectPTR__Convertible(PyObject* pyIn) { - if (Shiboken::Conversions::convertibleDictTypes(SBK_CONVERTER(SbkNatronEngineTypes[SBK_IMAGELAYER_IDX]), false, SBK_CONVERTER(SbkNatronEngineTypes[SBK_EFFECT_IDX]), true, pyIn)) - return std_map_ImageLayer_EffectPTR__PythonToCpp_std_map_ImageLayer_EffectPTR_; - return 0; -} - // C++ to Python conversion for type 'QList'. static PyObject* _QList_QVariant__CppToPython__QList_QVariant_(const void* cppIn) { ::QList& cppInRef = *((::QList*)cppIn); @@ -832,6 +833,7 @@ SBK_MODULE_INIT_FUNCTION_BEGIN(NatronEngine) #endif // Initialize classes in the type system + init_ExprUtils(module); init_PyCoreApplication(module); init_Group(module); init_App(module); @@ -852,6 +854,11 @@ SBK_MODULE_INIT_FUNCTION_BEGIN(NatronEngine) init_Effect(module); init_Param(module); init_AnimatedParam(module); + init_StringParamBase(module); + init_PathParam(module); + init_StringParam(module); + init_FileParam(module); + init_OutputFileParam(module); init_IntParam(module); init_Int2DParam(module); init_Int3DParam(module); @@ -861,16 +868,11 @@ SBK_MODULE_INIT_FUNCTION_BEGIN(NatronEngine) init_ColorParam(module); init_ChoiceParam(module); init_BooleanParam(module); - init_StringParamBase(module); - init_StringParam(module); - init_FileParam(module); - init_OutputFileParam(module); - init_PathParam(module); + init_PageParam(module); init_ButtonParam(module); init_ParametricParam(module); init_SeparatorParam(module); init_GroupParam(module); - init_PageParam(module); init_Int2DTuple(module); init_Int3DTuple(module); init_Double2DTuple(module); @@ -978,6 +980,13 @@ SBK_MODULE_INIT_FUNCTION_BEGIN(NatronEngine) std_list_EffectPTR__PythonToCpp_std_list_EffectPTR_, is_std_list_EffectPTR__PythonToCpp_std_list_EffectPTR__Convertible); + // Register converter for type 'std::map'. + SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_MAP_IMAGELAYER_EFFECTPTR_IDX] = Shiboken::Conversions::createConverter(&PyDict_Type, std_map_ImageLayer_EffectPTR__CppToPython_std_map_ImageLayer_EffectPTR_); + Shiboken::Conversions::registerConverterName(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_MAP_IMAGELAYER_EFFECTPTR_IDX], "std::map"); + Shiboken::Conversions::addPythonToCppValueConversion(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_MAP_IMAGELAYER_EFFECTPTR_IDX], + std_map_ImageLayer_EffectPTR__PythonToCpp_std_map_ImageLayer_EffectPTR_, + is_std_map_ImageLayer_EffectPTR__PythonToCpp_std_map_ImageLayer_EffectPTR__Convertible); + // Register converter for type 'const std::map&'. SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_MAP_QSTRING_NODECREATIONPROPERTYPTR_IDX] = Shiboken::Conversions::createConverter(&PyDict_Type, conststd_map_QString_NodeCreationPropertyPTR_REF_CppToPython_conststd_map_QString_NodeCreationPropertyPTR_REF); Shiboken::Conversions::registerConverterName(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_MAP_QSTRING_NODECREATIONPROPERTYPTR_IDX], "const std::map&"); @@ -1001,13 +1010,6 @@ SBK_MODULE_INIT_FUNCTION_BEGIN(NatronEngine) conststd_list_int_REF_PythonToCpp_conststd_list_int_REF, is_conststd_list_int_REF_PythonToCpp_conststd_list_int_REF_Convertible); - // Register converter for type 'std::map'. - SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_MAP_IMAGELAYER_EFFECTPTR_IDX] = Shiboken::Conversions::createConverter(&PyDict_Type, std_map_ImageLayer_EffectPTR__CppToPython_std_map_ImageLayer_EffectPTR_); - Shiboken::Conversions::registerConverterName(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_MAP_IMAGELAYER_EFFECTPTR_IDX], "std::map"); - Shiboken::Conversions::addPythonToCppValueConversion(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_MAP_IMAGELAYER_EFFECTPTR_IDX], - std_map_ImageLayer_EffectPTR__PythonToCpp_std_map_ImageLayer_EffectPTR_, - is_std_map_ImageLayer_EffectPTR__PythonToCpp_std_map_ImageLayer_EffectPTR__Convertible); - // Register converter for type 'QList'. SbkNatronEngineTypeConverters[SBK_NATRONENGINE_QLIST_QVARIANT_IDX] = Shiboken::Conversions::createConverter(&PyList_Type, _QList_QVariant__CppToPython__QList_QVariant_); Shiboken::Conversions::registerConverterName(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_QLIST_QVARIANT_IDX], "QList"); diff --git a/Engine/NatronEngine/natronengine_python.h b/Engine/NatronEngine/natronengine_python.h index 58bb1cc55d..e7b3c94bca 100644 --- a/Engine/NatronEngine/natronengine_python.h +++ b/Engine/NatronEngine/natronengine_python.h @@ -23,6 +23,7 @@ CLANG_DIAG_ON(uninitialized) #include #include #include +#include #include #include #include @@ -56,71 +57,72 @@ CLANG_DIAG_ON(uninitialized) #include // Type indices -#define SBK_NATRON_NAMESPACE_IDX 29 -#define SBK_NATRON_NAMESPACE_STANDARDBUTTONENUM_IDX 40 -#define SBK_QFLAGS_NATRON_NAMESPACE_STANDARDBUTTONENUM__IDX 52 -#define SBK_NATRON_NAMESPACE_IMAGECOMPONENTSENUM_IDX 33 -#define SBK_NATRON_NAMESPACE_IMAGEBITDEPTHENUM_IDX 32 -#define SBK_NATRON_NAMESPACE_KEYFRAMETYPEENUM_IDX 35 -#define SBK_NATRON_NAMESPACE_MERGINGFUNCTIONENUM_IDX 36 -#define SBK_NATRON_NAMESPACE_VALUECHANGEDREASONENUM_IDX 42 -#define SBK_NATRON_NAMESPACE_ANIMATIONLEVELENUM_IDX 30 -#define SBK_NATRON_NAMESPACE_ORIENTATIONENUM_IDX 37 -#define SBK_NATRON_NAMESPACE_DISPLAYCHANNELSENUM_IDX 31 -#define SBK_NATRON_NAMESPACE_IMAGEPREMULTIPLICATIONENUM_IDX 34 -#define SBK_NATRON_NAMESPACE_STATUSENUM_IDX 41 -#define SBK_NATRON_NAMESPACE_VIEWERCOMPOSITINGOPERATORENUM_IDX 44 -#define SBK_NATRON_NAMESPACE_PLAYBACKMODEENUM_IDX 39 -#define SBK_NATRON_NAMESPACE_PIXMAPENUM_IDX 38 -#define SBK_NATRON_NAMESPACE_VIEWERCOLORSPACEENUM_IDX 43 -#define SBK_RECTD_IDX 53 -#define SBK_RECTI_IDX 54 +#define SBK_NATRON_NAMESPACE_IDX 30 +#define SBK_NATRON_NAMESPACE_STANDARDBUTTONENUM_IDX 41 +#define SBK_QFLAGS_NATRON_NAMESPACE_STANDARDBUTTONENUM__IDX 53 +#define SBK_NATRON_NAMESPACE_IMAGECOMPONENTSENUM_IDX 34 +#define SBK_NATRON_NAMESPACE_IMAGEBITDEPTHENUM_IDX 33 +#define SBK_NATRON_NAMESPACE_KEYFRAMETYPEENUM_IDX 36 +#define SBK_NATRON_NAMESPACE_MERGINGFUNCTIONENUM_IDX 37 +#define SBK_NATRON_NAMESPACE_VALUECHANGEDREASONENUM_IDX 43 +#define SBK_NATRON_NAMESPACE_ANIMATIONLEVELENUM_IDX 31 +#define SBK_NATRON_NAMESPACE_ORIENTATIONENUM_IDX 38 +#define SBK_NATRON_NAMESPACE_DISPLAYCHANNELSENUM_IDX 32 +#define SBK_NATRON_NAMESPACE_IMAGEPREMULTIPLICATIONENUM_IDX 35 +#define SBK_NATRON_NAMESPACE_STATUSENUM_IDX 42 +#define SBK_NATRON_NAMESPACE_VIEWERCOMPOSITINGOPERATORENUM_IDX 45 +#define SBK_NATRON_NAMESPACE_PLAYBACKMODEENUM_IDX 40 +#define SBK_NATRON_NAMESPACE_PIXMAPENUM_IDX 39 +#define SBK_NATRON_NAMESPACE_VIEWERCOLORSPACEENUM_IDX 44 +#define SBK_RECTD_IDX 54 +#define SBK_RECTI_IDX 55 #define SBK_COLORTUPLE_IDX 9 #define SBK_DOUBLE3DTUPLE_IDX 13 #define SBK_DOUBLE2DTUPLE_IDX 11 -#define SBK_INT3DTUPLE_IDX 24 -#define SBK_INT2DTUPLE_IDX 22 -#define SBK_PARAM_IDX 48 -#define SBK_PAGEPARAM_IDX 47 -#define SBK_GROUPPARAM_IDX 19 -#define SBK_SEPARATORPARAM_IDX 56 +#define SBK_INT3DTUPLE_IDX 25 +#define SBK_INT2DTUPLE_IDX 23 +#define SBK_PARAM_IDX 49 +#define SBK_GROUPPARAM_IDX 20 +#define SBK_SEPARATORPARAM_IDX 57 #define SBK_BUTTONPARAM_IDX 6 #define SBK_ANIMATEDPARAM_IDX 0 -#define SBK_INTPARAM_IDX 26 -#define SBK_INT2DPARAM_IDX 21 -#define SBK_INT3DPARAM_IDX 23 -#define SBK_STRINGPARAMBASE_IDX 60 -#define SBK_PATHPARAM_IDX 50 -#define SBK_OUTPUTFILEPARAM_IDX 46 -#define SBK_FILEPARAM_IDX 16 -#define SBK_STRINGPARAM_IDX 58 -#define SBK_STRINGPARAM_TYPEENUM_IDX 59 +#define SBK_STRINGPARAMBASE_IDX 61 +#define SBK_PATHPARAM_IDX 51 +#define SBK_OUTPUTFILEPARAM_IDX 47 +#define SBK_FILEPARAM_IDX 17 +#define SBK_STRINGPARAM_IDX 59 +#define SBK_STRINGPARAM_TYPEENUM_IDX 60 #define SBK_BOOLEANPARAM_IDX 5 #define SBK_CHOICEPARAM_IDX 7 #define SBK_COLORPARAM_IDX 8 #define SBK_DOUBLEPARAM_IDX 14 #define SBK_DOUBLE2DPARAM_IDX 10 #define SBK_DOUBLE3DPARAM_IDX 12 -#define SBK_PARAMETRICPARAM_IDX 49 -#define SBK_USERPARAMHOLDER_IDX 63 -#define SBK_IMAGELAYER_IDX 20 -#define SBK_TRACKER_IDX 62 -#define SBK_TRACK_IDX 61 -#define SBK_ROTO_IDX 55 -#define SBK_ITEMBASE_IDX 27 +#define SBK_INTPARAM_IDX 27 +#define SBK_INT2DPARAM_IDX 22 +#define SBK_INT3DPARAM_IDX 24 +#define SBK_PARAMETRICPARAM_IDX 50 +#define SBK_PAGEPARAM_IDX 48 +#define SBK_USERPARAMHOLDER_IDX 64 +#define SBK_IMAGELAYER_IDX 21 +#define SBK_TRACKER_IDX 63 +#define SBK_TRACK_IDX 62 +#define SBK_ROTO_IDX 56 +#define SBK_ITEMBASE_IDX 28 #define SBK_BEZIERCURVE_IDX 3 -#define SBK_LAYER_IDX 28 -#define SBK_NODECREATIONPROPERTY_IDX 45 -#define SBK_STRINGNODECREATIONPROPERTY_IDX 57 -#define SBK_FLOATNODECREATIONPROPERTY_IDX 17 +#define SBK_LAYER_IDX 29 +#define SBK_NODECREATIONPROPERTY_IDX 46 +#define SBK_STRINGNODECREATIONPROPERTY_IDX 58 +#define SBK_FLOATNODECREATIONPROPERTY_IDX 18 #define SBK_BOOLNODECREATIONPROPERTY_IDX 4 -#define SBK_INTNODECREATIONPROPERTY_IDX 25 +#define SBK_INTNODECREATIONPROPERTY_IDX 26 #define SBK_APPSETTINGS_IDX 2 -#define SBK_GROUP_IDX 18 -#define SBK_APP_IDX 1 +#define SBK_GROUP_IDX 19 #define SBK_EFFECT_IDX 15 -#define SBK_PYCOREAPPLICATION_IDX 51 -#define SBK_NatronEngine_IDX_COUNT 64 +#define SBK_APP_IDX 1 +#define SBK_PYCOREAPPLICATION_IDX 52 +#define SBK_EXPRUTILS_IDX 16 +#define SBK_NatronEngine_IDX_COUNT 65 // This variable stores all Python types exported by this module. extern PyTypeObject** SbkNatronEngineTypes; @@ -142,10 +144,10 @@ extern SbkConverter** SbkNatronEngineTypeConverters; #define SBK_NATRONENGINE_STD_VECTOR_BOOL_IDX 10 // const std::vector & #define SBK_NATRONENGINE_STD_VECTOR_INT_IDX 11 // const std::vector & #define SBK_NATRONENGINE_STD_LIST_EFFECTPTR_IDX 12 // std::list -#define SBK_NATRONENGINE_STD_MAP_QSTRING_NODECREATIONPROPERTYPTR_IDX 13 // const std::map & -#define SBK_NATRONENGINE_STD_LIST_QSTRING_IDX 14 // std::list -#define SBK_NATRONENGINE_STD_LIST_INT_IDX 15 // const std::list & -#define SBK_NATRONENGINE_STD_MAP_IMAGELAYER_EFFECTPTR_IDX 16 // std::map +#define SBK_NATRONENGINE_STD_MAP_IMAGELAYER_EFFECTPTR_IDX 13 // std::map +#define SBK_NATRONENGINE_STD_MAP_QSTRING_NODECREATIONPROPERTYPTR_IDX 14 // const std::map & +#define SBK_NATRONENGINE_STD_LIST_QSTRING_IDX 15 // std::list +#define SBK_NATRONENGINE_STD_LIST_INT_IDX 16 // const std::list & #define SBK_NATRONENGINE_QLIST_QVARIANT_IDX 17 // QList #define SBK_NATRONENGINE_QLIST_QSTRING_IDX 18 // QList #define SBK_NATRONENGINE_QMAP_QSTRING_QVARIANT_IDX 19 // QMap @@ -181,14 +183,10 @@ template<> inline PyTypeObject* SbkType inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INT3DTUPLE_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INT2DTUPLE_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_PARAM_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_PAGEPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_GROUPPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_SEPARATORPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_BUTTONPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_ANIMATEDPARAM_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INTPARAM_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INT2DPARAM_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INT3DPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_STRINGPARAMBASE_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_PATHPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_OUTPUTFILEPARAM_IDX]); } @@ -201,7 +199,11 @@ template<> inline PyTypeObject* SbkType inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_DOUBLEPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_DOUBLE2DPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_DOUBLE3DPARAM_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INTPARAM_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INT2DPARAM_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INT3DPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_PARAMETRICPARAM_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_PAGEPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_USERPARAMHOLDER_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_IMAGELAYER_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_TRACKER_IDX]); } @@ -217,9 +219,10 @@ template<> inline PyTypeObject* SbkType inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INTNODECREATIONPROPERTY_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_APPSETTINGS_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_GROUP_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_APP_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_EFFECT_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_APP_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_PYCOREAPPLICATION_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_EXPRUTILS_IDX]); } } // namespace Shiboken diff --git a/Engine/Noise.cpp b/Engine/Noise.cpp new file mode 100644 index 0000000000..f6ac48921d --- /dev/null +++ b/Engine/Noise.cpp @@ -0,0 +1,252 @@ +/* + Copyright Disney Enterprises, Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License + and the following modification to it: Section 6 Trademarks. + deleted and replaced with: + + 6. Trademarks. This License does not grant permission to use the + trade names, trademarks, service marks, or product names of the + Licensor and its affiliates, except as required for reproducing + the content of the NOTICE file. + + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +*/ + +//#define SEEXPR_USE_SSE + +#include +#ifdef SEEXPR_USE_SSE +#include +#endif +#include + +#include "Global/Macros.h" + +namespace { +#include "NoiseTables.h" +} +#include "Noise.h" +NATRON_NAMESPACE_ENTER + +inline double floorSSE(double val) { +#ifdef SEEXPR_USE_SSE + return _mm_cvtsd_f64(_mm_floor_sd(_mm_set_sd(0.0), _mm_set_sd(val))); +#else + return std::floor(val); +#endif +} + +inline double roundSSE(double val) { +#ifdef SEEXPR_USE_SSE + return _mm_cvtsd_f64(_mm_round_sd(_mm_set_sd(0.0), _mm_set_sd(val), _MM_FROUND_TO_NEAREST_INT)); +#else + return std::round(val); +#endif +} + +//! This is the Quintic interpolant from Perlin's Improved Noise Paper +double s_curve(double t) { return t * t * t * (t * (6 * t - 15) + 10); } + +//! Does a hash reduce to a character +template +unsigned char hashReduceChar(int index[d]) { + uint32_t seed = 0; + // blend with seed (constants from Numerical Recipes, attrib. from Knuth) + for (int k = 0; k < d; k++) { + static const uint32_t M = 1664525, C = 1013904223; + seed = seed * M + index[k] + C; + } + // tempering (from Matsumoto) + seed ^= (seed >> 11); + seed ^= (seed << 7) & 0x9d2c5680UL; + seed ^= (seed << 15) & 0xefc60000UL; + seed ^= (seed >> 18); + // compute one byte by mixing third and first bytes + return (((seed & 0xff0000) >> 4) + (seed & 0xff)) & 0xff; +} + +//! Does a hash reduce to an integer +template +uint32_t hashReduce(uint32_t index[d]) { + union { + uint32_t i; + unsigned char c[4]; + } u1, u2; + // blend with seed (constants from Numerical Recipes, attrib. from Knuth) + u1.i = 0; + for (int k = 0; k < d; k++) { + static const uint32_t M = 1664525, C = 1013904223; + u1.i = u1.i * M + index[k] + C; + } + // tempering (from Matsumoto) + u1.i ^= (u1.i >> 11); + u1.i ^= (u1.i << 7) & 0x9d2c5680U; + u1.i ^= (u1.i << 15) & 0xefc60000U; + u1.i ^= (u1.i >> 18); + // permute bytes (shares perlin noise permutation table) + u2.c[3] = p[u1.c[0]]; + u2.c[2] = p[u1.c[1] + u2.c[3]]; + u2.c[1] = p[u1.c[2] + u2.c[2]]; + u2.c[0] = p[u1.c[3] + u2.c[1]]; + + return u2.i; +} + +//! Noise with d_in dimensional domain, 1 dimensional abcissa +template +T noiseHelper(const T* X, const int* period = 0) { + // find lattice index + T weights[2][d]; // lower and upper weights + int index[d]; + for (int k = 0; k < d; k++) { + T f = floorSSE(X[k]); + index[k] = (int)f; + if (periodic) { + index[k] %= period[k]; + if (index[k] < 0) index[k] += period[k]; + } + weights[0][k] = X[k] - f; + weights[1][k] = weights[0][k] - 1; // dist to cell with index one above + } + // compute function values propagated from zero from each node + int num = 1 << d; + T vals[num]; + for (int dummy = 0; dummy < num; dummy++) { + int latticeIndex[d]; + int offset[d]; + for (int k = 0; k < d; k++) { + offset[k] = ((dummy & (1 << k)) != 0); + latticeIndex[k] = index[k] + offset[k]; + } + // hash to get representative gradient vector + int lookup = hashReduceChar(latticeIndex); + T val = 0; + for (int k = 0; k < d; k++) { + double grad = NOISE_TABLES::g[lookup][k]; + double weight = weights[offset[k]][k]; + val += grad * weight; + } + vals[dummy] = val; + } + // compute linear interpolation coefficients + T alphas[d]; + for (int k = 0; k < d; k++) alphas[k] = s_curve(weights[0][k]); + // perform multilinear interpolation (i.e. linear, bilinear, trilinear, quadralinear) + for (int newd = d - 1; newd >= 0; newd--) { + int newnum = 1 << newd; + int k = (d - newd - 1); + T alpha = alphas[k]; + T beta = T(1) - alphas[k]; + for (int dummy = 0; dummy < newnum; dummy++) { + int index = dummy * (1 << (d - newd)); + int otherIndex = index + (1 << k); + // T alpha=s_curve(weights[0][k]); + vals[index] = beta * vals[index] + alpha * vals[otherIndex]; + } + } + // return reduced version + return vals[0]; +} + + + + +//! Computes cellular noise (non-interpolated piecewise constant cell random values) +template +void CellNoise(const T* in, T* out) { + uint32_t index[d_in]; + int dim = 0; + for (int k = 0; k < d_in; k++) index[k] = uint32_t(floorSSE(in[k])); + while (1) { + out[dim] = hashReduce(index) * (1.0 / 0xffffffffu); + if (++dim >= d_out) break; + for (int k = 0; k < d_in; k++) index[k] += 1000; + } +} + +//! Noise with d_in dimensional domain, d_out dimensional abcissa +template +void Noise(const T* in, T* out) { + T P[d_in]; + for (int i = 0; i < d_in; i++) P[i] = in[i]; + + int i = 0; + while (1) { + out[i] = noiseHelper(P); + if (++i >= d_out) break; + for (int k = 0; k < d_out; k++) P[k] += (T)1000; + } +} + +//! Periodic Noise with d_in dimensional domain, d_out dimensional abcissa +template +void PNoise(const T* in, const int* period, T* out) { + T P[d_in]; + for (int i = 0; i < d_in; i++) P[i] = in[i]; + + int i = 0; + while (1) { + out[i] = noiseHelper(P, period); + if (++i >= d_out) break; + for (int k = 0; k < d_out; k++) P[k] += (T)1000; + } +} + +//! Noise with d_in dimensional domain, d_out dimensional abcissa +//! If turbulence is true then Perlin's turbulence is computed +template +void FBM(const T* in, T* out, int octaves, T lacunarity, T gain) { + T P[d_in]; + for (int i = 0; i < d_in; i++) P[i] = in[i]; + + T scale = 1; + for (int k = 0; k < d_out; k++) out[k] = 0; + int octave = 0; + while (1) { + T localResult[d_out]; + Noise(P, localResult); + if (turbulence) + for (int k = 0; k < d_out; k++) out[k] += fabs(localResult[k]) * scale; + else + for (int k = 0; k < d_out; k++) out[k] += localResult[k] * scale; + if (++octave >= octaves) break; + scale *= gain; + for (int k = 0; k < d_in; k++) { + P[k] *= lacunarity; + P[k] += (T)1234; + } + } +} + +// Explicit instantiations +template void CellNoise<3, 1, double>(const double*, double*); +template void CellNoise<3, 3, double>(const double*, double*); +template void Noise<1, 1, double>(const double*, double*); +template void Noise<2, 1, double>(const double*, double*); +template void Noise<3, 1, double>(const double*, double*); +template void PNoise<3, 1, double>(const double*, const int*, double*); +template void Noise<4, 1, double>(const double*, double*); +template void Noise<3, 3, double>(const double*, double*); +template void Noise<4, 3, double>(const double*, double*); +template void FBM<3, 1, false, double>(const double*, double*, int, double, double); +template void FBM<3, 1, true, double>(const double*, double*, int, double, double); +template void FBM<3, 3, false, double>(const double*, double*, int, double, double); +template void FBM<3, 3, true, double>(const double*, double*, int, double, double); +template void FBM<4, 1, false, double>(const double*, double*, int, double, double); +template void FBM<4, 3, false, double>(const double*, double*, int, double, double); +NATRON_NAMESPACE_EXIT + +#ifdef MAINTEST +int main(int argc, char* argv[]) { + typedef double T; + T sum = 0; + for (int i = 0; i < 10000000; i++) { + T foo[3] = {.3, .3, .3}; + // for(int k=0;k<3;k++) foo[k]=(double)rand()/double(RAND_MAX)*100.; + sum += SeExpr2::noiseHelper<3, T, false>(foo); + } +} +#endif diff --git a/Engine/Noise.h b/Engine/Noise.h new file mode 100644 index 0000000000..4b4292d2f6 --- /dev/null +++ b/Engine/Noise.h @@ -0,0 +1,43 @@ +/* + Copyright Disney Enterprises, Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License + and the following modification to it: Section 6 Trademarks. + deleted and replaced with: + + 6. Trademarks. This License does not grant permission to use the + trade names, trademarks, service marks, or product names of the + Licensor and its affiliates, except as required for reproducing + the content of the NOTICE file. + + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +*/ +#ifndef NATRON_ENGINE_NOISE_H +#define NATRON_ENGINE_NOISE_H + +#include "Global/Macros.h" + +NATRON_NAMESPACE_ENTER + +//! One octave of non-periodic Perlin noise +template +void Noise(const T* in, T* out); + +//! One octave of periodic noise +//! period gives the integer period before tiles repease +template +void PNoise(const T* in, const int* period, T* out); + +//! Fractional Brownian Motion. If turbulence is true then turbulence computed. +template +void FBM(const T* in, T* out, int octaves, T lacunarity, T gain); + +//! Cellular noise with input and output dimensionality +template +void CellNoise(const T* in, T* out); + +NATRON_NAMESPACE_EXIT + +#endif // NATRON_ENGINE_NOISE_H diff --git a/Engine/NoiseTables.h b/Engine/NoiseTables.h new file mode 100644 index 0000000000..c604e97eb3 --- /dev/null +++ b/Engine/NoiseTables.h @@ -0,0 +1,2124 @@ +/* + Copyright Disney Enterprises, Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License + and the following modification to it: Section 6 Trademarks. + deleted and replaced with: + + 6. Trademarks. This License does not grant permission to use the + trade names, trademarks, service marks, or product names of the + Licensor and its affiliates, except as required for reproducing + the content of the NOTICE file. + + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +*/ +#ifndef _NoiseTables_h_ +#define _NoiseTables_h_ + +static const int p[514] = { + 37, 197, 187, 204, 20, 12, 242, 79, 52, 48, 160, 53, 142, 209, 166, 1, 198, 49, 233, 114, 230, 141, 155, + 198, 74, 135, 218, 123, 208, 166, 216, 182, 131, 149, 173, 42, 180, 12, 56, 159, 191, 85, 29, 134, 53, 239, + 182, 168, 139, 41, 223, 50, 24, 164, 17, 102, 121, 116, 148, 37, 105, 153, 102, 181, 255, 69, 77, 253, 59, + 20, 164, 218, 90, 113, 47, 5, 90, 36, 0, 180, 44, 114, 41, 140, 160, 34, 149, 77, 148, 100, 181, 22, + 113, 39, 22, 24, 247, 194, 43, 188, 227, 213, 29, 200, 72, 199, 8, 129, 32, 13, 130, 12, 218, 7, 246, + 176, 148, 252, 57, 30, 78, 178, 49, 87, 158, 182, 80, 68, 113, 4, 41, 216, 138, 1, 108, 49, 68, 75, + 242, 7, 219, 169, 90, 157, 198, 103, 214, 127, 202, 238, 148, 184, 101, 235, 87, 158, 127, 54, 20, 212, 56, + 85, 152, 176, 178, 220, 95, 103, 246, 137, 178, 203, 247, 71, 141, 10, 232, 23, 167, 135, 181, 129, 248, 144, + 202, 174, 247, 108, 183, 50, 162, 223, 52, 99, 102, 163, 187, 36, 195, 121, 79, 99, 182, 29, 199, 191, 109, + 5, 171, 132, 157, 192, 245, 71, 252, 74, 162, 181, 105, 251, 194, 2, 133, 53, 12, 135, 221, 203, 233, 229, + 255, 208, 191, 132, 73, 239, 40, 113, 59, 37, 36, 44, 158, 255, 232, 143, 148, 202, 143, 72, 188, 254, 253, + 70, 109, 222, 37, 197, 187, 204, 20, 12, 242, 79, 52, 48, 160, 53, 142, 209, 166, 1, 198, 49, 233, 114, + 230, 141, 155, 198, 74, 135, 218, 123, 208, 166, 216, 182, 131, 149, 173, 42, 180, 12, 56, 159, 191, 85, 29, + 134, 53, 239, 182, 168, 139, 41, 223, 50, 24, 164, 17, 102, 121, 116, 148, 37, 105, 153, 102, 181, 255, 69, + 77, 253, 59, 20, 164, 218, 90, 113, 47, 5, 90, 36, 0, 180, 44, 114, 41, 140, 160, 34, 149, 77, 148, + 100, 181, 22, 113, 39, 22, 24, 247, 194, 43, 188, 227, 213, 29, 200, 72, 199, 8, 129, 32, 13, 130, 12, + 218, 7, 246, 176, 148, 252, 57, 30, 78, 178, 49, 87, 158, 182, 80, 68, 113, 4, 41, 216, 138, 1, 108, + 49, 68, 75, 242, 7, 219, 169, 90, 157, 198, 103, 214, 127, 202, 238, 148, 184, 101, 235, 87, 158, 127, 54, + 20, 212, 56, 85, 152, 176, 178, 220, 95, 103, 246, 137, 178, 203, 247, 71, 141, 10, 232, 23, 167, 135, 181, + 129, 248, 144, 202, 174, 247, 108, 183, 50, 162, 223, 52, 99, 102, 163, 187, 36, 195, 121, 79, 99, 182, 29, + 199, 191, 109, 5, 171, 132, 157, 192, 245, 71, 252, 74, 162, 181, 105, 251, 194, 2, 133, 53, 12, 135, 221, + 203, 233, 229, 255, 208, 191, 132, 73, 239, 40, 113, 59, 37, 36, 44, 158, 255, 232, 143, 148, 202, 143, 72, + 188, 254, 253, 70, 109, 222, 37, 197}; + +template +struct NOISE_TABLES {}; +template <> +struct NOISE_TABLES<1> { + static double g[514][1]; +}; +template <> +struct NOISE_TABLES<2> { + static double g[514][2]; +}; +template <> +struct NOISE_TABLES<3> { + static double g[514][3]; +}; +template <> +struct NOISE_TABLES<4> { + static double g[514][4]; +}; + +double NOISE_TABLES<1>::g[514][1] = {{-0.090145990972}, + {0.411026453868}, + {-0.132971130209}, + {0.0658028292851}, + {-0.0881082376329}, + {0.86592480015}, + {-0.32929844812}, + {0.53603629749}, + {-0.643078474092}, + {-0.30599109277}, + {0.926631567402}, + {0.912201292233}, + {0.802304085975}, + {-0.67915638005}, + {-0.751813438823}, + {-0.208967638797}, + {0.132315414586}, + {0.682349428924}, + {-0.525549874155}, + {0.275599612628}, + {-0.74676958287}, + {0.937047988958}, + {0.43460815577}, + {0.0142260747245}, + {0.180749138277}, + {-0.313463441395}, + {-0.274002283835}, + {0.523003236382}, + {0.780913908778}, + {-0.494934167865}, + {0.818593572183}, + {0.533915816067}, + {-0.0130361482251}, + {-0.705622687068}, + {0.722682123285}, + {0.507754061746}, + {-0.757993627819}, + {0.190727068281}, + {-0.380282707147}, + {0.301661041443}, + {0.136426856476}, + {-0.974945445514}, + {-0.614343303113}, + {0.44021261626}, + {-0.22030993216}, + {-0.198781048086}, + {0.236968770351}, + {-0.0465780655332}, + {0.401668674428}, + {0.597507722287}, + {-0.905798733301}, + {-0.502411080041}, + {-0.72004154009}, + {-0.753980111307}, + {0.891663443047}, + {0.081057763492}, + {-0.312669535049}, + {-0.611594876551}, + {-0.497563251588}, + {-0.582638042743}, + {0.860701680181}, + {0.961532428698}, + {-0.479053663586}, + {-0.619041737502}, + {-0.218915686691}, + {-0.457452315145}, + {0.873417690785}, + {0.116833303787}, + {-0.980519135986}, + {-0.404040133296}, + {0.252722546802}, + {0.642103114503}, + {0.34763654904}, + {0.456416335261}, + {0.953028024491}, + {0.235275936909}, + {0.601498060731}, + {0.781827877417}, + {0.470419079269}, + {0.0146950691393}, + {-0.235694665784}, + {-0.574844704427}, + {0.684892633207}, + {-0.458411945802}, + {0.265911694559}, + {0.169202280876}, + {-0.777909790703}, + {0.726384224166}, + {-0.553828089727}, + {-0.0832123692333}, + {0.721487611045}, + {-0.906675489131}, + {-0.960026196153}, + {-0.78755654858}, + {0.250631178512}, + {0.13332056756}, + {-0.719064191516}, + {0.168404894273}, + {0.899696787568}, + {-0.241155077287}, + {-0.791726996813}, + {0.68490416293}, + {0.830729929906}, + {0.829245788371}, + {0.476796832217}, + {-0.30340629475}, + {-0.97160859071}, + {0.0960159613032}, + {0.261892913066}, + {-0.043841341881}, + {-0.592923976594}, + {0.806058029402}, + {0.176253456712}, + {0.0506651479611}, + {0.534088270467}, + {-0.920834855247}, + {-0.534653045788}, + {-0.978110639545}, + {0.759932895317}, + {-0.399887306932}, + {0.763288749264}, + {0.867870667884}, + {-0.823463631323}, + {0.532253707161}, + {0.870235490679}, + {-0.836201428062}, + {-0.592575962626}, + {0.333064244848}, + {0.513161315099}, + {0.817530148018}, + {0.485314750665}, + {-0.915658953288}, + {0.950090890385}, + {-0.00565229265779}, + {-0.2369852937}, + {-0.639252510593}, + {-0.564966485607}, + {0.803662909711}, + {-0.480365971715}, + {-0.467749219524}, + {-0.647923617773}, + {-0.814307872654}, + {-0.660981673188}, + {-0.259482410343}, + {0.0363703852677}, + {-0.957017459476}, + {-0.921870853532}, + {0.975689516208}, + {-0.288951336719}, + {-0.483533013229}, + {0.15064861802}, + {-0.422837651762}, + {-0.350912002365}, + {0.475871327275}, + {0.547622776027}, + {-0.506213996343}, + {-0.804770566067}, + {-0.845954101597}, + {0.23097978224}, + {0.66933952991}, + {0.895522370029}, + {0.38271924921}, + {-0.047671968577}, + {0.781721975093}, + {0.0182365072946}, + {0.492118301366}, + {0.957992423079}, + {-0.920838951996}, + {0.88530095043}, + {0.50074425311}, + {-0.802729743362}, + {0.255851096265}, + {-0.0417193094939}, + {0.539403492592}, + {0.745108632462}, + {0.368877509679}, + {-0.635294033791}, + {-0.0187516717085}, + {0.262703079115}, + {-0.32231529635}, + {0.976310199589}, + {-0.209039698068}, + {-0.645023155102}, + {0.67912494015}, + {0.495622450157}, + {-0.100251892683}, + {-0.996848817347}, + {-0.0987236675542}, + {-0.425090747899}, + {-0.104203365904}, + {0.0573246754207}, + {-0.0544615962989}, + {0.284179140426}, + {-0.949997917006}, + {-0.778489146074}, + {0.806684595133}, + {0.914782453223}, + {0.671023546212}, + {-0.519537764358}, + {-0.654052862376}, + {0.0488377191846}, + {-0.221751204501}, + {0.354255608828}, + {0.141263067657}, + {-0.935591719894}, + {-0.959165803959}, + {-0.235671934167}, + {-0.851174410829}, + {-0.465661863837}, + {-0.674442248127}, + {0.870089018545}, + {-0.266588007415}, + {-0.299569719915}, + {-0.155664768335}, + {-0.22595161199}, + {0.0859028106026}, + {0.517376331039}, + {0.34541393042}, + {-0.123476696938}, + {-0.0112102981913}, + {-0.281653772416}, + {-0.217051444608}, + {-0.202052714191}, + {-0.677372779399}, + {0.412327454875}, + {0.63177679019}, + {0.505127108848}, + {0.805814803029}, + {0.640261350475}, + {-0.303699827338}, + {0.786067593123}, + {0.6986625095}, + {0.148519758809}, + {0.862348270656}, + {0.289668520104}, + {-0.468991456892}, + {-0.3788574345}, + {0.015087748091}, + {-0.51623334978}, + {-0.0584277738908}, + {-0.294675787398}, + {0.266100261255}, + {-0.540560801096}, + {-0.431404190759}, + {-0.400578990802}, + {0.180171166068}, + {-0.32280133619}, + {0.245608171607}, + {-0.0360762501108}, + {-0.18418033835}, + {0.419723697381}, + {0.455768661817}, + {-0.343602991191}, + {0.994294798001}, + {0.159996929507}, + {-0.749944765734}, + {-0.090145990972}, + {0.411026453868}, + {-0.132971130209}, + {0.0658028292851}, + {-0.0881082376329}, + {0.86592480015}, + {-0.32929844812}, + {0.53603629749}, + {-0.643078474092}, + {-0.30599109277}, + {0.926631567402}, + {0.912201292233}, + {0.802304085975}, + {-0.67915638005}, + {-0.751813438823}, + {-0.208967638797}, + {0.132315414586}, + {0.682349428924}, + {-0.525549874155}, + {0.275599612628}, + {-0.74676958287}, + {0.937047988958}, + {0.43460815577}, + {0.0142260747245}, + {0.180749138277}, + {-0.313463441395}, + {-0.274002283835}, + {0.523003236382}, + {0.780913908778}, + {-0.494934167865}, + {0.818593572183}, + {0.533915816067}, + {-0.0130361482251}, + {-0.705622687068}, + {0.722682123285}, + {0.507754061746}, + {-0.757993627819}, + {0.190727068281}, + {-0.380282707147}, + {0.301661041443}, + {0.136426856476}, + {-0.974945445514}, + {-0.614343303113}, + {0.44021261626}, + {-0.22030993216}, + {-0.198781048086}, + {0.236968770351}, + {-0.0465780655332}, + {0.401668674428}, + {0.597507722287}, + {-0.905798733301}, + {-0.502411080041}, + {-0.72004154009}, + {-0.753980111307}, + {0.891663443047}, + {0.081057763492}, + {-0.312669535049}, + {-0.611594876551}, + {-0.497563251588}, + {-0.582638042743}, + {0.860701680181}, + {0.961532428698}, + {-0.479053663586}, + {-0.619041737502}, + {-0.218915686691}, + {-0.457452315145}, + {0.873417690785}, + {0.116833303787}, + {-0.980519135986}, + {-0.404040133296}, + {0.252722546802}, + {0.642103114503}, + {0.34763654904}, + {0.456416335261}, + {0.953028024491}, + {0.235275936909}, + {0.601498060731}, + {0.781827877417}, + {0.470419079269}, + {0.0146950691393}, + {-0.235694665784}, + {-0.574844704427}, + {0.684892633207}, + {-0.458411945802}, + {0.265911694559}, + {0.169202280876}, + {-0.777909790703}, + {0.726384224166}, + {-0.553828089727}, + {-0.0832123692333}, + {0.721487611045}, + {-0.906675489131}, + {-0.960026196153}, + {-0.78755654858}, + {0.250631178512}, + {0.13332056756}, + {-0.719064191516}, + {0.168404894273}, + {0.899696787568}, + {-0.241155077287}, + {-0.791726996813}, + {0.68490416293}, + {0.830729929906}, + {0.829245788371}, + {0.476796832217}, + {-0.30340629475}, + {-0.97160859071}, + {0.0960159613032}, + {0.261892913066}, + {-0.043841341881}, + {-0.592923976594}, + {0.806058029402}, + {0.176253456712}, + {0.0506651479611}, + {0.534088270467}, + {-0.920834855247}, + {-0.534653045788}, + {-0.978110639545}, + {0.759932895317}, + {-0.399887306932}, + {0.763288749264}, + {0.867870667884}, + {-0.823463631323}, + {0.532253707161}, + {0.870235490679}, + {-0.836201428062}, + {-0.592575962626}, + {0.333064244848}, + {0.513161315099}, + {0.817530148018}, + {0.485314750665}, + {-0.915658953288}, + {0.950090890385}, + {-0.00565229265779}, + {-0.2369852937}, + {-0.639252510593}, + {-0.564966485607}, + {0.803662909711}, + {-0.480365971715}, + {-0.467749219524}, + {-0.647923617773}, + {-0.814307872654}, + {-0.660981673188}, + {-0.259482410343}, + {0.0363703852677}, + {-0.957017459476}, + {-0.921870853532}, + {0.975689516208}, + {-0.288951336719}, + {-0.483533013229}, + {0.15064861802}, + {-0.422837651762}, + {-0.350912002365}, + {0.475871327275}, + {0.547622776027}, + {-0.506213996343}, + {-0.804770566067}, + {-0.845954101597}, + {0.23097978224}, + {0.66933952991}, + {0.895522370029}, + {0.38271924921}, + {-0.047671968577}, + {0.781721975093}, + {0.0182365072946}, + {0.492118301366}, + {0.957992423079}, + {-0.920838951996}, + {0.88530095043}, + {0.50074425311}, + {-0.802729743362}, + {0.255851096265}, + {-0.0417193094939}, + {0.539403492592}, + {0.745108632462}, + {0.368877509679}, + {-0.635294033791}, + {-0.0187516717085}, + {0.262703079115}, + {-0.32231529635}, + {0.976310199589}, + {-0.209039698068}, + {-0.645023155102}, + {0.67912494015}, + {0.495622450157}, + {-0.100251892683}, + {-0.996848817347}, + {-0.0987236675542}, + {-0.425090747899}, + {-0.104203365904}, + {0.0573246754207}, + {-0.0544615962989}, + {0.284179140426}, + {-0.949997917006}, + {-0.778489146074}, + {0.806684595133}, + {0.914782453223}, + {0.671023546212}, + {-0.519537764358}, + {-0.654052862376}, + {0.0488377191846}, + {-0.221751204501}, + {0.354255608828}, + {0.141263067657}, + {-0.935591719894}, + {-0.959165803959}, + {-0.235671934167}, + {-0.851174410829}, + {-0.465661863837}, + {-0.674442248127}, + {0.870089018545}, + {-0.266588007415}, + {-0.299569719915}, + {-0.155664768335}, + {-0.22595161199}, + {0.0859028106026}, + {0.517376331039}, + {0.34541393042}, + {-0.123476696938}, + {-0.0112102981913}, + {-0.281653772416}, + {-0.217051444608}, + {-0.202052714191}, + {-0.677372779399}, + {0.412327454875}, + {0.63177679019}, + {0.505127108848}, + {0.805814803029}, + {0.640261350475}, + {-0.303699827338}, + {0.786067593123}, + {0.6986625095}, + {0.148519758809}, + {0.862348270656}, + {0.289668520104}, + {-0.468991456892}, + {-0.3788574345}, + {0.015087748091}, + {-0.51623334978}, + {-0.0584277738908}, + {-0.294675787398}, + {0.266100261255}, + {-0.540560801096}, + {-0.431404190759}, + {-0.400578990802}, + {0.180171166068}, + {-0.32280133619}, + {0.245608171607}, + {-0.0360762501108}, + {-0.18418033835}, + {0.419723697381}, + {0.455768661817}, + {-0.343602991191}, + {0.994294798001}, + {0.159996929507}, + {-0.749944765734}, + {-0.090145990972}, + {0.411026453868}}; + +double NOISE_TABLES<2>::g[514][2] = {{-0.151629, 0.988438}, + {-0.965502, 0.260395}, + {0.423502, 0.905895}, + {0.592141, 0.805834}, + {-0.387536, 0.921855}, + {-0.961849, -0.27358}, + {0.92593, -0.377695}, + {-0.776778, 0.629775}, + {0.922126, 0.38689}, + {0.847856, -0.530226}, + {0.249481, -0.96838}, + {0.296638, -0.95499}, + {-0.476145, 0.879367}, + {0.939988, 0.341208}, + {0.0559883, -0.998432}, + {0.820859, -0.571131}, + {-0.761065, 0.648676}, + {0.560754, -0.827983}, + {0.309366, 0.950943}, + {0.986137, -0.165934}, + {-0.947255, -0.320481}, + {-0.580349, 0.814368}, + {-0.35311, -0.935582}, + {0.600649, -0.799513}, + {0.0688496, 0.997627}, + {0.639101, -0.769123}, + {0.142116, 0.98985}, + {0.693872, -0.720099}, + {-0.95484, -0.29712}, + {0.620061, -0.784554}, + {0.855417, 0.51794}, + {-0.999843, 0.0176931}, + {0.981774, -0.190054}, + {0.711309, -0.702879}, + {-0.752388, -0.658721}, + {0.611741, 0.791058}, + {-0.719155, -0.69485}, + {0.884515, -0.466511}, + {0.201722, -0.979443}, + {-0.259763, -0.965673}, + {0.828983, 0.559273}, + {-0.999976, -0.00687675}, + {0.934908, -0.35489}, + {-0.600188, 0.799859}, + {0.999026, -0.0441183}, + {-0.72827, 0.685291}, + {-0.2121, -0.977248}, + {0.744893, -0.667184}, + {0.477018, -0.878893}, + {-0.247895, 0.968787}, + {-0.486511, -0.873674}, + {0.411162, -0.911562}, + {-0.638767, 0.7694}, + {0.401133, 0.91602}, + {-0.115368, -0.993323}, + {-0.988121, -0.153677}, + {-0.998432, -0.0559873}, + {0.433379, -0.901212}, + {0.676017, -0.736886}, + {0.867865, 0.4968}, + {-0.647582, -0.761996}, + {0.0443233, 0.999017}, + {0.776688, -0.629886}, + {0.455336, -0.89032}, + {-0.993282, 0.115723}, + {0.974665, 0.22367}, + {-0.827382, -0.561639}, + {-0.89603, 0.443993}, + {-0.744892, 0.667185}, + {-0.821064, 0.570837}, + {0.842454, 0.538768}, + {0.984458, 0.175618}, + {-0.853954, -0.520348}, + {0.177653, -0.984093}, + {0.22567, -0.974204}, + {-0.443072, -0.896486}, + {-0.984048, -0.177903}, + {0.800552, 0.599263}, + {-0.958812, 0.284042}, + {-0.848122, 0.529801}, + {0.668281, 0.743909}, + {0.703976, 0.710224}, + {-0.127298, 0.991865}, + {-0.0909771, -0.995853}, + {-0.968279, -0.249873}, + {0.51951, -0.854464}, + {-0.410073, 0.912053}, + {0.35568, 0.934608}, + {0.761019, -0.64873}, + {-0.364766, 0.931099}, + {0.129207, -0.991618}, + {0.10486, -0.994487}, + {0.895682, -0.444695}, + {-0.735993, -0.676989}, + {-0.926304, 0.376778}, + {-0.834845, 0.550485}, + {0.467459, 0.884015}, + {0.97682, -0.214061}, + {-0.991598, -0.129358}, + {0.948073, 0.318053}, + {-0.398569, -0.917139}, + {-0.906671, 0.421838}, + {0.498414, -0.866939}, + {0.968887, 0.247502}, + {-0.693715, 0.72025}, + {0.998546, 0.0539088}, + {0.993084, -0.117406}, + {0.958454, -0.285248}, + {0.48902, 0.872272}, + {-0.589776, -0.807567}, + {-0.78381, -0.621001}, + {0.540294, -0.841476}, + {0.388698, -0.921365}, + {-0.675803, 0.737082}, + {-0.840922, -0.541157}, + {0.965157, -0.261672}, + {0.72832, -0.685237}, + {-0.974124, -0.226015}, + {0.996924, 0.078373}, + {-0.916764, 0.399428}, + {-0.188071, -0.982156}, + {0.999988, 0.00489994}, + {-0.921093, -0.389343}, + {-0.283368, -0.959011}, + {-0.628687, -0.777658}, + {-0.995825, 0.0912825}, + {-0.997767, 0.0667875}, + {-0.341775, 0.939782}, + {-0.996755, -0.0804983}, + {-0.711207, 0.702983}, + {-0.330056, -0.943962}, + {-0.139691, -0.990195}, + {-0.569783, -0.821795}, + {-0.999107, 0.0422528}, + {-0.200002, 0.979796}, + {0.378521, 0.925593}, + {0.0933337, 0.995635}, + {-0.236002, -0.971753}, + {0.91236, 0.40939}, + {-0.0175388, -0.999846}, + {0.860595, -0.50929}, + {-0.806786, 0.590844}, + {-0.986397, 0.164381}, + {-0.999506, -0.0314418}, + {0.365999, -0.930615}, + {-0.860887, 0.508797}, + {0.891185, 0.453639}, + {0.117761, 0.993042}, + {0.979856, 0.199704}, + {0.962527, 0.271186}, + {-0.684191, -0.729303}, + {0.721192, 0.692735}, + {0.238526, 0.971136}, + {0.00697998, -0.999976}, + {-0.930376, -0.366607}, + {0.815014, 0.579442}, + {-0.528782, -0.848757}, + {-0.900866, -0.434097}, + {-0.884848, 0.46588}, + {0.902044, 0.431644}, + {-0.979381, -0.20202}, + {0.262303, 0.964986}, + {-0.224016, 0.974586}, + {-0.295191, 0.955438}, + {-0.464931, -0.885347}, + {-0.45439, 0.890803}, + {0.343081, -0.939306}, + {0.989908, -0.141713}, + {0.97128, -0.237938}, + {0.737974, 0.674829}, + {-0.866472, -0.499225}, + {0.580876, -0.813992}, + {-0.318579, 0.947896}, + {0.770191, 0.637813}, + {0.87979, 0.475362}, + {0.332624, 0.94306}, + {-0.0665321, -0.997784}, + {0.75431, 0.656519}, + {0.931337, 0.364158}, + {0.951175, -0.308652}, + {-0.0784228, 0.99692}, + {-0.657484, 0.753469}, + {-0.701884, -0.712291}, + {-0.994476, -0.10496}, + {-0.00479666, 0.999989}, + {0.190552, 0.981677}, + {0.153476, -0.988152}, + {-0.666087, -0.745874}, + {-0.0293607, 0.999569}, + {-0.990138, 0.140094}, + {0.285921, 0.958253}, + {-0.539632, 0.841901}, + {-0.306804, -0.951773}, + {0.806616, -0.591075}, + {0.994703, 0.102791}, + {0.943325, -0.331871}, + {-0.0539077, 0.998546}, + {-0.939099, -0.343648}, + {0.916396, -0.400274}, + {-0.873131, 0.487485}, + {-0.76833, -0.640054}, + {-0.889936, -0.456086}, + {-0.943698, 0.330809}, + {0.166385, 0.986061}, + {0.657757, -0.753231}, + {-0.16393, -0.986472}, + {-0.813345, -0.581782}, + {0.686335, 0.727285}, + {-0.375952, -0.926639}, + {0.531244, 0.847219}, + {0.997645, -0.0685942}, + {-0.507799, -0.861475}, + {0.510286, 0.860005}, + {0.319956, -0.947433}, + {-0.497612, 0.8674}, + {0.445615, 0.895225}, + {-0.97713, 0.212644}, + {0.785609, 0.618724}, + {-0.951542, 0.307518}, + {0.991884, 0.127147}, + {-0.935283, 0.3539}, + {-0.518778, 0.854909}, + {0.214604, 0.976701}, + {0.906311, -0.422611}, + {-0.878469, -0.4778}, + {-0.420947, -0.907085}, + {0.649823, 0.760086}, + {-0.549448, -0.835528}, + {-0.619665, 0.784867}, + {0.630972, 0.775805}, + {-0.175868, 0.984414}, + {-0.911254, -0.411844}, + {0.55188, 0.833923}, + {0.988468, 0.151428}, + {0.834608, -0.550844}, + {-0.98206, 0.188569}, + {-0.271624, 0.962403}, + {0.0314939, -0.999504}, + {0.0197696, 0.999805}, + {-0.102891, 0.994693}, + {0.995664, -0.0930283}, + {0.273142, -0.961974}, + {-0.609415, -0.792851}, + {-0.971609, 0.23659}, + {-0.798818, -0.601573}, + {0.79189, -0.610664}, + {0.872817, -0.488047}, + {0.572183, 0.820126}, + {-0.0420478, -0.999116}, + {0.999567, 0.0294129}, + {0.0804485, -0.996759}, + {0.955587, 0.294708}, + {-0.432362, 0.9017}, + {-0.56016, 0.828385}, + {0.999808, -0.0196154}, + {-0.792021, 0.610494}, + {-0.151629, 0.988438}, + {-0.965502, 0.260395}, + {0.423502, 0.905895}, + {0.592141, 0.805834}, + {-0.387536, 0.921855}, + {-0.961849, -0.27358}, + {0.92593, -0.377695}, + {-0.776778, 0.629775}, + {0.922126, 0.38689}, + {0.847856, -0.530226}, + {0.249481, -0.96838}, + {0.296638, -0.95499}, + {-0.476145, 0.879367}, + {0.939988, 0.341208}, + {0.0559883, -0.998432}, + {0.820859, -0.571131}, + {-0.761065, 0.648676}, + {0.560754, -0.827983}, + {0.309366, 0.950943}, + {0.986137, -0.165934}, + {-0.947255, -0.320481}, + {-0.580349, 0.814368}, + {-0.35311, -0.935582}, + {0.600649, -0.799513}, + {0.0688496, 0.997627}, + {0.639101, -0.769123}, + {0.142116, 0.98985}, + {0.693872, -0.720099}, + {-0.95484, -0.29712}, + {0.620061, -0.784554}, + {0.855417, 0.51794}, + {-0.999843, 0.0176931}, + {0.981774, -0.190054}, + {0.711309, -0.702879}, + {-0.752388, -0.658721}, + {0.611741, 0.791058}, + {-0.719155, -0.69485}, + {0.884515, -0.466511}, + {0.201722, -0.979443}, + {-0.259763, -0.965673}, + {0.828983, 0.559273}, + {-0.999976, -0.00687675}, + {0.934908, -0.35489}, + {-0.600188, 0.799859}, + {0.999026, -0.0441183}, + {-0.72827, 0.685291}, + {-0.2121, -0.977248}, + {0.744893, -0.667184}, + {0.477018, -0.878893}, + {-0.247895, 0.968787}, + {-0.486511, -0.873674}, + {0.411162, -0.911562}, + {-0.638767, 0.7694}, + {0.401133, 0.91602}, + {-0.115368, -0.993323}, + {-0.988121, -0.153677}, + {-0.998432, -0.0559873}, + {0.433379, -0.901212}, + {0.676017, -0.736886}, + {0.867865, 0.4968}, + {-0.647582, -0.761996}, + {0.0443233, 0.999017}, + {0.776688, -0.629886}, + {0.455336, -0.89032}, + {-0.993282, 0.115723}, + {0.974665, 0.22367}, + {-0.827382, -0.561639}, + {-0.89603, 0.443993}, + {-0.744892, 0.667185}, + {-0.821064, 0.570837}, + {0.842454, 0.538768}, + {0.984458, 0.175618}, + {-0.853954, -0.520348}, + {0.177653, -0.984093}, + {0.22567, -0.974204}, + {-0.443072, -0.896486}, + {-0.984048, -0.177903}, + {0.800552, 0.599263}, + {-0.958812, 0.284042}, + {-0.848122, 0.529801}, + {0.668281, 0.743909}, + {0.703976, 0.710224}, + {-0.127298, 0.991865}, + {-0.0909771, -0.995853}, + {-0.968279, -0.249873}, + {0.51951, -0.854464}, + {-0.410073, 0.912053}, + {0.35568, 0.934608}, + {0.761019, -0.64873}, + {-0.364766, 0.931099}, + {0.129207, -0.991618}, + {0.10486, -0.994487}, + {0.895682, -0.444695}, + {-0.735993, -0.676989}, + {-0.926304, 0.376778}, + {-0.834845, 0.550485}, + {0.467459, 0.884015}, + {0.97682, -0.214061}, + {-0.991598, -0.129358}, + {0.948073, 0.318053}, + {-0.398569, -0.917139}, + {-0.906671, 0.421838}, + {0.498414, -0.866939}, + {0.968887, 0.247502}, + {-0.693715, 0.72025}, + {0.998546, 0.0539088}, + {0.993084, -0.117406}, + {0.958454, -0.285248}, + {0.48902, 0.872272}, + {-0.589776, -0.807567}, + {-0.78381, -0.621001}, + {0.540294, -0.841476}, + {0.388698, -0.921365}, + {-0.675803, 0.737082}, + {-0.840922, -0.541157}, + {0.965157, -0.261672}, + {0.72832, -0.685237}, + {-0.974124, -0.226015}, + {0.996924, 0.078373}, + {-0.916764, 0.399428}, + {-0.188071, -0.982156}, + {0.999988, 0.00489994}, + {-0.921093, -0.389343}, + {-0.283368, -0.959011}, + {-0.628687, -0.777658}, + {-0.995825, 0.0912825}, + {-0.997767, 0.0667875}, + {-0.341775, 0.939782}, + {-0.996755, -0.0804983}, + {-0.711207, 0.702983}, + {-0.330056, -0.943962}, + {-0.139691, -0.990195}, + {-0.569783, -0.821795}, + {-0.999107, 0.0422528}, + {-0.200002, 0.979796}, + {0.378521, 0.925593}, + {0.0933337, 0.995635}, + {-0.236002, -0.971753}, + {0.91236, 0.40939}, + {-0.0175388, -0.999846}, + {0.860595, -0.50929}, + {-0.806786, 0.590844}, + {-0.986397, 0.164381}, + {-0.999506, -0.0314418}, + {0.365999, -0.930615}, + {-0.860887, 0.508797}, + {0.891185, 0.453639}, + {0.117761, 0.993042}, + {0.979856, 0.199704}, + {0.962527, 0.271186}, + {-0.684191, -0.729303}, + {0.721192, 0.692735}, + {0.238526, 0.971136}, + {0.00697998, -0.999976}, + {-0.930376, -0.366607}, + {0.815014, 0.579442}, + {-0.528782, -0.848757}, + {-0.900866, -0.434097}, + {-0.884848, 0.46588}, + {0.902044, 0.431644}, + {-0.979381, -0.20202}, + {0.262303, 0.964986}, + {-0.224016, 0.974586}, + {-0.295191, 0.955438}, + {-0.464931, -0.885347}, + {-0.45439, 0.890803}, + {0.343081, -0.939306}, + {0.989908, -0.141713}, + {0.97128, -0.237938}, + {0.737974, 0.674829}, + {-0.866472, -0.499225}, + {0.580876, -0.813992}, + {-0.318579, 0.947896}, + {0.770191, 0.637813}, + {0.87979, 0.475362}, + {0.332624, 0.94306}, + {-0.0665321, -0.997784}, + {0.75431, 0.656519}, + {0.931337, 0.364158}, + {0.951175, -0.308652}, + {-0.0784228, 0.99692}, + {-0.657484, 0.753469}, + {-0.701884, -0.712291}, + {-0.994476, -0.10496}, + {-0.00479666, 0.999989}, + {0.190552, 0.981677}, + {0.153476, -0.988152}, + {-0.666087, -0.745874}, + {-0.0293607, 0.999569}, + {-0.990138, 0.140094}, + {0.285921, 0.958253}, + {-0.539632, 0.841901}, + {-0.306804, -0.951773}, + {0.806616, -0.591075}, + {0.994703, 0.102791}, + {0.943325, -0.331871}, + {-0.0539077, 0.998546}, + {-0.939099, -0.343648}, + {0.916396, -0.400274}, + {-0.873131, 0.487485}, + {-0.76833, -0.640054}, + {-0.889936, -0.456086}, + {-0.943698, 0.330809}, + {0.166385, 0.986061}, + {0.657757, -0.753231}, + {-0.16393, -0.986472}, + {-0.813345, -0.581782}, + {0.686335, 0.727285}, + {-0.375952, -0.926639}, + {0.531244, 0.847219}, + {0.997645, -0.0685942}, + {-0.507799, -0.861475}, + {0.510286, 0.860005}, + {0.319956, -0.947433}, + {-0.497612, 0.8674}, + {0.445615, 0.895225}, + {-0.97713, 0.212644}, + {0.785609, 0.618724}, + {-0.951542, 0.307518}, + {0.991884, 0.127147}, + {-0.935283, 0.3539}, + {-0.518778, 0.854909}, + {0.214604, 0.976701}, + {0.906311, -0.422611}, + {-0.878469, -0.4778}, + {-0.420947, -0.907085}, + {0.649823, 0.760086}, + {-0.549448, -0.835528}, + {-0.619665, 0.784867}, + {0.630972, 0.775805}, + {-0.175868, 0.984414}, + {-0.911254, -0.411844}, + {0.55188, 0.833923}, + {0.988468, 0.151428}, + {0.834608, -0.550844}, + {-0.98206, 0.188569}, + {-0.271624, 0.962403}, + {0.0314939, -0.999504}, + {0.0197696, 0.999805}, + {-0.102891, 0.994693}, + {0.995664, -0.0930283}, + {0.273142, -0.961974}, + {-0.609415, -0.792851}, + {-0.971609, 0.23659}, + {-0.798818, -0.601573}, + {0.79189, -0.610664}, + {0.872817, -0.488047}, + {0.572183, 0.820126}, + {-0.0420478, -0.999116}, + {0.999567, 0.0294129}, + {0.0804485, -0.996759}, + {0.955587, 0.294708}, + {-0.432362, 0.9017}, + {-0.56016, 0.828385}, + {0.999808, -0.0196154}, + {-0.792021, 0.610494}, + {-0.151629, 0.988438}, + {-0.965502, 0.260395}}; + +double NOISE_TABLES<3>::g[514][3] = {{0.703937, 0.671213, 0.232264}, + {0.244363, 0.69386, -0.677381}, + {-0.331423, 0.848405, -0.412756}, + {0.126499, 0.962872, 0.238487}, + {0.466958, -0.483874, 0.740146}, + {0.176755, 0.860964, 0.476969}, + {0.886366, 0.406782, -0.221099}, + {0.0185006, 0.775828, 0.630673}, + {-0.470088, 0.0605037, 0.880543}, + {-0.773492, 0.626673, -0.0948238}, + {-0.857512, 0.288094, -0.426232}, + {0.150081, 0.415784, 0.896995}, + {-0.872249, -0.218042, 0.437766}, + {-0.0861065, -0.839216, -0.536938}, + {0.349644, -0.0680964, -0.934405}, + {-0.0398576, 0.898367, 0.437433}, + {0.468223, -0.875571, -0.118926}, + {-0.103358, 0.963883, 0.24545}, + {0.337089, -0.875548, 0.346102}, + {-0.0221145, 0.424378, -0.905215}, + {0.0437806, 0.910029, -0.412227}, + {-0.708037, 0.621613, -0.335084}, + {-0.582809, 0.409583, -0.701837}, + {0.449608, -0.880991, 0.147335}, + {0.894835, -0.444366, 0.0425467}, + {0.612009, -0.290472, -0.735576}, + {0.327684, 0.528202, 0.783343}, + {-0.954306, -0.0592497, 0.292897}, + {-0.787289, -0.592354, 0.17115}, + {-0.532847, 0.754446, -0.383257}, + {0.967865, 0.202682, -0.148851}, + {-0.154359, 0.666301, 0.729532}, + {0.815913, -0.378909, 0.436708}, + {-0.33297, -0.903445, -0.270035}, + {0.473239, -0.483413, -0.736449}, + {-0.575346, 0.601649, -0.554071}, + {-0.0318239, 0.27278, 0.96155}, + {0.265315, 0.13551, -0.954591}, + {-0.631428, -0.24433, -0.735935}, + {0.660881, -0.728335, -0.181008}, + {0.213022, 0.525664, -0.823589}, + {-0.584948, -0.498582, 0.639729}, + {0.326382, 0.886109, 0.329069}, + {-0.639737, -0.0281372, 0.768078}, + {0.0488475, 0.780061, -0.623793}, + {-0.162389, 0.939152, -0.302694}, + {0.743029, 0.329622, -0.582459}, + {-0.0392915, 0.998263, 0.0438991}, + {-0.184122, 0.684116, -0.705751}, + {0.649173, -0.486517, -0.584701}, + {-0.797453, -0.508998, -0.324021}, + {-0.692277, 0.00421333, -0.721619}, + {0.736423, -0.0850594, -0.671153}, + {0.185898, 0.982543, -0.00722356}, + {0.0127172, 0.618041, -0.786043}, + {0.552496, 0.831102, 0.0633782}, + {0.931649, 0.086932, 0.352808}, + {0.16589, 0.183359, 0.968948}, + {-0.563792, -0.466113, -0.681819}, + {-0.227157, 0.970054, -0.0859935}, + {0.143632, -0.772967, -0.617973}, + {0.80845, -0.55899, -0.184227}, + {-0.259797, -0.315267, 0.91275}, + {-0.210642, -0.9083, 0.361416}, + {0.111219, -0.900813, -0.419723}, + {0.271668, -0.442262, -0.854752}, + {-0.82864, 0.0821824, -0.553717}, + {-0.375708, 0.718987, -0.584723}, + {-0.280864, -0.0848669, 0.955988}, + {0.40012, 0.909678, -0.111309}, + {0.982483, 0.139306, 0.123782}, + {-0.945762, -0.253865, 0.2027}, + {-0.980597, -0.195914, -0.0068499}, + {0.35892, 0.311644, 0.879804}, + {-0.150533, 0.0281254, -0.988205}, + {0.942365, 0.333462, 0.0274149}, + {0.0915656, -0.977007, -0.192542}, + {0.482284, 0.138992, -0.864918}, + {0.910838, 0.310947, 0.271452}, + {0.621993, 0.639092, 0.452422}, + {-0.847242, -0.424279, 0.319637}, + {0.491705, 0.587825, 0.642408}, + {-0.892862, 0.392122, 0.221445}, + {0.604611, -0.268798, 0.749796}, + {-0.750032, -0.369835, 0.548338}, + {0.832349, 0.0323993, 0.553304}, + {0.768444, 0.48877, -0.413035}, + {0.520619, -0.0862026, 0.849426}, + {0.0382017, -0.5973, 0.801108}, + {-0.462935, 0.762886, 0.451326}, + {0.847687, 0.528653, -0.0441998}, + {-0.379082, -0.618955, 0.687889}, + {-0.405669, 0.550519, -0.729631}, + {-0.221196, -0.34563, -0.911928}, + {0.431557, 0.83464, -0.342248}, + {-0.648354, -0.596692, -0.472859}, + {-0.370907, 0.105338, -0.922677}, + {-0.0718653, -0.849552, 0.522587}, + {-0.347969, -0.919283, 0.183948}, + {-0.271436, 0.146575, 0.95123}, + {0.809606, -0.531526, 0.249035}, + {0.354965, 0.926855, 0.122231}, + {0.11355, -0.586723, -0.801787}, + {0.428599, 0.539449, -0.724774}, + {0.671071, 0.133191, -0.729331}, + {-0.691673, -0.722188, 0.00581921}, + {0.210179, -0.958281, 0.193709}, + {-0.902243, -0.426146, 0.0660138}, + {-0.404368, 0.338777, -0.849539}, + {0.795005, -0.464171, -0.390528}, + {-0.608185, 0.590394, 0.530609}, + {0.398167, -0.316797, 0.860873}, + {-0.652399, 0.754199, 0.0745617}, + {0.692765, -0.0251959, 0.720723}, + {-0.111766, -0.935697, -0.334633}, + {-0.0339944, -0.412959, 0.910115}, + {0.534409, 0.379982, 0.754997}, + {0.77425, -0.632123, 0.0309428}, + {-0.707191, -0.566922, 0.42247}, + {-0.212727, -0.529147, 0.821432}, + {0.296734, -0.914603, -0.274681}, + {-0.218053, 0.496506, -0.840199}, + {0.422297, -0.273784, -0.864122}, + {0.591333, 0.787304, -0.17458}, + {-0.443239, -0.305043, -0.842904}, + {0.661367, -0.639136, -0.392553}, + {-0.468663, -0.182573, 0.864305}, + {-0.516925, -0.0670702, -0.853399}, + {-0.710741, 0.375331, 0.594957}, + {0.423102, 0.759161, 0.494631}, + {0.247216, 0.839627, -0.483643}, + {-0.916356, -0.364994, -0.164534}, + {-0.970304, 0.237044, 0.0481746}, + {-0.508056, -0.773006, -0.379922}, + {0.717762, 0.696189, 0.0117958}, + {-0.879854, 0.0374545, 0.473766}, + {-0.141238, -0.706546, 0.69343}, + {-0.302912, -0.8224, -0.481563}, + {-0.52973, -0.679401, 0.507741}, + {-0.995612, 0.00112916, 0.0935721}, + {0.770279, -0.290515, -0.567689}, + {0.831609, 0.267528, 0.486678}, + {0.145521, -0.277545, 0.949628}, + {0.507867, -0.636986, 0.579931}, + {0.890254, -0.268962, -0.367569}, + {0.0181128, 0.983902, -0.177786}, + {0.967931, -0.127579, -0.216412}, + {-0.868754, -0.306667, -0.388872}, + {0.102164, -0.0286481, -0.994355}, + {-0.67944, -0.692457, -0.24262}, + {0.899886, -0.148992, 0.409886}, + {0.824701, 0.114807, -0.553794}, + {-0.223681, 0.35753, 0.906719}, + {-0.735341, 0.453771, -0.503355}, + {-0.319217, 0.519664, 0.792496}, + {0.360392, 0.0842246, 0.928991}, + {0.0285471, -0.397916, -0.916978}, + {0.748567, 0.623001, -0.226975}, + {-0.938623, 0.104478, -0.328743}, + {0.439054, 0.708447, -0.552571}, + {-0.138696, -0.983299, -0.117838}, + {0.102764, -0.75416, 0.648601}, + {-0.792884, 0.589741, 0.15343}, + {-0.614839, 0.222451, 0.75663}, + {0.662237, -0.437329, 0.608429}, + {-0.435869, -0.413395, 0.799451}, + {-0.290422, 0.886642, 0.359889}, + {-0.628215, -0.27459, 0.727974}, + {0.783055, 0.483628, 0.391061}, + {-0.46599, -0.659429, -0.589921}, + {-0.96489, -0.139979, -0.222248}, + {-0.262613, -0.693507, -0.670882}, + {-0.941807, 0.283267, -0.180997}, + {0.517647, -0.766618, 0.379919}, + {0.91527, -0.365825, -0.168683}, + {0.880251, 0.267538, -0.391894}, + {0.497402, -0.797527, -0.341384}, + {-0.201279, 0.268824, -0.941924}, + {-0.36178, -0.513064, -0.778383}, + {-0.0622299, -0.190018, -0.979806}, + {0.920058, -0.313354, 0.235163}, + {0.611315, 0.534067, -0.584009}, + {-0.900076, -0.0891747, -0.42651}, + {-0.488622, 0.841614, 0.230075}, + {-0.765284, 0.132044, 0.630004}, + {0.0566041, -0.997883, 0.032038}, + {0.221663, -0.463196, 0.858088}, + {-0.136397, -0.537233, -0.832332}, + {0.188996, -0.239227, -0.952392}, + {-0.0692875, -0.184642, 0.98036}, + {0.324608, -0.767909, 0.552218}, + {0.561478, -0.0737953, -0.824195}, + {-0.818049, -0.567854, -0.0913143}, + {0.977631, -0.0847148, 0.192515}, + {0.00137412, -0.957845, 0.287284}, + {-0.650958, 0.691099, 0.314063}, + {-0.223262, 0.801023, 0.555442}, + {-0.773378, 0.500316, 0.38932}, + {0.578787, 0.345454, -0.738693}, + {0.610163, 0.684089, -0.399654}, + {0.32642, -0.806744, -0.492559}, + {0.228387, 0.93919, -0.25644}, + {0.54976, 0.152703, 0.821246}, + {0.678923, 0.438401, 0.588955}, + {-0.850488, 0.279179, 0.44579}, + {0.0130521, 0.183984, -0.982843}, + {-0.566217, 0.17794, -0.804821}, + {0.709054, 0.21427, 0.671812}, + {0.49716, -0.664111, -0.55838}, + {-0.347565, -0.936701, -0.0423009}, + {0.17422, 0.333029, -0.926682}, + {-0.776182, -0.123523, 0.618291}, + {-0.308091, -0.131397, -0.942239}, + {-0.530185, -0.835661, -0.14344}, + {-0.448458, -0.820814, 0.353766}, + {0.26657, 0.717597, 0.643425}, + {-0.533719, -0.839756, 0.0997717}, + {0.386265, 0.345329, -0.855305}, + {-0.0646575, 0.505187, 0.860585}, + {0.975145, -0.221327, 0.0103059}, + {-0.785106, -0.170651, -0.595388}, + {-0.991786, 0.0543184, -0.115802}, + {0.94534, 0.0632803, -0.319889}, + {0.683011, -0.587613, 0.433828}, + {-0.634975, -0.724176, 0.269027}, + {0.876185, -0.0834622, -0.474694}, + {0.287078, -0.625462, 0.725523}, + {-0.395736, 0.661196, 0.637348}, + {0.843124, 0.509441, 0.172079}, + {-0.468808, 0.8833, -0.000465431}, + {-0.947066, 0.172266, 0.270906}, + {0.531331, 0.798747, 0.282294}, + {-0.0477147, -0.703516, -0.709076}, + {-0.435629, 0.300855, 0.848359}, + {-0.293093, 0.947852, 0.12519}, + {0.609435, -0.792271, 0.029926}, + {-0.40416, 0.89042, -0.209302}, + {0.104886, 0.622757, 0.775353}, + {0.13811, -0.884292, 0.446042}, + {-0.531316, 0.462603, 0.709719}, + {-0.0749454, 0.0546115, 0.995691}, + {-0.307886, -0.782869, 0.540668}, + {-0.145564, 0.832899, -0.533938}, + {-0.734822, -0.395011, -0.551364}, + {-0.892592, 0.45057, -0.0163148}, + {-0.611459, 0.774063, -0.164148}, + {0.313613, -0.644045, -0.697749}, + {0.286015, -0.957831, -0.0274987}, + {-0.149122, -0.981781, 0.117763}, + {0.656373, -0.718632, 0.229658}, + {-0.844891, 0.464422, -0.265466}, + {0.316523, -0.132894, 0.93923}, + {0.998767, 0.00915237, -0.0487939}, + {-0.724761, 0.251606, -0.641417}, + {0.773361, -0.209935, 0.598197}, + {0.124979, -0.0345928, 0.991556}, + {0.703937, 0.671213, 0.232264}, + {0.244363, 0.69386, -0.677381}, + {-0.331423, 0.848405, -0.412756}, + {0.126499, 0.962872, 0.238487}, + {0.466958, -0.483874, 0.740146}, + {0.176755, 0.860964, 0.476969}, + {0.886366, 0.406782, -0.221099}, + {0.0185006, 0.775828, 0.630673}, + {-0.470088, 0.0605037, 0.880543}, + {-0.773492, 0.626673, -0.0948238}, + {-0.857512, 0.288094, -0.426232}, + {0.150081, 0.415784, 0.896995}, + {-0.872249, -0.218042, 0.437766}, + {-0.0861065, -0.839216, -0.536938}, + {0.349644, -0.0680964, -0.934405}, + {-0.0398576, 0.898367, 0.437433}, + {0.468223, -0.875571, -0.118926}, + {-0.103358, 0.963883, 0.24545}, + {0.337089, -0.875548, 0.346102}, + {-0.0221145, 0.424378, -0.905215}, + {0.0437806, 0.910029, -0.412227}, + {-0.708037, 0.621613, -0.335084}, + {-0.582809, 0.409583, -0.701837}, + {0.449608, -0.880991, 0.147335}, + {0.894835, -0.444366, 0.0425467}, + {0.612009, -0.290472, -0.735576}, + {0.327684, 0.528202, 0.783343}, + {-0.954306, -0.0592497, 0.292897}, + {-0.787289, -0.592354, 0.17115}, + {-0.532847, 0.754446, -0.383257}, + {0.967865, 0.202682, -0.148851}, + {-0.154359, 0.666301, 0.729532}, + {0.815913, -0.378909, 0.436708}, + {-0.33297, -0.903445, -0.270035}, + {0.473239, -0.483413, -0.736449}, + {-0.575346, 0.601649, -0.554071}, + {-0.0318239, 0.27278, 0.96155}, + {0.265315, 0.13551, -0.954591}, + {-0.631428, -0.24433, -0.735935}, + {0.660881, -0.728335, -0.181008}, + {0.213022, 0.525664, -0.823589}, + {-0.584948, -0.498582, 0.639729}, + {0.326382, 0.886109, 0.329069}, + {-0.639737, -0.0281372, 0.768078}, + {0.0488475, 0.780061, -0.623793}, + {-0.162389, 0.939152, -0.302694}, + {0.743029, 0.329622, -0.582459}, + {-0.0392915, 0.998263, 0.0438991}, + {-0.184122, 0.684116, -0.705751}, + {0.649173, -0.486517, -0.584701}, + {-0.797453, -0.508998, -0.324021}, + {-0.692277, 0.00421333, -0.721619}, + {0.736423, -0.0850594, -0.671153}, + {0.185898, 0.982543, -0.00722356}, + {0.0127172, 0.618041, -0.786043}, + {0.552496, 0.831102, 0.0633782}, + {0.931649, 0.086932, 0.352808}, + {0.16589, 0.183359, 0.968948}, + {-0.563792, -0.466113, -0.681819}, + {-0.227157, 0.970054, -0.0859935}, + {0.143632, -0.772967, -0.617973}, + {0.80845, -0.55899, -0.184227}, + {-0.259797, -0.315267, 0.91275}, + {-0.210642, -0.9083, 0.361416}, + {0.111219, -0.900813, -0.419723}, + {0.271668, -0.442262, -0.854752}, + {-0.82864, 0.0821824, -0.553717}, + {-0.375708, 0.718987, -0.584723}, + {-0.280864, -0.0848669, 0.955988}, + {0.40012, 0.909678, -0.111309}, + {0.982483, 0.139306, 0.123782}, + {-0.945762, -0.253865, 0.2027}, + {-0.980597, -0.195914, -0.0068499}, + {0.35892, 0.311644, 0.879804}, + {-0.150533, 0.0281254, -0.988205}, + {0.942365, 0.333462, 0.0274149}, + {0.0915656, -0.977007, -0.192542}, + {0.482284, 0.138992, -0.864918}, + {0.910838, 0.310947, 0.271452}, + {0.621993, 0.639092, 0.452422}, + {-0.847242, -0.424279, 0.319637}, + {0.491705, 0.587825, 0.642408}, + {-0.892862, 0.392122, 0.221445}, + {0.604611, -0.268798, 0.749796}, + {-0.750032, -0.369835, 0.548338}, + {0.832349, 0.0323993, 0.553304}, + {0.768444, 0.48877, -0.413035}, + {0.520619, -0.0862026, 0.849426}, + {0.0382017, -0.5973, 0.801108}, + {-0.462935, 0.762886, 0.451326}, + {0.847687, 0.528653, -0.0441998}, + {-0.379082, -0.618955, 0.687889}, + {-0.405669, 0.550519, -0.729631}, + {-0.221196, -0.34563, -0.911928}, + {0.431557, 0.83464, -0.342248}, + {-0.648354, -0.596692, -0.472859}, + {-0.370907, 0.105338, -0.922677}, + {-0.0718653, -0.849552, 0.522587}, + {-0.347969, -0.919283, 0.183948}, + {-0.271436, 0.146575, 0.95123}, + {0.809606, -0.531526, 0.249035}, + {0.354965, 0.926855, 0.122231}, + {0.11355, -0.586723, -0.801787}, + {0.428599, 0.539449, -0.724774}, + {0.671071, 0.133191, -0.729331}, + {-0.691673, -0.722188, 0.00581921}, + {0.210179, -0.958281, 0.193709}, + {-0.902243, -0.426146, 0.0660138}, + {-0.404368, 0.338777, -0.849539}, + {0.795005, -0.464171, -0.390528}, + {-0.608185, 0.590394, 0.530609}, + {0.398167, -0.316797, 0.860873}, + {-0.652399, 0.754199, 0.0745617}, + {0.692765, -0.0251959, 0.720723}, + {-0.111766, -0.935697, -0.334633}, + {-0.0339944, -0.412959, 0.910115}, + {0.534409, 0.379982, 0.754997}, + {0.77425, -0.632123, 0.0309428}, + {-0.707191, -0.566922, 0.42247}, + {-0.212727, -0.529147, 0.821432}, + {0.296734, -0.914603, -0.274681}, + {-0.218053, 0.496506, -0.840199}, + {0.422297, -0.273784, -0.864122}, + {0.591333, 0.787304, -0.17458}, + {-0.443239, -0.305043, -0.842904}, + {0.661367, -0.639136, -0.392553}, + {-0.468663, -0.182573, 0.864305}, + {-0.516925, -0.0670702, -0.853399}, + {-0.710741, 0.375331, 0.594957}, + {0.423102, 0.759161, 0.494631}, + {0.247216, 0.839627, -0.483643}, + {-0.916356, -0.364994, -0.164534}, + {-0.970304, 0.237044, 0.0481746}, + {-0.508056, -0.773006, -0.379922}, + {0.717762, 0.696189, 0.0117958}, + {-0.879854, 0.0374545, 0.473766}, + {-0.141238, -0.706546, 0.69343}, + {-0.302912, -0.8224, -0.481563}, + {-0.52973, -0.679401, 0.507741}, + {-0.995612, 0.00112916, 0.0935721}, + {0.770279, -0.290515, -0.567689}, + {0.831609, 0.267528, 0.486678}, + {0.145521, -0.277545, 0.949628}, + {0.507867, -0.636986, 0.579931}, + {0.890254, -0.268962, -0.367569}, + {0.0181128, 0.983902, -0.177786}, + {0.967931, -0.127579, -0.216412}, + {-0.868754, -0.306667, -0.388872}, + {0.102164, -0.0286481, -0.994355}, + {-0.67944, -0.692457, -0.24262}, + {0.899886, -0.148992, 0.409886}, + {0.824701, 0.114807, -0.553794}, + {-0.223681, 0.35753, 0.906719}, + {-0.735341, 0.453771, -0.503355}, + {-0.319217, 0.519664, 0.792496}, + {0.360392, 0.0842246, 0.928991}, + {0.0285471, -0.397916, -0.916978}, + {0.748567, 0.623001, -0.226975}, + {-0.938623, 0.104478, -0.328743}, + {0.439054, 0.708447, -0.552571}, + {-0.138696, -0.983299, -0.117838}, + {0.102764, -0.75416, 0.648601}, + {-0.792884, 0.589741, 0.15343}, + {-0.614839, 0.222451, 0.75663}, + {0.662237, -0.437329, 0.608429}, + {-0.435869, -0.413395, 0.799451}, + {-0.290422, 0.886642, 0.359889}, + {-0.628215, -0.27459, 0.727974}, + {0.783055, 0.483628, 0.391061}, + {-0.46599, -0.659429, -0.589921}, + {-0.96489, -0.139979, -0.222248}, + {-0.262613, -0.693507, -0.670882}, + {-0.941807, 0.283267, -0.180997}, + {0.517647, -0.766618, 0.379919}, + {0.91527, -0.365825, -0.168683}, + {0.880251, 0.267538, -0.391894}, + {0.497402, -0.797527, -0.341384}, + {-0.201279, 0.268824, -0.941924}, + {-0.36178, -0.513064, -0.778383}, + {-0.0622299, -0.190018, -0.979806}, + {0.920058, -0.313354, 0.235163}, + {0.611315, 0.534067, -0.584009}, + {-0.900076, -0.0891747, -0.42651}, + {-0.488622, 0.841614, 0.230075}, + {-0.765284, 0.132044, 0.630004}, + {0.0566041, -0.997883, 0.032038}, + {0.221663, -0.463196, 0.858088}, + {-0.136397, -0.537233, -0.832332}, + {0.188996, -0.239227, -0.952392}, + {-0.0692875, -0.184642, 0.98036}, + {0.324608, -0.767909, 0.552218}, + {0.561478, -0.0737953, -0.824195}, + {-0.818049, -0.567854, -0.0913143}, + {0.977631, -0.0847148, 0.192515}, + {0.00137412, -0.957845, 0.287284}, + {-0.650958, 0.691099, 0.314063}, + {-0.223262, 0.801023, 0.555442}, + {-0.773378, 0.500316, 0.38932}, + {0.578787, 0.345454, -0.738693}, + {0.610163, 0.684089, -0.399654}, + {0.32642, -0.806744, -0.492559}, + {0.228387, 0.93919, -0.25644}, + {0.54976, 0.152703, 0.821246}, + {0.678923, 0.438401, 0.588955}, + {-0.850488, 0.279179, 0.44579}, + {0.0130521, 0.183984, -0.982843}, + {-0.566217, 0.17794, -0.804821}, + {0.709054, 0.21427, 0.671812}, + {0.49716, -0.664111, -0.55838}, + {-0.347565, -0.936701, -0.0423009}, + {0.17422, 0.333029, -0.926682}, + {-0.776182, -0.123523, 0.618291}, + {-0.308091, -0.131397, -0.942239}, + {-0.530185, -0.835661, -0.14344}, + {-0.448458, -0.820814, 0.353766}, + {0.26657, 0.717597, 0.643425}, + {-0.533719, -0.839756, 0.0997717}, + {0.386265, 0.345329, -0.855305}, + {-0.0646575, 0.505187, 0.860585}, + {0.975145, -0.221327, 0.0103059}, + {-0.785106, -0.170651, -0.595388}, + {-0.991786, 0.0543184, -0.115802}, + {0.94534, 0.0632803, -0.319889}, + {0.683011, -0.587613, 0.433828}, + {-0.634975, -0.724176, 0.269027}, + {0.876185, -0.0834622, -0.474694}, + {0.287078, -0.625462, 0.725523}, + {-0.395736, 0.661196, 0.637348}, + {0.843124, 0.509441, 0.172079}, + {-0.468808, 0.8833, -0.000465431}, + {-0.947066, 0.172266, 0.270906}, + {0.531331, 0.798747, 0.282294}, + {-0.0477147, -0.703516, -0.709076}, + {-0.435629, 0.300855, 0.848359}, + {-0.293093, 0.947852, 0.12519}, + {0.609435, -0.792271, 0.029926}, + {-0.40416, 0.89042, -0.209302}, + {0.104886, 0.622757, 0.775353}, + {0.13811, -0.884292, 0.446042}, + {-0.531316, 0.462603, 0.709719}, + {-0.0749454, 0.0546115, 0.995691}, + {-0.307886, -0.782869, 0.540668}, + {-0.145564, 0.832899, -0.533938}, + {-0.734822, -0.395011, -0.551364}, + {-0.892592, 0.45057, -0.0163148}, + {-0.611459, 0.774063, -0.164148}, + {0.313613, -0.644045, -0.697749}, + {0.286015, -0.957831, -0.0274987}, + {-0.149122, -0.981781, 0.117763}, + {0.656373, -0.718632, 0.229658}, + {-0.844891, 0.464422, -0.265466}, + {0.316523, -0.132894, 0.93923}, + {0.998767, 0.00915237, -0.0487939}, + {-0.724761, 0.251606, -0.641417}, + {0.773361, -0.209935, 0.598197}, + {0.124979, -0.0345928, 0.991556}, + {0.703937, 0.671213, 0.232264}, + {0.244363, 0.69386, -0.677381}}; + +double NOISE_TABLES<4>::g[514][4] = {{0.3966, 0.564479, 0.423247, 0.58731}, + {0.207686, 0.293048, -0.883543, -0.300569}, + {-0.145433, 0.307846, 0.936414, 0.0849082}, + {0.666268, 0.207833, 0.44005, -0.565021}, + {0.652951, -0.00227182, -0.588353, 0.47696}, + {0.221574, -0.823315, -0.367396, 0.371587}, + {-0.236882, -0.955985, 0.167044, -0.0455716}, + {-0.781451, -0.438422, 0.313148, 0.314737}, + {-0.225926, 0.956158, 0.150141, -0.110349}, + {-0.833293, -0.363813, 0.309378, -0.278475}, + {-0.873073, 0.00211995, 0.423987, 0.240777}, + {0.306914, -0.7367, 0.21705, -0.562109}, + {0.682326, -0.374178, -0.322874, 0.53868}, + {-0.192218, 0.2844, -0.00210586, -0.939236}, + {-0.544339, 0.512692, -0.534324, -0.394132}, + {0.284116, -0.183261, -0.728104, 0.596288}, + {0.183594, -0.932705, 0.254254, -0.17807}, + {-0.64169, -0.205595, 0.301285, -0.674679}, + {0.148202, -0.240829, 0.587807, 0.757972}, + {0.449893, -0.145313, 0.618109, -0.628029}, + {0.10435, 0.241438, -0.73631, 0.623431}, + {0.322788, 0.0994767, -0.00434734, 0.941219}, + {0.422486, -0.629475, -0.442919, -0.478632}, + {0.385144, 0.483074, -0.784525, 0.053138}, + {0.42928, -0.128703, -0.366779, 0.815247}, + {0.489462, 0.157652, 0.785911, -0.34339}, + {-0.214972, 0.700646, -0.0211753, -0.680025}, + {0.35655, -0.209979, 0.897849, -0.150495}, + {-0.076423, 0.836021, 0.527187, 0.13154}, + {-0.923646, 0.0314742, -0.327382, 0.196745}, + {-0.448991, 0.87173, -0.154501, 0.120931}, + {0.977875, -0.149525, -0.134619, -0.0572834}, + {0.250627, 0.508589, -0.596248, -0.568342}, + {0.721136, -0.602061, 0.291308, 0.180621}, + {-0.556466, -0.167224, 0.679021, -0.44868}, + {-0.425316, -0.637457, -0.379061, -0.518718}, + {-0.384742, 0.142519, 0.87612, -0.253133}, + {-0.637148, -0.481892, -0.600691, 0.0315185}, + {0.501334, 0.857258, -0.11734, 0.0022026}, + {0.917651, 0.0368148, 0.18608, -0.349192}, + {0.715984, 0.499081, 0.428469, 0.233879}, + {-0.33469, -0.463351, 0.814315, 0.10089}, + {-0.0108647, -0.646727, -0.55418, -0.523937}, + {0.814467, 0.57796, 0.0439751, 0.0259406}, + {0.176981, -0.459889, 0.852448, 0.174677}, + {-0.594521, 0.2006, 0.479296, -0.613661}, + {-0.296544, -0.66192, -0.660758, -0.193188}, + {0.552435, 0.0238813, -0.828288, -0.0904599}, + {0.81773, 0.3791, 0.0550689, 0.429614}, + {0.186315, 0.227278, 0.695315, -0.655872}, + {0.575947, -0.537464, 0.184169, 0.587791}, + {0.471377, 0.475964, 0.17765, -0.720904}, + {-0.613022, 0.153936, 0.760917, 0.146672}, + {0.297196, -0.313326, 0.187985, 0.882136}, + {-0.898109, -0.12216, 0.0316785, 0.421277}, + {0.251227, -0.515579, -0.441395, 0.690097}, + {-0.816822, 0.275739, -0.490435, -0.127453}, + {-0.0536727, -0.0294697, -0.348803, -0.935194}, + {0.416032, 0.528296, -0.0170906, 0.739951}, + {-0.529771, -0.32045, -0.692976, -0.369376}, + {-0.640762, -0.161788, 0.316987, 0.680271}, + {0.0064156, -0.427237, -0.135966, 0.893835}, + {-0.617571, -0.254647, -0.354157, -0.654472}, + {-0.481219, -0.78939, 0.257056, 0.28145}, + {-0.460855, 0.420169, -0.266908, -0.734732}, + {-0.324338, 0.505725, 0.709785, 0.367766}, + {-0.867004, -0.130448, -0.0277134, -0.480124}, + {-0.433253, 0.617241, -0.483873, 0.444042}, + {-0.725647, -0.22864, 0.647887, -0.0374377}, + {0.573867, -0.621648, -0.48646, 0.218145}, + {-0.846039, -0.157257, -0.449647, -0.239386}, + {-0.812685, 0.527575, 0.221465, -0.11028}, + {0.487958, -0.197467, -0.163563, -0.834356}, + {-0.187005, 0.457608, 0.734737, -0.464528}, + {0.903127, -0.216889, 0.0404167, 0.368357}, + {0.369741, 0.120311, -0.868549, 0.30731}, + {-0.173836, -0.270056, -0.697615, -0.640456}, + {0.0141874, -0.0217574, -0.32394, 0.945721}, + {0.278108, 0.316916, -0.380316, 0.823152}, + {0.556537, 0.736762, 0.108059, 0.368473}, + {-0.706484, -0.0525948, -0.699774, 0.0918124}, + {0.970553, 0.167163, 0.155321, 0.0771967}, + {0.799861, 0.0880928, 0.441702, 0.396688}, + {-0.940329, 0.274188, 0.0514292, 0.194827}, + {0.112483, -0.984542, -0.126443, 0.0451367}, + {-0.883989, -0.393168, -0.238698, 0.0837004}, + {0.754818, -0.131129, 0.567742, -0.301204}, + {-0.552476, 0.120932, -0.761782, -0.315964}, + {0.8378, -0.192508, -0.171916, -0.48112}, + {0.89415, -0.210934, 0.387082, 0.0785524}, + {0.0622882, 0.1887, 0.934266, -0.296073}, + {-0.409742, 0.185908, 0.27674, 0.849096}, + {-0.476167, -0.600529, -0.487339, 0.418487}, + {-0.316251, 0.0188809, 0.335442, -0.887191}, + {0.232989, -0.717448, -0.0349111, 0.655565}, + {0.597784, 0.21959, 0.254963, 0.727618}, + {-0.601204, -0.223947, 0.657606, 0.394913}, + {-0.283001, -0.348646, 0.530459, -0.719007}, + {-0.0217517, -0.391103, -0.883317, -0.25752}, + {-0.28506, -0.119544, 0.588338, 0.747201}, + {0.913283, 0.107572, -0.262486, 0.292309}, + {0.276777, 0.189932, 0.568026, 0.751443}, + {0.809873, 0.290422, 0.487329, -0.149233}, + {0.669484, 0.0268262, 0.738559, 0.0748527}, + {0.625212, -0.566228, -0.0501739, -0.534769}, + {-0.417575, -0.527939, 0.455064, 0.582948}, + {0.141708, -0.0501356, -0.987945, -0.0370026}, + {0.230493, -0.587281, -0.152535, -0.760728}, + {-0.693449, 0.529716, 0.00843522, -0.488321}, + {-0.514916, 0.67448, 0.377116, -0.37111}, + {0.0721797, -0.204176, 0.841643, -0.494712}, + {0.62109, -0.437169, 0.650406, -0.0101057}, + {0.221762, 0.655354, -0.150918, -0.706085}, + {-0.0418541, 0.69175, 0.464089, 0.55168}, + {-0.392686, -0.142914, -0.0771214, -0.905221}, + {-0.499222, -0.516884, 0.00997627, -0.695348}, + {-0.132351, -0.397851, 0.289778, 0.860364}, + {-0.116953, 0.859767, -0.277326, 0.412569}, + {-0.420042, 0.717699, -0.555292, -0.0110998}, + {0.498195, -0.293886, -0.785358, 0.22056}, + {-0.130403, -0.706956, -0.312377, 0.62099}, + {0.0628368, 0.136674, 0.861757, 0.484507}, + {0.697412, -0.228603, 0.250549, -0.631334}, + {-0.41447, -0.304384, -0.369856, 0.773803}, + {-0.739257, 0.430684, 0.448312, 0.258895}, + {0.707515, 0.161745, -0.0388176, -0.686844}, + {-0.150637, -0.804078, -0.542715, 0.190335}, + {-0.334267, 0.0266575, -0.940638, 0.05248}, + {-0.0128381, 0.32431, -0.924373, 0.200482}, + {0.298876, -0.128842, -0.842588, -0.42909}, + {0.681684, 0.5947, -0.295622, 0.306997}, + {0.563868, -0.182781, 0.449858, 0.668036}, + {0.923849, 0.275927, -0.192935, -0.182051}, + {-0.144332, 0.0252123, -0.9134, -0.379782}, + {0.500583, 0.462126, 0.731835, -0.0165344}, + {0.783017, 0.458745, 0.125446, -0.400876}, + {0.285519, 0.810783, -0.498437, 0.112568}, + {0.830314, -0.0288258, -0.507055, -0.22944}, + {-0.881805, 0.0807794, 0.336043, -0.32089}, + {-0.104195, 0.80065, 0.498675, -0.315319}, + {0.0863339, 0.449352, 0.265859, 0.848498}, + {-0.346937, 0.200739, -0.442646, 0.802124}, + {-0.139349, -0.118364, -0.668803, 0.720607}, + {-0.0382987, 0.404686, -0.391262, -0.825637}, + {0.0558261, 0.915931, -0.0524622, -0.393956}, + {-0.0963122, -0.5074, -0.696057, 0.498773}, + {-0.651087, 0.161344, 0.0492618, -0.740018}, + {-0.753608, 0.156929, -0.350541, -0.53345}, + {0.0772411, -0.115201, 0.505355, -0.851692}, + {-0.234778, 0.675125, -0.00839805, 0.699296}, + {0.591905, -0.230435, -0.540421, -0.551809}, + {-0.314978, 0.193376, -0.796097, 0.479191}, + {0.0899122, 0.585199, 0.793914, -0.138417}, + {0.362748, 0.767312, 0.492388, 0.192875}, + {-0.513788, -0.605397, 0.388027, -0.467923}, + {-0.579922, 0.371073, -0.703691, 0.175536}, + {-0.518207, 0.769929, 0.363265, 0.0819105}, + {-0.404626, 0.834503, -0.179128, -0.328323}, + {-0.491739, -0.801317, 0.0039489, -0.340689}, + {-0.16205, 0.304384, -0.0690012, 0.936125}, + {0.277272, 0.154124, 0.943307, 0.0976609}, + {0.823632, -0.25152, -0.48221, 0.160753}, + {-0.165263, -0.448625, -0.302819, -0.824454}, + {-0.229479, 0.0553714, 0.712654, -0.660605}, + {-0.18919, -0.905954, -0.29718, -0.234815}, + {-0.235521, 0.891597, 0.170089, 0.347354}, + {0.432232, 0.0566435, 0.251762, -0.86405}, + {-0.251848, -0.473755, 0.764748, -0.356776}, + {0.118396, 0.719541, 0.275706, -0.626283}, + {0.167366, -0.904479, 0.214395, 0.328543}, + {-0.752118, -0.273176, -0.362227, 0.478001}, + {-0.124596, -0.40576, 0.760569, 0.491293}, + {-0.0827556, -0.186714, 0.974415, -0.0938402}, + {0.152124, 0.820868, 0.079178, 0.544761}, + {0.521831, -0.796874, -0.0406404, 0.301716}, + {-0.107772, -0.79673, 0.356639, -0.47583}, + {-0.282502, -0.407823, -0.859924, 0.120017}, + {-0.549686, -0.7863, -0.282029, 0.00605861}, + {-0.455303, 0.553854, 0.351687, 0.601881}, + {-0.0239912, 0.659488, -0.664518, 0.350594}, + {0.0581978, 0.669567, -0.710906, -0.20714}, + {0.590643, -0.75143, 0.202333, -0.213436}, + {-0.582665, 0.437274, -0.166569, 0.664491}, + {0.73719, 0.28539, -0.598939, 0.127968}, + {0.476506, 0.411229, -0.600336, 0.493386}, + {-0.144859, -0.77094, -0.0684603, -0.616425}, + {0.211188, -0.886245, -0.155185, -0.381953}, + {0.293755, 0.725368, -0.336643, 0.523661}, + {0.333981, 0.802013, -0.378939, -0.318805}, + {-0.0847942, 0.557028, -0.415693, 0.713953}, + {-0.480506, -0.217267, -0.72165, 0.448475}, + {0.138476, -0.562358, -0.804054, 0.134448}, + {0.326335, -0.379109, 0.227467, -0.835488}, + {0.347074, 0.576619, 0.588744, -0.447695}, + {-0.582098, -0.632204, 0.509717, -0.0408605}, + {0.17048, -0.816078, -0.534754, -0.137812}, + {0.236625, 0.91684, 0.282418, -0.153799}, + {0.09755, 0.347047, 0.33001, -0.872431}, + {0.282442, -0.774077, 0.558413, 0.0959496}, + {0.605938, 0.679424, 0.380906, -0.161656}, + {0.607551, 0.508538, -0.269046, -0.547618}, + {-0.674865, 0.645797, 0.0633188, 0.351418}, + {0.686316, 0.592474, -0.401118, -0.130572}, + {0.824402, -0.536749, -0.13702, 0.116129}, + {0.664881, 0.206143, -0.242747, 0.675657}, + {0.121442, 0.539656, 0.773081, 0.310434}, + {-0.259371, -0.91246, -0.131031, 0.288053}, + {-0.479147, -0.473136, 0.0407929, 0.738171}, + {-0.988997, -0.118559, 0.0869354, -0.0164336}, + {0.654787, -0.156903, 0.0152464, 0.739191}, + {-0.178412, 0.398846, -0.714787, -0.54605}, + {-0.553813, 0.187505, 0.589564, 0.557268}, + {0.60236, 0.307484, -0.633372, -0.376108}, + {0.162858, -0.633189, 0.401326, 0.641472}, + {0.404143, -0.137226, 0.816029, 0.389787}, + {0.494529, 0.152378, -0.431805, -0.73876}, + {0.864593, -0.40003, 0.158965, -0.2592}, + {-0.16913, -0.784426, 0.589029, -0.0954786}, + {0.492717, 0.292249, 0.715538, 0.399782}, + {-0.153812, 0.313327, 0.599478, 0.720273}, + {-0.7547, 0.242425, 0.191, 0.578945}, + {0.062637, -0.0843262, 0.0788559, -0.991336}, + {-0.669503, 0.136757, -0.526071, 0.506273}, + {0.47891, -0.514986, 0.583609, 0.405999}, + {-0.657984, 0.000454589, -0.138546, 0.740177}, + {0.210304, -0.313976, -0.509264, -0.773202}, + {-0.769058, -0.5088, -0.195983, -0.333562}, + {0.266989, 0.264362, -0.107222, -0.920507}, + {-0.939282, 0.237949, -0.0730232, -0.236213}, + {0.752746, -0.461731, -0.411838, -0.224874}, + {-0.6754, 0.356672, 0.607108, -0.219181}, + {0.547087, -0.797894, -0.229937, -0.105783}, + {0.16953, -0.586082, 0.753246, -0.245741}, + {-0.281731, -0.0694107, 0.912762, 0.287533}, + {0.118704, 0.111371, -0.675153, -0.719496}, + {-0.288969, 0.425292, -0.847561, -0.131391}, + {-0.125155, -0.765708, 0.526488, 0.347617}, + {-0.297342, -0.1225, -0.0152089, 0.946758}, + {-0.783263, 0.450131, -0.321386, 0.283888}, + {-0.296458, 0.500393, 0.371153, -0.723854}, + {0.518157, -0.52786, 0.525683, -0.42016}, + {-0.110051, -0.470855, 0.159525, -0.86066}, + {-0.683128, -0.613667, -0.0893266, 0.385708}, + {-0.407913, 0.0819627, -0.561403, -0.715344}, + {-0.753685, -0.650154, 0.0946762, -0.0172123}, + {-0.0939369, 0.736528, -0.425184, -0.517611}, + {0.103569, 0.9843, -0.0230777, 0.141048}, + {0.127728, -0.513648, 0.555166, -0.641593}, + {0.434096, -0.469744, -0.745669, -0.186756}, + {-0.0425633, -0.12077, -0.923236, 0.362269}, + {0.47616, 0.77633, 0.0392142, -0.411152}, + {-0.177387, -0.763558, 0.13944, 0.605036}, + {-0.347184, 0.604497, 0.713482, -0.070643}, + {0.00423816, 0.0210573, 0.311046, 0.950152}, + {-0.0738423, 0.920237, -0.370337, -0.102767}, + {-0.739379, 0.626192, -0.219025, -0.115026}, + {0.3966, 0.564479, 0.423247, 0.58731}, + {0.207686, 0.293048, -0.883543, -0.300569}, + {-0.145433, 0.307846, 0.936414, 0.0849082}, + {0.666268, 0.207833, 0.44005, -0.565021}, + {0.652951, -0.00227182, -0.588353, 0.47696}, + {0.221574, -0.823315, -0.367396, 0.371587}, + {-0.236882, -0.955985, 0.167044, -0.0455716}, + {-0.781451, -0.438422, 0.313148, 0.314737}, + {-0.225926, 0.956158, 0.150141, -0.110349}, + {-0.833293, -0.363813, 0.309378, -0.278475}, + {-0.873073, 0.00211995, 0.423987, 0.240777}, + {0.306914, -0.7367, 0.21705, -0.562109}, + {0.682326, -0.374178, -0.322874, 0.53868}, + {-0.192218, 0.2844, -0.00210586, -0.939236}, + {-0.544339, 0.512692, -0.534324, -0.394132}, + {0.284116, -0.183261, -0.728104, 0.596288}, + {0.183594, -0.932705, 0.254254, -0.17807}, + {-0.64169, -0.205595, 0.301285, -0.674679}, + {0.148202, -0.240829, 0.587807, 0.757972}, + {0.449893, -0.145313, 0.618109, -0.628029}, + {0.10435, 0.241438, -0.73631, 0.623431}, + {0.322788, 0.0994767, -0.00434734, 0.941219}, + {0.422486, -0.629475, -0.442919, -0.478632}, + {0.385144, 0.483074, -0.784525, 0.053138}, + {0.42928, -0.128703, -0.366779, 0.815247}, + {0.489462, 0.157652, 0.785911, -0.34339}, + {-0.214972, 0.700646, -0.0211753, -0.680025}, + {0.35655, -0.209979, 0.897849, -0.150495}, + {-0.076423, 0.836021, 0.527187, 0.13154}, + {-0.923646, 0.0314742, -0.327382, 0.196745}, + {-0.448991, 0.87173, -0.154501, 0.120931}, + {0.977875, -0.149525, -0.134619, -0.0572834}, + {0.250627, 0.508589, -0.596248, -0.568342}, + {0.721136, -0.602061, 0.291308, 0.180621}, + {-0.556466, -0.167224, 0.679021, -0.44868}, + {-0.425316, -0.637457, -0.379061, -0.518718}, + {-0.384742, 0.142519, 0.87612, -0.253133}, + {-0.637148, -0.481892, -0.600691, 0.0315185}, + {0.501334, 0.857258, -0.11734, 0.0022026}, + {0.917651, 0.0368148, 0.18608, -0.349192}, + {0.715984, 0.499081, 0.428469, 0.233879}, + {-0.33469, -0.463351, 0.814315, 0.10089}, + {-0.0108647, -0.646727, -0.55418, -0.523937}, + {0.814467, 0.57796, 0.0439751, 0.0259406}, + {0.176981, -0.459889, 0.852448, 0.174677}, + {-0.594521, 0.2006, 0.479296, -0.613661}, + {-0.296544, -0.66192, -0.660758, -0.193188}, + {0.552435, 0.0238813, -0.828288, -0.0904599}, + {0.81773, 0.3791, 0.0550689, 0.429614}, + {0.186315, 0.227278, 0.695315, -0.655872}, + {0.575947, -0.537464, 0.184169, 0.587791}, + {0.471377, 0.475964, 0.17765, -0.720904}, + {-0.613022, 0.153936, 0.760917, 0.146672}, + {0.297196, -0.313326, 0.187985, 0.882136}, + {-0.898109, -0.12216, 0.0316785, 0.421277}, + {0.251227, -0.515579, -0.441395, 0.690097}, + {-0.816822, 0.275739, -0.490435, -0.127453}, + {-0.0536727, -0.0294697, -0.348803, -0.935194}, + {0.416032, 0.528296, -0.0170906, 0.739951}, + {-0.529771, -0.32045, -0.692976, -0.369376}, + {-0.640762, -0.161788, 0.316987, 0.680271}, + {0.0064156, -0.427237, -0.135966, 0.893835}, + {-0.617571, -0.254647, -0.354157, -0.654472}, + {-0.481219, -0.78939, 0.257056, 0.28145}, + {-0.460855, 0.420169, -0.266908, -0.734732}, + {-0.324338, 0.505725, 0.709785, 0.367766}, + {-0.867004, -0.130448, -0.0277134, -0.480124}, + {-0.433253, 0.617241, -0.483873, 0.444042}, + {-0.725647, -0.22864, 0.647887, -0.0374377}, + {0.573867, -0.621648, -0.48646, 0.218145}, + {-0.846039, -0.157257, -0.449647, -0.239386}, + {-0.812685, 0.527575, 0.221465, -0.11028}, + {0.487958, -0.197467, -0.163563, -0.834356}, + {-0.187005, 0.457608, 0.734737, -0.464528}, + {0.903127, -0.216889, 0.0404167, 0.368357}, + {0.369741, 0.120311, -0.868549, 0.30731}, + {-0.173836, -0.270056, -0.697615, -0.640456}, + {0.0141874, -0.0217574, -0.32394, 0.945721}, + {0.278108, 0.316916, -0.380316, 0.823152}, + {0.556537, 0.736762, 0.108059, 0.368473}, + {-0.706484, -0.0525948, -0.699774, 0.0918124}, + {0.970553, 0.167163, 0.155321, 0.0771967}, + {0.799861, 0.0880928, 0.441702, 0.396688}, + {-0.940329, 0.274188, 0.0514292, 0.194827}, + {0.112483, -0.984542, -0.126443, 0.0451367}, + {-0.883989, -0.393168, -0.238698, 0.0837004}, + {0.754818, -0.131129, 0.567742, -0.301204}, + {-0.552476, 0.120932, -0.761782, -0.315964}, + {0.8378, -0.192508, -0.171916, -0.48112}, + {0.89415, -0.210934, 0.387082, 0.0785524}, + {0.0622882, 0.1887, 0.934266, -0.296073}, + {-0.409742, 0.185908, 0.27674, 0.849096}, + {-0.476167, -0.600529, -0.487339, 0.418487}, + {-0.316251, 0.0188809, 0.335442, -0.887191}, + {0.232989, -0.717448, -0.0349111, 0.655565}, + {0.597784, 0.21959, 0.254963, 0.727618}, + {-0.601204, -0.223947, 0.657606, 0.394913}, + {-0.283001, -0.348646, 0.530459, -0.719007}, + {-0.0217517, -0.391103, -0.883317, -0.25752}, + {-0.28506, -0.119544, 0.588338, 0.747201}, + {0.913283, 0.107572, -0.262486, 0.292309}, + {0.276777, 0.189932, 0.568026, 0.751443}, + {0.809873, 0.290422, 0.487329, -0.149233}, + {0.669484, 0.0268262, 0.738559, 0.0748527}, + {0.625212, -0.566228, -0.0501739, -0.534769}, + {-0.417575, -0.527939, 0.455064, 0.582948}, + {0.141708, -0.0501356, -0.987945, -0.0370026}, + {0.230493, -0.587281, -0.152535, -0.760728}, + {-0.693449, 0.529716, 0.00843522, -0.488321}, + {-0.514916, 0.67448, 0.377116, -0.37111}, + {0.0721797, -0.204176, 0.841643, -0.494712}, + {0.62109, -0.437169, 0.650406, -0.0101057}, + {0.221762, 0.655354, -0.150918, -0.706085}, + {-0.0418541, 0.69175, 0.464089, 0.55168}, + {-0.392686, -0.142914, -0.0771214, -0.905221}, + {-0.499222, -0.516884, 0.00997627, -0.695348}, + {-0.132351, -0.397851, 0.289778, 0.860364}, + {-0.116953, 0.859767, -0.277326, 0.412569}, + {-0.420042, 0.717699, -0.555292, -0.0110998}, + {0.498195, -0.293886, -0.785358, 0.22056}, + {-0.130403, -0.706956, -0.312377, 0.62099}, + {0.0628368, 0.136674, 0.861757, 0.484507}, + {0.697412, -0.228603, 0.250549, -0.631334}, + {-0.41447, -0.304384, -0.369856, 0.773803}, + {-0.739257, 0.430684, 0.448312, 0.258895}, + {0.707515, 0.161745, -0.0388176, -0.686844}, + {-0.150637, -0.804078, -0.542715, 0.190335}, + {-0.334267, 0.0266575, -0.940638, 0.05248}, + {-0.0128381, 0.32431, -0.924373, 0.200482}, + {0.298876, -0.128842, -0.842588, -0.42909}, + {0.681684, 0.5947, -0.295622, 0.306997}, + {0.563868, -0.182781, 0.449858, 0.668036}, + {0.923849, 0.275927, -0.192935, -0.182051}, + {-0.144332, 0.0252123, -0.9134, -0.379782}, + {0.500583, 0.462126, 0.731835, -0.0165344}, + {0.783017, 0.458745, 0.125446, -0.400876}, + {0.285519, 0.810783, -0.498437, 0.112568}, + {0.830314, -0.0288258, -0.507055, -0.22944}, + {-0.881805, 0.0807794, 0.336043, -0.32089}, + {-0.104195, 0.80065, 0.498675, -0.315319}, + {0.0863339, 0.449352, 0.265859, 0.848498}, + {-0.346937, 0.200739, -0.442646, 0.802124}, + {-0.139349, -0.118364, -0.668803, 0.720607}, + {-0.0382987, 0.404686, -0.391262, -0.825637}, + {0.0558261, 0.915931, -0.0524622, -0.393956}, + {-0.0963122, -0.5074, -0.696057, 0.498773}, + {-0.651087, 0.161344, 0.0492618, -0.740018}, + {-0.753608, 0.156929, -0.350541, -0.53345}, + {0.0772411, -0.115201, 0.505355, -0.851692}, + {-0.234778, 0.675125, -0.00839805, 0.699296}, + {0.591905, -0.230435, -0.540421, -0.551809}, + {-0.314978, 0.193376, -0.796097, 0.479191}, + {0.0899122, 0.585199, 0.793914, -0.138417}, + {0.362748, 0.767312, 0.492388, 0.192875}, + {-0.513788, -0.605397, 0.388027, -0.467923}, + {-0.579922, 0.371073, -0.703691, 0.175536}, + {-0.518207, 0.769929, 0.363265, 0.0819105}, + {-0.404626, 0.834503, -0.179128, -0.328323}, + {-0.491739, -0.801317, 0.0039489, -0.340689}, + {-0.16205, 0.304384, -0.0690012, 0.936125}, + {0.277272, 0.154124, 0.943307, 0.0976609}, + {0.823632, -0.25152, -0.48221, 0.160753}, + {-0.165263, -0.448625, -0.302819, -0.824454}, + {-0.229479, 0.0553714, 0.712654, -0.660605}, + {-0.18919, -0.905954, -0.29718, -0.234815}, + {-0.235521, 0.891597, 0.170089, 0.347354}, + {0.432232, 0.0566435, 0.251762, -0.86405}, + {-0.251848, -0.473755, 0.764748, -0.356776}, + {0.118396, 0.719541, 0.275706, -0.626283}, + {0.167366, -0.904479, 0.214395, 0.328543}, + {-0.752118, -0.273176, -0.362227, 0.478001}, + {-0.124596, -0.40576, 0.760569, 0.491293}, + {-0.0827556, -0.186714, 0.974415, -0.0938402}, + {0.152124, 0.820868, 0.079178, 0.544761}, + {0.521831, -0.796874, -0.0406404, 0.301716}, + {-0.107772, -0.79673, 0.356639, -0.47583}, + {-0.282502, -0.407823, -0.859924, 0.120017}, + {-0.549686, -0.7863, -0.282029, 0.00605861}, + {-0.455303, 0.553854, 0.351687, 0.601881}, + {-0.0239912, 0.659488, -0.664518, 0.350594}, + {0.0581978, 0.669567, -0.710906, -0.20714}, + {0.590643, -0.75143, 0.202333, -0.213436}, + {-0.582665, 0.437274, -0.166569, 0.664491}, + {0.73719, 0.28539, -0.598939, 0.127968}, + {0.476506, 0.411229, -0.600336, 0.493386}, + {-0.144859, -0.77094, -0.0684603, -0.616425}, + {0.211188, -0.886245, -0.155185, -0.381953}, + {0.293755, 0.725368, -0.336643, 0.523661}, + {0.333981, 0.802013, -0.378939, -0.318805}, + {-0.0847942, 0.557028, -0.415693, 0.713953}, + {-0.480506, -0.217267, -0.72165, 0.448475}, + {0.138476, -0.562358, -0.804054, 0.134448}, + {0.326335, -0.379109, 0.227467, -0.835488}, + {0.347074, 0.576619, 0.588744, -0.447695}, + {-0.582098, -0.632204, 0.509717, -0.0408605}, + {0.17048, -0.816078, -0.534754, -0.137812}, + {0.236625, 0.91684, 0.282418, -0.153799}, + {0.09755, 0.347047, 0.33001, -0.872431}, + {0.282442, -0.774077, 0.558413, 0.0959496}, + {0.605938, 0.679424, 0.380906, -0.161656}, + {0.607551, 0.508538, -0.269046, -0.547618}, + {-0.674865, 0.645797, 0.0633188, 0.351418}, + {0.686316, 0.592474, -0.401118, -0.130572}, + {0.824402, -0.536749, -0.13702, 0.116129}, + {0.664881, 0.206143, -0.242747, 0.675657}, + {0.121442, 0.539656, 0.773081, 0.310434}, + {-0.259371, -0.91246, -0.131031, 0.288053}, + {-0.479147, -0.473136, 0.0407929, 0.738171}, + {-0.988997, -0.118559, 0.0869354, -0.0164336}, + {0.654787, -0.156903, 0.0152464, 0.739191}, + {-0.178412, 0.398846, -0.714787, -0.54605}, + {-0.553813, 0.187505, 0.589564, 0.557268}, + {0.60236, 0.307484, -0.633372, -0.376108}, + {0.162858, -0.633189, 0.401326, 0.641472}, + {0.404143, -0.137226, 0.816029, 0.389787}, + {0.494529, 0.152378, -0.431805, -0.73876}, + {0.864593, -0.40003, 0.158965, -0.2592}, + {-0.16913, -0.784426, 0.589029, -0.0954786}, + {0.492717, 0.292249, 0.715538, 0.399782}, + {-0.153812, 0.313327, 0.599478, 0.720273}, + {-0.7547, 0.242425, 0.191, 0.578945}, + {0.062637, -0.0843262, 0.0788559, -0.991336}, + {-0.669503, 0.136757, -0.526071, 0.506273}, + {0.47891, -0.514986, 0.583609, 0.405999}, + {-0.657984, 0.000454589, -0.138546, 0.740177}, + {0.210304, -0.313976, -0.509264, -0.773202}, + {-0.769058, -0.5088, -0.195983, -0.333562}, + {0.266989, 0.264362, -0.107222, -0.920507}, + {-0.939282, 0.237949, -0.0730232, -0.236213}, + {0.752746, -0.461731, -0.411838, -0.224874}, + {-0.6754, 0.356672, 0.607108, -0.219181}, + {0.547087, -0.797894, -0.229937, -0.105783}, + {0.16953, -0.586082, 0.753246, -0.245741}, + {-0.281731, -0.0694107, 0.912762, 0.287533}, + {0.118704, 0.111371, -0.675153, -0.719496}, + {-0.288969, 0.425292, -0.847561, -0.131391}, + {-0.125155, -0.765708, 0.526488, 0.347617}, + {-0.297342, -0.1225, -0.0152089, 0.946758}, + {-0.783263, 0.450131, -0.321386, 0.283888}, + {-0.296458, 0.500393, 0.371153, -0.723854}, + {0.518157, -0.52786, 0.525683, -0.42016}, + {-0.110051, -0.470855, 0.159525, -0.86066}, + {-0.683128, -0.613667, -0.0893266, 0.385708}, + {-0.407913, 0.0819627, -0.561403, -0.715344}, + {-0.753685, -0.650154, 0.0946762, -0.0172123}, + {-0.0939369, 0.736528, -0.425184, -0.517611}, + {0.103569, 0.9843, -0.0230777, 0.141048}, + {0.127728, -0.513648, 0.555166, -0.641593}, + {0.434096, -0.469744, -0.745669, -0.186756}, + {-0.0425633, -0.12077, -0.923236, 0.362269}, + {0.47616, 0.77633, 0.0392142, -0.411152}, + {-0.177387, -0.763558, 0.13944, 0.605036}, + {-0.347184, 0.604497, 0.713482, -0.070643}, + {0.00423816, 0.0210573, 0.311046, 0.950152}, + {-0.0738423, 0.920237, -0.370337, -0.102767}, + {-0.739379, 0.626192, -0.219025, -0.115026}, + {0.3966, 0.564479, 0.423247, 0.58731}, + {0.207686, 0.293048, -0.883543, -0.300569}}; + +#endif diff --git a/Engine/PyExprUtils.cpp b/Engine/PyExprUtils.cpp new file mode 100644 index 0000000000..61e5d7336e --- /dev/null +++ b/Engine/PyExprUtils.cpp @@ -0,0 +1,365 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * This file is part of Natron , + * Copyright (C) 2016 INRIA and Alexandre Gauthier-Foichat + * + * Natron is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Natron is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Natron. If not, see + * ***** END LICENSE BLOCK ***** */ + +// ***** BEGIN PYTHON BLOCK ***** +// from : +// "Since Python may define some pre-processor definitions which affect the standard headers on some systems, you must include Python.h before any standard headers are included." +#include +// ***** END PYTHON BLOCK ***** + + +#include "PyExprUtils.h" + +#include +#include + +#include "Global/GlobalDefines.h" +#include "Engine/Noise.h" + +NATRON_NAMESPACE_ENTER +NATRON_PYTHON_NAMESPACE_ENTER + +double +ExprUtils::linearstep(double x, double a, double b) { + if (a < b) { + return x < a ? 0 : (x > b ? 1 : (x - a) / (b - a)); + } else if (a > b) { + return 1 - (x < b ? 0 : (x > a ? 1 : (x - b) / (a - b))); + } + return boxstep(x, a); +} + +double +ExprUtils::smoothstep(double x, double a, double b) { + if (a < b) { + if (x < a) return 0; + if (x >= b) return 1; + x = (x - a) / (b - a); + } else if (a > b) { + if (x <= b) return 1; + if (x > a) return 0; + x = 1 - (x - b) / (a - b); + } else + return boxstep(x, a); + return x * x * (3 - 2 * x); +} + +double +ExprUtils::gaussstep(double x, double a, double b) { + if (a < b) { + if (x < a) return 0; + if (x >= b) return 1; + x = 1 - (x - a) / (b - a); + } else if (a > b) { + if (x <= b) return 1; + if (x > a) return 0; + x = (x - b) / (a - b); + } else + return boxstep(x, a); + return pow(2, -8 * x * x); +} + +double +ExprUtils::remap(double x, double source, double range, double falloff, double interp) { + range = fabs(range); + falloff = fabs(falloff); + + if (falloff == 0) return fabs(x - source) < range; + + double a, b; + if (x > source) { + a = source + range; + b = a + falloff; + } else { + a = source - range; + b = a - falloff; + } + + switch (int(interp)) { + case 0: + return linearstep(x, b, a); + case 1: + return smoothstep(x, b, a); + default: + return gaussstep(x, b, a); + } +} + +double +ExprUtils::hash(const std::vector& args) +{ + // combine args into a single seed + U32 seed = 0; + for (int i = 0; i < (int)args.size(); i++) { + // make irrational to generate fraction and combine xor into 32 bits + int exp = 0; + double frac = frexp(args[i] * double(M_E * M_PI), &exp); + U32 s = (U32)(frac * UINT32_MAX) ^ (U32)exp; + + // blend with seed (constants from Numerical Recipes, attrib. from Knuth) + static const U32 M = 1664525, C = 1013904223; + seed = seed * M + s + C; + } + + // tempering (from Matsumoto) + seed ^= (seed >> 11); + seed ^= (seed << 7) & 0x9d2c5680UL; + seed ^= (seed << 15) & 0xefc60000UL; + seed ^= (seed >> 18); + + // permute + static unsigned char p[256] = { + 148, 201, 203, 34, 85, 225, 163, 200, 174, 137, 51, 24, 19, 252, 107, 173, 110, 251, 149, 69, 180, 152, + 141, 132, 22, 20, 147, 219, 37, 46, 154, 114, 59, 49, 155, 161, 239, 77, 47, 10, 70, 227, 53, 235, + 30, 188, 143, 73, 88, 193, 214, 194, 18, 120, 176, 36, 212, 84, 211, 142, 167, 57, 153, 71, 159, 151, + 126, 115, 229, 124, 172, 101, 79, 183, 32, 38, 68, 11, 67, 109, 221, 3, 4, 61, 122, 94, 72, 117, + 12, 240, 199, 76, 118, 5, 48, 197, 128, 62, 119, 89, 14, 45, 226, 195, 80, 50, 40, 192, 60, 65, + 166, 106, 90, 215, 213, 232, 250, 207, 104, 52, 182, 29, 157, 103, 242, 97, 111, 17, 8, 175, 254, 108, + 208, 224, 191, 112, 105, 187, 43, 56, 185, 243, 196, 156, 246, 249, 184, 7, 135, 6, 158, 82, 130, 234, + 206, 255, 160, 236, 171, 230, 42, 98, 54, 74, 209, 205, 33, 177, 15, 138, 178, 44, 116, 96, 140, 253, + 233, 125, 21, 133, 136, 86, 245, 58, 23, 1, 75, 165, 92, 217, 39, 0, 218, 91, 179, 55, 238, 170, + 134, 83, 25, 189, 216, 100, 129, 150, 241, 210, 123, 99, 2, 164, 16, 220, 121, 139, 168, 64, 190, 9, + 31, 228, 95, 247, 244, 81, 102, 145, 204, 146, 26, 87, 113, 198, 181, 127, 237, 169, 28, 93, 27, 41, + 231, 248, 78, 162, 13, 186, 63, 66, 131, 202, 35, 144, 222, 223}; + union { + uint32_t i; + unsigned char c[4]; + } u1, u2; + u1.i = seed; + u2.c[3] = p[u1.c[0]]; + u2.c[2] = p[(u1.c[1] + u2.c[3]) & 0xff]; + u2.c[1] = p[(u1.c[2] + u2.c[2]) & 0xff]; + u2.c[0] = p[(u1.c[3] + u2.c[1]) & 0xff]; + + // scale to [0.0 .. 1.0] + return u2.i * (1.0 / UINT32_MAX); +} + +double +ExprUtils::noise(double x) +{ + double ret; + Noise<1, 1>(&x, &ret); + return ret; +} + +double +ExprUtils::noise(const Double2DTuple& p) +{ + double ret; + Noise<2, 1>((const double*)&p.x, &ret); + return ret; +} + +double +ExprUtils::noise(const Double3DTuple& p) +{ + double ret; + Noise<3, 1>((const double*)&p.x, &ret); + return ret; +} + +double +ExprUtils::noise(const ColorTuple& p) +{ + double ret; + Noise<4, 1>((const double*)&p.r, &ret); + return ret; +} + + +double +ExprUtils::snoise(const Double3DTuple& p) +{ + double result; + Noise<3, 1>((const double*)&p.x, &result); + return result; + +} + +Double3DTuple +ExprUtils::vnoise(const Double3DTuple& p) +{ + Double3DTuple result; + Noise<3, 3>((const double*)&p.x, (double*)&result.x); + return result; + +} + +Double3DTuple +ExprUtils::cnoise(const Double3DTuple& p) +{ + Double3DTuple ret; + Noise<3, 3>((const double*)&p.x, (double*)&ret.x); + ret.x = p.x * 0.5 + 0.5; + ret.y = p.y * 0.5 + 0.5; + ret.z = p.z * 0.5 + 0.5; + return ret; +} + +double +ExprUtils::snoise4(const ColorTuple& p) +{ + double result; + Noise<4, 1>((const double*)&p.r, &result); + return result; +} + +Double3DTuple +ExprUtils::vnoise4(const ColorTuple& p) +{ + Double3DTuple result; + Noise<4, 3>((const double*)&p.r, (double*)&result.x); + return result; +} + +Double3DTuple +ExprUtils::cnoise4(const ColorTuple& p) +{ + Double3DTuple result; + Noise<4, 3>((const double*)&p.r, (double*)&result.x); + result.x = result.x * 0.5 + 0.5; + result.y = result.y * 0.5 + 0.5; + result.z = result.z * 0.5 + 0.5; + return result; +} + +double +ExprUtils::turbulence(const Double3DTuple& p, int octaves, double lacunarity, double gain) +{ + octaves = std::min(std::max(octaves, 1), 8); + double result = 0; + FBM<3, 1, true>((const double*)&p.x, &result, octaves, lacunarity, gain); + return .5 * result + .5; +} + +Double3DTuple +ExprUtils::vturbulence(const Double3DTuple& p, int octaves, double lacunarity, double gain) +{ + octaves = std::min(std::max(octaves, 1), 8); + Double3DTuple result; + FBM<3, 3, true>((const double*)&p.x, (double*)&result.x, octaves, lacunarity, gain); + return result; + +} + +Double3DTuple +ExprUtils::cturbulence(const Double3DTuple& p, int octaves, double lacunarity, double gain) +{ + octaves = std::min(std::max(octaves, 1), 8); + Double3DTuple result; + FBM<3, 3, true>((const double*)&p.x, (double*)&result.x, octaves, lacunarity, gain); + result.x = result.x * 0.5 + 0.5; + result.y = result.y * 0.5 + 0.5; + result.z = result.z * 0.5 + 0.5; + return result; +} + +double +ExprUtils::fbm(const Double3DTuple& p, int octaves, double lacunarity, double gain) +{ + octaves = std::min(std::max(octaves, 1), 8); + double result = 0.0; + FBM<3, 1, false>((const double*)&p.x, &result, octaves, lacunarity, gain); + return .5 * result + .5; + +} + +Double3DTuple +ExprUtils::vfbm(const Double3DTuple& p, int octaves, double lacunarity, double gain) +{ + octaves = std::min(std::max(octaves, 1), 8); + Double3DTuple result; + FBM<3, 3, false>((const double*)&p.x, (double*)&result.x, octaves, lacunarity, gain); + return result; +} + +double +ExprUtils::fbm4(const ColorTuple& p, int octaves, double lacunarity, double gain) +{ + octaves = std::min(std::max(octaves, 1), 8); + double result = 0.0; + FBM<4, 1, false>((const double*)&p.r, &result, octaves, lacunarity, gain); + return .5 * result + .5; +} + +Double3DTuple +ExprUtils::vfbm4(const ColorTuple& p, int octaves, double lacunarity, double gain) +{ + octaves = std::min(std::max(octaves, 1), 8); + Double3DTuple result; + FBM<4, 3, false>((const double*)&p.r, (double*)&result.x, octaves, lacunarity, gain); + return result; +} + +Double3DTuple +ExprUtils::cfbm(const Double3DTuple& p, int octaves, double lacunarity, double gain) +{ + octaves = std::min(std::max(octaves, 1), 8); + Double3DTuple result; + FBM<3, 3, false>((const double*)&p.x, (double*)&result.x, octaves, lacunarity, gain); + result.x = result.x * 0.5 + 0.5; + result.y = result.y * 0.5 + 0.5; + result.z = result.z * 0.5 + 0.5; + return result; + +} + +Double3DTuple +ExprUtils::cfbm4(const ColorTuple& p, int octaves, double lacunarity, double gain) +{ + octaves = std::min(std::max(octaves, 1), 8); + Double3DTuple result; + FBM<4, 3, false>((const double*)&p.r, (double*)&result.x, octaves, lacunarity, gain); + result.x = result.x * 0.5 + 0.5; + result.y = result.y * 0.5 + 0.5; + result.z = result.z * 0.5 + 0.5; + return result; + +} + +double +ExprUtils::cellnoise(const Double3DTuple& p) +{ + double result; + CellNoise<3, 1>((const double*)&p.x, &result); + return result; +} + +Double3DTuple +ExprUtils::ccellnoise(const Double3DTuple& p) +{ + Double3DTuple result; + CellNoise<3, 1>((const double*)&p.x, (double*)&result.x); + return result; +} + +double +ExprUtils::pnoise(const Double3DTuple& p, const Double3DTuple& period) +{ + double result; + int pargs[3] = {std::max(1,(int)period.x), + std::max(1,(int)period.y), + std::max(1,(int)period.z)}; + PNoise<3, 1>((const double*)&p.x, pargs, &result); + return result; + +} + +NATRON_PYTHON_NAMESPACE_EXIT +NATRON_NAMESPACE_EXIT \ No newline at end of file diff --git a/Engine/PyExprUtils.h b/Engine/PyExprUtils.h new file mode 100644 index 0000000000..b9423a8c92 --- /dev/null +++ b/Engine/PyExprUtils.h @@ -0,0 +1,128 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * This file is part of Natron , + * Copyright (C) 2016 INRIA and Alexandre Gauthier-Foichat + * + * Natron is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Natron is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Natron. If not, see + * ***** END LICENSE BLOCK ***** */ + +#ifndef PYNOISE_H +#define PYNOISE_H + +// ***** BEGIN PYTHON BLOCK ***** +// from : +// "Since Python may define some pre-processor definitions which affect the standard headers on some systems, you must include Python.h before any standard headers are included." +#include +// ***** END PYTHON BLOCK ***** + +#include + +#include "Global/Macros.h" + +#include "Engine/PyParameter.h" + +NATRON_NAMESPACE_ENTER; +NATRON_PYTHON_NAMESPACE_ENTER; + + +class ExprUtils +{ +public: + + ExprUtils() + { + + } + + // if x < a then 0 otherwise 1 + static double boxstep(double x, double a) { return x < a ? 0.0 : 1.0; } + + // Transitions linearly when a < x < b + static double linearstep(double x, double a, double b); + + // Transitions smoothly (cubic) when a < x < b + static double smoothstep(double x, double a, double b); + + // Transitions smoothly (exponentially) when a < x < b + static double gaussstep(double x, double a, double b); + + // General remapping function. + // When x is within +/- range of source, the result is one. + // The result falls to zero beyond that range over falloff distance. + // The falloff shape is controlled by interp. + // linear = 0 + // smooth = 1 + // gaussian = 2 + static double remap(double x, double source, double range, double falloff, double interp); + + // Linear interpolation of a and b according to alpha + static double mix(double x, double y, double alpha) { return x * (1 - alpha) + y * alpha; } + + // Like rand, but with no internal seeds. Any number of seeds may be given + // and the result will be a random function based on all the seeds. + static double hash(const std::vector& args); + + // Original perlin noise at location (C2 interpolant) + static double noise(double x); + static double noise(const Double2DTuple& p); + static double noise(const Double3DTuple& p); + static double noise(const ColorTuple& p); + + // signed noise w/ range -1 to 1 formed with original perlin noise at location (C2 interpolant) + double snoise(const Double3DTuple& p); + + // vector noise formed with original perlin noise at location (C2 interpolant) + static Double3DTuple vnoise(const Double3DTuple& p); + + // color noise formed with original perlin noise at location (C2 interpolant) + static Double3DTuple cnoise(const Double3DTuple& p); + + // 4D signed noise w/ range -1 to 1 formed with original perlin noise at location (C2 interpolant) + static double snoise4(const ColorTuple& p); + + // 4D vector noise formed with original perlin noise at location (C2 interpolant) + static Double3DTuple vnoise4(const ColorTuple& p); + + // 4D color noise formed with original perlin noise at location (C2 interpolant)" + static Double3DTuple cnoise4(const ColorTuple& p); + + // fbm (Fractal Brownian Motion) is a multi-frequency noise function. + // The base frequency is the same as the noise function. The total + // number of frequencies is controlled by octaves. The lacunarity is the + // spacing between the frequencies - a value of 2 means each octave is + // twice the previous frequency. The gain controls how much each + // frequency is scaled relative to the previous frequency. + static double turbulence(const Double3DTuple& p, int octaves = 6, double lacunarity = 2., double gain = 0.5); + static Double3DTuple vturbulence(const Double3DTuple& p, int octaves = 6, double lacunarity = 2., double gain = 0.5); + static Double3DTuple cturbulence(const Double3DTuple& p, int octaves = 6, double lacunarity = 2., double gain = 0.5); + static double fbm(const Double3DTuple& p, int octaves = 6, double lacunarity = 2., double gain = 0.5); + static Double3DTuple vfbm(const Double3DTuple& p, int octaves = 6, double lacunarity = 2., double gain = 0.5); + static double fbm4(const ColorTuple& p, int octaves = 6, double lacunarity = 2., double gain = 0.5); + static Double3DTuple vfbm4(const ColorTuple& p, int octaves = 6, double lacunarity = 2., double gain = 0.5); + static Double3DTuple cfbm(const Double3DTuple& p, int octaves = 6, double lacunarity = 2., double gain = 0.5); + static Double3DTuple cfbm4(const ColorTuple& p, int octaves = 6, double lacunarity = 2., double gain = 0.5); + + // cellnoise generates a field of constant colored cubes based on the integer location + // This is the same as the prman cellnoise function + static double cellnoise(const Double3DTuple& p); + static Double3DTuple ccellnoise(const Double3DTuple& p); + + // periodic noise + static double pnoise(const Double3DTuple& p, const Double3DTuple& period); +}; + +NATRON_PYTHON_NAMESPACE_EXIT; +NATRON_NAMESPACE_EXIT; + + +#endif // PYNOISE_H diff --git a/Engine/Pyside_Engine_Python.h b/Engine/Pyside_Engine_Python.h index e55be6df89..478a188b46 100644 --- a/Engine/Pyside_Engine_Python.h +++ b/Engine/Pyside_Engine_Python.h @@ -42,6 +42,7 @@ #include //Engine +#include "PyExprUtils.h" #include "MergingEnum.h" #include "PyGlobalFunctions.h" #include "PyNodeGroup.h" diff --git a/Engine/typesystem_engine.xml b/Engine/typesystem_engine.xml index 25b42e780d..972c6bedba 100644 --- a/Engine/typesystem_engine.xml +++ b/Engine/typesystem_engine.xml @@ -269,7 +269,9 @@ - + + + diff --git a/Gui/Pyside_Gui_Python.h b/Gui/Pyside_Gui_Python.h index c4c2ba77c2..74688b3e44 100644 --- a/Gui/Pyside_Gui_Python.h +++ b/Gui/Pyside_Gui_Python.h @@ -38,6 +38,7 @@ #include //Engine +#include "PyExprUtils.h" #include "MergingEnum.h" #include "PyGlobalFunctions.h" #include "PyNodeGroup.h"