在Python中使用NumPy或pyGLM的等效语句是什么?
vmath::translate(0.0f, 0.0f, -4.0f) * vmath::translate(1.2f, 2.2f, -1.0f)
这是来自一个更大的语句块,我很难转换为 Python,因为不熟悉这两个库。 搜索和手册对我来说几乎没有运气。
vmath::mat4 mv_matrix = vmath::translate(0.0f, 0.0f, -4.0f) *
vmath::translate(sinf(2.1f * f) * 0.5f,
cosf(1.7f * f) * 0.5f,
sinf(1.3f * f) * cosf(1.5f * f) * 2.0f) *
vmath::rotate((float)currentTime * 45.0f, 0.0f, 1.0f, 0.0f) *
vmath::rotate((float)currentTime * 81.0f, 1.0f, 0.0f, 0.0f);
如果我可以也问一下。 vmath::rotate(( 在 Python 中也等效于什么?
import numpy.matlib
import numpy as np
a = np.array([0.0, 0.0, -4.0])
b = np.array([1.2, 2.2, 1.0])
product = np.dot(a,b)
print product
对于轮换,您可以使用此答案 https://stackoverflow.com/a/6802723/1547872