algorithm - How to find the intersection point between a line and a rectangle? -


I have a line that goes from points A to B; I have both points (X, Y). I also have a rectangle that is centered in B. And the width and height of the rectangle is.

I need to find the point in the point that intersects the rectangle. Is there any such formula that gives me that point (x, y)?

You want to check out - this is the classic set of routines for graphics and many of the necessary Algorithms are included though it is in C and some time algorithms are still shining and it should be trivial to move in other languages.

For your current problem, just create four rows for rectangular and see how the line given is the hole in your form.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -