• 12
• 10
• 10
• 13
• 10

# Angles between two vectors in 3D space

This topic is 2891 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Please take a look at this picture I have two parts connected by a 'joint' in 3D space. Imagine part 1 is your right hand, part 2 is your right shoulder bone and the joint is your right shoulder socket. You can rotate your right hand freely in 3D space. I believe the two lines are related by two angles. What's the best and the fastest way to measure those two angles? If line 1 is moved to a new position in space, line 2 should also be moved accordingly, keeping those angles constant. How do I go about that?

##### Share on other sites
What does this:
Quote:
 I have two parts connected by a 'joint' in 3D space. Imagine part 1 is your right hand, part 2 is your right shoulder bone and the joint is your right shoulder socket. You can rotate your right hand freely in 3D space.

have to do with this:
Quote:
 believe the two lines are related by two angles.

And what two angles are you talking about?

Quote:
 If line 1 is moved to a new position in space, line 2 should also be moved accordingly, keeping those angles constant.How do I go about that?

Move line 2 with the same amount. But I'm quite sure that's not what you mean, are you trying to get line 2 out of line 1 with just an angle value?

##### Share on other sites
Stick figure of a person standing

This picture might make you understand better.

Initially, body part 1-4 is orthogonal to 1-2. If I change it to 180 degrees (raising your hand), the locations of 4-6 and 6-8 should also change, while preserving their current angles.

In a nutshell, if I move 1-4 to any position, the rest of the hand should follow accordingly

The same goes for the legs. If I raise the legs, the feet should follow suit.

##### Share on other sites
In order to achieve that you need a tree of transformations. What you'd get is something like this:

Shoulder     |Upper arm     |Lower arm     |    Hand    /  |Thumb  Index finger

First you transform the shoulder, then you multiply that transformation with the upper arm transformation, which should be relative to the shoulder, and then you take that transformation and multiply that with the lower arm transformation and this goes on till you reach the fingers. By rotating the shoulder now(or any other limb), all the other limbs that 'follow' will rotate as well and keep their position relative to the rotated limb.

##### Share on other sites
Thanks.
I have no problem with body part tree.

I'm just stuck in the transformation part. I have no clue how to measure the relative angle(s) between two body parts and how to transform the body parts to new locations while preserving their relative angle(s)

##### Share on other sites
Why would you want to measure the angle? Lets say you start out with a stretched out arm, every angle relative to their parent limb is 0 degrees(or 180 degrees, depends on how you look at it). If you rotate the the parent limb, all child limbs will still have an angle of 0 degrees relative to that parent. If you transform the way I described in my previous post that is.

##### Share on other sites
Well the pose in the picture is just an example. Actually the posture is arbitrary (sitting, standing, running.. etc). So you have to know the angles.

The hands may not necessarily be all stretched out 180'

##### Share on other sites
So what is it that you are trying to do? Are you trying to animate the body?

Yes