开发者

3D: write function to find configuration of a triangle

开发者 https://www.devze.com 2022-12-18 09:21 出处:网络
In 3D space, given P1 and P2, and two links attached end to end with lengths L1 and L2 respectively, link1 starts at P1. Write a function that finds the configurations of the links that put the开发

3D: write function to find configuration of a triangle

In 3D space, given P1 and P2, and two links attached end to end with lengths L1 and L2 respectively, link1 starts at P1. Write a function that finds the configurations of the links that put the开发者_JAVA技巧 2nd link’s end at point P1. I dunno where to start... What exactly "link configuration" should be (as output): A vector (like 2i -3j+5k)? Or a point coordinate of the joint point or what..?

My thought is that there is infinite number of solutions in 3D, and 2 solutions in 2D, and I am trying to one of them for the 1st step for 3D.

Given P1 (x1,y1,z1), P2 (x2,y2,z2), L1 and L2, all I can think of is: convert to a new coordinate system (not sure how though) such that P1 becomes (0,0,0) and P2 becomes (d,0,0) where d = distance(P1, P2). Now we reduce it to a 2D problem where we need to find P3 (x, y, 0) in the new coordinate system, such that P3 is L1 from (0,0,0), and L2 from (d,0,0).

I think we can find exactly two solutions of P3 (x3, +/-y3) as we fix z to 0. And then, I need to convert it back to the original coordinate system...and z coordinate should kick in...but I have no clue about how.


Sounds like you're looking for a point P that's distance L1 away from P1 and distance L2 away from P2.

The solutions to this in n-dimensions are intersections of the n-sphere center P1 radius L1 and the n-sphere center P2 radius L2.

Here's the solution to this problem in 3d: http://mathworld.wolfram.com/Sphere-SphereIntersection.html

In 3d, there will be either 1 solution (when the spheres just touch), solutions that form a circle (center on the line between P1 and P2), or no solution (when L1 + L2 is smaller than the distance between P1 and P2.

0

精彩评论

暂无评论...
验证码 换一张
取 消