Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I did not understand your Q1 for Q2: Identifying sequence of lines vs identifying bezier curve was toughest problem for me.


Q1: What algorithm do you use to identify the nearest shape? How do you know the user intends to draw a square, or a curve or a rectangle?


When user completes a stroke (touch up), then I take the path drawn by user, then divide the path such that each small sub path is very close to a line. Then I have combination of lines, Suppose I have four lines, then possibilities are that it can be a quadrilateral or circle, (if the end of last line is close to the start of the first line), then I use variance to determine which shape closely fits to the drawn stroke.

Once I know if this is quadrilateral, then uses various heuristics to find out if it is close to a rectangle or parallelogram etc.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: