This method returns the coordinates of the intersection of 2 lines. Test the line you want to draw against EACH side of the square and if the length of the array returned is 2 then use the intersection co-ordinates as the line end.
* Find the point of intersection between two lines. <br>
* An array is returned that contains the intersection points in x, y order.
* If the array is of length: <br>
* 0 then there is no intersection <br>
* 2 these are the x/y coordinates of the intersection point. <br>
* @param x0
* @param y0
* @param x1
* @param y1 start and end co-ordinates of first line
* @param x2
* @param y2
* @param x3
* @param y3 start and end co-ordinates of second line
When working with code, it can easily become very difficult to read... Try using Edit > Auto Format, in processing to make your code easier to read. No offense, but your code is a little hard to read....
Leave a comment on andrewgies17's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic