0

I want to compare UIBeizerpaths and check if they are similar or almost same.

Example: If we have two semi circles with different radius they are similar as shape only difference is size. Same like above two straight lines on the same axis will be similar even though one might be longer than other.

jscs
  • 63,694
  • 13
  • 151
  • 195
Adnan Aftab
  • 14,377
  • 4
  • 45
  • 54
  • The approach I try to follow is to draw a bezier path and re-scale to match the size and then see if they are similar, but the issue is everybody's drawing could be different, and shape will not exactly match each, so need to come up with something which says its almost same. – Adnan Aftab Jul 04 '17 at 13:35
  • 1
    I'm facing a (somewhat) similar issue right now! It concerns scaling a bezier path into a larger image. (If an image size is originally 600x800 but the bezier paths have a composite bounds of 400x200, scale things up to an image that is 600x300.) My "Plan B", which may help, is that each bezier path has "feature points" that I draw from. I figure if I get a "bounds" consisting of *minX/minY/maxX/maxY* I have a rectangle I can then "scale" to the size I want, drawing things at the desired size. Maybe that can help you? –  Jul 04 '17 at 13:43
  • Drawing both paths into bitmaps and then compare bitmaps can help https://stackoverflow.com/questions/32094337/how-to-calculate-the-similarity-of-two-line-drawing-images-in-swift – Adnan Aftab Jul 04 '17 at 13:52
  • Sure, but for you I'm thinking the "critical path" (play on words intended) are those "scaled" points that dictate the bezier paths. Going pixel-by-pixel may be too processor intensive, even if scaled. I don't know if you can find those points in reverse - a user draws a path and then you get the control points - but I'm assuming you already know how to compare two images pixel-by-pixel for the difference. –  Jul 04 '17 at 14:03
  • check this if help https://stackoverflow.com/questions/27622358/detect-if-drawing-a-path-is-a-circle-rectangle-in-xcode – Prashant Tukadiya Jul 04 '17 at 14:41

0 Answers0