Skip to content

Should XRRigidTransform.inverse.inverse return the original object? #576

@toji

Description

@toji

Question asked by @NellWaliczek on #560 (comment) Effectively, should to following code be guaranteed to evaluate to true?

let A = new XRRigidTransform(somePosition, someOrientation);
let B = A.inverse;
let C = B.inverse;
assert(A === C);

It wouldn't be a huge burden to retain the "parent" transform. There's possibly some minor memory concerns that would come along with that, but it's probably not a big deal. It may improve performance in some rather weird edge cases, but I don't think we should be optimizing for that.

I would be tempted to leave it up to the UA, but there IS a minor compat issue that would come out of it. The biggest functionality fallout of a same-object policy here would be that if someone patches an attribute onto the transform, and then calls T.inverse.inverse that patched value would still be expected to be there. I don't know if that's behavior we necessarily want people to be relying on, and as a result I would suggest not implementing this, but I do think it's worthy of discussion.

A related topic: Should XRRigidTransform.inverse return the same object every time it's called? That actually seems more logical to me, and probably yields real performance benefits in cases where the attribute is referenced multiple times, so I'd advocate for enforcing that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions