How to use the vector.Frame.Frames function in vector

To help you get started, we’ve selected a few vector 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 otherlab / geode / vector / Frame.py View on Github external
def identity(d):
  return Frames(zeros(d),Rotation.identity(d))
github otherlab / geode / vector / Frame.py View on Github external
def __eq__(self,x):
        assert isinstance(x,Frames)
        return all(self.reals()==x.reals(),axis=-1)
github otherlab / geode / vector / Frame.py View on Github external
def __mul__(self,x):
        if isinstance(x,Frames):
            return Frames(self.t+self.r*x.t,self.r*x.r)
        return self.t+self.r*x
github otherlab / geode / vector / Frame.py View on Github external
def from_reals(x):
  x = asarray(x)
  d = size_to_d[x.shape[-1]]
  return x.ravel().view(Frames.dtypes[d]).view(Frames).reshape(x.shape[:-1])
github otherlab / geode / vector / Frame.py View on Github external
interp = frame_interpolation_2d if f1.d==2 else frame_interpolation_3d
  if f1.shape!=f2.shape:
    b = broadcast(f1,f2)
    new_f = [empty(b.shape,dtype=f1.dtype).view(Frames) for _ in xrange(2)]
    new_f[0][:] = f1
    new_f[1][:] = f2
    f1,f2 = new_f
  return interp(f1.ravel(),f2.ravel(),s).reshape(f1.shape)

size_to_d = {4:2,7:3}
def from_reals(x):
  x = asarray(x)
  d = size_to_d[x.shape[-1]]
  return x.ravel().view(Frames.dtypes[d]).view(Frames).reshape(x.shape[:-1])

other_core._set_frame_type(Frames)
github otherlab / geode / vector / Frame.py View on Github external
def interpolation(f1,f2,s):
  interp = frame_interpolation_2d if f1.d==2 else frame_interpolation_3d
  if f1.shape!=f2.shape:
    b = broadcast(f1,f2)
    new_f = [empty(b.shape,dtype=f1.dtype).view(Frames) for _ in xrange(2)]
    new_f[0][:] = f1
    new_f[1][:] = f2
    f1,f2 = new_f
  return interp(f1.ravel(),f2.ravel(),s).reshape(f1.shape)
github otherlab / geode / vector / Frame.py View on Github external
def inverse(self):
      ri = self.r.inverse()
      return Frames(ri*-self.t,ri)