KEMBAR78
Some matrix clarifications by Manishearth · Pull Request #654 · immersive-web/webxr · GitHub
Skip to content

Conversation

@Manishearth
Copy link
Contributor

We've been circling around whether transforms are "transforms from" or "transforms to" a bunch, see #582 (comment) , #649 (comment) for the latest examples.

These are some clarifications that may help.

I have a potential fix for #582 ready as well, but I want to land that separately since that actually adds new semantics as opposed to clarifying existing semantics.

r? @toji @NellWaliczek

cc @klausw @thetuvix

@Manishearth
Copy link
Contributor Author

While I was working on this I realized the fundamental issue was that we're thinking about these transforms as transforms "between spaces", which is what's ambiguous (since you can transform the origins of the spaces, or you can transform the coordinates of objects in the spaces).

This uniformly makes us talk of these as positions and orientations floating in space, among other things.

@Manishearth
Copy link
Contributor Author

When I first wanted to do this PR it had a lot more things that needed doing, fortunately all the recent spec work has pinned down most of the ambiguous bits around this already.

Copy link
Contributor

@klausw klausw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, just some suggestions. Thanks!

index.bs Outdated
</pre>

The <dfn attribute for="XRPose">transform</dfn> attribute describes the {{XRRigidTransform}} between two {{XRSpace}}.
The <dfn attribute for="XRPose">transform</dfn> attribute describes the position and orientation relative to the underlying {{XRSpace}}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's some potential confusion here since the getPose definition uses sourceSpace and destinationSpace in its arguments, and it's not obvious which of these is the "underlying" space.

How about using relative to the reference {{XRSpace}} here, and changing the getPose definition to match? Something like this?

XRPose? getPose(XRSpace space, XRSpace referenceSpace);
...
When the <dfn method for="XRFrame">getPose(|space|, |referenceSpace|)</dfn> method is invoked, the user agent MUST run the following steps:
...
  1. [=Populate the pose=] of |space| in |referenceSpace| at the time represented by |frame| into |pose|.

Not sure what the best name is for the first argument. The proposal here is roughly following the explainer which uses getPose(xrSpace, xrReferenceSpace). Other options would be posedSpace, objectSpace, trackedSpace?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I like this. This better clarifies the source/destination thing too.

@Manishearth
Copy link
Contributor Author

Addressed

Copy link
Member

@toji toji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all seems sensible to me, with one minor concern about an arg name that I'm not going to block on. Seems like Klaus' feedback was all addressed pretty directly, so I feel comfortable merging this now.

<div class="algorithm unstable" data-algorithm="get-pose">

When the <dfn method for="XRFrame">getPose(|sourceSpace|, |destinationSpace|)</dfn> method is invoked, the user agent MUST run the following steps:
When the <dfn method for="XRFrame">getPose(|space|, |referenceSpace|)</dfn> method is invoked, the user agent MUST run the following steps:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm slightly concerned that using "referenceSpace" here may erroneously imply that the input can ONLY be an XRReferenceSpace. That said, naming is hard and there's not a lot a great options that I can think of here that address what you and Klaus were talking about. So maybe it's a non-issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's fair. I think ultimately it's clear from the types, though.

shrug

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I jumped the gun on this and merged it before Nell had a chance to sign off, and she shares my concern about using referenceSpace as a name here. As a result I'm going to do a follow up to adjust the name again. I'll post a PR when I have something so we can make sure the name is agreeable all around.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. You can just revert a856300

@toji toji merged commit 98d329a into immersive-web:master May 17, 2019
@Manishearth Manishearth deleted the matrices branch May 17, 2019 21:38
@klausw
Copy link
Contributor

klausw commented May 17, 2019 via email

@toji
Copy link
Member

toji commented May 17, 2019

Great suggestions, thanks!

@thetuvix
Copy link
Contributor

This is a great change! Once we start to include offset spaces, anchor spaces, etc., I've found it far more straightforward to reason about the pose of one space "in" another. Aligning to that model within our API naming should help the developers using WebXR as well!

At the risk of Brandon calling me out for aligning WebXR to OpenXR 😄, I'll put in my vote for baseSpace. (I share the concerns around developer confusion if we call the parameter referenceSpace)

We can then describe getPose to developers simply:

getPose(space, baseSpace) returns the pose of space within baseSpace at the time represented by this XRFrame.

@toji
Copy link
Member

toji commented May 20, 2019

Thanks all! PR to change the name is now up at #659

@AdaRoseCannon AdaRoseCannon added the ed:spec Include in newsletter, spec change label Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ed:spec Include in newsletter, spec change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants