Example #1
0
 def __init__(self, freq=10, amp=10, oct=4, angle=radians(45), seed=-1):
     StrokeShader.__init__(self)
     self.noise = Noise(seed)
     self.freq = freq
     self.amp = amp
     self.oct = oct
     self.dir = Vector((cos(angle), sin(angle)))
Example #2
0
 def __init__(self, freq=10, amp=10, oct=4, angle=radians(45), seed=-1):
     StrokeShader.__init__(self)
     self.noise = Noise(seed)
     self.freq = freq
     self.amp = amp
     self.oct = oct
     self.dir = Vector((cos(angle), sin(angle)))
Example #3
0
class pyPerlinNoise1DShader(StrokeShader):
    """
    Displaces the stroke using the curvilinear abscissa.  This means
    that lines with the same length and sampling interval will be
    identically distorded.
    """
    def __init__(self, freq=10, amp=10, oct=4, seed=-1):
        StrokeShader.__init__(self)
        self.__noise = Noise(seed)
        self.__freq = freq
        self.__amp = amp
        self.__oct = oct

    def shade(self, stroke):
        for svert in stroke:
            s = svert.projected_x + svert.projected_y
            nres = self.__noise.turbulence1(s, self.__freq, self.__amp, self.__oct)
            svert.point = (svert.projected_x + nres, svert.projected_y + nres)
        stroke.update_length()
Example #4
0
class pyPerlinNoise1DShader(StrokeShader):
    """
    Displaces the stroke using the curvilinear abscissa.  This means
    that lines with the same length and sampling interval will be
    identically distorded.
    """
    def __init__(self, freq=10, amp=10, oct=4, seed=-1):
        StrokeShader.__init__(self)
        self.__noise = Noise(seed)
        self.__freq = freq
        self.__amp = amp
        self.__oct = oct

    def shade(self, stroke):
        for svert in stroke:
            s = svert.projected_x + svert.projected_y
            nres = self.__noise.turbulence1(s, self.__freq, self.__amp, self.__oct)
            svert.point = (svert.projected_x + nres, svert.projected_y + nres)
        stroke.update_length()
Example #5
0
class pyPerlinNoise2DShader(StrokeShader):
    """
    Displaces the stroke using the strokes coordinates.  This means
    that in a scene no strokes will be distorded identically.

    More information on the noise shaders can be found at:
    freestyleintegration.wordpress.com/2011/09/25/development-updates-on-september-25/
    """
    def __init__(self, freq=10, amp=10, oct=4, seed=-1):
        StrokeShader.__init__(self)
        self.__noise = Noise(seed)
        self.__freq = freq
        self.__amp = amp
        self.__oct = oct

    def shade(self, stroke):
        for svert in stroke:
            nres = self.__noise.turbulence2(svert.point_2d, self.__freq, self.__amp, self.__oct)
            svert.point = (svert.projected_x + nres, svert.projected_y + nres)
        stroke.update_length()
Example #6
0
class PerlinNoise1DShader(StrokeShader):
    """
    Displaces the stroke using the curvilinear abscissa.  This means
    that lines with the same length and sampling interval will be
    identically distorded.
    """
    def __init__(self, freq=10, amp=10, oct=4, angle=radians(45), seed=-1):
        StrokeShader.__init__(self)
        self.noise = Noise(seed)
        self.freq = freq
        self.amp = amp
        self.oct = oct
        self.dir = Vector((cos(angle), sin(angle)))

    def shade(self, stroke):
        length = stroke.length_2d
        for svert in stroke:
            nres = self.noise.turbulence1(length * svert.u, self.freq, self.amp, self.oct)
            svert.point += nres * self.dir
        stroke.update_length()
Example #7
0
class pyPerlinNoise2DShader(StrokeShader):
    """
    Displaces the stroke using the strokes coordinates.  This means
    that in a scene no strokes will be distorded identically.

    More information on the noise shaders can be found at:
    freestyleintegration.wordpress.com/2011/09/25/development-updates-on-september-25/
    """
    def __init__(self, freq=10, amp=10, oct=4, seed=-1):
        StrokeShader.__init__(self)
        self.__noise = Noise(seed)
        self.__freq = freq
        self.__amp = amp
        self.__oct = oct

    def shade(self, stroke):
        for svert in stroke:
            nres = self.__noise.turbulence2(svert.point_2d, self.__freq, self.__amp, self.__oct)
            svert.point = (svert.projected_x + nres, svert.projected_y + nres)
        stroke.update_length()
