Skip to content

Define behavior for non-invertible/representible XRRigidTransforms #1236

Open
@alcooper91

Description

@alcooper91

It is possible for an XRRigidTransform to be generated with a translation that cannot be represented in its matrix attribute, since XRRigidTransform's position/orientation take DOMPointInits (typically doubles), and the matrix representation is a Float32Array (essentially floats).

For example:

(new XRRigidTransform({x: 1e50})).matrix
Float32Array(16) [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, Infinity, 0, 0, 1]

It is also possible to store values that are large enough that typical inverse algorithms on the matrix fail to invert them (though these numbers end up being represented as Infinity in the .matrix value anyways). Even attempting to do the inverse with the decomposed position/orientation, could result in numbers that could overflow.

For Example, if 1e50 were instead ~DBL_MAX, the below would cause an overflow, even with most internal representations:

a=new XRRigidTransform({y: 1e50, z: 1e50}, {x: 0.3826834, w: 0.9238795})

a.inverse.position
DOMPointReadOnly {x: -0, y: -1.4142135623730944e+50, z: -4.938409389042487e+42, w: 1}

Examples taken from discussions with @klausw who can correct me if I've misrepresented any of these. This arose because of investigations due to a Chrome bug: https://crbug.com/1258611

cc @toji

Metadata

Metadata

Assignees

No one assigned

    Labels

    editor triageIssues marked for triage/re-examination by the editors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions