Skip to content

Commit

Permalink
FIX: Ensure contiguous inputs to points_in_polygon (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwiggins committed Jul 12, 2018
1 parent 0bfc04a commit 6915dce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion chaco/polygon_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def hittest(self, screen_pt, threshold=7.0, return_distance=False):
data_pt = self.map_data(screen_pt, all_values=True)
index = self.index.get_data()
value = self.value.get_data()
poly = np.vstack((index,value)).T
poly = np.column_stack((index, value))
if points_in_polygon([data_pt], poly)[0] == 1:
return True
else:
Expand Down
7 changes: 3 additions & 4 deletions chaco/tools/lasso_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
# Major library imports
import numpy
from numpy import array, empty, sometrue, vstack, zeros, ascontiguousarray
from numpy import array, column_stack, empty, sometrue, vstack, zeros

# Enthought library imports
from traits.api import Any, Array, Enum, Event, Bool, Instance, \
Expand Down Expand Up @@ -308,9 +308,8 @@ def _map_data(self, point):
def _get_data(self):
""" Returns the datapoints in the plot, as an Nx2 array of (x,y).
"""
points = array((self.plot.index.get_data(),
self.plot.value.get_data()))
return ascontiguousarray(points.T)
return column_stack((self.plot.index.get_data(),
self.plot.value.get_data()))

#------------------------------------------------------------------------
# Property getter/setters
Expand Down

0 comments on commit 6915dce

Please sign in to comment.