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 c604096

Browse filesBrowse files
committed
Deprecate unused/undocumented functions
1 parent 99d39bd commit c604096
Copy full SHA for c604096

File tree

Expand file treeCollapse file tree

5 files changed

+45
-22
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+45
-22
lines changed

‎lib/mpl_toolkits/mplot3d/art3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/art3d.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def set_3d_properties(self, z=0, zdir='z'):
148148
@artist.allow_rasterization
149149
def draw(self, renderer):
150150
position3d = np.array((self._x, self._y, self._z))
151-
proj = proj3d.proj_trans_points(
151+
proj = proj3d._proj_trans_points(
152152
[position3d, position3d + self._dir_vec], self.axes.M)
153153
dx = proj[0][1] - proj[0][0]
154154
dy = proj[1][1] - proj[1][0]
@@ -359,7 +359,7 @@ def do_3d_projection(self):
359359
"""
360360
Project the points according to renderer matrix.
361361
"""
362-
xyslist = [proj3d.proj_trans_points(points, self.axes.M)
362+
xyslist = [proj3d._proj_trans_points(points, self.axes.M)
363363
for points in self._segments3d]
364364
segments_2d = [np.column_stack([xs, ys]) for xs, ys, zs in xyslist]
365365
LineCollection.set_segments(self, segments_2d)

‎lib/mpl_toolkits/mplot3d/axes3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/axes3d.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def _tunit_cube(self, vals=None, M=None):
249249
if M is None:
250250
M = self.M
251251
xyzs = self._unit_cube(vals)
252-
tcube = proj3d.proj_points(xyzs, M)
252+
tcube = proj3d._proj_points(xyzs, M)
253253
return tcube
254254

255255
@_api.deprecated("3.7")
@@ -918,15 +918,15 @@ def get_proj(self):
918918
if self._focal_length == np.inf:
919919
# Orthographic projection
920920
viewM = proj3d._view_transformation_uvw(u, v, w, eye)
921-
projM = proj3d.ortho_transformation(-self._dist, self._dist)
921+
projM = proj3d._ortho_transformation(-self._dist, self._dist)
922922
else:
923923
# Perspective projection
924924
# Scale the eye dist to compensate for the focal length zoom effect
925925
eye_focal = R + self._dist * ps * self._focal_length
926926
viewM = proj3d._view_transformation_uvw(u, v, w, eye_focal)
927-
projM = proj3d.persp_transformation(-self._dist,
928-
self._dist,
929-
self._focal_length)
927+
projM = proj3d._persp_transformation(-self._dist,
928+
self._dist,
929+
self._focal_length)
930930

931931
# Combine all the transformation matrices to get the final projection
932932
M0 = np.dot(viewM, worldM)

‎lib/mpl_toolkits/mplot3d/axis3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/axis3d.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ def draw(self, renderer):
367367

368368
# Project the edge points along the current position and
369369
# create the line:
370-
pep = proj3d.proj_trans_points([edgep1, edgep2], self.axes.M)
370+
pep = proj3d._proj_trans_points([edgep1, edgep2], self.axes.M)
371371
pep = np.asarray(pep)
372372
self.line.set_data(pep[0], pep[1])
373373
self.line.draw(renderer)

‎lib/mpl_toolkits/mplot3d/proj3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/proj3d.py
+36-3Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import numpy as np
66
import numpy.linalg as linalg
77

8+
from matplotlib import _api
9+
810

911
def _line2d_seg_dist(p, s0, s1):
1012
"""
@@ -51,7 +53,15 @@ def world_transformation(xmin, xmax,
5153
[0, 0, 0, 1]])
5254

5355

56+
@_api.deprecated("3.8")
5457
def rotation_about_vector(v, angle):
58+
"""
59+
Produce a rotation matrix for an angle in radians about a vector.
60+
"""
61+
return _rotation_about_vector(v, angle)
62+
63+
64+
def _rotation_about_vector(v, angle):
5565
"""
5666
Produce a rotation matrix for an angle in radians about a vector.
5767
"""
@@ -101,7 +111,7 @@ def _view_axes(E, R, V, roll):
101111
# Save some computation for the default roll=0
102112
if roll != 0:
103113
# A positive rotation of the camera is a negative rotation of the world
104-
Rroll = rotation_about_vector(w, -roll)
114+
Rroll = _rotation_about_vector(w, -roll)
105115
u = np.dot(Rroll, u)
106116
v = np.dot(Rroll, v)
107117
return u, v, w
@@ -150,7 +160,12 @@ def view_transformation(E, R, V, roll):
150160
return M
151161

152162

163+
@_api.deprecated("3.8")
153164
def persp_transformation(zfront, zback, focal_length):
165+
return _persp_transformation(zfront, zback, focal_length)
166+
167+
168+
def _persp_transformation(zfront, zback, focal_length):
154169
e = focal_length
155170
a = 1 # aspect ratio
156171
b = (zfront+zback)/(zfront-zback)
@@ -162,7 +177,12 @@ def persp_transformation(zfront, zback, focal_length):
162177
return proj_matrix
163178

164179

180+
@_api.deprecated("3.8")
165181
def ortho_transformation(zfront, zback):
182+
return _ortho_transformation(zfront, zback)
183+
184+
185+
def _ortho_transformation(zfront, zback):
166186
# note: w component in the resulting vector will be (zback-zfront), not 1
167187
a = -(zfront + zback)
168188
b = -(zfront - zback)
@@ -218,7 +238,9 @@ def proj_transform(xs, ys, zs, M):
218238
return _proj_transform_vec(vec, M)
219239

220240

221-
transform = proj_transform
241+
transform = _api.deprecated(
242+
"3.8", obj_type="function", name="transform",
243+
alternative="proj_transform")(proj_transform)
222244

223245

224246
def proj_transform_clip(xs, ys, zs, M):
@@ -231,15 +253,26 @@ def proj_transform_clip(xs, ys, zs, M):
231253
return _proj_transform_vec_clip(vec, M)
232254

233255

256+
@_api.deprecated("3.8")
234257
def proj_points(points, M):
235-
return np.column_stack(proj_trans_points(points, M))
258+
return _proj_points(points, M)
259+
236260

261+
def _proj_points(points, M):
262+
return np.column_stack(_proj_trans_points(points, M))
237263

264+
265+
@_api.deprecated("3.8")
238266
def proj_trans_points(points, M):
267+
return _proj_trans_points(points, M)
268+
269+
270+
def _proj_trans_points(points, M):
239271
xs, ys, zs = zip(*points)
240272
return proj_transform(xs, ys, zs, M)
241273

242274

275+
@_api.deprecated("3.8")
243276
def rot_x(V, alpha):
244277
cosa, sina = np.cos(alpha), np.sin(alpha)
245278
M1 = np.array([[1, 0, 0, 0],

‎lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/tests/test_axes3d.py
+1-11Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ def test_proj_axes_cube_ortho():
10741074
roll = 0
10751075
u, v, w = proj3d._view_axes(E, R, V, roll)
10761076
viewM = proj3d._view_transformation_uvw(u, v, w, E)
1077-
orthoM = proj3d.ortho_transformation(-1, 1)
1077+
orthoM = proj3d._ortho_transformation(-1, 1)
10781078
M = np.dot(orthoM, viewM)
10791079

10801080
ts = '0 1 2 3 0 4 5 6 7 4'.split()
@@ -1095,16 +1095,6 @@ def test_proj_axes_cube_ortho():
10951095
ax.set_ylim(-200, 200)
10961096

10971097

1098-
def test_rot():
1099-
V = [1, 0, 0, 1]
1100-
rotated_V = proj3d.rot_x(V, np.pi / 6)
1101-
np.testing.assert_allclose(rotated_V, [1, 0, 0, 1])
1102-
1103-
V = [0, 1, 0, 1]
1104-
rotated_V = proj3d.rot_x(V, np.pi / 6)
1105-
np.testing.assert_allclose(rotated_V, [0, np.sqrt(3) / 2, 0.5, 1])
1106-
1107-
11081098
def test_world():
11091099
xmin, xmax = 100, 120
11101100
ymin, ymax = -100, 100

0 commit comments

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