Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Conversion of Rotation and Translation Parameters #358

Closed
CYXYZ opened this issue Dec 23, 2024 · 1 comment
Closed

Conversion of Rotation and Translation Parameters #358

CYXYZ opened this issue Dec 23, 2024 · 1 comment

Comments

@CYXYZ
Copy link

CYXYZ commented Dec 23, 2024

Dear vivek,

I have noticed that in the latest version, the conversion of rotation and translation parameters to axis-angle, Euler angles, etc., uses the following updated code for the translation parameters:

def inverse(self):
    R = self.matrix[..., :3, :3]
    t = self.matrix[..., :3, 3]
    Rinv = R.mT
    tinv = -torch.einsum("bij, bj -> bi", Rinv, t)
    matrix = make_matrix(Rinv, tinv)
    return RigidTransform(matrix)

def compose(self, T):
    matrix = torch.einsum("bij, bjk -> bik", T.matrix, self.matrix)
    return RigidTransform(matrix)

def convert(self, parameterization, convention=None):
    translation = -self.inverse().translation

However, in the previous version, the translation parameters were always maintained as follows:

def inverse(self):
        R = self.matrix[..., :3, :3]
        t = self.matrix[..., :3, 3]
        Rinv = R.mT
        tinv = -torch.einsum("bij, bj -> bi", Rinv, t)
        matrix = make_matrix(Rinv, tinv)
        return RigidTransform(matrix)

    def compose(self, T):
        matrix = torch.einsum("bij, bjk -> bik", T.matrix, self.matrix)
        return RigidTransform(matrix)

    def convert(self, parameterization, convention=None):
        translation = self.matrix[..., :3, 3]

Could you please explain the reason for updating this part of the code? It seems that the previous version was easier to understand.

Best regards,
cyxyz

@eigenvivek
Copy link
Owner

hi @CYXYZ , the difference was introduced in diffdrr 0.4.0. in previous versions, rigid transforms were parameterized as [R | t]. after 0.4.0, they were parameterized as [R | Rt ]. consequently the inverse formula changed. the specific reasons are covered here #234 (comment)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants