Skip to content
This repository has been archived by the owner on Jan 9, 2020. It is now read-only.

Commit

Permalink
Bug Fix regarding the comparison between two Points objects
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelotrevisani committed Nov 8, 2017
1 parent a50ebd5 commit 4fbe706
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def test_create_points(vtk_points, np_points):
assert points == vtk_points
assert points == np_points

def test_compare_points(points, np_points):
points2 = Points(np_points)
assert points == points2

def test_xyz_points(points, np_points):
assert np.array_equal(points.x, np_points[:, 0])
assert np.array_equal(points.y, np_points[:, 1])
Expand Down Expand Up @@ -127,4 +131,4 @@ def test_div(points, np_points):
assert points == np_points
assert points.GetPoint(0) == (.0, .1, .2)
assert points.GetPoint(1) == (.1, .2, .3)
assert points.GetPoint(2) == (.2, .3, .4)
assert points.GetPoint(2) == (.2, .3, .4)
2 changes: 2 additions & 0 deletions vtky/Points.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def __init__(self, array, array_name='Points'):
def __eq__(self, other):
if isinstance(other, vtk.vtkPoints):
return self._base_array == other.GetData()
if isinstance(other, Points):
return self._base_array == other.xyz
return self._base_array == other

def _do_operation(self, other, operation):
Expand Down

0 comments on commit 4fbe706

Please sign in to comment.