0

What would the equivalent statements be in Python using either NumPy or pyGLM ?

vmath::translate(0.0f, 0.0f, -4.0f) * vmath::translate(1.2f, 2.2f, -1.0f)

This is from a larger statement block that I am having difficulty converting to Python being not familiar with the two libraries. Searches and the manuals are yielding little luck of results for me.

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

If I may also ask. What is the vmath::rotate() equivalent in Python as well? Thank You.

eyllanesc
  • 190,383
  • 15
  • 87
  • 142
Stan S.
  • 539
  • 5
  • 13

1 Answers1

1
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

for rotation, you may go with this answer https://stackoverflow.com/a/6802723/1547872

dileep nandanam
  • 2,386
  • 13
  • 19