def spline_iterator():
    from modules.sandSpline import SandSpline

    splines = []
    for _ in range(5):  # number of circles
        guide = f(0.5, 0.5)  # centre
        pnum = randint(DISTORTLOW, DISTORTHIGH)  #weighted equally
        pnum = math.floor(
            abs(random() - random()) * (1 + DISTORTHIGH - DISTORTLOW) +
            DISTORTLOW)  #weighted to low end

        a = random() * TWOPI + linspace(0, TWOPI, pnum)
        # a = linspace(0, TWOPI, pnum)

        modifier = (
            (random() * (RANDEND - RANDSTART)) + RANDSTART)  #path radius
        path = column_stack((cos(a), sin(a))) * modifier

        scale = arange(pnum).astype('float') * STP

        s = SandSpline(guide, path, INUM, scale)
        splines.append(s)

    itt = 0
    while True:
        for w, s in enumerate(splines):
            xy = next(s)
            itt += 1
            yield itt, w, xy
Exemple #2
0
def spline_iterator():
  from modules.sandSpline import SandSpline

  splines = []
  for x in linspace(EDGE, 1.0-EDGE, GRID_X):
    for y in linspace(EDGE, 1.0-EDGE, GRID_Y):
      guide = f(x,y)
      pnum = randint(10,150)

      a = random()*TWOPI + linspace(0, TWOPI, pnum)
      path = column_stack((cos(a), sin(a))) * LEAP_Y

      scale = arange(pnum).astype('float')*STP

      s = SandSpline(
          guide,
          path,
          INUM,
          scale
          )
      splines.append(s)

  itt = 0
  while True:
    for w, s in enumerate(splines):
      xy = next(s)
      itt += 1
      yield itt, w, xy
Exemple #3
0
    def __init__(self, n, back, front, params):
        Render.__init__(self, n, front, back)

        # scale down canvas so random drift doesn't get clipped
        self.scale(0.6)

        numSplines = params['numSplines']
        sectionCount = params['sectionCount']
        noiseScale = params['noiseScale']
        noiseDetail = params['noiseDetail']
        density = params['density']
        radius = params['radius']
        decayRadius = params['decayRadius']
        radiusDecay = params['radiusDecay']

        # computed
        self.alpha = n * 0.000005 * (1.0 + random() * 0.1)
        # self.alpha = n * 0.00003 * (1.0+random()*0.1)
        # if self.alpha < 0.05:
        # self.alpha = 0.08
        # if self.alpha < 0.03:
        self.alpha = 0.055

        print('===========')
        print("spline count: " + str(numSplines))
        print("section count: " + str(sectionCount))
        print("noise: " + str(noiseScale))
        print("detail: " + str(noiseDetail))
        print("alpha: " + str(self.alpha))
        print("radiusDecay: " + str(radiusDecay))

        # load up sampler
        self.sampler = self.get_colors_from_file('img/check.png')

        # create splines
        self.splines = []
        for i in range(numSplines):
            self.splines.append(
                SandSpline(sectionCount, radius, noiseScale, noiseDetail,
                           density))
            if decayRadius:
                radius -= radiusDecay
Exemple #4
0
def spline_iterator():
    from modules.sandSpline import SandSpline

    splines = []
    guide = f()

    pnum = randint(4, 100)
    px = zeros(pnum, 'float')
    py = linspace(EDGE, 1.0 - EDGE, pnum)
    path = column_stack([px, py])

    scale = arange(pnum).astype('float') * STP

    s = SandSpline(guide, path, INUM, scale)
    splines.append(s)

    itt = 0
    while True:
        for w, s in enumerate(splines):
            xy = next(s)
            itt += 1
            yield itt, w, xy
Exemple #5
0
def spline_iterator():
    from modules.sandSpline import SandSpline

    splines = []
    for _ in range(30):
        guide = f(0.5, 0.5)
        pnum = randint(15, 100)

        a = random() * TWOPI + linspace(0, TWOPI, pnum)
        # a = linspace(0, TWOPI, pnum)
        path = column_stack((cos(a), sin(a))) * (0.1 + random() * 0.4)

        scale = arange(pnum).astype('float') * STP

        s = SandSpline(guide, path, INUM, scale)
        splines.append(s)

    itt = 0
    while True:
        for w, s in enumerate(splines):
            xy = next(s)
            itt += 1
            yield itt, w, xy
Exemple #6
0
def spline_iterator():
    from modules.sandSpline import SandSpline

    splines = []
    for i, y in enumerate(linspace(EDGE, 1.0 - EDGE, GRID_Y)):
        pnum = 4 + i
        guide = f(0.5, y)

        ## hlines
        x = linspace(-1, 1.0, pnum) * (1.0 - 2 * EDGE) * 0.5
        y = zeros(pnum, 'float')
        path = column_stack([x, y])

        scale = arange(pnum).astype('float') * STP

        s = SandSpline(guide, path, INUM, scale)
        splines.append(s)

    itt = 0
    while True:
        for s in splines:
            xy = next(s)
            itt += 1
            yield itt, xy