def rotate(self, theta): """ Theta in degrees. Problem is that rotating grid result in negative indicies in rr, cc. Therefore, don't want to do image[rr,cc]. Returns (2,N) indicies.""" newgrid = rotate(column_array(self.grid), theta, center=self.midpoint) logger.warn("Rotations will lead to astry indicies") return unzip_array(astype_rint(newgrid))
def _get_rr_cc(self): """ Rotate unrotated_rr_cc through theta """ theta = self.phi center = self.center[::-1] #Necessary if theta % 360.0 == 0.0: return self.unrotated_rr_cc # Rotate transposed rr_cc transposed = np.array(self.unrotated_rr_cc).T return rotate(transposed, center=center, theta=self.phi, rint='up').T
def as_patch(self, *args, **kwargs): """ Explictly rotate vertex coords for patch. """ rotated_coords = rotate(self.xymatrix, theta=self.phi, center=self.center) return mpatch.Polygon(rotated_coords, closed=True, **kwargs)