Sender | Message | Time |
---|---|---|
22 Sep 2023 | ||
17:45:27 | ||
23 Sep 2023 | ||
18:16:37 | ||
24 Sep 2023 | ||
how do I convert from a right handed coordinate system to a left handed one? I tried to figure out the correct orientation, by applying 180 deg. on each coordinate axis with math_quat_rotate . I thought that by doing so, one (out of 9) combination would work. so iterating through 180 deg. rotations for each axis = 3axis ^ 2 = 9. but after trying all of these out, nothing seems to work. so I thought I might need to change the handedness of my coordinate system. is there any code that can assist here? or maybe someone has a better idea. | 12:08:00 | |
oh I think the answer is negating the x, y, and z components of the quaternion 🤔 | 12:25:27 | |
It depends a bit how you want to map them. Typically I think of it as flipping the Z axis (typically +y is upwards on the screen, +x is to the right and the whether -z or +z is "forwards" is usually the difference). So if you've got a modelview matrix from a right handed coordinate system, then pre-multiplying by a matrix with [1 1 -1 1] on the diagonal will do it. That will make the modelview include a flip too which is a little weird - you can post multiply by the z flip too to get an equivalent model-view for left handed "object" coords to a left handed "camera" | 12:51:10 | |
I'm gonna be honest I don't understand what a modelview matrix is. is that coming from the calibration? either way I just bruteforced my way through it. turns out all I need is math_quat_from_angle_vector(DEG_TO_RAD(180), &z_axis, &rotation_quat); and then *(-1) the y and z component of the orientation quaternion. | 13:42:53 | |
* I'm gonna be honest I don't know what a modelview matrix is. is that coming from the calibration? either way I just bruteforced my way through it. turns out all I need is math_quat_from_angle_vector(DEG_TO_RAD(180), &z_axis, &rotation_quat); and then *(-1) the y and z component of the orientation quaternion. | 13:43:00 | |
What are the two coordinate systems? Because the answer depends on that. | 14:17:23 | |
Example: if one is X:Left, Y:Up, Z:Forward, and the other is X:Right, Y:Up, Z:Forward; - You convert screen-space positions by negating the X axis - You convert quaternions by negating Y and Z. (With quaternions, you negate and shuffle coordinates just like with position vectors, but you also have to negate XYZ if you change handedness) | 14:19:09 | |
* Example: if one is X:Left, Y:Up, Z:Forward, and the other is X:Right, Y:Up, Z:Forward; - You convert screen-space positions by negating the X axis - You convert quaternions by negating Y and Z. With quaternions, you negate and shuffle coordinates just like with position vectors, but you also have to negate XYZ if you change handedness) | 14:19:22 | |
* Example: if one is X:Left, Y:Up, Z:Forward, and the other is X:Right, Y:Up, Z:Forward; - You convert (screen-space?) positions by negating the X axis - You convert quaternions by negating Y and Z. With quaternions, you negate and shuffle coordinates just like with position vectors, but you also have to negate XYZ if you change handedness) | 14:19:45 | |
By the way, you cannot convert between different handed systems with just rotations, because you also need to mirror the system. | 14:21:34 | |
so the one from the XR50, which I use, says it uses: x to right, y to down, z to forward. and for the target I'm not sure. my guess would be: x to left, y to down, z to backward. the target should be whatever monado uses. very unsure about it. so for the XR50 here is what works: quaternions rotated by 180 degrees around z-axis AND negated y and z. and for the position just negating y and z. I don't have an intuitive understanding if that makes sense, but testing with xrgears, it looks correct | 14:38:26 | |
Guys what is this channel good for | 15:36:20 | |
questions about XR (AR/VR/MR) related algorithms and math problems | 15:54:04 | |
6ax3dc Yeah x right, y down, and z forward is the standard OpenCV coordinate system. | 16:19:16 | |
* 6ax3dc Yeah x right, y down, and z forward is the standard OpenCV coordinate system. | 16:19:24 | |
many of these ops can be done by negating components in vectors and quaternions - but the way i think about this, and apply such things, - is done more generally with a matrix - in 3d graphics when you look at a 3x3 or 4x4 matrix, you can think of its first 3 columns as vector directions for the x,y,z axes of the space it represents. Multiplying by a matrix which is similar to an identity matrix, (i.e. column 0 is 1 0 0 (x), column 1 is 0 1 0 (y), and column 2 is 0 0 1 (z) ) but with its 'axes' changed e.g. flipping y to z and inverting the direction of z (column 0 is 1 0 0 (x) column 1 is 0 0 -1 (y is now z but inverted) column 2 is 0 1 0) (z is now y) will result in this kind of space transformation. see https://stackoverflow.com/questions/1263072/changing-a-matrix-from-right-handed-to-left-handed-coordinate-system/71168853#71168853 for a more complete example of this.. I find the presentation of 'change of basis' in the math sense difficult to understand since it is general and applies to spaces where 'axes' are not orthonormal like we use almost exclusively in graphics - but i can easily visualise the 100/010/001 basis vectors and intuitively see how those 1s need to be exchanged and/or inverted to -1s to get my new coordinate system.. Maybe helpful when thinking about this type of thing? | 18:53:58 | |
well I tried to do it with intuition by checking on which axis the rotation is wrong in the xrgears and then tried to negate these axis'. for example when I was looking right, the view was also "turning right", and then I negated it and the view was correct. but at some point I got very confused when it wasn't for some reason acting to my intuition. then I just thought about all the possible configurations and thought "huh, not that many just try them all". it was 9 for the quaternion rotations, and then 9 for the combinations of negating these axis. so I made a nice little table and check off all combinations. worked great xd | 19:00:48 | |
althought I still don't see how it makes sense in the end. it does work, but it doesn't make sense to me. according to the XR50 docs I start with a coordinate system like: X=right, Y=down, Z=forward. and then I apply a 180 degrees rotation around the z-axis. so now I have: X=left, Y=up, Z=forward (is that correct?). then I negate the y- and z-component. so in my head I'm now flipping the positive y- and z-component to the opposite side, so I end up with: X=left, Y=down, Z=backward. but according to Jakob's comment, this isn't what monado uses, but it does work for the little testing I did. so idk, it works and I'm happy, but if anyone has some clarification, that'd be great | 19:07:41 | |
* although I still don't see how it makes sense in the end. it does work, but it doesn't make sense to me. according to the XR50 docs I start with a coordinate system like: X=right, Y=down, Z=forward. and then I apply a 180 degrees rotation around the z-axis. so now I have: X=left, Y=up, Z=forward (is that correct?). then I negate the y- and z-component. so in my head I'm now flipping the positive y- and z-component to the opposite side, so I end up with: X=left, Y=down, Z=backward. but according to Jakob's comment, this isn't what monado uses, but it does work for the little testing I did. so idk, it works and I'm happy, but if anyone has some clarification, that'd be great | 19:07:47 | |
Redacted or Malformed Event | 23:50:02 | |
25 Sep 2023 | ||
22:48:16 | ||
22:48:25 | ||
26 Sep 2023 | ||
06:38:11 | ||
12:07:35 | ||
28 Sep 2023 | ||
20:02:27 | ||
20:02:39 | ||
1 Oct 2023 | ||
05:09:59 | ||
06:20:20 |