[🐛 bug report] Inconsistent behavior of ScalarTransform4f chaining
Summary
The behavior of the scale function of a ScalarTransform4f instance depends on how the object was instantiated. If done using a convenience function (like rotate, look_at, translate, etc.), the .scale() function will add a scaling on top of the existing transform. But if instantiated using a 4x4 array, the .scale() function will completely replace the earlier transform. Same goes for other functions like rotate, translate, etc.
System configuration
System information:
OS: Ubuntu 22.04.1 LTS CPU: 11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz GPU: NVIDIA RTX A4000 Python: 3.10.6 (main, Nov 2 2022, 18:53:38) [GCC 11.3.0] NVidia driver: 515.43.04 CUDA: 11.7.64 LLVM: 14.0.0
Dr.Jit: 0.2.2 Mitsuba: 3.0.2 Is custom build? True Compiled with: Clang 14.0.0 Variants: scalar_rgb scalar_spectral llvm_ad_spectral
Steps to reproduce
import mitsuba
from mitsuba import ScalarTransform4f as Transform
T1 = Transform.rotate([1, 0, 0], 90)
print(T1)
[[1, 0, 0, 0],
[0, -4.37114e-08, -1, 0],
[0, 1, -4.37114e-08, 0],
[0, 0, 0, 1]]
T2 = Transform([[1, 0, 0, 0],
[0, -4.37114e-08, -1, 0],
[0, 1, -4.37114e-08, 0],
[0, 0, 0, 1]])
print(T1.scale(0.5))
print(T2.scale(0.5))
[[0.5, 0, 0, 0],
[0, -2.18557e-08, -0.5, 0],
[0, 0.5, -2.18557e-08, 0],
[0, 0, 0, 1]]
[[0.5, 0, 0, 0],
[0, 0.5, 0, 0],
[0, 0, 0.5, 0],
[0, 0, 0, 1]]
Hi @UNakade
Thanks for pointing this out, it is indeed a bit awkward and confusing.