MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _get_vector

Method _get_vector

lib/mpl_toolkits/mplot3d/art3d.py:1338–1367  ·  view source on GitHub ↗

Optimize points for projection. Parameters ---------- segments3d : NumPy array or list of NumPy arrays List of vertices of the boundary of every segment. If all paths are of equal length and this argument is a NumPy array, then it should

(self, segments3d)

Source from the content-addressed store, hash-verified

1336 return self._get_vector(segments3d)
1337
1338 def _get_vector(self, segments3d):
1339 """
1340 Optimize points for projection.
1341
1342 Parameters
1343 ----------
1344 segments3d : NumPy array or list of NumPy arrays
1345 List of vertices of the boundary of every segment. If all paths are
1346 of equal length and this argument is a NumPy array, then it should
1347 be of shape (num_faces, num_vertices, 3).
1348 """
1349 if isinstance(segments3d, np.ndarray):
1350 _api.check_shape((None, None, 3), segments3d=segments3d)
1351 if isinstance(segments3d, np.ma.MaskedArray):
1352 self._faces = segments3d.data
1353 self._invalid_vertices = segments3d.mask.any(axis=-1)
1354 else:
1355 self._faces = segments3d
1356 self._invalid_vertices = False
1357 else:
1358 # Turn the potentially ragged list into a numpy array for later speedups
1359 # If it is ragged, set the unused vertices per face as invalid
1360 num_faces = len(segments3d)
1361 num_verts = np.fromiter(map(len, segments3d), dtype=np.intp)
1362 max_verts = num_verts.max(initial=0)
1363 segments = np.empty((num_faces, max_verts, 3))
1364 for i, face in enumerate(segments3d):
1365 segments[i, :len(face)] = face
1366 self._faces = segments
1367 self._invalid_vertices = np.arange(max_verts) >= num_verts[:, None]
1368
1369 def set_verts(self, verts, closed=True):
1370 """

Callers 2

get_vectorMethod · 0.95
set_vertsMethod · 0.95

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected