Hello, I'm trying to find an optimal solution for a problem I'm having. I'm looking for 3D solution.
I'm trying to convert a Point from world coordinates to the local coordinates of a specific Object, so that when the Object rotates/changes position, I would still be able to find new coordinate for the Point, that would be have the same relation (position/rotation) to the Object as during the initial state.
I have the Forward, Right, Up vector of this Object; its position in world coordinates as well as the position of the Point in world coordinates.
I was thinking I could get the difference in angles between the vector from Object's origin to Point's origin and the Forward vector of the Object, and then rotate by this difference from the Forward vector backwards to get the direction of the desired vector, but that is unreliable. So I'm assuming I will have to use some transformation Matrix for this.
What are the maths for my exact situation, where I'd be using a custom axis (the Forward vector of my object) and to do the conversion from world to local coordinates?
Do you have some sort of digital elevation model data set with elevation associated with a geographic coordinate system?
That would be the first thing to look for. Free data of that sort is not very widespread.
I would, because many years ago I had some training with this software, start at https://grass.osgeo.org/ as the pure SAS solutions in SAS/GIS require additional license.
GIS software for 3d spatial problems generally.
Hello @squad4 and welcome to the SAS Support Communities!
@squad4 wrote:
(...) I have the Forward, Right, Up vector of this Object; its position in world coordinates as well as the position of the Point in world coordinates. (...)
What are the maths ... to do the conversion from world to local coordinates?
So your "local coordinates" are defined by three (column) vectors f ("forward"), r ("right") and u ("up") forming an orthonormal basis of R³ and a vector c to the origin of the object's coordinate system. Then the transformation from local to "world coordinates" is easy: If x is a vector ("point") in local coordinates, use the transformation matrix T:=(f, r, u) and the translation vector c to obtain the corresponding vector x in world coordinates: x = Tx + c.
Now the inverse transformation, i.e. from world to local coordinates, is not difficult either: Remembering that the inverse of an orthogonal matrix (such as T) is just its transpose (T'), we obtain
x = T'(x-c)
When the object "rotates/changes position," matrix T and vector c change correspondingly.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.