question

Serge A avatar image
2 Likes"
Serge A asked Joerg Vogel commented

Vec4 and quaternions

I noticed that FlexSim 2025 documentation mentions new classes, Vec4 and Mat4.

I'm just curious, are you planning to support quaternion math?

It would be really neat if we could use Vec4 to represent and calculate FlexSim rotations.

https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation

FlexSim 24.2.2
quaternionvec4
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Joerg Vogel avatar image Joerg Vogel commented ·

@Serge A, would this not be a case for a Python program call?

0 Likes 0 ·
Serge A avatar image Serge A Joerg Vogel commented ·

The third party libraries for quaternions were already available before Vec4, Boost QVM for C++ or several Python libraries, but it's a huge convenience to have something built in FlexSim. Like Vec3 has dot, cross, project, projectRotation and normalized, they are incredibly useful and many geometric calculations can be done in a relatively simple Flexscript code.

Quaternions can define rotations as an arbitrary 3D axis and an angle, and in some situations it is a more straightforward way than Euler angles used in FlexSim by default (rx, ry, rz). The product of two quaternions also shows what is the effective rotation axis of a combination of two rotations. It's not at all . Conversion from one representation to another is not rocket science, but it's easy to make a mistake. https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles

I don't know what exactly was the motivation to add Vec4 to Flexscript, but it immediately came to my mind that now there is an opportunity to improve geometric capabilities of Flexscript.

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Serge A commented ·
We work with ABB Robots. They use quaternions.
0 Likes 0 ·

0 Answers