Example #8
0
class PerlinNoise1DShader(StrokeShader):
    """
    Displaces the stroke using the curvilinear abscissa.  This means
    that lines with the same length and sampling interval will be
    identically distorded.
    """
    def __init__(self, freq=10, amp=10, oct=4, angle=radians(45), seed=-1):
        StrokeShader.__init__(self)
        self.noise = Noise(seed)
        self.freq = freq
        self.amp = amp
        self.oct = oct
        self.dir = Vector((cos(angle), sin(angle)))

    def shade(self, stroke):
        length = stroke.length_2d
        for svert in stroke:
            nres = self.noise.turbulence1(length * svert.u, self.freq, self.amp, self.oct)
            svert.point += nres * self.dir
        stroke.update_length()
Example #9
0
class PerlinNoise2DShader(StrokeShader):
    """
    Displaces the stroke using the strokes coordinates.  This means
    that in a scene no strokes will be distorded identically.

    More information on the noise shaders can be found at:
    freestyleintegration.wordpress.com/2011/09/25/development-updates-on-september-25/
    """
    def __init__(self, freq=10, amp=10, oct=4, angle=radians(45), seed=-1):
        StrokeShader.__init__(self)
        self.noise = Noise(seed)
        self.freq = freq
        self.amp = amp
        self.oct = oct
        self.dir = Vector((cos(angle), sin(angle)))

    def shade(self, stroke):
        for svert in stroke:
            projected = Vector((svert.projected_x, svert.projected_y))
            nres = self.noise.turbulence2(projected, self.freq, self.amp, self.oct)
            svert.point += nres * self.dir
        stroke.update_length()
Example #10
0
class pyPerlinNoise1DShader(StrokeShader):
    """
    Displaces the stroke using the curvilinear abscissa.  This means
    that lines with the same length and sampling interval will be
    identically distorded
    """
    def __init__(self, freq=10, amp=10, oct=4, seed=-1):
        StrokeShader.__init__(self)
        self.__noise = Noise(seed)
        self.__freq = freq
        self.__amp = amp
        self.__oct = oct

    def shade(self, stroke):
        it = stroke.stroke_vertices_begin()
        while not it.is_end:
            v = it.object
            i = v.projected_x + v.projected_y
            nres = self.__noise.turbulence1(i, self.__freq, self.__amp, self.__oct)
            v.point = (v.projected_x + nres, v.projected_y + nres)
            it.increment()
        stroke.update_length()
Example #11
0
class pyPerlinNoise1DShader(StrokeShader):
    """
    Displaces the stroke using the curvilinear abscissa.  This means
    that lines with the same length and sampling interval will be
    identically distorded
    """
    def __init__(self, freq=10, amp=10, oct=4, seed=-1):
        StrokeShader.__init__(self)
        self.__noise = Noise(seed)
        self.__freq = freq
        self.__amp = amp
        self.__oct = oct

    def shade(self, stroke):
        it = stroke.stroke_vertices_begin()
        while not it.is_end:
            v = it.object
            i = v.projected_x + v.projected_y
            nres = self.__noise.turbulence1(i, self.__freq, self.__amp, self.__oct)
            v.point = (v.projected_x + nres, v.projected_y + nres)
            it.increment()
        stroke.update_length()
Example #12
0
class PerlinNoise2DShader(StrokeShader):
    """
    Displaces the stroke using the strokes coordinates.  This means
    that in a scene no strokes will be distorded identically.

    More information on the noise shaders can be found at:
    freestyleintegration.wordpress.com/2011/09/25/development-updates-on-september-25/
    """
    def __init__(self, freq=10, amp=10, oct=4, angle=radians(45), seed=-1):
        StrokeShader.__init__(self)
        self.noise = Noise(seed)
        self.freq = freq
        self.amp = amp
        self.oct = oct
        self.dir = Vector((cos(angle), sin(angle)))

    def shade(self, stroke):
        for svert in stroke:
            projected = Vector((svert.projected_x, svert.projected_y))
            nres = self.noise.turbulence2(projected, self.freq, self.amp, self.oct)
            svert.point += nres * self.dir
        stroke.update_length()
Example #13
0
 def __init__(self, freq=10, amp=10, oct=4, seed=-1):
     StrokeShader.__init__(self)
     self.__noise = Noise(seed)
     self.__freq = freq
     self.__amp = amp
     self.__oct = oct
Example #14
0
 def __init__(self, freq=10, amp=10, oct=4, seed=-1):
     StrokeShader.__init__(self)
     self.__noise = Noise(seed)
     self.__freq = freq
     self.__amp = amp
     self.__oct = oct