Mahamutha M
Mahamutha M

Reputation: 1287

How to find the third vertices of a triangle when lengths are unequal

I have two vertices of a triangle and the lengths are unequal. How to find the third vertex?Reference

Upvotes: 1

Views: 1115

Answers (2)

user1196549
user1196549

Reputation:

Translate all points so that P2 becomes the origin.

Then you solve

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

(mind the renumbering of d1).

By subtraction of the two equations,

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

which is a linear equation, of the form

a.x + b.y + c = 0

and in parametric form

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

where (x0, y0) is an arbitrary solution, for instance (- ac / (a² + b²), - bc / (a² + b²)).

Now solve the quadratic equation in t

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

which gives two solutions, and undo the initial translation.

Upvotes: 1

Futurologist
Futurologist

Reputation: 1914

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

Upvotes: 0

Related Questions