0

I have an image and all text is marked by rectangles around each word. I need to select some words by marking them with finger. To do so, I draw a line on the image. I need to check which rectangle contains that line.

how I can check if a rectangle contains that line.

enter image description here

i want get rectangle on which line as drawn

Edit This has been implemented in Google Translator App. I need exact same behavior.

Laurel
  • 5,965
  • 14
  • 31
  • 57
SAIR
  • 1,121
  • 11
  • 31
  • You have an array of rectangles....right? – Mohammad Zarei May 01 '16 at 07:37
  • yes i have list of rectangles – SAIR May 01 '16 at 07:47
  • Alright, there are 2 possibilities....first if the line starts in the rectangle and ends right there...the second is if the line cuts one line of rectangle. I try to right an answer for you. – Mohammad Zarei May 01 '16 at 08:01
  • I think, you can use this [link](http://stackoverflow.com/questions/4977491/determining-if-two-line-segments-intersect/4977569#4977569) – Mohammad Zarei May 01 '16 at 08:53
  • Test if your touch line segment intersects with any rect's 4 side line segments. See the [duplicate answer](http://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect/565282#565282) for the algorithm and code. – markE May 01 '16 at 17:45

0 Answers0