当长度不相等时如何找到三角形的第三个顶点

时间:2019-06-03 12:22:18

标签: geometry triangulation

我有两个三角形的顶点,并且长度不相等。如何找到第三个顶点?Reference

2 个答案:

答案 0 :(得分:1)

function [vertex_1a, vertex_1b] = third_vertex(x2, y2, x3, y3, d1, d3)

   d2 = sqrt((x3 - x2)^2 + (y3 - y2)^2); % distance between vertex 2 and 3

   % Orthogonal projection of side 12 onto side 23, calculated unsing 
   % the Law of cosines:
   k = (d2^2 + d1^2 - d3^2) / (2*d2);   
   % height from vertex 1 to side 23 calculated by Pythagoras' theorem:
   h = sqrt(d1^2 - k^2);

   % calculating the output: the coordinates of vertex 1, there are two solutions: 
   vertex_1a(1) = x2 + (k/d2)*(x3 - x2) - (h/d2)*(y3 - y2); 
   vertex_1a(2) = y2 + (k/d2)*(y3 - y2) + (h/d2)*(x3 - x2);

   vertex_1b(1) = x2 + (k/d2)*(x3 - x2) + (h/d2)*(y3 - y2); 
   vertex_1b(2) = y2 + (k/d2)*(y3 - y2) - (h/d2)*(x3 - x2);

end

答案 1 :(得分:1)

平移所有点,以使P2成为原点。

那你解决

x² + y² = d2²
(x - x3)² + (y - y3)² = d3²

(请注意d1的重新编号)。

通过将两个方程式相减

(2x - x3).x3 + (2y - y3).y3 = d2² - d3²

是线性方程,形式为

a.x + b.y + c = 0

以参数形式

x = x0 + b.t
y = y0 - a.t

其中(x0, y0)是任意解决方案,例如(- ac / (a² + b²), - bc / (a² + b²))

现在求解t中的二次方程式

(x0 + b.t)² + (y0 - a.t)² = d2²

给出两种解决方案,并撤消初始翻译。