Example #1
0
 def __new__(clas,coords=None,origin=None,axes=None):
     """Initialize the CoordinateSystem"""
     if coords is None:
         coords = np.eye(4,3)
         if axes is not None:
             coords[:3] = axes
         if origin is not None:
             coords += origin
     else:
         coords = at.checkArray(coords,(4,3),'f','i')
     coords = Coords.__new__(clas,coords)
     return coords
Example #2
0
 def __new__(clas,coords=None,origins=None,vectors=None):
     """Initialize the BoundVectors."""
     if coords is None:
         coords = eye(2,3,-1)
         if vectors is not None:
             coords = resize(coords,vectors.shape[:-1]+(2,3))
             coords[...,1,:] = vectors
         if origins is not None:
             coords += origins[...,newaxis,:]
     elif coords.shape[-2:] != (2,3):
         raise ValueError,"Expected shape (2,3) for last two array axes."
     return Coords.__new__(clas,coords)