2D problem: I measure the position of the 3 ends of a triangle in a cartesian system. Now i move the system (triangle) to another cartesian system and measure the position of just two ends. How can I identify the location of the 3rd end based on this data?
thanks! (an开发者_如何学Cd sorry for the bad english as a second angle)
This question is from 8 years ago, but even though it is a little vague, I think it could be answered fairly concisely, and if I have come across it then maybe someone else will come across it and gain some benefit from an actual real answer rather than the one which was accepted. (I apologize for accidentally upvoting the accepted "answer". I had originally downvoted it, but realized that the question was actually a bit vague and tried to reverse my downvote. Sadly, because of my noob rep, that seems to have translated into an actual upvote. It didn't deserve the downvote, but it didn't deserve an upvote, either.)
Lead-Up
So, lets say you have a simple cartesian grid, or reference frame:
And within that 10x10 reference frame you have a triangle object:
I failed to lable the images, but the (a, b, c) co-ordinates of this triangle are obviously a=(0,0), b=(0,4), and c=(4,0).
Now let's say that we move that triangle within our cartesian reference frame (grid):
We've moved the triangle x=x+1 and y=y+1, therefore, given that the new co-ordinates of "b" and "c" are b=(1,5) and c=(5,1), what is "a"?
It's pretty obvious that "a" would be (1,1), but looking at the math we can see that
Δb=b2-b1
Δb=(x2,y2)-(x1,y1)
Δb=(1,5)-(0,4)
Δb=(1-0, 5-4)
∴Δb=(1,1) or (+1,+1)
If we do the same for the two "c" co-ordinates we arrive at the same answer, Δc also equals (1,1), therefore it's a translation (a linear movement) and not a rotation, which means that Δa is also (1,1)! So:
a2=a1+Δa
a2=(0,0)+(+1,+1)
a2=(0+1,0+1)∴
∴a2=(1,1)
And if you take a look at the image you can clearly see that the new position of "a" is at (1,1).
Translation
But that's just the lead-up. Your question was in converting from one cartesian reference frame to another. Consider that your 10x10 reference frame is within a larger reference frame:
We can call your 10x10 grid a "local" reference frame, and it exists within maybe a "global" reference frame. There may actually be a number of other "local" reference frames within this global reference frame:
But to keep it simple, of course we're going to just consider one cartesian reference frame within another:
Now we need to translate that "local" reference frame within the "global" reference frame:
So, "locally", the (a,b,c) co-ordinates of our triangle are still {(0,0),(0,4),(4,0)}, but the origin of our local reference frame is not aligned with the origin of the global reference frame! Our local reference frame has shifted (+3.5,+1.5)!
Now what's the position of our triangle?!
You basically approach it the same way. The relative position of our "local" reference frame is (+3.5,+1.5), which we will call Δf for difference in frames, therefore the triangle relative to the global origin will be ag=al+Δf, bg=bl+Δf, and cg=cl+Δf, where (ag,bg,cg) are the co-ordinates within the global reference frame and (al,bl,cl) are co-ordinates within the local reference frame.
Three-Dimensional Cartesian System
It's exactly the same, you just include the third "z" co-ordinate to the position of the triangle.
Rotation
One of the assumptions I'm making from your original question is that you were actually asking about translation and were not interested in rotation at the time that you asked this question 8 years ago.
Very quickly, however, you need to use trig in order to rotate your 2d object within your reference frame, so you need to first determine from where you're rotating your object, which we call a rotational axis. Then, once you decide where the rotational axis is, recalculate the (x,y) for each of the three points in your triangle:
x = r · cos θ
y = r · sin θ
where θ is the angle at which we're rotating the object, "r" is the distance of that point from the axis of rotation, and "·" just means multiplication.
So, if we were to rotate our triangle 30° counter clockwise around piont "a" it may look similar to this:
But, again, that wasn't your question. Your questions was, "given the locations of two of the points, determine the position of the third".
Without any explanation whatsoever, only because I don't think you were asking about rotation, what you do is you work backwards:
if x = r · cos θ, then θ = arccos(x/r)
Now you have the angle of rotation which you can now apply to the original position of the missing point to find its (x,y) and, as with our original translational example, also works from one cartesian reference frame to another. Meaning, that if your "local" reference frame rotates within the global reference frame, even though it appears that nothing has changed within your local frame, you can plot the locations of the points of your objects within the global frame.
And, again, that also works for 3D reference frames, as well.
And finally, if your cartesian local reference frame is both translated and rotated, which it almost certainly is, then you would apply both methods to plot your points onto the other (global?) cartesian reference frame.
Real-World Application
Oh, so many! Our brains do this so intuitively every day when we're driving or walking down the street that I don't know where to begin!
Translation is easy, but rotation gets a little hairy when crossing axes. One trick to make things easier is to translate the object from one frame of reference to another in order to make the trig more straight-forward.
Telling the story in pictures:
And that's just the start...
I hope that helps.
This is a pretty vague question, but if I'm reading it right, then you need even less information than that. If you have the transformation of the first coordinate system to the second, then apply that to each of the three points to find each of the 3 equivalent points.
Otherwise, if you don't have the transformation, I would think it's impossible. After all, an infinite number of possible transformations of a coordinate system can result in the same two locations of two points yet different locations of the third.
精彩评论