Created
November 9, 2017 01:29
-
-
Save nathanmsmith/8d7f672346f2a990d60a72fc7af1d878 to your computer and use it in GitHub Desktop.
174eyyyyyy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
np.set_printoptions(formatter={'float': lambda x: "{0:0.3f}".format(x)}) | |
cam = np.matrix() # put cam matrix here | |
wcs = np.matrix([[3, 0, -2, 1], | |
[2, 0, -1, 5], | |
[1, -3, 2, -1], | |
[1, 1, 1, 1]]) | |
mproj = np.matrix() # put m_proj matrix here | |
vp = np.matrix() # put viewport matrix here | |
vcs = cam * wcs | |
print("M_vcs:") | |
print(vcs) | |
print("\n") | |
ccs = mproj * vcs | |
print("M_ccs:") | |
print(ccs) | |
print("\n") | |
ndcs = 1 / ccs[3, 3] * ccs | |
print("M_ndcs:") | |
print(ndcs) | |
print("\n") | |
dcs = vp * ndcs | |
print("M_dcs:") | |
print(dcs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment