1
$\begingroup$

I need to draw a triangle like an arrow in the middle of the line. How can I calculate triangle's coordinates in order to draw it in the middle of the line PLEASE?

enter image description here

** UPDATE **

Here I have found out how to find the middle of the line, so now I have a coordinate for one of three vertices of the triangle. I need to calculate coordinates of other two vertices.

  • 0
    @Nicolas. Let's say I need a triangle of 2cm of each sides. Could you propose me any formula for that please?2011-06-07

1 Answers 1

2

First start with a triangle of the size you want, say directed to the right. The three corners are then $(0,0), (x_0,y_0), (x_0,-y_0)$ where $x_0 \lt 0$. You just multiply these by the rotation matrix $\left(\begin {array}{c c}\cos \theta & \sin \theta \\ -\sin \theta & \cos \theta \end{array}\right)\left(\begin {array}{c}x_0 \\ y_0 \end{array}\right)$ to get each point relative to the head of your arrow. To get $\theta$ you need the angle of your line. How is that represented?

  • 0
    @Ross. I have solved the problem. Thanks a lot.2011-06-07