Skip to content
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

distance between 2 dual quaternion #7

Open
romainVala opened this issue Mar 31, 2021 · 3 comments
Open

distance between 2 dual quaternion #7

romainVala opened this issue Mar 31, 2021 · 3 comments

Comments

@romainVala
Copy link

romainVala commented Mar 31, 2021

Hello

First thanks a lot for this nice code,
I could not find a solution to compute the axis postion of the rotations, and then I realize one should use dual quaternion and I found your code, with the nice .screw method !

this is not really an issue, but I am just seeking for advise.
how would you define a distance between 2 quaternions ?

Many thanks

@Achllle
Copy link
Owner

Achllle commented Mar 31, 2021

Distance can mean several different things so the answer depends on what you're trying to achieve. It can help to dive into manifold theory a little bit here. A manifold can be endowed with a metric, for example you can use any norm (for Euclidean space think the 2-norm, 1-norm, infinity-norm, ...) and it will be a valid metric and thus distance. That will allow you to ask questions like 'what's the distance between these points on the manifold?'. The code in this repo has 3 such norms defined that all yield different distances. You can also come up with your own distance function. In robotics when we talk about the distance between two points, we often treat translation and rotation separately, with translation being the 2-norm of the translation components (the Euclidean distance).

Any rigid displacement can be written as a screw motion, illustrated by the animation in the main readme. You could define distance between two poses as the length of the screw axis and the angle required to rotate around them. Dual quaternions just happen to have a direct relation with screw parameters, unlike homogeneous transformation matrices or most other representations.
Hope that helps. There are some references that I'd recommend starting with to understand DQs better.

@romainVala
Copy link
Author

Hi
thanks for your helps,

I do not see any distance function in your code ... what are the 3 norms your mention ?

If I may develop a little bit here is the context:
I am working with brain MRI acquisition, and I want to simulate head motion durion the acquisition context. I also have a lot a head motion measurement which I would like to summarize/synthetise in order to use realistic motion in my simulation. I hope having a proper distance would help (for instance to try some clustering)
two transform are close, if they induce a similar displacement field amplitude in the object. So having only rotation angle and translation distance is not enough, the position of the screw axis is also of particular importance. I could try defining the metric from those different quantity (angle distance, axis distance to the origin), but may be there is a way directly from the dual_quaternion ... ?

An other related question, is to quantify the motion severity : The best ground truth for it is the displacement field in each voxel (points of my 3D grid) (note that the direction is not that important, just the amplitude matter) but it is very long and intensive to compute, so I would like a way to approximate it from the dual quaternion, if possible
So for this point, the question is not the distance between 2 transforms but the distance between 2 object position (induced by a given transform)

I greatly appreciate any insights
many thanks

@Achllle
Copy link
Owner

Achllle commented Apr 8, 2021

So having only rotation angle and translation distance is not enough, the position of the screw axis is also of particular importance. I could try defining the metric from those different quantity (angle distance, axis distance to the origin), but may be there is a way directly from the dual_quaternion ... ?

It sounds like you are looking for screw parameters. You can use the Plucker line coordinates, the distance along that line, and the rotation angle to cluster different rigid body motions. You could also use the dual quaternion that describes the motion from one pose to another like that, assuming you implement the correct group actions (if you don't know what this means, I recommend reading A Micro Lie Theory for a good intro).

distance between 2 object position (induced by a given transform)

You want the x, y, z difference between poses? Use translation

is how to compute the mean rigid transformation between n dual_quaternion
there is also different work on this topic (at least for rotation ), and it seems also that there are different solution.

There are different ways to do this indeed with each option having different properties. This is the exact same thing as defining a distance function. There are several ways to define them and you get to pick what you need for your application. See for example The second reference in the list of references (Kavan et al., Skinning with dual quaternions).
You're looking for ScLERP which is the extension to slerp for quaternions. Just set the parameter t to 0.5. Other ways to do it with different properties are nlerp and dlb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants