示例#1
0
 def bbox_ra(self):  # Cartesian box relative to ring center in (0,0)
     # NOTE: can be optimized -- as we already knew which dots influence which side
     pts = lrotate(self.points_ra(), -int(self.a / 90))
     r = self.limitAt(0, pts)
     t = self.limitAt(1, pts)
     l = self.limitAt(2, pts)
     b = self.limitAt(3, pts)
     pts = lrotate(self.points_ra(), -int((self.a + self.da) / 90))
     r = max(r, self.limitAt(0, pts))
     t = max(t, self.limitAt(1, pts))
     l = min(l, self.limitAt(2, pts))
     b = min(b, self.limitAt(3, pts))
     return [l, t, r - l, t - b]  # not mirrored, for inner use
示例#2
0
 def bbox_ra(self):  # Cartesian box relative to ring center in (0,0)
     # NOTE: can be optimized -- as we already knew which dots influence which side
     pts = lrotate(self.points_ra(), -int(self.a / 90))
     r = self.limitAt(0, pts)
     t = self.limitAt(1, pts)
     l = self.limitAt(2, pts)
     b = self.limitAt(3, pts)
     pts = lrotate(self.points_ra(), -int((self.a+self.da) / 90))
     r = max(r, self.limitAt(0, pts))
     t = max(t, self.limitAt(1, pts))
     l = min(l, self.limitAt(2, pts))
     b = min(b, self.limitAt(3, pts))
     return [l, t, r-l, t-b]  # not mirrored, for inner use
示例#3
0
 def test_sz(self):
     assert lrotate([], 1) == []
     assert lrotate([1], 1) == [1]
     assert lrotate([1], -1) == [1]
     assert lrotate([1], 3) == [1]
示例#4
0
 def test_wrap(self):
     assert lrotate([1, 2, 3], 3) == [1, 2, 3]
     assert lrotate([1, 2, 3], 7) == [2, 3, 1]
     assert lrotate([1, 2, 3], -4) == [3, 1, 2]
示例#5
0
 def test_in(self):
     assert lrotate([1, 2, 3], 0) == [1, 2, 3]
     assert lrotate([1, 2, 3], 1) == [2, 3, 1]
     assert lrotate([1, 2, 3], 2) == [3, 1, 2]