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
@@ -150,7 +160,12 @@ def view_transformation(E, R, V, roll):
150160 return M
151161
152162
163+ @_api .deprecated ("3.8" )
153164def 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" )
165181def 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
224246def 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" )
234257def 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" )
238266def 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" )
243276def rot_x (V , alpha ):
244277 cosa , sina = np .cos (alpha ), np .sin (alpha )
245278 M1 = np .array ([[1 , 0 , 0 , 0 ],
0 commit comments