How can I interpret Isometry2 into a tuple: (x, y, rot)

How can I extract Isometry2's fields into (x, y, rot), with x & y for translation, and rot for rotation. All of these are primitive, e.g. f32 or f64.

Hi! If rot is the rotation angle then you can retrieve the data as a tuple using the following:

(iso.translation.vector.x, iso.translation.vector.y, iso.rotation.angle())

In the next version of nalgebra we will add coordinate access to the translation (see https://github.com/rustsim/nalgebra/issues/509) so you will be able to do:

(iso.translation.x, iso.translation.y, iso.rotation.angle())
1 Like