How to use the desert.primitives.basePrimitive.__init__ 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 / desert / primitives.py View on Github external
def __init__(self, s, mid, dens, noise=None):
    basePrimitive.__init__(self)

    try:
      sx, sy = s
    except TypeError:
      sx = s
      sy = s

    self.s = reshape([sx, sy], (1, 2)).astype(npfloat)
    self.mid = reshape(mid, (-1, 2)).astype(npfloat)
    self.dens = dens
    self.noise = noise

    self.num = self.mid.shape[0]

    self._s = None
    self._mid = None
github inconvergent / desert / desert / primitives.py View on Github external
def __init__(self, a, b, dens, noise=None):
    basePrimitive.__init__(self)

    a = reshape(a, (-1, 2)).astype(npfloat)
    b = reshape(b, (-1, 2)).astype(npfloat)

    assert a.shape[0] == b.shape[0], 'inconsistent number of points in a, b'

    self.ab = column_stack((a, b))

    self.num = self.ab.shape[0]
    self.dens = dens
    self.noise = noise

    self._ab = None
github inconvergent / desert / desert / primitives.py View on Github external
def __init__(self, pts, dens, closed=False, noise=None):
    basePrimitive.__init__(self)

    self.num = len(pts)

    # pts = reshape(pts, (-1, 2, self.num)).astype(npfloat)
    pts = dstack(pts).astype(npfloat)

    assert pts.shape[0] > 2, 'must have at least 3 points'

    self.pts = pts

    self.closed = closed
    self.dens = dens
    self.noise = noise

    ctrlpts = pts.shape[0]
github inconvergent / desert / desert / primitives.py View on Github external
def __init__(self, rad, mid, dens, noise=None):
    basePrimitive.__init__(self)
    self.rad = rad
    self.mid = reshape(mid, (-1, 2)).astype(npfloat)
    self.dens = dens
    self.noise = noise

    self.num = self.mid.shape[0]

    self._mid = None
    self._cuda_init = False