Question: Consider I have 2 points.

QPoint(100,100)
QPoint(200,200)

Now, I need to draw a pointed arrow at the end of line QPoint(200,200).

How can I get the points of the arrow coordinates since the line is in inclined angle? The arrow should be like given below.

[![enter image description here](https://i.stack.imgur.com/0l39d.png)](https://i.stack.imgur.com/0l39d.png)

As this is more a general question, Im tagging on pyqt5 and css.

Answer: 
You need to calculate the slope of your line, which will let you find a point on the line a given distance from your endpoint. You can then build a a new line perpendicular to the original line that goes through the point. The ends of the arrows should lie on that line a given distance from the original. It's easier to show than explain:

```js
function draw(point1, point2, distance, length) {
  // slope is dx/dy
  let dx = point2[0] - point1[0]
  let dy = point2[1] - point1[1]
  let v_norm = Math.sqrt(dx ** 2 + dy ** 2)

  // point on line at distance
  let point_on_line = [point2[0] - distance * dx / v_norm, point2[1] - distance * dy / v_norm]

  // endpoints of arrows at length above point (the distance from the original line
  let point_below = [point_on_line[0] - length * -dy / v_norm, point_on_line[1] - length * dx / v_norm, ]
  let point_above = [point_on_line[0] + length * -dy / v_norm, point_on_line[1] + length * dx / v_norm, ]

  var canvas = document.getElementById('canvas');
  var ctx = canvas.getContext('2d');

  ctx.beginPath();
  ctx.moveTo(...point1);
  ctx.lineTo(...point2);
  ctx.moveTo(...point_above)
  ctx.lineTo(...point2)
  ctx.lineTo(...point_below)
  ctx.stroke();
}

draw([100, 100], [200, 150], 20, 10)
draw([100, 100], [300, 150], 20, 10)
draw([100, 100], [150, 10], 20, 10)
draw([100, 100], [90, 150], 20, 10)
draw([100, 100], [200, 100], 20, 10)
draw([100, 100], [5, 10], 20, 10)
```

```html
<canvas id="canvas" width='500' height='500'></canvas>
```

You can alter the shape of the arrows using `distance` and `length`
If we have a look at the points we need (U and D needed, S and E given):

```
      U
     /|
   /  |    
S---------------------E
   \  |
     \|
      D

```

We actually have to go back from S to E, then we turn by 90 degrees and walk up the same length. If we take the direction between S and E (represented as Vectors):

```
d = E - S

```

Then we can get the distance to walk back:

```
b = -d / 4

```

And then to walk up in a 90 degree angle, we just swap x and y, to go down we just take the negative one:

```
u = [b.y, b.x]
d = -u

```

So we can finally get our points as:

```
U = S + b + u
D = S + b + d

```

*(The code above is pseudocode as you wanted a general solution)*