Hi I'm creating a simple program to create create lines.
When the user is drawing a line, first he needs to draw the first point *ignore '5cm' information for above image
The second point (mouse point) is temporary and show after the first one was drawn
I want to develop a functionality that the user can draw this line entering the distance between the first point and other (that I don't know). The second point above is temporary but will use to detect the direction or other math information.
The user can draw lines with angles or directions.
I've tried to solve using euclidean distance but I don't know how to solve =/ I've tried to understand angular coefficient of a line to solve it but I didn't figure out.
I'm not good with Math, can someone help me? The code isn't necessary, I just need some tips or formulas.
Thanks e sorry for my english.
Some formula to discover the thir point by distancie from first one.
CodePudding user response:
You may consider the following.
User enters M1
point and then M2
point. The second point is used to define direction e
-- it is a unit vector in direction from M1
to M2
.
Then user enters distance d
. It is the distance between M1
and final point A
. For the position of A
see last equation.
P.S. You should learn how basic vector algebra works and how to convert between different representations of vectors. The last you should learn is decomposition of vector into its direction (e
) and magnitude (d
). Topic "vector equation of line" covers all of it.