Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 27d1199

Browse filesBrowse files
committed
Revert 2c1bc6b for performance
1 parent e2549cd commit 27d1199
Copy full SHA for 27d1199

File tree

Expand file treeCollapse file tree

3 files changed

+10
-11
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+10
-11
lines changed

‎lib/matplotlib/tests/test_path.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_path.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def test_contains_points_negative_radius():
3939
expected = [True, False, False]
4040
result = path.contains_points(points, radius=-0.5)
4141

42-
assert result.dtype == np.bool
4342
assert np.all(result == expected)
4443

4544

‎src/_path.h

Copy file name to clipboardExpand all lines: src/_path.h
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ struct XY
7979
template <class PathIterator, class PointArray, class ResultArray>
8080
void point_in_path_impl(PointArray &points, PathIterator &path, ResultArray &inside_flag)
8181
{
82-
bool yflag1;
82+
uint8_t yflag1;
8383
double vtx0, vty0, vtx1, vty1;
8484
double tx, ty;
8585
double sx, sy;
@@ -89,13 +89,13 @@ void point_in_path_impl(PointArray &points, PathIterator &path, ResultArray &ins
8989

9090
size_t n = points.size();
9191

92-
std::vector<bool> yflag0(n);
93-
std::vector<bool> subpath_flag(n);
92+
std::vector<uint8_t> yflag0(n);
93+
std::vector<uint8_t> subpath_flag(n);
9494

9595
path.rewind(0);
9696

9797
for (i = 0; i < n; ++i) {
98-
inside_flag[i] = false;
98+
inside_flag[i] = 0;
9999
}
100100

101101
unsigned code = 0;
@@ -118,7 +118,7 @@ void point_in_path_impl(PointArray &points, PathIterator &path, ResultArray &ins
118118
// get test bit for above/below X axis
119119
yflag0[i] = (vty0 >= ty);
120120

121-
subpath_flag[i] = false;
121+
subpath_flag[i] = 0;
122122
}
123123
}
124124

@@ -164,7 +164,7 @@ void point_in_path_impl(PointArray &points, PathIterator &path, ResultArray &ins
164164
// Haigh-Hutchinson's different polygon inclusion
165165
// tests.
166166
if (((vty1 - ty) * (vtx0 - vtx1) >= (vtx1 - tx) * (vty0 - vty1)) == yflag1) {
167-
subpath_flag[i] = subpath_flag[i] ^ true;
167+
subpath_flag[i] ^= 1;
168168
}
169169
}
170170

@@ -196,8 +196,8 @@ void point_in_path_impl(PointArray &points, PathIterator &path, ResultArray &ins
196196
subpath_flag[i] = subpath_flag[i] ^ true;
197197
}
198198
}
199-
inside_flag[i] = inside_flag[i] || subpath_flag[i];
200-
if (inside_flag[i] == false) {
199+
inside_flag[i] |= subpath_flag[i];
200+
if (inside_flag[i] == 0) {
201201
all_done = false;
202202
}
203203
}

‎src/_path_wrapper.cpp

Copy file name to clipboardExpand all lines: src/_path_wrapper.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static PyObject *Py_points_in_path(PyObject *self, PyObject *args, PyObject *kwd
9393
}
9494

9595
npy_intp dims[] = { (npy_intp)points.size() };
96-
numpy::array_view<bool, 1> results(dims);
96+
numpy::array_view<uint8_t, 1> results(dims);
9797

9898
CALL_CPP("points_in_path", (points_in_path(points, r, path, trans, results)));
9999

@@ -152,7 +152,7 @@ static PyObject *Py_points_on_path(PyObject *self, PyObject *args, PyObject *kwd
152152
}
153153

154154
npy_intp dims[] = { (npy_intp)points.size() };
155-
numpy::array_view<bool, 1> results(dims);
155+
numpy::array_view<uint8_t, 1> results(dims);
156156

157157
CALL_CPP("points_on_path", (points_on_path(points, r, path, trans, results)));
158158

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.