Geometry (Triangles)

Revision en2, by CrazzyBeer, 2015-07-29 18:30:22

Suppose you have a triangle(x1,y1,x2,y2,x3,y3) and another one (x11,y11,x22,y22,x33,y33) . Coordinates don't come in a specific order.

The question: Can you draw the second triangle by just moving or rotating the first one? You can't detach the triangle from the board. EX: Therefore, using any of this two triangles you can't draw the other one.

So, one way is to compare the area and the angles, but still can't figure out how to deal with the case given above (where the area and the angles are equal, but the answer is still "NO". Maybe it's a special use of signed area formula?

UPD!!! Thanks everyone! Here's how I solved it. 1. Read coords of the first triangle 2. Compute d1 (between point 1 and 2), d2 (2-3), d3 (1-3). 3. Put them in a separate vector. (We suppose that the direction is clockwise) 4. Compute the signed area, if it's less than zero, swap vector[0] with vector[2]. (we took the wrong direction, switch to counter-clockwise).

5-6-7-8. Repeat 1-2-3-4 for the second triangle. 9. Compare all the shifts (either to left or right) of the first vector with the second vector (to check for matches). If it matches — the answer is YES and NO otherwise.

Tags geometry, triangles, area, compare

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
ru5 Russian CrazzyBeer 2015-07-29 18:37:40 2 Мелкая правка: 'е такое.\n1. Читае' -> 'е такое.\n\n1. Читае'
ru4 Russian CrazzyBeer 2015-07-29 18:37:15 10
en4 English CrazzyBeer 2015-07-29 18:36:53 10
ru3 Russian CrazzyBeer 2015-07-29 18:36:24 577
en3 English CrazzyBeer 2015-07-29 18:31:29 20
en2 English CrazzyBeer 2015-07-29 18:30:22 609
ru2 Russian CrazzyBeer 2015-07-29 16:25:48 2 Мелкая правка: 'а доску.\n![ ](htt' -
ru1 Russian CrazzyBeer 2015-07-29 16:25:08 670 Первая редакция перевода на Русский
en1 English CrazzyBeer 2015-07-29 16:19:09 718 Initial revision (published)