Pyrr icon indicating copy to clipboard operation
Pyrr copied to clipboard

Natural dtype for rotation matrices

Open asnt opened this issue 6 years ago • 5 comments

Tentative PR for #80

This could maybe be applied to other functions. I haven't checked yet. Any hints welcome.

asnt avatar Oct 14 '18 19:10 asnt

I have a feeling those test failures are related to #77

adamlwgriffiths avatar Oct 15 '18 12:10 adamlwgriffiths

I think any of the create_from_x functions would need this. It may also be pertinent to add to the quaternion functions.

Lastly, update the CHANGELOG and add yourself to the contributors in the README if you wish =)

There are other features we need to include in the CHANGELOG since the last release, but don't let that stop you.

adamlwgriffiths avatar Oct 15 '18 12:10 adamlwgriffiths

Anyone else want to chime in on this one? @foohyfooh?

adamlwgriffiths avatar Oct 15 '18 12:10 adamlwgriffiths

I think any of the create_from_x functions would need this.

The other create_from_X functions from matrix33.py seem to behave as expected. The ones taking euler angles or quaternions as input rely on the fact that the input dtype is float, which is most of the time the case but not guaranteed (see below).

It may also be pertinent to add to the quaternion functions.

As for the creation of a rotation matrix from axis-angle, I would also enforce that Euler angles and quaternions be float. Currently, the create function for both representation uses the input dtype, which might be int in some cases (although that will probably only happen rarely since the values are usually passed as float). Problematic cases:

>>> import pyrr
>>> e = pyrr.euler.create(1,2,3)
>>> e
array([1, 2, 3])
>>> e.dtype
dtype('int64')
>>> q = pyrr.quaternion.create(1,2,3,4)
>>> q
array([1, 2, 3, 4])
>>> q.dtype
dtype('int64')
>>>

Seems related to #35

asnt avatar Nov 06 '18 21:11 asnt

That's the thing. If you want to enable user laziness, then you need to update all the interfaces to be more intelligent. So many API functions need to be touched.

adamlwgriffiths avatar Nov 08 '18 07:11 adamlwgriffiths