Skip to content

Commit

Permalink
Fix Box rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Jun 8, 2020
1 parent f01018d commit 7964022
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions holoviews/element/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,13 @@ def __init__(self, x, y, spec, **params):

half_width = (self.width * self.aspect)/ 2.0
half_height = self.height / 2.0
(l,b,r,t) = (x-half_width, y-half_height, x+half_width, y+half_height)

(l,b,r,t) = (-half_width, -half_height, half_width, half_height)
box = np.array([(l, b), (l, t), (r, t), (r, b),(l, b)])
rot = np.array([[np.cos(self.orientation), -np.sin(self.orientation)],
[np.sin(self.orientation), np.cos(self.orientation)]])

self.data = [np.tensordot(rot, box.T, axes=[1,0]).T]
xs, ys = np.tensordot(rot, box.T, axes=[1,0])
self.data = [np.column_stack([xs+x, ys+y])]


class Ellipse(BaseShape):
Expand Down

0 comments on commit 7964022

Please sign in to comment.