Hello, I have the following problem, I want to verify if the user draw a line over a collection of points, for example I have all the points of the vertices of the "A" vowel and the "A" vowel is being displayed using a sprite I will ask the user to draw the "A" over the "A" displayed on the sprite, and I wanted to check if that line he draw match the points I have store on a NSMutableArray which as I said (are the points of the "A" vowel). The goal is to verify if the user draw correctly the A. This is an app for kids. I know already how to draw the lines and store all the points of the line on an array.
Have any of you guys had a similar situation and want to share any ideas on this?
Verify line drawn over points
(5 posts) (3 voices)-
Posted 11 months ago #
-
Hii geykel, Am now doing an application for chinese letters. Am facing the same problem now. Plz share ur ideas if u solved this issue
Posted 9 months ago # -
Hi
i am new to cocos2d. but i have worked enough on draw lines.
what i would do is compare the cgpoints using (CGPointequaltopoint) method and see which of the point are deviationg and check if deviation is too much then not exact A and if deviation is little then nearly A. after checking it for few time you might get an idea to set a constant deviation value.
i hope it works and if you find some other way let us knowPosted 9 months ago # -
For straight lines, find the slope between the starting and end point(since u know the first and last point for one line). Let x1,y1 and x2,y2 are two points, then slope=y2-y1/(x2-x1).
In st.lines slopes remains same for all the points in that line. Hence u detect slope between ur starting point and current mouse movement points. If the slope is same, then it is on the correct path.Posted 9 months ago # -
Thank you! i did not think in this way will surely try it.
Posted 9 months ago #
Reply
You must log in to post.