## discord-algorithms-and-math | 961 Members | |

Bridged room for #algorithms-and-math on the Monado discord | 5 Servers |

Sender | Message | Time |
---|---|---|

22 Sep 2023 | ||

fredinfinite23 changed their display name from fredinfinite23#0 to fredinfinite23. | 17:45:27 | |

23 Sep 2023 | ||

418cat#0 changed their display name from 418cat to 418cat#0. | 18:16:37 | |

24 Sep 2023 | ||

6ax3dc | 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 |

6ax3dc | oh I think the answer is negating the x, y, and z components of the quaternion ðŸ¤” | 12:25:27 |

zappar_simon | 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 |

6ax3dc | 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 |

6ax3dc | * 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 |

stikmann | What are the two coordinate systems? Because the answer depends on that. | 14:17:23 |

stikmann | 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 |

stikmann | * 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 |

stikmann | * 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 |

stikmann | By the way, you cannot convert between different handed systems with just rotations, because you also need to mirror the system. | 14:21:34 |

6ax3dc | 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 |

def(not_onion) | Guys what is this channel good for | 15:36:20 |

niko_20010 | questions about XR (AR/VR/MR) related algorithms and math problems | 15:54:04 |

bornecrantz | 6ax3dc Yeah x right, y down, and z forward is the standard OpenCV coordinate system. | 16:19:16 |

bornecrantz | * 6ax3dc Yeah x right, y down, and z forward is the standard OpenCV coordinate system. | 16:19:24 |

.pblack | 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 |

6ax3dc | 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 |

6ax3dc | 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 |

6ax3dc | * 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 |

stikmann | Redacted or Malformed Event | 23:50:02 |

25 Sep 2023 | ||

mrsnippy changed their display name from MRSNIPPY to mrsnippy#0. | 22:48:16 | |

mrsnippy changed their display name from mrsnippy#0 to mrsnippy. | 22:48:25 | |

26 Sep 2023 | ||

electrolisa#0 changed their display name from electrolisa to electrolisa#0. | 06:38:11 | |

rinlovesyou#0 changed their profile picture. | 12:07:35 | |

28 Sep 2023 | ||

autumnaurelium#0 changed their display name from aurelium to autumnaurelium#0. | 20:02:27 | |

autumnaurelium#0 changed their profile picture. | 20:02:39 | |

1 Oct 2023 | ||

bonts#0 changed their display name from Bonts to bonts#0. | 05:09:59 | |

disso_peach#0 changed their display name from dissociative Peach to disso_peach#0. | 06:20:20 |

Back to Room ListRoom Version: 9