Open mllobera opened 1 week ago
Support for mass transforms is inconsistent and depends on the function. The intention was always to add support for it, but I never got around to it.
A trivial (and slow) way to do it would be detect lists of lists / arrays of arrays, and iterate over them at the function level using a decorator.
Thanks for the quick response. It is good to know.
On Fri, Nov 15, 2024 at 8:25 AM Adam Griffiths @.***> wrote:
Support for mass transforms is inconsistent and depends on the function. The intention was always to add support for it, but I never got around to it.
A trivial (and slow) way to do it would be detect lists of lists / arrays of arrays, and iterate over them at the function level using a decorator.
— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/adamlwgriffiths/Pyrr/issues/127*issuecomment-2479357055__;Iw!!K-Hz7m0Vt54!lk7dQgC_MeXjflyB0QsPaFGTWgAS9AE_QYGtE6t03OFHjwGpUaB39m8UzAnOR21_WBVP37YCP-gn64H7eIithnA$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AANCY3VLY5HMQDZPZ2CNKNL2AYN53AVCNFSM6AAAAABR2DU7GGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZZGM2TOMBVGU__;!!K-Hz7m0Vt54!lk7dQgC_MeXjflyB0QsPaFGTWgAS9AE_QYGtE6t03OFHjwGpUaB39m8UzAnOR21_WBVP37YCP-gn64H7fI3Ueo8$ . You are receiving this because you authored the thread.Message ID: @.***>
--
Marcos Llobera Assoc. Prof. in Anthropology Digital Archaeology Research Lab (DigAR Lab https://www.digarlab.uw.edu/) University of Washington pronouns: he/his/him
The following example is a hack but it works to do mass transformation (the price you pay is that you revert back to numpy).
S = Matrix44.from_scale([0.5, -0.5, 1])
R = Matrix44.from_z_rotation(radians(90))
T = Matrix44.from_translation([-100, -100, 0])
t = S * R * T
vecs = np.array([[100.0, 100.0, 0, 1],
[200.0, 200.0, 0, 1]])
trans = vecs * np.matrix(t)
trans = np.array(trans)
result
array([[ 0., 0., 0., 1.]
,[50., 50., 0., 1.]])
Not ideal but...
I haven't tested it, but that should work as is, since the procedural and oo interfaces are just np.arrays. Possibly some of the extra stuff added will cause problems.
Vector3 -> BaseVector3 -> BaseVector -> BaseObject
Alternatively you can just use the procedural API which is literally just np.array.
Thanks Adam. I was surprise to see that Matrix44 did not behave as a numpy matrix. By just perusing very quickly through your code, this is explained because , as you point out, matrix inherits from an numpy array and not a numpy matrix. Changing this would represent a huge endeavor but I am wondering whether it would provide a slick way towards providing a way for mass transformations. Just some thoughts...
I could not find this information so I thought I would ask here.
Is there a way to be able to process an array or list of vectors all at once?
So something like,
I have seen that there is a function
matrix44.apply_to_vectors()
but I have been unable to get it to work with either a numpy array or a list (also I cannot tell when to use Matrix44 or matrix44? it seems that there are two different set of methods???)