Skip to content

Commit

Permalink
Merge pull request #87 from LemurPwned/feat/add-noise-pyis
Browse files Browse the repository at this point in the history
adding 1/f noise binding .pyis
  • Loading branch information
LemurPwned authored Dec 10, 2024
2 parents 13a504e + ea21ef3 commit ff146a2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
13 changes: 13 additions & 0 deletions cmtj/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,19 @@ class Layer:
"""
...

def createBufferedAlphaNoise(self, bufferSize: int) -> None:
"""Create a buffered alpha noise generator."""
...

def setAlphaNoise(self, alpha: float, std: float, scale: float, axis: Axis = Axis.all) -> None:
"""Set alpha noise for the layer.
:param alpha: Alpha parameter
:param std: Standard deviation
:param scale: Scale
:param axis: Axis, by default all axes are used
"""
...

def setAnisotropyDriver(self, driver: ScalarDriver) -> None:
"""Set anisotropy driver for the layer.
It's scalar. The axis is determined in the layer constructor"""
Expand Down
17 changes: 14 additions & 3 deletions cmtj/noise/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ class BufferedAlphaNoise:
def fillBuffer(self) -> None:
"""Fill the buffer with the noise. This method is called only once."""
...

def tick(self) -> float:
"""Produce the next sample of the noise."""
...
pass

class VectorAlphaNoise:
"""Create a vector alpha noise generator. Alpha can be in [0, 2]."""
Expand All @@ -22,15 +22,26 @@ class VectorAlphaNoise:
std: float,
scale: float,
axis: cmtj.Axis = cmtj.Axis.all,
) -> None: ...
) -> None:
"""Kasdin algorithm for vector alpha noise generation.
:param bufferSize: Buffer size
:param alpha: Alpha parameter
:param std: Standard deviation
:param scale: Scale
:param axis: Axis, by default all axes are used
"""
...

def getPrevSample(self) -> cmtj.CVector:
"""Get the previous sample of the noise in a vector form."""
...

def getScale(self) -> float:
"""Get the scale of the noise."""
...

def tick(self) -> float: ...
def tickVector(self) -> cmtj.CVector:
"""Get the next sample of the noise in a vector form."""
...
pass
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from setuptools import Extension, find_namespace_packages, setup
from setuptools.command.build_ext import build_ext

__version__ = "1.6.0"
__version__ = "1.6.1"
"""
As per
https://github.com/pybind/python_example
Expand Down

0 comments on commit ff146a2

Please sign in to comment.