Overloading of operations for transformations (rotation and translation)?

In my code blocs, t are of type Translation3 and r of type UnitQuaternion.

While expressing the transformation of a camera in the coordinate system of another, I have the projection matrix:

| r1.inverse() * r2        r1.inverse() * (t2 - t1) |
|         0                             1           |

When using the Translation3 type for t1 and t2, the operation Sub is not implemented. So I tried replacing it by t2 * t1.inverse() which should be similar according to the semantics if I’m correct. Then there is another issue. Doing r1.inverse() * (t2 * t1.inverse()) is not possible I believe since I get the error: expected Translation, found Isometry. So I guess I have few questions:

  • How should I proceed to make this operation possible (if there is a way), and have the result as a Translation3?
  • Would it make sense to have Add and Sub for translations? If so, I wouldn’t mind trying to make a PR.

Actually, I found the answer for the first question with the mention of the Isometry type in the error. It turns out that doing rotation * translation returns an Isometry, which contains a translation field.

The second question about Add and Sub for translations still stands I think.

Would it make sense to have Add and Sub for translations? If so, I wouldn’t mind trying to make a PR.

I am still a bit hesitant about this. But I think it is still preferable not to implement Add/Sub for Translation since it is designed to be used as a transformation that compose using multiplication, just like other transformations.

:+1: Makes sense to keep it consistent then.