How to get the absolute position of a relative object?

  • Thread starter GuillemVS
  • Start date
I don't know if this question suits this forum, I post this here actually because I saw (if not my memory is failing) that here it is also possible to solve math problems.

So, back on track:

I like to discover things from myself, so I searched for the Euler's formula, willing to find the forward of an object. And so I came up with the result that:
forward = (sin(yrot) * cos(xrot), sin(xrot), cos(xrot) * cos(yrot))

So then I wanted to get the absolute from any relative, not just from the forward (0, 0, 1). I thought that I could just simply convert from the forward to a rotation, such as (1,0,0) is (0,pi / 2, 0) in rotation, with the following formula:

xrot = asin(y)
yrot = asin(x / cos(asin(y))

There's no need for zrot since it doesn't change the vector of direction, but the perspective of the object (seen or seeing).
I know that this formula doesn't accurately pass from one and another (because sometimes the resulting rotation might be different for the same forward, so there's no harm in the actual value of the rotation).
So then I thought about adding this rotation to the actual rotation of the parent, in order so that it's like it's facing the child (it's forward now is it's child position). And then afterwards get the forward that would get the absolute position of the child.

But it didn't work, I don't know if I did something wrong, or if I thought of something that's not actually true or that this couldn't work in the first place.

I would like to know, may I ask, how can I do that and where did I misunderstood or misthought (is that a word?) about what I'm saying.

Thank you in advance.
 

fresh_42

Mentor
Insights Author
2018 Award
11,153
7,655
Hello and :welcome: !

It is hard to parse what you want to know. What is a forward? I mean, except of a football position. Maybe you should start and say what you want to do, what you have, and where you want to end up. Obviously you have a kind of coordinate system. Which one? And which dimension? I read x and y, but also points with three coordinates.
 
Hello and :welcome: !

It is hard to parse what you want to know. What is a forward? I mean, except of a football position. Maybe you should start and say what you want to do, what you have, and where you want to end up. Obviously you have a kind of coordinate system. Which one? And which dimension? I read x and y, but also points with three coordinates.
Hello, and thank you!

A forward is a direction vector of an object. For example:
If an object has this rotation (0,0,0) the forward will be (0,0,1) and the right will be (1,0,0).

We can understand the forward as a child element that is in (0,0,1) position relative to the parent, that when the parent rotates (and the child with it) we get the absolute position of the child and we get the forward vector of the parent. For example:
If the parent has this rotation (0,pi / 2, 0) the forward will be (1,0,0) and the right will be (0,0,-1).

What I wanted to do, is not only to get the forward (where child position is (0,0,1)) I want to get any absolute position of a child, not only forward or right.

So, as I explained before, I thought about passing from the child position to a rotation of the parent (such as (1,0,0) is (0,pi / 2,0)) and then adding it to the actual parent rotation (so that if the parent was looking at (0,0,0) now is at (0,pi / 2,0)) now the parent forward should/would be the position of the child (if we get the forward now from (0, pi / 2, 0) we get that the position absolute of the child is (1,0,0), in this example the parent rotation wasn't changed in the beginning, that's why the right (this vector) stays the same).

But I don't know why it didn't work, and I want to get a clue about it.
 

jbriggs444

Science Advisor
Homework Helper
7,512
2,564
If an object has this rotation (0,0,0) the forward will be (0,0,1) and the right will be (1,0,0).
Please slow down and start over.

An object has an "orientation", not a "rotation". That orientation can be expressed as a three-tuple in a variety of ways. One common way would be (roll, pitch, yaw). What scheme do you have in mind?
 
Please slow down and start over.

An object has an "orientation", not a "rotation". That orientation can be expressed as a three-tuple in a variety of ways. One common way would be (roll, pitch, yaw). What scheme do you have in mind?
Sorry! I'm supposing that you are supposing things that you can't.

So, (roll, pitch, yaw) we could say that they change these axis in this order (z, y, x). What I'm using right now is (x, y, z) the changing of axis.
I have been working with 3D Engines and that's why I use the word rotation (it's the term used) and the orientation is usually expressed as Quaternion that we define using Eulers(x, y, z).

Also when I talk about the forward and the right are just Vectors of position, not any rotation/orientation.

First post, I will need to be more precise in the future ^^
 

Want to reply to this thread?

"How to get the absolute position of a relative object?" You must log in or register to reply here.

Related Threads for: How to get the absolute position of a relative object?

Replies
4
Views
10K
S
Replies
10
Views
546
Replies
3
Views
526
Replies
3
Views
16K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving

Hot Threads

Top