Stuck on a 3D coordinate geometry problem

1. May 11, 2012

yasith

Dear all,

I am a medical doctor stuck with a mathematics problem. I have taken a project to map the 3D movement of a particular bone and describe its motion. My maths knowledge is a bit lacking. However using logic I felt that I would need to track 3 constant markers on the particular bone and use its coordinates at different points in time to map motion.

by using trilateration I managed to map the coordinates at different times.

However I am still stuck and unsure as to how to accurately describe how the bone
1. translates
2. rotates around the 3 axis

how would a physicist/engineer or mathematicians approach such a problem?

Yasith

2. May 12, 2012

chiro

Hey yasith and welcome to the forums.

In physics and computer graphics (and computer games involving 3D gameplay and rendering) we solve this by using hierarchical co-ordinate systems. The mathematics of this involves linear algebra and creating matrices for scaling, rotation and translation and multiplying these together to get the final transformation for each co-ordinate system.

Translations are easy as they are always the same form of matrix. Rotations can be done several ways: one is euler-angles (don't do this), the other is angle-axis rotation and the other final popular method is through what is known as quaternion algebras. You don't have to understand the math, but understand that the axis-angle method works by defining an axis to rotate around and then an angle between 0 and 2pi in radians.

Quaternions are good if you want to take multiple rotations and merge them together in one rotation just in case you are wondering.

Again this is a standard problem in 3D modelling. I can give you more specific information if you need it.

3. May 12, 2012

yasith

The problem I am faced is defining the rotation component of an object given the coordinates of original and end position.

For my particular problem I have a perfect 3D rendered model of a small bone which I have put though its motion and mapped 3 particular topographical markers on it to a 3D coordinate system. Now based on this data I have to calculate the rotational component this bone went though. can you suggest a strategy?

if you were to read this in a scientific journal how would you like this information to be presented?

Yasith

4. May 12, 2012

chiro

In terms of you given a vector in a local system with initial and final points, the way to calculate the angle and the axis of the rotation is to take the cross-product of the normalized initial and final vectors and take the inner-product (dot-product) to get the angle.

We assume that your initial and final point corresponds to a proper rotation in your local system. If we assume the local system has (0,0,0) as its origin then the distance of initial point in local coordinates is the same as final point in local co-ordinates.

If you don't have co-ordinates in local co-ordinates for this system then you have to translate by the negative origin, rotate, and then translate back. Think of this like rotating the moon around the earth where you are given the earth relative to the sun, relative to the earth being 'the sun' for its relative system.

If you have final points in a particular system, you can find the angle by just using a dot-product. If you want to do this for a hierarchical system, then you will probably need to tell me what data you have and the hierarchy of the actual bones you are considering. The idea however is the same to find a rotation: if you have final and initial points, your rotation can be calculated by taking the cross-product to get your rotation axis and dot product to get your angle.

With regards to this being in a scientific journal, I would check with the actual journal for specific submission guidelines as I can't really answer that question.

But if you wanted to write how you extracted the rotation information, then the best way to do this is to reference an external text that proves the cross-product/dot product to extract rotation information from initial and final states.

If you want the intuitive explanation, the intuitive explanation is that the rotation axis is perpendicular to both initial and final vectors which is why you calculate the cross-product. The dot-product is used because it calculates the cosine of the angle when you have normalized vectors. That's the intuitive version and if you want, you can show this graphically in the Appendix of your journal article. You can search google, other journal articles, or online textbooks or websites to get this kind of graphic. The mathematical proof for the perpendicular property is also a very simple proof if you need to include this.

5. May 14, 2012

yasith

mediafire.com/?m62f9do2jgzg6o4

sorry I can't link the image directly yet as I have not reached 10 posts on this forum to attach an image.

point a,b,c are my constant points which I am using to define a set of axis
object of interest which I have circled moves relative to the triangle abc.
the object of interest can translate as well as rotate. and the axis of rotation can also change.

I can get coordinates for as many points as I want from the object of interest.

therefore given this problem

1. I need to describe the translation of the object over time
2. I need to describe its rotation

6. May 14, 2012

yasith

thank you so much for your help chiro.

using my diagram and understanding of my problem can you show me the working for your quoted description?

7. May 14, 2012

chiro

I'm afraid I need more specific information.

If you have only say one bone rotating with respect to something that is constant, then this is easy to do, and the way to describe this as a function of time is to calculate the rotation axis and make the angle change at a specific rate (radians per second).

What I need you to do is to supply me with the number of bones involved from the very end of the final bone all the way to the starting bone where the 'root' of the tree ends.

If you only have say one or two-bones total, then this should be manageable but if you have more, then this is actually not easy, but you can still solve it. The technical area for this kind of problem where you are given a complex bone structure with constraints and you need to say move the end from point A to B is called Inverse Kinematics or IK for short. IK contains all the theory, understanding and algorithms to do this.

The idea is that with IK, if you have given say a complete bone structure for a human being and you want to calculate how all bones change as a function of time (which include translation and rotation) where you move say your hand from A to B and you want everything else but your arms, elbows and hands (and fingers for that hand) to say the same, then you use an IK solver to generate the positions for you.

If you have a complex bone-structure, then I would use an IK system to do it. You can get IK libraries where you specify the bone-structure in a hiearchical tree (root note would correspond to torso, leaf node would correspond to fingers as an example) and you also give it constraints (like for example you can't do crazy things with your elbows unless you have some weird disorder so you say how many angles things can bend).

After you have set this up, you then tell it where it should start in 3D co-ordinates (i.e. the actual bone), where it should end (again in 3D co-ordinates), and then you usually give it a time step which is the delta time parameter and it will generate a list of all 3D positions of all joints for your bones and then you can either just get a print out of the text, or if you have something with graphics, you can output the image (or even a video) of the simulation.

I think you didn't expect this response, but again if you have more than two bones then this is what I would recommend you do.

8. May 14, 2012

chiro

In addition to what I have said above, you should also give me some variables for all of your bones with respect to the points for each joint and the end-points for your final end-bones including the ones you are measuring.

For example you can call the joint positions A,B,C, etc where A is the end-point for bone 1, B is the position that joins bone 1 and 2, C is the position that joins 2 and 3 and so on.

9. May 14, 2012

yasith

to quite simply put there will only be 2 bones involved. One of them will be used to build the reference dimension axis and the other will be the mobile object which we need to describe.

10. May 14, 2012

yasith

I have been looking into the concept of inverse kinematics to apply to this model as you suggested and I can see a few problems.

the anatomical area that I am interested in studying is the carpal bones (small bones at the end of the wrist) which has a multitude of small ligaments attached to them pulling them in complex directions. Thus it does not behave as a simple robotic joint. That is the reason for my scientific interest in mapping this complex motion. First phase is to describe motion and the second phase is to understand the complex ligament mechanics that is responsible for this motion. Second phase at the moment is a very distant objective.

For my problem I feel a more appropriate analogy is the moon circling the earth. If we fix the reference frame at earth given 2 positions of the moon describe its translation and rotation.

11. May 14, 2012

chiro

Well if you are 'translating' the earth and then rotating 'the moon', then the calculation is very straight forward.

You start off by translating the moon and the earth together and then apply a local transformation of the moon relative to the earth using your axis-angle technique.

You have to translate both the moon and the earth together because we assume that the distance between the moon and the earth is constant. If this changes then it means that the distance will shrink or grow to the earth and this is not what happens.

If the earth is fixed and the moon only changes (like say when you curl your funger but your hand doesn't move), then this is simply calculating the angle-axis rotation axis and then calculating the angle using the dot product.

If however the earth and the moon are both moving through space, then this is a little harder. You would use this kind of thing to solve it analytically:

http://www.ryanjuckett.com/programming/animation/16-analytic-two-bone-ik-in-2d

12. May 14, 2012

yasith

i think we are nearly there solving the problem. angle axis method and dot product is going to give the answer. Do you have a link for the working on this? I need to get my head around this concept.

more I think about this problem I feel it may be very simple. Can you suggest a link to the working and the maths behind calculating centre of rotation on a 3D coordinate system?