PyGLM或NumPy实现python中vmath等价语句的翻译方法

2024-09-30 06:26:47 发布

您现在位置:Python中文网/ 问答频道 /正文

Python中使用NumPypyGLM的等价语句是什么?你知道吗

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);

如果我也可以问的话。Python中的vmath::rotate()等价物是什么?谢谢您。你知道吗


Tags: numpy手册语句floatmatrixtranslate等价rotate
1条回答
网友
1楼 · 发布于 2024-09-30 06:26:47
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

相关问题 更多 >

    热门问题