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

Skip to content

Commit fdcc0d8

Browse files
simplify projection
1 parent 0bf8b7b commit fdcc0d8

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

lib/mpl_toolkits/mplot3d/proj3d.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,10 @@ def _ortho_transformation(zfront, zback):
133133

134134
def _proj_transform_vec(vec, M):
135135
vecw = np.dot(M, vec.data)
136-
w = vecw[3]
137-
txs, tys, tzs = vecw[0]/w, vecw[1]/w, vecw[2]/w
138-
if np.ma.isMA(vec[0]): # we check each to protect for scalars
139-
txs = np.ma.array(txs, mask=vec[0].mask)
140-
if np.ma.isMA(vec[1]):
141-
tys = np.ma.array(tys, mask=vec[1].mask)
142-
if np.ma.isMA(vec[2]):
143-
tzs = np.ma.array(tzs, mask=vec[2].mask)
144-
return txs, tys, tzs
136+
ts = vecw[0:3]/vecw[3]
137+
if np.ma.isMA(vec):
138+
ts = np.ma.array(ts, mask=vec.mask)
139+
return ts[0], ts[1], ts[2]
145140

146141

147142
def _proj_transform_vectors(vecs, M):

0 commit comments

Comments
 (0)