-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editorial changes #1
Conversation
index.bs
Outdated
let sensor = new DeviceOrientationSensor(); | ||
let matrix = new Float32Array(16); | ||
const sensor = new DeviceOrientationSensor(); | ||
const mat4 = new Float32Array(16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using mat4 to indicate it is a 4x4 (ie 16) array.
const is used when no reassignment occurs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it allow to modify the array's content?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes :-) but you cannot reassign, ie do mat4 = true
that is the only thing it prevents... otherwise you need to use Object.freeze(mat4)
index.bs
Outdated
Orientation sensor is a [=high-level=] sensor which is created through [=sensor-fusion=] | ||
of [=low-level=] motion sensors (accelerometer, gyroscope, magnetometer). | ||
The device orientation sensor is a [=high-level=] sensor which is created through [=sensor-fusion=] | ||
of the [=low-level=] motion sensors (accelerometer, gyroscope). The type of fusion (complementary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is device orientation so lets drop magnetometer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain more? the underlying rotation vector is using all three
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is the compass. DeviceOrientation is normally what is called "Game rotation vector". So I guess you want to support both modes? (ie. game and compass) using the same sensor?
(update: as tobie stated, device orientation can mean both with old spec which is why everyone is confused - I guess it traditionally means a compass like sensor, but we want something else here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to understand the different use case for
- geomagnetic rotation vector
- rotation vector (which uses magnetometer)
Also at least the former, you want to be able to easily adjust to true north (Android has an API for this)
Also these both seems more related to a compass sensor than a device orientation sensor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually for games, it is quite important that it is allowed to drift so that it can be used for controls:
A game rotation vector sensor is similar to a rotation vector sensor but not using the geomagnetic field. Therefore the Y axis doesn't point north but instead to some other reference. That reference is allowed to drift by the same order of magnitude as the gyroscope drifts around the Z axis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As said, cannot we introduce also RelativeOrientationSensor : DeviceOrientationSensor // ignores magnetometer
wrapping TYPE_GAME_ROTATION_VECTOR
? and let DeviceOrientationSensor
wrap TYPE_ROTATION_VECTOR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure what is best. One is relative to the device orientation itself, and one is relative to the earth.
It seems better to have two separate objects for that to avoid confusion.
Now as both MS and Android calls the one relative to earth for Device Orientation Sensor, we should probably keep that name, but both could potentially inherit from one Orientation Sensor.
I think that makes sense, as we may have other devices in the future relative to other things. Like with "device" we usually mean the device where the code is running. With an external headset, that might not be the device actually running the code, so I could imagine a
GamepadSensor extends Relative Orientation Sensor
HeadsetSensor extends Orientation Sensor.
Actually looking at the above, I now see that the name "device" is probably quite bad, because it is not clear what it refers to, so just calling it Orientation Sensor may make sense.
I guess we could have
- Orientation Sensor (relative to the world / earth)
- Relative Orientation Sensor (relative to the device itself) extends the above.
Then in the future we might have external sensors inheriting those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact that these very important conversations are happening within review comments of a pull request is a pretty good sign that this approach to spec writing isn't an adequate one.
The role of the editor is to gather consensus from the WG and document it in a spec. It is absolutely clear here that there is no such consensus. And it's really bothering that these conversations are buried in here.
I strongly suggest discussing and gathering higher-level consensus around these issues before diving in editorial work. Addressing the open issue on this topic, such as the email I penned on the mailing list in defence of writing a single motion sensor spec, seems like the right way to proceed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kenchris please feel free to open issues for your concerns and we'll continue there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will update my patch here and then I will see if Tobie and I can write some general introduction to motion sensors.
index.bs
Outdated
y-axis points north and z-axis points up and is perpendicular to the plane made up of x and y axis. | ||
of the device in a three dimensional Cartesian coordinate system (x, y, z), where the x-axis points | ||
east, the y-axis points north and the z-axis points upwards and is perpendicular to the plane made | ||
up of x and y axis. The values are no necessarily normalized. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these normalized or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think unit quaternion means that they are normalized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, let me update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What normalization means should be defined somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the vector has a length of one... but that definition probably differs a bit for quaternions as only the 3 latter parts represents the vector the the first part the scalar. I will dig up a definition somewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, its vector normalization. (That rings a distant bell somewhere.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant it needs a dfn in the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, @alexshalamov is now working on that
index.bs
Outdated
@@ -85,8 +88,8 @@ The DeviceOrientationSensor Interface {#deviceorientationsensor-interface} | |||
<pre class="idl"> | |||
[Constructor(optional SensorOptions sensorOptions)] | |||
interface DeviceOrientationSensor : Sensor { | |||
void populateQuaternion(Float32Array array); | |||
void populateMatrix(Float32Array array); | |||
void populateQuaternion(Float32Array buffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that buffer makes it more clear that we write to these... we could use targetBuffer or similar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we do with the timestamps, here?
We need to expose those somehow and tie them to the correct typed array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't we still have the inherited timestamp
attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What when we have > 1 reading between animation frames?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same behavior as with all the existing sensors: we read data right before a new frame is rendered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But when this data is buffered, and you get > 1 sample delivered on the animation frame, you'll need a different timestamp for each of the buffered data.
So what's the plan to handle that?
Are you suggesting different TypeArray organisations depending on whether the data is buffered or not? That seems like a rather bad idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data is always the same and it's corresponding to the timestamp, we just don't read from shared buffer in the middle of frame painting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the proposed API only populates the latest reading (same as in other sensors) it is not meant to collect series of previous readings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. But this is also something we want to do, no? So we need a consistent approach here, else we'll end up with different data representations depending on how the data is collected.
index.bs
Outdated
"{{SyntaxError!!exception}}" {{DOMException}} and abort these steps. | ||
1. If |array| parameter is {{Float32Array}} with size other than four, [=throw=] an | ||
1. If |buffer| parameter is of type {{Float32Array}} with a size other than four, [=throw=] a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or should we use typeof ? @anssiko ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"of type" is good in prose (and is proper English). It is clear the behaviour mirrors that of the "typeof" operator defined in ES.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is WebIDL, so type is correct (typeof wouldn't make any sense here).
index.bs
Outdated
"{{SyntaxError!!exception}}" {{DOMException}} and abort these steps. | ||
1. If the value of sensor_instance|.[=[[state]]=] is not <a enum-value>"activated"</a>, | ||
[=throw=] an "{{InvalidStateError!!exception}}" {{DOMException}} and abort these steps. | ||
[=throw=] a "{{InvalidStateError!!exception}}" {{DOMException}} and abort these steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mistake of mine here.
index.bs
Outdated
@@ -97,16 +100,16 @@ To <dfn>Construct a DeviceOrientationSensor Object</dfn> the user agent must inv | |||
|
|||
<div algorithm="to populate quaternion"> | |||
The {{DeviceOrientationSensor/populateQuaternion()}} method must run these steps or their [=equivalent=]: | |||
1. If |array| parameter is not {{Float32Array}}, [=throw=] an | |||
1. If |buffer| parameter is not of type {{Float32Array}}, [=throw=] an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be "a Syntax..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can drop "parameter" here. It's redundant with |x| notation.
index.bs
Outdated
1. A web-based game uses the device's orientation relative to the Earth's surface as user input. For example, simulation of Ball-in-a-maze puzzle. | ||
1. A WebVR API polyfill implementation tracks the headset's (or mobile device's for mobile VR) orientation. | ||
1. A mapping web application orientates the 2D map with the orientation of the device. | ||
1. A compass monitor's the device's orientation relative to true north and aligns the compass heading in a three-dimensional space. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can drop the first here..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, I think made-up use cases that aren't rooted in real problems faced by real developers in real life provide a false sense of security. I recommend avoiding them.
index.bs
Outdated
1. A WebVR API polyfill implementation tracks the headset's (or mobile device's for mobile VR) orientation. | ||
1. A mapping web application orientates the 2D map with the orientation of the device. | ||
1. A compass monitor's the device's orientation relative to true north and aligns the compass heading in a three-dimensional space. | ||
1. A game uses the device's orientation relative to the ground as user input. For example, a ball-in-a-maze puzzle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this say 2. ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bikeshed is autoincrementing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah cool :-) makes sense then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Markdown auto-increments. :)
Some minor changes and the start for discussion