R
R
Ray Dostoyevsky2021-03-23 17:28:38
Python
Ray Dostoyevsky, 2021-03-23 17:28:38

How to find the point of intersection of two coordinate lines?

There is a problem that needs to be solved in the Python programming language: Given two lines A (x, y, angle) and B (x, y, angle), you need to find the point of intersection of these lines.
ps I looked all over the mathematical sites, and did not find the exact solution to my problem.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2021-03-23
@RayProgrammer

This is the simplest school trigonometry.
x A + a sin(angle A ) = x B + b sin(angle B )
y A + a cos(angle A ) = y B + b cos(angle B )
Solve the system of equations, get a and b . Substitute a straight line into the equation to get the point of intersection.

T
Tera Incognita, 2021-04-07
@Lunali

I made a ready-made program, you can do it like this https://planet.mblock.cc/project/704229
code is open, see
the initial lines you put it yourself, you can add the code from the user and then it will draw itself,
that is, you can ask where to draw the line, the starting points and then you can even do voice dialing without any problems and the program will show itself,
I don’t know how to write it mathematically or with an expression, but it’s very easy, as you can see the program works, and the code can be viewed and rewritten, I spent a whole 10 minutes on it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question