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.
Hello,
I was having the same sort of issue using your solution i was able to get the result, but using this formula i was only able to calculate the position of the point, how to calculate the orientation of the point ?
Hello @Nikitha_K and welcome to the SAS Support Communities!
If the determinant, det T, of the transformation matrix T is positive, the basis f, r, u of R³ has the same orientation as the canonical basis e1 = (1, 0, 0)', e2 = (0, 1, 0)', e3 = (0, 0, 1)' (defining the world coordinate system). If det T < 0, the two orientations are different. (Remember that R³ has only two orientations.)
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: