Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit acbad48

Browse files
committed
Revert changes to the existing test
1 parent 579d1e4 commit acbad48

2 files changed

Lines changed: 8 additions & 19 deletions

File tree

-102 Bytes
Loading

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -370,37 +370,26 @@ def test_plotsurface_1d_raises():
370370
ax.plot_surface(X, Y, z)
371371

372372

373-
def _test_proj_make_M(proj='persp'):
373+
def _test_proj_make_M():
374374
# eye point
375375
E = np.array([1000, -1000, 2000])
376376
R = np.array([100, 100, 100])
377377
V = np.array([0, 0, 1])
378378
viewM = proj3d.view_transformation(E, R, V)
379-
if proj == 'persp':
380-
projM = proj3d.persp_transformation(-100, 100)
381-
else:
382-
projM = proj3d.ortho_transformation(-100, 100)
383-
return np.dot(projM, viewM)
379+
perspM = proj3d.persp_transformation(100, -100)
380+
M = np.dot(perspM, viewM)
381+
return M
384382

385383

386384
def test_proj_transform():
385+
M = _test_proj_make_M()
386+
387387
xs = np.array([0, 1, 1, 0, 0, 0, 1, 1, 0, 0]) * 300.0
388388
ys = np.array([0, 0, 1, 1, 0, 0, 0, 1, 1, 0]) * 300.0
389389
zs = np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1]) * 300.0
390390

391-
# perspective
392-
perspM = _test_proj_make_M()
393-
txs, tys, tzs = proj3d.proj_transform(xs, ys, zs, perspM)
394-
ixs, iys, izs = proj3d.inv_transform(txs, tys, tzs, perspM)
395-
396-
np.testing.assert_almost_equal(ixs, xs)
397-
np.testing.assert_almost_equal(iys, ys)
398-
np.testing.assert_almost_equal(izs, zs)
399-
400-
# orthographic
401-
orthoM = _test_proj_make_M(proj='ortho')
402-
txs, tys, tzs = proj3d.proj_transform(xs, ys, zs, orthoM)
403-
ixs, iys, izs = proj3d.inv_transform(txs, tys, tzs, orthoM)
391+
txs, tys, tzs = proj3d.proj_transform(xs, ys, zs, M)
392+
ixs, iys, izs = proj3d.inv_transform(txs, tys, tzs, M)
404393

405394
np.testing.assert_almost_equal(ixs, xs)
406395
np.testing.assert_almost_equal(iys, ys)

0 commit comments

Comments
 (0)