b****r 发帖数: 1272 | 1 In 3D, 给定P1,P2坐标,和两个相连线段,长度分别为L1,L2,已知其中一个线段头在P1点。现在要
把另外那个线段的尾放在P2点,要求写一个FUNCTION返回这两个线段的向量表达式。
交点的通解应该在一个圆上。题目说,至少给定一组有效解。3D编程大牛给讲讲,谢了。 | L****t 发帖数: 924 | 2 p1+v_1L1 + v_2L2 = p2 ?
P1点。现在要
了。
【在 b****r 的大作中提到】 : In 3D, 给定P1,P2坐标,和两个相连线段,长度分别为L1,L2,已知其中一个线段头在P1点。现在要 : 把另外那个线段的尾放在P2点,要求写一个FUNCTION返回这两个线段的向量表达式。 : 交点的通解应该在一个圆上。题目说,至少给定一组有效解。3D编程大牛给讲讲,谢了。
| c*****o 发帖数: 178 | 3 是不是以P2为圆心,L2为半径的一个圆球和以P1为园心,L1为半径的一个圆球的交集啊
,是一个圆。 | c**********e 发帖数: 2007 | 4
Yes.
If P is any point on 萧十一姐's circle, then we have
|P-P1| = l_1, or |P-P1|^2 = l_1^2. ... ... (1)
|P-P2| = l_2, or |P-P2|^2 = l_2^2. ... ... (2)
The difference of the two is
(P2-P1)*(2P-P1-P2)=l_1^2-l_2^2. ... ... (3)
The circle is in the plane (3).
【在 c*****o 的大作中提到】 : 是不是以P2为圆心,L2为半径的一个圆球和以P1为园心,L1为半径的一个圆球的交集啊 : ,是一个圆。
| c**********e 发帖数: 2007 | 5 For programming purpose, let us decide the circle's center C,
radius r, and radius vector.
Look at the triangle PP_1P_2, where P is any point on the target
circle. The 3sides are
a = l_1
b = l_2
c = |P_1-P_2|, where |.| means distance
denote s=(a+b+c)/2.
Then the area of triangle: ea=sqrt(s*(s-a)*(s-b)*(s-c)).
The height of the triangle is the radius of the circle:
r = h = 2*area/c
The distance d=|P_1-O|=sqrt(l_1^2-r^2).
So C = P_1 + P_1 + d*(P_2-P_1)/|P_2-P_1|
So P = C + r*v1 where v is any uni |
|