How to find the vertices of a trinagle given points on the triangle?

I have been given 6 points where 2 points define a side of the trianglee. how can I obtain the vertices of triangle?

Answers (2)

Meaning the 6 points consist of duplicates of the vertices? If so, this looks applicable

5 Comments

With reference to the image, I have red co-ordinates and I have to find the co-ords of a,b,c.
"red co-ordinates" is not universally understood terminology, I don't believe...
I assume a,b,c denote the vertices.
I was just telling it for an example. My problem is this, I am given the co-ordinates of red points...each side of the triangle has two red points. Using these , I have to find co-ordinates of a,b and c.
Are the red points located at the vertices or just at arbitrary locations on the edges? Do you know which pairs of red points belong to the same edge of the triangle?
yes! red points ar enot locate don the vertices , but on the sides of the triangle.Every side of the triangle will pass through the red points. One side has two red points, so d whole triangle will have six red points. Using these red points, I have to create the lines, and then form a triangle and find the vertices.

Sign in to comment.

If S is a 6x2 matrix such that each pair of consecutive rows S(i,:) and S(i+1,:) are points on one side of the triangle, then you can use qlcon2vert ( Available Here ) as follows,
x0=mean(S).'; %interior point
A=[S(2,:)-S(1,:); S(4,:)-S(3,:); S(6,:)-S(5,:)]*[0 -1; 1 0];
b=sum(A.*S(1:2:end,:),2);
D=diag(sign(b-A*x0));
A=D*A; b=D*b;
Vertices=qlcon2vert(x0,A,b)

3 Comments

Hey..thank you for your reply!I am getting an error on matrix dimensions What about this code:
if true
% code
for i = 1 : 3
[xp] = input('enter the value of 1st co-ord');
[yp] = input('enter the value of 2nd co=ord');
%for a and b:
yp(1) = xp(2); xp(2) = yp(1);
a = (yp(2)-yp(1)) / (xp(2)-xp(1)); b = yp(1)-a*xp(1); %y = a*x + b; xlims = [0 15]; ylims = [0 15];
y = xlims*a+b; z = line( xlims, y );
xlim(xlims); ylim(ylims);
i = i+1; end end end I uderstand tht there is a mathematical error wwhich I'll rectify. But the main problem is the lines ar enot geting plotted properly! please help
I cannot read it. To use the
button properly, highlight the code first and then click the button.
This is the code which I have written. Ignore the mathematical error. I am not able to plot the triangle and obtain the vertices
for i = 1 : 3
[xp] = input('enter the value of 1st co-ord');
[yp] = input('enter the value of 2nd co=ord');
%for a and b:
yp(1) = xp(2); xp(2) = yp(1);
a = (yp(2)-yp(1)) / (xp(2)-xp(1));
b = yp(1)-a*xp(1);
%y = a*x + b;
xlims = [0 15];
ylims = [0 15];
y = xlims*a+b;
z = line( xlims, y );
xlim(xlims); ylim(ylims);
end

Sign in to comment.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Asked:

on 28 May 2014

Commented:

on 29 May 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!