You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello @Zuzu-Typ
I've noticed a strange behavior of the glm constructors: they accept all kind of numbers when creating a glm type from separated components, but only the native python floats when converting a tuple to a glm type.
>>>importglm>>>importnumpyasnp# native python floats# working as separate arguments>>>glm.vec2(1., 2.)
vec2( 1, 2 )
# working in a tuple>>>glm.vec2((1., 2.))
vec2( 1, 2 )
# esoteric python floats (in this example, numpy floats)# working as separate arguments>>>glm.vec2(np.float32(1.), np.float32(2.))
vec2( 1, 2 )
# not working in a tuple>>>glm.vec2((np.float32(1.), np.float32(2.)))
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>TypeError: invalidargumenttype(s) forvec()
invalidargument type(s) forvec()
The same occurs with np.float* and np.*int*
While working with numpy and glm together, it's quite common to have numpy return values we want to use as vectors (such as array or image coordinates, or dtype structure fields), so supporting creating vectors from tuple of esoteric numbers could be of some help
For now my workaround is
p=np.unravel_index(np.argmax(...)) # the result is of type (np.uint64, np.uint64)p= (int(p[0]), int(p[1]), int(p[2])) # convert each component manually# then latersome_expression(vec3(p))
# instead ofp=uvec3(np.unravel_index(np.argmax(...)))
Do you think the support for this could be added to the glm constructors ?
The text was updated successfully, but these errors were encountered:
Hello @Zuzu-Typ
I've noticed a strange behavior of the glm constructors: they accept all kind of numbers when creating a glm type from separated components, but only the native python floats when converting a tuple to a glm type.
The same occurs with
np.float*
andnp.*int*
While working with numpy and glm together, it's quite common to have numpy return values we want to use as vectors (such as array or image coordinates, or dtype structure fields), so supporting creating vectors from tuple of esoteric numbers could be of some help
For now my workaround is
Do you think the support for this could be added to the glm constructors ?
The text was updated successfully, but these errors were encountered: