55import numpy as np
66import numpy .linalg as linalg
77
8+ from matplotlib import _api
9+
810
911def _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" )
5457def 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
@@ -130,6 +140,7 @@ def _view_transformation_uvw(u, v, w, E):
130140 return M
131141
132142
143+ @_api .deprecated ("3.8" )
133144def view_transformation (E , R , V , roll ):
134145 """
135146 Return the view transformation matrix.
@@ -150,7 +161,12 @@ def view_transformation(E, R, V, roll):
150161 return M
151162
152163
164+ @_api .deprecated ("3.8" )
153165def persp_transformation (zfront , zback , focal_length ):
166+ return _persp_transformation (zfront , zback , focal_length )
167+
168+
169+ def _persp_transformation (zfront , zback , focal_length ):
154170 e = focal_length
155171 a = 1 # aspect ratio
156172 b = (zfront + zback )/ (zfront - zback )
@@ -162,7 +178,12 @@ def persp_transformation(zfront, zback, focal_length):
162178 return proj_matrix
163179
164180
181+ @_api .deprecated ("3.8" )
165182def ortho_transformation (zfront , zback ):
183+ return _ortho_transformation (zfront , zback )
184+
185+
186+ def _ortho_transformation (zfront , zback ):
166187 # note: w component in the resulting vector will be (zback-zfront), not 1
167188 a = - (zfront + zback )
168189 b = - (zfront - zback )
@@ -218,7 +239,9 @@ def proj_transform(xs, ys, zs, M):
218239 return _proj_transform_vec (vec , M )
219240
220241
221- transform = proj_transform
242+ transform = _api .deprecated (
243+ "3.8" , obj_type = "function" , name = "transform" ,
244+ alternative = "proj_transform" )(proj_transform )
222245
223246
224247def proj_transform_clip (xs , ys , zs , M ):
@@ -231,15 +254,26 @@ def proj_transform_clip(xs, ys, zs, M):
231254 return _proj_transform_vec_clip (vec , M )
232255
233256
257+ @_api .deprecated ("3.8" )
234258def proj_points (points , M ):
235- return np .column_stack (proj_trans_points (points , M ))
259+ return _proj_points (points , M )
260+
236261
262+ def _proj_points (points , M ):
263+ return np .column_stack (_proj_trans_points (points , M ))
237264
265+
266+ @_api .deprecated ("3.8" )
238267def proj_trans_points (points , M ):
268+ return _proj_trans_points (points , M )
269+
270+
271+ def _proj_trans_points (points , M ):
239272 xs , ys , zs = zip (* points )
240273 return proj_transform (xs , ys , zs , M )
241274
242275
276+ @_api .deprecated ("3.8" )
243277def rot_x (V , alpha ):
244278 cosa , sina = np .cos (alpha ), np .sin (alpha )
245279 M1 = np .array ([[1 , 0 , 0 , 0 ],
0 commit comments