tags:

views:

290

answers:

1

Hello

Is there a way in Matlab to find the 4h vertice of a parallelogram when other 3 are known ?

I would like to draw a rotated reactangle with mouse but Matlab doesn't allow it, so I decided to put 3 points and find 4th one automatically and by impoly function draw a

h1=impoint();
h2=impoint();
h3=impoint();

p1 = getPosition(h);
p2 = getPosition(h2);
p3 = getPosition(h3);
%p4=help needed here
impoly(gca,[p1 ; p2  ; p3  ;p4y])

Thanks

+3  A: 

One problem you face is that there is an ambiguity. Simple vector addition will find you a fourth point, but it might not be the fourth point you want.

Do you have:

    *----*  
     \    \  
      \    \  
       *----+

or

    *----*
   /    /
  /    /
 +----*

or

      +
      ||
     /  \
    *    *
     \  /
      ||
       *

That said. Assume that you have parallelogram ABCD, and that you know you have verticies ABC, then you can find D by noting that \vec{BD} = \vec{BA} + \vec{BC}.

dmckee
thanx.how can I get the vec{BA} by knowing A,B,C coordinates.just by subtracting Ax,Bx and Ay,By ?
tguclu
"just by subtracting Ax,Bx and Ay,By" Yes. Sorry that I don't know matlab syntax, btw.
dmckee

related questions