5
5
import numpy as np
6
6
import numpy .linalg as linalg
7
7
8
+ from matplotlib import _api
9
+
8
10
9
11
def _line2d_seg_dist (p , s0 , s1 ):
10
12
"""
@@ -51,7 +53,15 @@ def world_transformation(xmin, xmax,
51
53
[0 , 0 , 0 , 1 ]])
52
54
53
55
56
+ @_api .deprecated ("3.8" )
54
57
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 ):
55
65
"""
56
66
Produce a rotation matrix for an angle in radians about a vector.
57
67
"""
@@ -101,7 +111,7 @@ def _view_axes(E, R, V, roll):
101
111
# Save some computation for the default roll=0
102
112
if roll != 0 :
103
113
# 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 )
105
115
u = np .dot (Rroll , u )
106
116
v = np .dot (Rroll , v )
107
117
return u , v , w
@@ -150,7 +160,12 @@ def view_transformation(E, R, V, roll):
150
160
return M
151
161
152
162
163
+ @_api .deprecated ("3.8" )
153
164
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 ):
154
169
e = focal_length
155
170
a = 1 # aspect ratio
156
171
b = (zfront + zback )/ (zfront - zback )
@@ -162,7 +177,12 @@ def persp_transformation(zfront, zback, focal_length):
162
177
return proj_matrix
163
178
164
179
180
+ @_api .deprecated ("3.8" )
165
181
def ortho_transformation (zfront , zback ):
182
+ return _ortho_transformation (zfront , zback )
183
+
184
+
185
+ def _ortho_transformation (zfront , zback ):
166
186
# note: w component in the resulting vector will be (zback-zfront), not 1
167
187
a = - (zfront + zback )
168
188
b = - (zfront - zback )
@@ -218,7 +238,9 @@ def proj_transform(xs, ys, zs, M):
218
238
return _proj_transform_vec (vec , M )
219
239
220
240
221
- transform = proj_transform
241
+ transform = _api .deprecated (
242
+ "3.8" , obj_type = "function" , name = "transform" ,
243
+ alternative = "proj_transform" )(proj_transform )
222
244
223
245
224
246
def proj_transform_clip (xs , ys , zs , M ):
@@ -231,15 +253,26 @@ def proj_transform_clip(xs, ys, zs, M):
231
253
return _proj_transform_vec_clip (vec , M )
232
254
233
255
256
+ @_api .deprecated ("3.8" )
234
257
def proj_points (points , M ):
235
- return np .column_stack (proj_trans_points (points , M ))
258
+ return _proj_points (points , M )
259
+
236
260
261
+ def _proj_points (points , M ):
262
+ return np .column_stack (_proj_trans_points (points , M ))
237
263
264
+
265
+ @_api .deprecated ("3.8" )
238
266
def proj_trans_points (points , M ):
267
+ return _proj_trans_points (points , M )
268
+
269
+
270
+ def _proj_trans_points (points , M ):
239
271
xs , ys , zs = zip (* points )
240
272
return proj_transform (xs , ys , zs , M )
241
273
242
274
275
+ @_api .deprecated ("3.8" )
243
276
def rot_x (V , alpha ):
244
277
cosa , sina = np .cos (alpha ), np .sin (alpha )
245
278
M1 = np .array ([[1 , 0 , 0 , 0 ],
0 commit comments