How to use the desert.rnd.in_circle function in desert

To help you get started, we’ve selected a few desert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inconvergent / desert / examples / walker.py View on Github external
with Desert(imsize, verbose=VERBOSE)\
      .init(fg=black(0.1),
            bg=white()) as desert:

    num = 20

    xya = random((num, 2))
    xyb = random((num, 2))

    stacka = []
    stackb = []

    drift = in_circle(1, 0, 0, 0.00001)

    for i in range(1, 100000):
      xya += in_circle(num, 0, 0, 0.001) + drift
      xyb += in_circle(num, 0, 0, 0.001) + drift
      stacka.append(xya.copy())
      stackb.append(xyb.copy())

      if not i%10000:
        desert.draw([stroke(stacka, stackb, 0.01)]).show(0.01)
        stacka = []
        stackb = []

    desert.show(1).save(filename(arg))
github inconvergent / desert / examples / walker.py View on Github external
def main(arg):

  imsize = 1000
  with Desert(imsize, verbose=VERBOSE)\
      .init(fg=black(0.1),
            bg=white()) as desert:

    num = 20

    xya = random((num, 2))
    xyb = random((num, 2))

    stacka = []
    stackb = []

    drift = in_circle(1, 0, 0, 0.00001)

    for i in range(1, 100000):
      xya += in_circle(num, 0, 0, 0.001) + drift
      xyb += in_circle(num, 0, 0, 0.001) + drift
      stacka.append(xya.copy())
      stackb.append(xyb.copy())

      if not i%10000:
        desert.draw([stroke(stacka, stackb, 0.01)]).show(0.01)
        stacka = []
        stackb = []

    desert.show(1).save(filename(arg))
github inconvergent / desert / examples / walker.py View on Github external
.init(fg=black(0.1),
            bg=white()) as desert:

    num = 20

    xya = random((num, 2))
    xyb = random((num, 2))

    stacka = []
    stackb = []

    drift = in_circle(1, 0, 0, 0.00001)

    for i in range(1, 100000):
      xya += in_circle(num, 0, 0, 0.001) + drift
      xyb += in_circle(num, 0, 0, 0.001) + drift
      stacka.append(xya.copy())
      stackb.append(xyb.copy())

      if not i%10000:
        desert.draw([stroke(stacka, stackb, 0.01)]).show(0.01)
        stacka = []
        stackb = []

    desert.show(1).save(filename(arg))
github inconvergent / desert / examples / spline.py View on Github external
density = 0.15
    num = 20
    rad = 0.35

    noise = 0.00005
    spl = []

    for _ in range(20):
      a = sorted(random(num)*TWOPI)
      spl.append(0.5 + column_stack((cos(a), sin(a)))*rad)

    res = []
    for i in range(1, 4000000):
      for xy in spl:
        n = xy.shape[0]
        xy += in_circle(n, 0, 0, 1)*reshape(arange(n), (n, 1))*noise
        res.append(xy.copy())

      if not i%400:
        c.draw([bzspl(res, density, noise=0.001)]).show(gamma=1.5)
        res = []
      if not i%(400*20):
        c.save(filename(arg), gamma=1.5)