How to get the absolute position of a relative object?

In summary, the conversation is about a person trying to understand how to calculate the absolute position of a child object in relation to a parent object. They mention using Euler's formula to find the forward direction of an object and then trying to convert from the forward to a rotation. They also mention trying to add this rotation to the parent's actual rotation in order to face the child, but it didn't work and they are looking for a clue as to where they went wrong. They mention the Frenet Serret equations as a possible solution but need more time to look into it.
  • #1
GuillemVS
12
1
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.
 
Mathematics news on Phys.org
  • #2
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.
 
  • #4
fresh_42 said:
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.
 
  • #5
  • #6
GuillemVS said:
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?
 
  • #7
jbriggs444 said:
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 ^^
 

1. How do you define an absolute position for a relative object?

The absolute position of a relative object is defined by its distance from a fixed point of reference, usually the top left corner of the page or its containing element. This position is not affected by the position of other elements on the page.

2. Can an element have both relative and absolute positioning?

Yes, an element can have both relative and absolute positioning. This is known as "position: relative" and allows the element to be positioned relative to its normal position in the document flow.

3. How do you get the absolute position of a relative object using CSS?

To get the absolute position of a relative object using CSS, you can use the "top", "right", "bottom", and "left" properties. These properties specify the distance from the top, right, bottom, and left edges of the element's containing element respectively.

4. How do you get the absolute position of a relative object using JavaScript?

To get the absolute position of a relative object using JavaScript, you can use the "offsetTop" and "offsetLeft" properties. These properties return the distance from the top and left edges of the element's offset parent, which is the closest ancestor element with a position other than "static".

5. How does the concept of stacking context affect the absolute position of a relative object?

The concept of stacking context can affect the absolute position of a relative object. If an element has a z-index value other than "auto", it creates a new stacking context. This means that the element will be positioned relative to other elements within its stacking context, rather than the page as a whole.

Similar threads

Replies
7
Views
1K
Replies
3
Views
1K
Replies
4
Views
210
Replies
4
Views
1K
Replies
1
Views
1K
Replies
7
Views
1K
  • Advanced Physics Homework Help
Replies
4
Views
436
  • Classical Physics
Replies
16
Views
1K
  • General Math
Replies
5
Views
950
Back
Top