P
P
Praud2019-04-01 20:57:48
Canvas
Praud, 2019-04-01 20:57:48

How to correctly calculate the coordinates of a point?

Hello. I have been bad friends with mathematics since childhood, but then I had to draw on the canvas, difficulties arose.
I have a certain straight line, the selection area of ​​the straight line is wider than it is, made for touch convenience. When I make a touch on a straight line, I should have a vertex (point) and I need to put this point on a straight line, regardless of what I touched a little to the left. The picture for clarity is below:
5ca250b39c9d1128129963.png
Tell me the solution, and if possible, point by point, so that I catch the essence, because I say that, alas, it’s tight with mathematics, I will be extremely
grateful.
From the original data, we get A(x1,y1); B(x2,y2) - straight line, C(x3,y3)
The output must be corrected C(x3, y3)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dollar, 2019-04-01
@dollar

Solution in the forehead. You need to first obtain the equation of a straight line on a plane , and then the projection of a point onto a straight line on a plane . You can start googling. It's easy. Both moments have specific well-known formulas.

G
GreatRash, 2019-04-02
@GreatRash

https://jsfiddle.net/pog615k3/2/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question